diff --git a/crates/contracts/src/cairo1_helpers.cairo b/crates/contracts/src/cairo1_helpers.cairo index 3beac0a78..c1d743d2d 100644 --- a/crates/contracts/src/cairo1_helpers.cairo +++ b/crates/contracts/src/cairo1_helpers.cairo @@ -13,8 +13,8 @@ pub trait IPrecompiles { /// # Returns /// /// * A tuple containing: - /// * A boolean indicating the success or failure of the execution. - /// * The gas cost of the execution. + /// * True if the execution was successful, false otherwise. + /// * The gas cost of the execution if successful, otherwise 0. /// * The output data from the execution. fn exec_precompile(self: @T, address: felt252, data: Span) -> (bool, u64, Span); } diff --git a/crates/evm/src/instructions/block_information.cairo b/crates/evm/src/instructions/block_information.cairo index b9da92115..bb5a3991e 100644 --- a/crates/evm/src/instructions/block_information.cairo +++ b/crates/evm/src/instructions/block_information.cairo @@ -9,6 +9,7 @@ use evm::gas; use evm::model::vm::{VM, VMTrait}; use evm::stack::StackTrait; use evm::state::StateTrait; +use utils::constants::MIN_BASE_FEE_PER_BLOB_GAS; use utils::traits::{EthAddressTryIntoResultContractAddress, EthAddressIntoU256}; #[generate_trait] @@ -131,7 +132,7 @@ pub impl BlockInformation of BlockInformationTrait { fn exec_blobbasefee(ref self: VM) -> Result<(), EVMError> { self.charge_gas(gas::BASE)?; - self.stack.push(0) + self.stack.push(MIN_BASE_FEE_PER_BLOB_GAS.into()) } } @@ -336,7 +337,7 @@ mod tests { #[test] - fn test_blobbasefee_should_return_zero() { + fn test_blobbasefee_should_return_one() { // Given let mut vm = VMBuilderTrait::new_with_presets().build(); @@ -344,8 +345,8 @@ mod tests { vm.exec_blobbasefee().unwrap(); // Then - assert(vm.stack.len() == 1, 'stack should have one element'); - assert(vm.stack.peek().unwrap() == 0, 'stack top should be 0'); + assert_eq!(vm.stack.len(), 1); + assert_eq!(vm.stack.peek().unwrap(), 1); } diff --git a/crates/utils/src/constants.cairo b/crates/utils/src/constants.cairo index 899b13828..9b1381d81 100644 --- a/crates/utils/src/constants.cairo +++ b/crates/utils/src/constants.cairo @@ -11,6 +11,7 @@ pub const CONTRACT_ADDRESS_PREFIX: felt252 = 'STARKNET_CONTRACT_ADDRESS'; // BLOCK pub const BLOCK_GAS_LIMIT: u64 = 7_000_000; +pub const MIN_BASE_FEE_PER_BLOB_GAS: u64 = 1; // CHAIN_ID = KKRT (0x4b4b5254) in ASCII pub const CHAIN_ID: u64 = 1263227476;