Skip to content

Commit

Permalink
feat: implemented BLOBBASEFEE (#872)
Browse files Browse the repository at this point in the history
* [feat] implemented BLOBBASEFEE

* Apply suggestions from code review

---------

Co-authored-by: Mathieu <[email protected]>
  • Loading branch information
adrianvrj and enitrat authored Aug 27, 2024
1 parent 11ac169 commit 29034e3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crates/evm/src/instructions/block_information.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ impl BlockInformation of BlockInformationTrait {
// doesn't really exists there so we just use the gas price)
self.stack.push(self.env.gas_price.into())
}

/// 0x4A - BLOBBASEFEE
/// Returns the value of the blob base-fee of the current block
/// Always returns Zero in the context of Kakarot
/// # Specification: https://www.evm.codes/#4a?fork=cancun
fn exec_blobbasefee(ref self: VM) -> Result<(), EVMError> {
self.charge_gas(gas::BASE)?;

self.stack.push(0)
}
}


Expand Down Expand Up @@ -347,6 +357,19 @@ mod tests {
assert(result == 0x00, 'stack top should be zero');
}

#[test]
fn test_blobbasefee_should_return_zero() {
// Given
let mut vm = VMBuilderTrait::new_with_presets().build();

// When
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');
}

// *************************************************************************
// 0x41: COINBASE
// *************************************************************************
Expand Down

0 comments on commit 29034e3

Please sign in to comment.