Skip to content

Commit 87242ce

Browse files
committed
kevm-pyk/evm: optimize for non-overflow cases on stack checks
1 parent b2896de commit 87242ce

File tree

1 file changed

+3
-1
lines changed
  • kevm-pyk/src/kevm_pyk/kproj/evm-semantics

1 file changed

+3
-1
lines changed

kevm-pyk/src/kevm_pyk/kproj/evm-semantics/evm.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,9 @@ The `#next [_]` operator initiates execution by:
381381
| #stackOverflow ( WordStack , OpCode ) [symbol(#stackOverflow), function, total]
382382
// ------------------------------------------------------------------------------------------------
383383
rule #stackUnderflow(WS, OP:OpCode) => #sizeWordStack(WS) <Int #stackNeeded(OP)
384-
rule #stackOverflow (WS, OP) => #sizeWordStack(WS) +Int #stackDelta(OP) >Int 1024
384+
385+
rule #stackOverflow(_WS, OP) => false requires #stackDelta(OP) <=Int 0
386+
rule #stackOverflow(WS, OP) => 1024 <Int #sizeWordStack(WS) +Int #stackDelta(OP) [owise]
385387
386388
syntax Int ::= #stackNeeded ( OpCode ) [symbol(#stackNeeded), function]
387389
// -----------------------------------------------------------------------

0 commit comments

Comments
 (0)