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

Has a problem specifying the range of getLogs API #1710

Closed
brew0722 opened this issue Nov 18, 2022 · 0 comments
Closed

Has a problem specifying the range of getLogs API #1710

brew0722 opened this issue Nov 18, 2022 · 0 comments
Assignees

Comments

@brew0722
Copy link

brew0722 commented Nov 18, 2022

Describe the bug

There is no problem until 1.9.1, but Applying EIP-234 (#1653 appears to be a bug.
I need blockHash, so I cherry-picked the above PR.
However, after the cherry pick, I experienced a new bug.

// Convert the RPC block numbers into internal representations

The results of eth_newFilter & eth_getFilterLogs API and getLogs API are different with the same FilterQuery input. the begin and end specification in getlogs API does not work as intended.
If filter query has a range input, begin and end appear to go to zero.

now:

		var (
			begin int64
			end   int64
		)
		if crit.FromBlock == nil {
			begin = int64(rpc.LatestBlockNumber)
		}
		if crit.ToBlock == nil {
			end = int64(rpc.LatestBlockNumber)
		}
		// Construct the range filter
		filter = NewRangeFilter(api.backend, begin, end, crit.Addresses, crit.Topics)
	}

suggest:

		begin := rpc.LatestBlockNumber.Int64()
		if crit.FromBlock != nil {
			begin = crit.FromBlock.Int64()
		}
		end := rpc.LatestBlockNumber.Int64()
		if crit.ToBlock != nil {
			end = crit.ToBlock.Int64()
		}

How to reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Attachments
If applicable, add data, logs or screenshots to help explain your problem.

Environment (please complete the following information)
0e5c8c1
latest commit of dev branch

Additional context
Add any other context about the problem here.

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

No branches or pull requests

2 participants