Skip to content

Commit 14cccd8

Browse files
committed
fix: use Conditional with REVERT instead of invalid JUMPDEST
Replace the PUSH2(0x1000) + JUMPI pattern (which relied on jumping to an invalid offset to trigger failure) with an explicit Conditional + REVERT. This is cleaner, more explicit about error handling intent, and doesn't rely on undefined behavior of invalid jump destinations.
1 parent 341594c commit 14cccd8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/benchmark/stateful/bloatnet/test_extcodesize_bytecode_sizes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
Block,
7676
BlockchainTestFiller,
7777
Bytecode,
78+
Conditional,
7879
Fork,
7980
Op,
8081
Transaction,
@@ -164,9 +165,10 @@ def build_attack_contract(factory_address: Address) -> Bytecode:
164165
)
165166
# Check if call succeeded (STATICCALL returns 1 on success)
166167
# Stack: [starting_salt, success]
167-
+ Op.ISZERO
168-
+ Op.PUSH2(0x1000) # Jump to end if failed
169-
+ Op.JUMPI
168+
+ Conditional(
169+
condition=Op.ISZERO, # If call failed (success=0)
170+
if_true=Op.REVERT(0, 0), # Revert with no data
171+
)
170172
# Stack: [starting_salt]
171173
# Load results from memory
172174
# Memory[96:128] = num_deployed_contracts
@@ -221,8 +223,6 @@ def build_attack_contract(factory_address: Address) -> Bytecode:
221223
),
222224
)
223225
+ Op.POP # Clean up remaining counter
224-
# === End ===
225-
+ Op.JUMPDEST # 0x1000 - error/end handler
226226
+ Op.STOP
227227
)
228228

0 commit comments

Comments
 (0)