Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

eth/filters: support reverse ordered logs #19030

Closed

Conversation

hackmod
Copy link
Contributor

@hackmod hackmod commented Feb 9, 2019

WIP
this is a quick hack to support reverse ordered eth_getLogs results for fromBlock > toBlock cases.

  • pass CI tests

@karalabe
Copy link
Member

Why is it better to add more code to handle a bad user request vs. just telling the user to fix their request?

@hackmod
Copy link
Contributor Author

hackmod commented Feb 10, 2019

showing lastest log item first is the expected behavior of a block explorer like as the etherscan.io
https://etherscan.io/token/0xB8c77482e45F1F44dE1745F52C74426C631bDD52

but currently, eth_getLogs does not show the latest logs(transaction) first.
this is a simple/quick hack to support fromBlock > toBlock (or we may support reverse:true parameter.)

furthermore, we may add some additional parameters like as follow

  • count:10 - getLogs 10 items. (and it might be better to force max limit to protect DDoS)
  • after:10 - getLogs after 10 items. (for pagination)

(count and after options are supported by the ethereum-parity. Please see https://wiki.parity.io/JSONRPC-trace-module#trace_filter // parity also does not support reverse ordered output nor fromBlock > toBlock case)

@karalabe
Copy link
Member

karalabe commented Aug 8, 2019

Block explorers should retrieve the data from Geth and index it themselves in whatever format is best for them. Apart from maybe visual display for a user, no use case can really be backed by a reverse log order, since everything relies on transforming a starting state based on the emitted logs. I just don't see a valid use case for this, but there is a lot of down sides with exploded filtering complexity.

@karalabe karalabe closed this Aug 8, 2019
@hackmod
Copy link
Contributor Author

hackmod commented Dec 21, 2019

Block explorers should retrieve the data from Geth and index it themselves in whatever format is best for them. Apart from maybe visual display for a user, no use case can really be backed by a reverse log order, since everything relies on transforming a starting state based on the emitted logs. I just don't see a valid use case for this, but there is a lot of down sides with exploded filtering complexity.

Almost all ethereum wallet dapps always implement its recent transaction via its own DB server or by using internal storage separately. If the geth support reverse ordered logs we don't have to much work to make a separate DB server (or explorer) to query recent transactions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants