diff --git a/src/standard/config.rs b/src/standard/config.rs index 63300bab..5cb65b5d 100644 --- a/src/standard/config.rs +++ b/src/standard/config.rs @@ -97,6 +97,8 @@ pub struct Config { pub has_base_fee: bool, /// Has PUSH0 opcode. See [EIP-3855](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3855.md) pub has_push0: bool, + /// Enables transient storage. See [EIP-1153](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1153.md) + pub eip_1153_enabled: bool, } impl Config { @@ -150,6 +152,7 @@ impl Config { has_ext_code_hash: false, has_base_fee: false, has_push0: false, + eip_1153_enabled: false, } } @@ -203,6 +206,7 @@ impl Config { has_ext_code_hash: true, has_base_fee: false, has_push0: false, + eip_1153_enabled: false, } } @@ -237,6 +241,7 @@ impl Config { disallow_executable_format, warm_coinbase_address, max_initcode_size, + eip_1153_enabled, } = inputs; // See https://eips.ethereum.org/EIPS/eip-2929 @@ -299,6 +304,7 @@ impl Config { has_ext_code_hash: true, has_base_fee, has_push0, + eip_1153_enabled, } } } @@ -315,6 +321,7 @@ struct DerivedConfigInputs { disallow_executable_format: bool, warm_coinbase_address: bool, max_initcode_size: Option, + eip_1153_enabled: bool, } impl DerivedConfigInputs { @@ -329,6 +336,7 @@ impl DerivedConfigInputs { disallow_executable_format: false, warm_coinbase_address: false, max_initcode_size: None, + eip_1153_enabled: false, } } @@ -343,6 +351,7 @@ impl DerivedConfigInputs { disallow_executable_format: true, warm_coinbase_address: false, max_initcode_size: None, + eip_1153_enabled: false, } } @@ -357,6 +366,7 @@ impl DerivedConfigInputs { disallow_executable_format: true, warm_coinbase_address: false, max_initcode_size: None, + eip_1153_enabled: false, } } @@ -372,6 +382,7 @@ impl DerivedConfigInputs { warm_coinbase_address: true, // 2 * 24576 as per EIP-3860 max_initcode_size: Some(0xC000), + eip_1153_enabled: false, } } } diff --git a/src/standard/gasometer/mod.rs b/src/standard/gasometer/mod.rs index 281bf173..23271e03 100644 --- a/src/standard/gasometer/mod.rs +++ b/src/standard/gasometer/mod.rs @@ -361,7 +361,7 @@ fn dynamic_opcode_cost( target_is_cold: handler.is_cold(address, Some(index)), } } - Opcode::TLOAD => GasCost::TLoad, + Opcode::TLOAD if config.eip_1153_enabled => GasCost::TLoad, Opcode::DELEGATECALL if config.has_delegate_call => { let target = stack.peek(1)?.into(); @@ -389,7 +389,7 @@ fn dynamic_opcode_cost( target_is_cold: handler.is_cold(address, Some(index)), } } - Opcode::TSTORE if !is_static => GasCost::TStore, + Opcode::TSTORE if !is_static && config.eip_1153_enabled => GasCost::TStore, Opcode::LOG0 if !is_static => GasCost::Log { n: 0, len: U256::from_big_endian(&stack.peek(1)?[..]),