diff --git a/crates/evm/src/instructions/block_information.cairo b/crates/evm/src/instructions/block_information.cairo index fe4d31bd7..b9da92115 100644 --- a/crates/evm/src/instructions/block_information.cairo +++ b/crates/evm/src/instructions/block_information.cairo @@ -111,9 +111,7 @@ pub impl BlockInformation of BlockInformationTrait { fn exec_basefee(ref self: VM) -> Result<(), EVMError> { self.charge_gas(gas::BASE)?; - // Get the current base fee. (Kakarot doesn't use EIP 1559 so basefee - // doesn't really exists there so we just use the gas price) - self.stack.push(self.env.gas_price.into()) + self.stack.push(self.env.base_fee.into()) } /// 0x49 - BLOBHASH @@ -284,7 +282,7 @@ mod tests { #[test] - fn test_basefee() { + fn test_basefee_should_push_env_base_fee() { // Given let mut vm = VMBuilderTrait::new_with_presets().build(); @@ -292,8 +290,8 @@ mod tests { vm.exec_basefee().unwrap(); // Then - assert(vm.stack.len() == 1, 'stack should have one element'); - assert(vm.stack.peek().unwrap() == gas_price().into(), 'stack top should be gas_price'); + assert_eq!(vm.stack.len(), 1); + assert_eq!(vm.stack.peek().unwrap(), vm.env.base_fee.into()); } #[test] diff --git a/crates/evm/src/test_utils.cairo b/crates/evm/src/test_utils.cairo index d961a0484..be3de3fad 100644 --- a/crates/evm/src/test_utils.cairo +++ b/crates/evm/src/test_utils.cairo @@ -200,10 +200,10 @@ pub fn tx_gas_limit() -> u64 { constants::BLOCK_GAS_LIMIT } -pub const BASE_FEE: u128 = 1000; +pub const BASE_FEE: u64 = 1000; pub fn gas_price() -> u128 { - BASE_FEE + 1 + BASE_FEE.into() + 1 } pub fn value() -> u256 { @@ -262,7 +262,7 @@ pub fn preset_environment() -> Environment { block_timestamp: block_info.block_timestamp, block_gas_limit: constants::BLOCK_GAS_LIMIT, coinbase: coinbase(), - base_fee: 0, + base_fee: BASE_FEE, state: Default::default(), } }