Skip to content

Commit

Permalink
Merge pull request from GHSA-vxmm-cwh2-q762
Browse files Browse the repository at this point in the history
on <=0.3.7, the batch payable check was broken. this was fixed due to
the removal of the global calldatasize check in 02339df. this commit
adds a test to prevent regression
  • Loading branch information
charles-cooper committed May 19, 2023
1 parent ed0a654 commit 9037270
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/parser/features/decorators/test_payable.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,24 @@ def __default__():
assert_tx_failed(
lambda: w3.eth.send_transaction({"to": c.address, "value": 100, "data": "0x12345678"})
)


def test_batch_nonpayable(get_contract, w3, assert_tx_failed):
code = """
@external
def foo() -> bool:
return True
@external
def __default__():
pass
"""

c = get_contract(code)
w3.eth.send_transaction({"to": c.address, "value": 0, "data": "0x12345678"})
data = bytes([1, 2, 3, 4])
for i in range(5):
calldata = "0x" + data[:i].hex()
assert_tx_failed(
lambda: w3.eth.send_transaction({"to": c.address, "value": 100, "data": calldata})
)

0 comments on commit 9037270

Please sign in to comment.