Skip to content

Commit

Permalink
rename fee_upgrade to fee
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Aug 14, 2024
1 parent 849d54c commit 2a0f407
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions data/genesis/demo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ version = "0.2"
start_proposing_view = 5
stop_proposing_view = 15

[upgrade.fee_upgrade]
[upgrade.fee]

[upgrade.fee_upgrade.chain_config]
[upgrade.fee.chain_config]
chain_id = 999999999
base_fee = '1 wei'
max_block_size = '1mb'
Expand Down
10 changes: 5 additions & 5 deletions doc/upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ version = "0.2"
start_proposing_view = 5
stop_proposing_view = 15

[upgrade.fee_upgrade]
[upgrade.fee]

[upgrade.fee_upgrade.chain_config]
[upgrade.fee.chain_config]
chain_id = 999999999
base_fee = '1 wei'
max_block_size = '1mb'
Expand All @@ -106,13 +106,13 @@ stop_proposing_view = 15
```

In the TOML configuration example above, the `upgrade` section defines an array of tables, each specifying upgrade
parameters:
parameters

- **Version:** the new version after an upgrade is successful.
- **start_proposing_view:** Represents the `start_proposing_view` value at which the upgrade is proposed.
- **stop_proposing_view:** Refers to the view at which the proposing an upgrade has stopped.
- **stop_proposing_view:** Refers to the view view after which the node stops proposing an upgrade.

The `upgrade.fee_upgrade.chain_config` table contains the complete set of chain config parameters, which can be used, for example,
The `upgrade.fee.chain_config` table contains the complete set of chain config parameters, which can be used, for example,
to enable protocol fees or modify other parameters.

## Fee upgrade
Expand Down
2 changes: 1 addition & 1 deletion sequencer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ mod test {
<SeqTypes as NodeType>::Upgrade::VERSION,
Upgrade {
mode,
upgrade_type: UpgradeType::FeeUpgrade {
upgrade_type: UpgradeType::Fee {
chain_config: chain_config_upgrade,
},
},
Expand Down
22 changes: 11 additions & 11 deletions sequencer/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Genesis {
let upgrades: Vec<&Upgrade> = self.upgrades.values().collect();

for upgrade in upgrades {
if let UpgradeType::FeeUpgrade { chain_config } = upgrade.upgrade_type {
if let UpgradeType::Fee { chain_config } = upgrade.upgrade_type {
base_fee = std::cmp::max(chain_config.base_fee, base_fee);
}
}
Expand Down Expand Up @@ -430,9 +430,9 @@ mod test {
start_proposing_view = 1
stop_proposing_view = 15

[upgrade.fee_upgrade]
[upgrade.fee]

[upgrade.fee_upgrade.chain_config]
[upgrade.fee.chain_config]
chain_id = 12345
max_block_size = 30000
base_fee = 1
Expand All @@ -454,7 +454,7 @@ mod test {
start_proposing_view: 1,
stop_proposing_view: 15,
}),
upgrade_type: UpgradeType::FeeUpgrade {
upgrade_type: UpgradeType::Fee {
chain_config: genesis.chain_config,
},
};
Expand Down Expand Up @@ -494,9 +494,9 @@ mod test {
start_proposing_time = "2024-01-01T00:00:00Z"
stop_proposing_time = "2024-01-02T00:00:00Z"

[upgrade.fee_upgrade]
[upgrade.fee]

[upgrade.fee_upgrade.chain_config]
[upgrade.fee.chain_config]
chain_id = 12345
max_block_size = 30000
base_fee = 1
Expand All @@ -520,7 +520,7 @@ mod test {
stop_proposing_time: Timestamp::from_string("2024-01-02T00:00:00Z".to_string())
.unwrap(),
}),
upgrade_type: UpgradeType::FeeUpgrade {
upgrade_type: UpgradeType::Fee {
chain_config: genesis.chain_config,
},
};
Expand Down Expand Up @@ -562,9 +562,9 @@ mod test {
start_proposing_time = 1
stop_proposing_time = 10

[upgrade.fee_upgrade]
[upgrade.fee]

[upgrade.fee_upgrade.chain_config]
[upgrade.fee.chain_config]
chain_id = 12345
max_block_size = 30000
base_fee = 1
Expand Down Expand Up @@ -651,9 +651,9 @@ mod test {
start_proposing_view = 1
stop_proposing_view = 15

[upgrade.fee_upgrade]
[upgrade.fee]

[upgrade.fee_upgrade.chain_config]
[upgrade.fee.chain_config]
chain_id = 12345
max_block_size = 30000
base_fee = 1
Expand Down
4 changes: 2 additions & 2 deletions types/src/v0/impls/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ impl BlockHeader<SeqTypes> for Header {
let chain_config = if version > instance_state.current_version {
match instance_state.upgrades.get(&version) {
Some(upgrade) => match upgrade.upgrade_type {
UpgradeType::FeeUpgrade { chain_config } => chain_config,
UpgradeType::Fee { chain_config } => chain_config,
_ => Header::get_chain_config(&validated_state, instance_state).await,
},
None => Header::get_chain_config(&validated_state, instance_state).await,
Expand Down Expand Up @@ -867,7 +867,7 @@ impl BlockHeader<SeqTypes> for Header {
let chain_config = if version > instance_state.current_version {
match instance_state.upgrades.get(&version) {
Some(upgrade) => match upgrade.upgrade_type {
UpgradeType::FeeUpgrade { chain_config } => chain_config,
UpgradeType::Fee { chain_config } => chain_config,
_ => Header::get_chain_config(&validated_state, instance_state).await,
},
None => Header::get_chain_config(&validated_state, instance_state).await,
Expand Down
2 changes: 1 addition & 1 deletion types/src/v0/impls/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ impl ValidatedState {
return;
};

if let UpgradeType::FeeUpgrade { chain_config } = upgrade.upgrade_type {
if let UpgradeType::Fee { chain_config } = upgrade.upgrade_type {
self.chain_config = chain_config.into();
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/src/v0/v0_1/instance_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{v0_3::ChainConfig, Timestamp};
pub enum UpgradeType {
// Note: Wrapping this in a tuple variant causes deserialization to fail because
// the 'chain_config' name is also provided in the TOML input.
FeeUpgrade { chain_config: ChainConfig },
Fee { chain_config: ChainConfig },
Marketplace {},
}

Expand Down

0 comments on commit 2a0f407

Please sign in to comment.