Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Validate and fix logIndex increment logic on eth_getLogs route #303

Closed
natanasow opened this issue Jul 7, 2022 · 0 comments · Fixed by #314
Closed

Validate and fix logIndex increment logic on eth_getLogs route #303

natanasow opened this issue Jul 7, 2022 · 0 comments · Fixed by #314
Assignees
Labels
bug Something isn't working P1
Milestone

Comments

@natanasow
Copy link
Collaborator

natanasow commented Jul 7, 2022

Description

HIP 482 notes that logIndex in eth_getLogs should be "The position of the log within the block.". Current implementation on network seems to use "The position of the log within the transaction." as returned by the mirror node.

This is resulting in the logIndex property being mostly zero within the same block

Response from eth_getLogs 👇

[
  {
    address: '0x00000000000000000000000000000000000003fa',
    blockHash: '0xdeece14c33d8910150fc7696f812bd7cbc18ffbc003289ee1379d2ee68c94ae1',
    blockNumber: 8,
    data: '0x0000000000000000000000000000000000000000000000000000000000000001',
    logIndex: 0,
    removed: false,
    topics: [
      '0x75e7d95cd72588af49ce2e4b7f004bce916d422999adf262a640e4239aab00c7',
      '0x0000000000000000000000000000000000000000000000000000000000000001',
      '0x0000000000000000000000000000000000000000000000000000000000000001',
      '0x0000000000000000000000000000000000000000000000000000000000000001'
    ],
    transactionHash: '0x10b1f11249ca0e6e07e94ddeca0ebcc0ac01df65c6b470a65c18fee72b6cb6e6',
    transactionIndex: 5
  },
  {
    address: '0x00000000000000000000000000000000000003fa',
    blockHash: '0xdeece14c33d8910150fc7696f812bd7cbc18ffbc003289ee1379d2ee68c94ae1',
    blockNumber: 8,
    data: '0x',
    logIndex: 0,
    removed: false,
    topics: [
      '0xa8fb2f9a49afc2ea148319326c7208965555151db2ce137c05174098730aedc3',
      '0x0000000000000000000000000000000000000000000000000000000000000001',
      '0x0000000000000000000000000000000000000000000000000000000000000001',
      '0x0000000000000000000000000000000000000000000000000000000000000001'
    ],
    transactionHash: '0xa49e7c75342abbaf0d94cc74cad86c4d8854311f0a9356e5187fd949d19a39ea',
    transactionIndex: 1
  },
  {
    address: '0x00000000000000000000000000000000000003fa',
    blockHash: '0x2b4ac46567dc531b847940d7787a640f09bc3801aa79963203d9883a466e619c',
    blockNumber: 7,
    data: '0x',
    logIndex: 0,
    removed: false,
    topics: [
      '0x513dad7582fd8b11c8f4d05e6e7ac8caaa5eb690e9173dd2bed96b5ae0e0d024',
      '0x0000000000000000000000000000000000000000000000000000000000000001',
      '0x0000000000000000000000000000000000000000000000000000000000000001'
    ],
    transactionHash: '0x8a96d29eb2ae5dd615186d6832c6939144eedfc5590b575e7018dce1b31e9ca6',
    transactionIndex: 11
  },
  {
    address: '0x00000000000000000000000000000000000003fa',
    blockHash: '0x2b4ac46567dc531b847940d7787a640f09bc3801aa79963203d9883a466e619c',
    blockNumber: 7,
    data: '0x',
    logIndex: 0,
    removed: false,
    topics: [
      '0x46692c0e59ca9cd1ad8f984a9d11715ec83424398b7eed4e05c8ce84662415a8',
      '0x0000000000000000000000000000000000000000000000000000000000000001'
    ],
    transactionHash: '0xdf4356a465d1b560112de846f5c1ee6be450cbb20cc901ac7fee5a245d0b05a1',
    transactionIndex: 7
  },
  {
    address: '0x00000000000000000000000000000000000003fa',
    blockHash: '0x2b4ac46567dc531b847940d7787a640f09bc3801aa79963203d9883a466e619c',
    blockNumber: 7,
    data: '0x0000000000000000000000000000000000000000000000000000000000000001',
    logIndex: 0,
    removed: false,
    topics: [],
    transactionHash: '0xc2c65e2cb16d8ff84bcc89e98a42509a892fa3fc760cb63780787bd9f083dec4',
    transactionIndex: 3
  }
]

Steps to reproduce

  1. Deploy a contract with events
  2. Make a contract call that emits the events
  3. Get the logs via eth_getLogs

Additional context

No response

Hedera network

other

Version

v1.0.0

Operating system

Linux

@natanasow natanasow added the bug Something isn't working label Jul 7, 2022
@natanasow natanasow self-assigned this Jul 7, 2022
@Nana-EC Nana-EC reopened this Jul 8, 2022
@Nana-EC Nana-EC changed the title Incorrect logIndex on eth_getLogs route Validate and fix logIndex increment logic on eth_getLogs route Jul 8, 2022
@Nana-EC Nana-EC added this to the 0.4.0 milestone Jul 8, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working P1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants