Skip to content

Commit 9037270

Browse files
Merge pull request from GHSA-vxmm-cwh2-q762
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
1 parent ed0a654 commit 9037270

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/parser/features/decorators/test_payable.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,24 @@ def __default__():
372372
assert_tx_failed(
373373
lambda: w3.eth.send_transaction({"to": c.address, "value": 100, "data": "0x12345678"})
374374
)
375+
376+
377+
def test_batch_nonpayable(get_contract, w3, assert_tx_failed):
378+
code = """
379+
@external
380+
def foo() -> bool:
381+
return True
382+
383+
@external
384+
def __default__():
385+
pass
386+
"""
387+
388+
c = get_contract(code)
389+
w3.eth.send_transaction({"to": c.address, "value": 0, "data": "0x12345678"})
390+
data = bytes([1, 2, 3, 4])
391+
for i in range(5):
392+
calldata = "0x" + data[:i].hex()
393+
assert_tx_failed(
394+
lambda: w3.eth.send_transaction({"to": c.address, "value": 100, "data": calldata})
395+
)

0 commit comments

Comments
 (0)