Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jump_to #453

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Changes from 1 commit
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
11 changes: 7 additions & 4 deletions evm_arithmetization/src/generation/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,16 @@ impl<F: Field> GenerationState<F> {
/// we're jumping to a special location.
pub(crate) fn jump_to(&mut self, dst: usize) -> Result<(), ProgramError> {
self.registers.program_counter = dst;
if dst == KERNEL.global_labels["observe_new_address"] {
let tip_u256 = stack_peek(self, 0)?;
if dst == KERNEL.global_labels["observe_new_address"] && self.get_registers().stack_len > 0
LindaGuiga marked this conversation as resolved.
Show resolved Hide resolved
{
let tip_u256 = stack_peek(self, 0).expect("There cannot be a stack underflow");
let tip_h256 = H256::from_uint(&tip_u256);
let tip_h160 = H160::from(tip_h256);
self.observe_address(tip_h160);
} else if dst == KERNEL.global_labels["observe_new_contract"] {
let tip_u256 = stack_peek(self, 0)?;
} else if dst == KERNEL.global_labels["observe_new_contract"]
&& self.get_registers().stack_len > 0
{
let tip_u256 = stack_peek(self, 0).expect("There cannot be a stack underflow");
let tip_h256 = H256::from_uint(&tip_u256);
self.observe_contract(tip_h256)?;
}
Expand Down
Loading