Skip to content

Commit

Permalink
rm one scope
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jun 25, 2024
1 parent 3c371b9 commit 6844ff3
Showing 1 changed file with 27 additions and 32 deletions.
59 changes: 27 additions & 32 deletions crates/chainspec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,39 +1195,34 @@ impl OptimismGenesisInfo {
let mut optimism_genesis_info: Self =
genesis.config.extra_fields.deserialize_as().unwrap_or_default();

if let Some(optimism_object) = genesis.config.extra_fields.get("optimism") {
if let Ok(optimism_base_fee_info) =
serde_json::from_value::<OptimismBaseFeeInfo>(optimism_object.clone())
{
if let (Some(elasticity), Some(denominator)) = (
optimism_base_fee_info.eip1559_elasticity,
optimism_base_fee_info.eip1559_denominator,
) {
let base_fee_params = if let Some(canyon_denominator) =
optimism_base_fee_info.eip1559_denominator_canyon
{
BaseFeeParamsKind::Variable(
vec![
(
Hardfork::London,
BaseFeeParams::new(denominator as u128, elasticity as u128),
),
(
Hardfork::Canyon,
BaseFeeParams::new(
canyon_denominator as u128,
elasticity as u128,
),
),
]
.into(),
)
} else {
BaseFeeParams::new(denominator as u128, elasticity as u128).into()
};
if let Some(Ok(optimism_base_fee_info)) =
genesis.config.extra_fields.get_deserialized::<OptimismBaseFeeInfo>("optimism")
{
if let (Some(elasticity), Some(denominator)) = (
optimism_base_fee_info.eip1559_elasticity,
optimism_base_fee_info.eip1559_denominator,
) {
let base_fee_params = if let Some(canyon_denominator) =
optimism_base_fee_info.eip1559_denominator_canyon
{
BaseFeeParamsKind::Variable(
vec![
(
Hardfork::London,
BaseFeeParams::new(denominator as u128, elasticity as u128),
),
(
Hardfork::Canyon,
BaseFeeParams::new(canyon_denominator as u128, elasticity as u128),
),
]
.into(),
)
} else {
BaseFeeParams::new(denominator as u128, elasticity as u128).into()
};

optimism_genesis_info.base_fee_params = base_fee_params;
}
optimism_genesis_info.base_fee_params = base_fee_params;
}
}

Expand Down

0 comments on commit 6844ff3

Please sign in to comment.