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

fix: saturate jumpi index taken on stack #1002

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading