Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions crates/context/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ impl CfgEnv {
}

impl<SPEC> CfgEnv<SPEC> {
pub fn new_with_spec(spec: SPEC) -> Self {
Self {
chain_id: 1,
limit_contract_code_size: None,
spec,
disable_nonce_check: false,
blob_target_and_max_count: vec![(SpecId::CANCUN, 3, 6), (SpecId::PRAGUE, 6, 9)],
#[cfg(feature = "memory_limit")]
memory_limit: (1 << 32) - 1,
#[cfg(feature = "optional_balance_check")]
disable_balance_check: false,
#[cfg(feature = "optional_block_gas_limit")]
disable_block_gas_limit: false,
#[cfg(feature = "optional_eip3607")]
disable_eip3607: false,
#[cfg(feature = "optional_no_base_fee")]
disable_base_fee: false,
}
}

pub fn with_chain_id(mut self, chain_id: u64) -> Self {
self.chain_id = chain_id;
self
Expand Down Expand Up @@ -184,23 +204,7 @@ impl<SPEC: Into<SpecId> + Copy> Cfg for CfgEnv<SPEC> {

impl<SPEC: Default> Default for CfgEnv<SPEC> {
fn default() -> Self {
Self {
chain_id: 1,
limit_contract_code_size: None,
spec: Default::default(),
disable_nonce_check: false,
blob_target_and_max_count: vec![(SpecId::CANCUN, 3, 6), (SpecId::PRAGUE, 6, 9)],
#[cfg(feature = "memory_limit")]
memory_limit: (1 << 32) - 1,
#[cfg(feature = "optional_balance_check")]
disable_balance_check: false,
#[cfg(feature = "optional_block_gas_limit")]
disable_block_gas_limit: false,
#[cfg(feature = "optional_eip3607")]
disable_eip3607: false,
#[cfg(feature = "optional_no_base_fee")]
disable_base_fee: false,
}
Self::new_with_spec(SPEC::default())
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/src/api/default_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl DefaultOp
fn op() -> Self {
Context::mainnet()
.with_tx(OpTransaction::default())
.with_cfg(CfgEnv::new().with_spec(OpSpecId::BEDROCK))
.with_cfg(CfgEnv::new_with_spec(OpSpecId::BEDROCK))
.with_chain(L1BlockInfo::default())
}
}
Expand Down
Loading