I'm having an issue with a UUID in bytes16 form being emitted as an indexed event topic, and I'm not sure where in the stack this is originating.

The event being emitted in Solidity looks like the following:

event ObjectOperation (
        bytes16 indexed uuid,
        ObjectOperationType indexed opType,
        Organization indexed organization,
        address senderAddress,
        uint8 changeScore

I can see the event in the log:

       "logs": [
           "logIndex": "0x0",
           "transactionIndex": "0x0",
           "transactionHash": "0x6cb6eae33b6d0f229cf2b50e5fe1b51e236e6fb951ffe1fec5db21d741478cd9",
           "blockHash": "0x7c69af4c298845244007d97e3de292dad1cf1d0ba34e65482fe0d224c6cbb73e",
           "blockNumber": "0xc",
           "address": "0x6596907f5db0df9330e1bc0d69c967909256a059",
           "data": "0x000000000000000000000000da9b53ac0609c634ad9e177c58ea73d043c9e94000000000000000000000000000000000000000000000000000000000000000ff",
           "topics": [
           "type": "mined"

Here, "0x4906bf6a230a11e990653a00205a280100000000000000000000000000000000" is the UUID 4906bf6a-230a-11e9-9065-3a00205a2801, but I notice this is right padded, as opposed to the other topics that are left padded.

In my application using go-ethereum's abi bindings, I get back a [16]byte of all zeros, which I assume has to do with this padding, based on the go-ethereum code's assumptions.

I've reproduced this behavior in both ganache and parity. Is this a bug in go-ethereum's log parsing, or in solidity (0.5.3)?

  • I'd suggest to report it to the go-ethereum developers. It seems an error in their code if I interpret the encoding correctly solidity.readthedocs.io/en/v0.5.3/…. It should have been topics[0][:arg.Type.Size] in the line you point to. – Ismael Jan 29 '19 at 17:33
  • 1
    I have created a pull request here to address this issue, but I'm waiting for a review. – jmcnevin Mar 6 '19 at 20:19

This appears to be a bug in go-ethereum's bind package, and I have created a pull request to fix it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.