From f605d912a5b19dc4d09ceadd6cd0f4e105dac0ea Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Fri, 2 Jun 2023 19:57:23 +0200 Subject: [PATCH] Propagate static flag (#1066) --- evm/src/cpu/kernel/asm/core/call.asm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/evm/src/cpu/kernel/asm/core/call.asm b/evm/src/cpu/kernel/asm/core/call.asm index 40290797..5f31ba49 100644 --- a/evm/src/cpu/kernel/asm/core/call.asm +++ b/evm/src/cpu/kernel/asm/core/call.asm @@ -45,6 +45,7 @@ global sys_call: // stack: new_ctx, kexit_info, callgas, address, value, args_offset, args_size, ret_offset, ret_size // Each line in the block below does not change the stack. + %set_static DUP4 %set_new_ctx_addr %address %set_new_ctx_caller DUP5 %set_new_ctx_value @@ -93,6 +94,7 @@ global sys_callcode: // stack: new_ctx, kexit_info, callgas, address, value, args_offset, args_size, ret_offset, ret_size // Each line in the block below does not change the stack. + %set_static %address %set_new_ctx_addr %address %set_new_ctx_caller DUP5 %set_new_ctx_value @@ -195,6 +197,7 @@ global sys_delegatecall: // stack: new_ctx, kexit_info, callgas, address, value, args_offset, args_size, ret_offset, ret_size // Each line in the block below does not change the stack. + %set_static %address %set_new_ctx_addr %caller %set_new_ctx_caller %callvalue %set_new_ctx_value @@ -243,6 +246,15 @@ call_insufficient_balance: // stack: new_ctx %endmacro +// Set @CTX_METADATA_STATIC of the next context to the current value. +%macro set_static + // stack: new_ctx + %mload_context_metadata(@CTX_METADATA_STATIC) + %stack (is_static, new_ctx) -> (new_ctx, @SEGMENT_CONTEXT_METADATA, @CTX_METADATA_STATIC, is_static, new_ctx) + MSTORE_GENERAL + // stack: new_ctx +%endmacro + %macro set_new_ctx_addr // stack: called_addr, new_ctx %stack (called_addr, new_ctx)