Skip to content

Commit

Permalink
refactor outer tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Apr 23, 2024
1 parent 14f93e2 commit 28d26b2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/functional/builtins/codegen/test_abi_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,13 @@ def f(x: Bytes[32 * 5]):
def test_abi_decode_oob_due_to_invalid_head2(w3, tx_failed, get_contract):
code = """
@external
def f(x: Bytes[2 * 32 + 3 * 32 + 3 * 32 * 4]):
def run(x: Bytes[2 * 32 + 3 * 32 + 3 * 32 * 4]):
y: Bytes[2 * 32 + 3 * 32 + 3 * 32 * 4] = x
decoded_y1: DynArray[Bytes[32 * 3], 3] = _abi_decode(y, DynArray[Bytes[32 * 3], 3])
"""
c = get_contract(code)
data = method_id("f(bytes)")
data += (0x20).to_bytes(32, "big") # tuple head
data += (0x0220).to_bytes(32, "big") # top-level bytes array length

data = b""

data += (0x20).to_bytes(32, "big") # DynArray head
data += (0x03).to_bytes(32, "big") # DynArray length
Expand Down Expand Up @@ -563,7 +562,7 @@ def f(x: Bytes[2 * 32 + 3 * 32 + 3 * 32 * 4]):
data += (0x00).to_bytes(31, "big")
data += (0x03).to_bytes(32, "big") * 2
with tx_failed():
w3.eth.send_transaction({"to": c.address, "data": data})
c.run(data)


def test_abi_decode_oob_due_to_invalid_head3(tx_failed, get_contract):
Expand Down

0 comments on commit 28d26b2

Please sign in to comment.