Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
fix: saturate jumpi index taken on stack (#1002)
Browse files Browse the repository at this point in the history
* fix: saturate jumpi index taken on stack

* scout: remove print
  • Loading branch information
enitrat authored Oct 1, 2024
1 parent e2bd71d commit 79a5e8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion crates/contracts/src/kakarot_core/eth_rpc.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ pub impl EthRPC<
fn eth_get_transaction_count(self: @TContractState, address: EthAddress) -> u64 {
let kakarot_state = KakarotState::get_state();
let starknet_address = kakarot_state.get_starknet_address(address);
println!("starknet_address: {:?}", starknet_address);
let account = IAccountDispatcher { contract_address: starknet_address };
let nonce = account.get_nonce();
nonce
Expand Down
4 changes: 3 additions & 1 deletion crates/evm/src/instructions/memory_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ pub impl MemoryOperation of MemoryOperationTrait {
/// The new pc target has to be a JUMPDEST opcode.
/// # Specification: https://www.evm.codes/#57?fork=shanghai
fn exec_jumpi(ref self: VM) -> Result<(), EVMError> {
let index = self.stack.pop_usize()?;
let index = self
.stack
.pop_saturating_usize()?; // Saturate because if b is 0, we skip the jump but don't want to fail here.
let b = self.stack.pop()?;

self.charge_gas(gas::HIGH)?;
Expand Down

0 comments on commit 79a5e8d

Please sign in to comment.