Skip to content

Commit

Permalink
Simplify a complicated event to facilitate tests
Browse files Browse the repository at this point in the history
PyEvm does not support opcode 0x5e (MCOPY) yet
  • Loading branch information
fjarri committed Mar 16, 2024
1 parent d9f64d2 commit 07efeed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
27 changes: 15 additions & 12 deletions tests/TestContractFunctionality.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,38 @@ contract Test {

struct ByteInner {
bytes4 inner1;
bytes inner2;
bytes10 inner2;
}

struct Foo {
bytes4 foo1;
bytes2[2] foo2;
bytes foo3;
string foo4;
bytes6 foo3;
ByteInner inner;
}

event Complicated(
bytes4 indexed x,
bytes indexed y,
bytes8 indexed y,
Foo indexed u,
ByteInner[2] indexed v
) anonymous;

function emitComplicated() public {
bytes memory bytestring33len1 = "012345678901234567890123456789012";
bytes memory bytestring33len2 = "-12345678901234567890123456789012";
ByteInner memory inner1 = ByteInner("0123", bytestring33len1);
ByteInner memory inner2 = ByteInner("-123", bytestring33len2);
bytes2 x = "aa";
bytes2 y = "bb";
bytes2[2] memory foo2 = [x, y];
Foo memory foo = Foo("4567", foo2, bytestring33len1, "\u1234\u1212", inner1);
ByteInner[2] memory inner_arr = [inner1, inner2];
emit Complicated("aaaa", bytestring33len2, foo, inner_arr);
emit Complicated(
"aaaa",
"55555555",
Foo(
"4567", [x, y],
"444444",
ByteInner("0123", "3333333333")
),
[
ByteInner("0123", "1111111111"),
ByteInner("-123", "2222222222")
]);
}

error MyError(address sender);
Expand Down
12 changes: 4 additions & 8 deletions tests/test_contract_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,10 @@ async def test_complicated_event(session, root_signer, compiled_contracts):

basic_contract = compiled_contracts["Test"]

bytestring33len1 = b"012345678901234567890123456789012"
bytestring33len2 = b"-12345678901234567890123456789012"
inner1 = [b"0123", bytestring33len1]
inner2 = [b"-123", bytestring33len2]
foo = [b"4567", [b"aa", b"bb"], bytestring33len1, "\u1234\u1212", inner1]
event_filter = basic_contract.abi.event.Complicated(
b"aaaa", bytestring33len2, foo, [inner1, inner2]
)
inner1 = [b"0123", b"1111111111"]
inner2 = [b"-123", b"2222222222"]
foo = [b"4567", [b"aa", b"bb"], b"444444", [b"0123", b"3333333333"]]
event_filter = basic_contract.abi.event.Complicated(b"aaaa", b"55555555", foo, [inner1, inner2])

contract = await session.deploy(root_signer, basic_contract.constructor(123, 456))

Expand Down

0 comments on commit 07efeed

Please sign in to comment.