@@ -12,6 +12,10 @@ namespace execution;
1212 #[skippable_if]
1313 sel = 0;
1414
15+ // TODO: make sure that all uses of `sel_error` here really should be "error" only
16+ // since `sel_error` will not be ` for the REVERT opcode. If we need "error or REVERT",
17+ // use `sel_failure`.
18+
1519 // Guaranteed to be boolean because sel_execute_call & sel_execute_static_call are mutually exclusive
1620 pol commit sel_enter_call;
1721 // The following selectors will be 0 if there is an error during execution (before the opcode execution step).
@@ -33,7 +37,9 @@ namespace execution;
3337 pol commit contract_address;
3438 pol commit bytecode_id;
3539 pol commit transaction_fee;
36- // Constrained boolean by tx trace (for enqueued call) and #[NEXT_IS_STATIC] for nested
40+ // Constrained boolean by tx trace for enqueued call, #[IS_STATIC_NEXT_ROW] during normal execution,
41+ // IS_STATIC_IF_STATIC_CALL+IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT for nested calls,
42+ // and CTX_STACK_CALL for returns or failures.
3743 pol commit is_static;
3844
3945 pol commit parent_calldata_addr;
@@ -189,7 +195,12 @@ namespace execution;
189195 // otherwise = 0 ==> is_static' = is_static
190196 #[IS_STATIC_NEXT_ROW]
191197 NOT_LAST_EXEC * DEFAULT_CTX_ROW * (is_static' - is_static) = 0;
192- NOT_LAST_EXEC * sel_enter_call * (is_static' - sel_execute_static_call) = 0;
198+ // An external call from a non-static context only creates a nested static context if the opcode is STATICCALL.
199+ #[IS_STATIC_IF_STATIC_CALL]
200+ NOT_LAST_EXEC * sel_enter_call * (1 - is_static) * (is_static' - sel_execute_static_call) = 0;
201+ // An external call from a static context always creates a nested static context.
202+ #[IS_STATIC_IF_CALL_FROM_STATIC_CONTEXT]
203+ NOT_LAST_EXEC * sel_enter_call * is_static * (is_static' - 1) = 0;
193204
194205 // nested_exit_call = 1 ==> constraints come from lookup
195206 // sel_enter_call = 1 ==> parent_calldata_addr' = rop[4] (resolved operand 5 from execution trace)
0 commit comments