Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions tests/ported_static/stQuadraticComplexityTest/test_call50000.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

Ported from:
state_tests/stQuadraticComplexityTest/Call50000Filler.json

@manually-enhanced: Do not overwrite. Post-state expectations corrected
manually (see PR #2784).
"""

import pytest
Expand Down Expand Up @@ -70,11 +73,11 @@ def test_call50000(
gas_limit=860000000,
)

addr = pre.fund_eoa(amount=7000) # noqa: F841
addr = pre.fund_eoa(amount=7000)
# Source: lll
# { (def 'i 0x80) (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALL 1600 <eoa:0xaaaf5374fce5edbc8e2a8697c15331677e6ebf0b> 1 0 50000 0 0) ) [[ 1 ]] @i} # noqa: E501
target = pre.deploy_contract( # noqa: F841
code=Op.JUMPDEST
target_code = (
Op.JUMPDEST
+ Op.JUMPI(
pc=0x3F, condition=Op.ISZERO(Op.LT(Op.MLOAD(offset=0x80), 0xC350))
)
Expand All @@ -94,7 +97,10 @@ def test_call50000(
+ Op.JUMP(pc=0x0)
+ Op.JUMPDEST
+ Op.SSTORE(key=0x1, value=Op.MLOAD(offset=0x80))
+ Op.STOP,
+ Op.STOP
)
target = pre.deploy_contract(
code=target_code,
balance=0xFFFFFFFFFFFFF,
nonce=0,
)
Expand All @@ -108,9 +114,7 @@ def test_call50000(
addr: Account(storage={}, code=b"", nonce=0),
target: Account(
storage={},
code=bytes.fromhex(
"5b61c3506080511015603f576000600061c3506000600173d9b97c712ebce43f3c19179bbef44b550f9e8bc0610640f16000556001608051016080526000565b60805160015500" # noqa: E501
),
code=bytes(target_code),
nonce=0,
),
},
Expand All @@ -123,9 +127,7 @@ def test_call50000(
addr: Account(storage={}, code=b"", nonce=0),
target: Account(
storage={},
code=bytes.fromhex(
"5b61c3506080511015603f576000600061c3506000600173d9b97c712ebce43f3c19179bbef44b550f9e8bc0610640f16000556001608051016080526000565b60805160015500" # noqa: E501
),
code=bytes(target_code),
nonce=0,
),
},
Expand Down
22 changes: 12 additions & 10 deletions tests/ported_static/stQuadraticComplexityTest/test_callcode50000.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

Ported from:
state_tests/stQuadraticComplexityTest/Callcode50000Filler.json

@manually-enhanced: Do not overwrite. Post-state expectations corrected
manually (see PR #2784).
"""

import pytest
Expand Down Expand Up @@ -70,11 +73,11 @@ def test_callcode50000(
gas_limit=8600000000,
)

addr = pre.fund_eoa(amount=7000) # noqa: F841
addr = pre.fund_eoa(amount=7000)
# Source: lll
# { (def 'i 0x80) (for {} (< @i 50000) [i](+ @i 1) [[ 0 ]] (CALLCODE 1600 <eoa:0xaaaf5374fce5edbc8e2a8697c15331677e6ebf0b> 1 0 50000 0 0) ) [[ 1 ]] @i} # noqa: E501
target = pre.deploy_contract( # noqa: F841
code=Op.JUMPDEST
target_code = (
Op.JUMPDEST
+ Op.JUMPI(
pc=0x3F, condition=Op.ISZERO(Op.LT(Op.MLOAD(offset=0x80), 0xC350))
)
Expand All @@ -94,7 +97,10 @@ def test_callcode50000(
+ Op.JUMP(pc=0x0)
+ Op.JUMPDEST
+ Op.SSTORE(key=0x1, value=Op.MLOAD(offset=0x80))
+ Op.STOP,
+ Op.STOP
)
target = pre.deploy_contract(
code=target_code,
balance=0xFFFFFFFFFFFFF,
nonce=0,
)
Expand All @@ -108,9 +114,7 @@ def test_callcode50000(
addr: Account(storage={}, code=b"", nonce=0),
target: Account(
storage={},
code=bytes.fromhex(
"5b61c3506080511015603f576000600061c3506000600173d9b97c712ebce43f3c19179bbef44b550f9e8bc0610640f26000556001608051016080526000565b60805160015500" # noqa: E501
),
code=bytes(target_code),
nonce=0,
),
},
Expand All @@ -123,9 +127,7 @@ def test_callcode50000(
addr: Account(storage={}, code=b"", nonce=0),
target: Account(
storage={},
code=bytes.fromhex(
"5b61c3506080511015603f576000600061c3506000600173d9b97c712ebce43f3c19179bbef44b550f9e8bc0610640f26000556001608051016080526000565b60805160015500" # noqa: E501
),
code=bytes(target_code),
nonce=0,
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

Ported from:
state_tests/stQuadraticComplexityTest/QuadraticComplexitySolidity_CallDataCopyFiller.json

@manually-enhanced: Do not overwrite. Post-state expectations corrected
manually (see PR #2784).
"""

import pytest
Expand Down Expand Up @@ -152,9 +155,14 @@ def test_quadratic_complexity_solidity_call_data_copy(
value=tx_value[v],
)

# With `g=1` the tx completes the inner CALL loop and the
# leading `SSTORE(0, 50000)` (the loop-counter snapshot taken
# before entering the loop body) commits. With `g=0` the tx
# OOGs and rolls everything back, leaving storage empty.
contract_0_storage = {0: 0xC350} if g == 1 else {}
post = {
contract_0: Account(
storage={},
storage=contract_0_storage,
code=bytes.fromhex(
"60003560e060020a9004806361a4770614601557005b601e6004356024565b60006000f35b60008160008190555073b94f5374fce5edbc8e2a8697c15331677e6ebf0b90505b600082131560bf5780600160a060020a03166000600060007f6a7573740000000000000000000000000000000000000000000000000000000081526004017f63616c6c000000000000000000000000000000000000000000000000000000008152602001600060008560155a03f150506001820391506045565b505056" # noqa: E501
),
Expand Down
Loading