Skip to content

Commit

Permalink
Merge pull request #2873 from Conflux-Chain/fix_testnet
Browse files Browse the repository at this point in the history
Fix testnet cip136 locking time.
  • Loading branch information
peilun-conflux authored Jun 27, 2024
2 parents c77a459 + b0f946e commit 88e19a0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ pub struct PosStateConfig {
cip136_in_queue_locked_views: u64,
cip136_round_per_term: u64,

fix_cip136_transition_view: u64,
fix_cip136_in_queue_locked_views: u64,
fix_cip136_out_queue_locked_views: u64,

nonce_limit_transition_view: u64,
max_nonce_per_account: u64,
}
Expand Down Expand Up @@ -56,7 +60,9 @@ impl PosStateConfig {
cip99_out_queue_locked_views: u64, nonce_limit_transition_view: u64,
max_nonce_per_account: u64, cip136_transition_view: u64,
cip136_in_queue_locked_views: u64, cip136_out_queue_locked_views: u64,
cip136_round_per_term: u64,
cip136_round_per_term: u64, fix_cip136_transition_view: u64,
fix_cip136_in_queue_locked_views: u64,
fix_cip136_out_queue_locked_views: u64,
) -> Self {
Self {
round_per_term,
Expand All @@ -71,6 +77,9 @@ impl PosStateConfig {
cip136_out_queue_locked_views,
cip136_in_queue_locked_views,
cip136_round_per_term,
fix_cip136_transition_view,
fix_cip136_in_queue_locked_views,
fix_cip136_out_queue_locked_views,
nonce_limit_transition_view,
max_nonce_per_account,
}
Expand Down Expand Up @@ -120,8 +129,12 @@ impl PosStateConfigTrait for OnceCell<PosStateConfig> {
&& view < conf.cip136_transition_view
{
conf.cip99_in_queue_locked_views
} else if view >= conf.cip136_transition_view {
} else if view >= conf.cip136_transition_view
&& view < conf.fix_cip136_transition_view
{
conf.cip136_in_queue_locked_views
} else if view >= conf.fix_cip136_transition_view {
conf.fix_cip136_in_queue_locked_views
} else {
conf.in_queue_locked_views
}
Expand All @@ -133,8 +146,12 @@ impl PosStateConfigTrait for OnceCell<PosStateConfig> {
&& view < conf.cip136_transition_view
{
conf.cip99_out_queue_locked_views
} else if view >= conf.cip136_transition_view {
} else if view >= conf.cip136_transition_view
&& view < conf.fix_cip136_transition_view
{
conf.cip136_out_queue_locked_views
} else if view >= conf.fix_cip136_transition_view {
conf.fix_cip136_out_queue_locked_views
} else {
conf.out_queue_locked_views
}
Expand Down Expand Up @@ -209,6 +226,9 @@ impl Default for PosStateConfig {
cip136_out_queue_locked_views: IN_QUEUE_LOCKED_VIEWS,
cip136_in_queue_locked_views: OUT_QUEUE_LOCKED_VIEWS,
cip136_round_per_term: ROUND_PER_TERM,
fix_cip136_transition_view: u64::MAX,
fix_cip136_in_queue_locked_views: IN_QUEUE_LOCKED_VIEWS,
fix_cip136_out_queue_locked_views: OUT_QUEUE_LOCKED_VIEWS,
nonce_limit_transition_view: u64::MAX,
max_nonce_per_account: u64::MAX,
}
Expand Down
6 changes: 6 additions & 0 deletions crates/client/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ build_config! {
(pos_cip136_in_queue_locked_views, (u64), IN_QUEUE_LOCKED_VIEWS * 2)
(pos_cip136_out_queue_locked_views, (u64), OUT_QUEUE_LOCKED_VIEWS * 2)
(pos_cip136_round_per_term, (u64), ROUND_PER_TERM * 2)
(pos_fix_cip136_transition_view, (u64), 1733760)
(pos_fix_cip136_in_queue_locked_views, (u64), 18720 * 2)
(pos_fix_cip136_out_queue_locked_views, (u64), 1440 * 2)
(dev_pos_private_key_encryption_password, (Option<String>), None)
(pos_started_as_voter, (bool), true)

Expand Down Expand Up @@ -1286,6 +1289,9 @@ impl Configuration {
self.raw_conf.pos_cip136_in_queue_locked_views,
self.raw_conf.pos_cip136_out_queue_locked_views,
self.raw_conf.pos_cip136_round_per_term,
self.raw_conf.pos_fix_cip136_transition_view,
self.raw_conf.pos_fix_cip136_in_queue_locked_views,
self.raw_conf.pos_fix_cip136_out_queue_locked_views,
)
}

Expand Down

0 comments on commit 88e19a0

Please sign in to comment.