From 28aad7e0b477bec88ffef9d82cfc20451f17716c Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 31 May 2021 14:46:14 +0200 Subject: [PATCH] Add test with event where indexed parameters are not the first. --- .../events/event_indexed_mixed.sol | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/libsolidity/semanticTests/events/event_indexed_mixed.sol diff --git a/test/libsolidity/semanticTests/events/event_indexed_mixed.sol b/test/libsolidity/semanticTests/events/event_indexed_mixed.sol new file mode 100644 index 000000000..e816a4961 --- /dev/null +++ b/test/libsolidity/semanticTests/events/event_indexed_mixed.sol @@ -0,0 +1,18 @@ +contract C { + // Indexed parameters are always listed first in the output. + // The data is the ABI encoding of just the non-indexed parameters, + // so putting the indexed parameters "in between" would mess + // up the offsets for the reader. + event E(uint a, uint indexed r, uint b, bytes c); + function deposit() public { + emit E(1, 2, 3, "def"); + } +} +// ==== +// compileViaYul: also +// ---- +// deposit() -> +// ~ emit E(uint256,uint256,uint256,bytes): #0x02, 0x01, 0x03, 0x60, 0x03, "def" +// gas irOptimized: 23685 +// gas legacy: 24170 +// gas legacyOptimized: 23753