Skip to content

Conversation

@deffrian
Copy link
Contributor

@deffrian deffrian commented Dec 5, 2025

Fixes Closes Resolves #

eth_getLogs/filter-error-blockHash-and-range (nethermind)
eth_getLogs/filter-error-future-block-range (nethermind)

Changes

  • Refactor eth_getLogs a bit
  • Add checks

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

@deffrian deffrian marked this pull request as ready for review December 5, 2025 21:13
@LukaszRozmej LukaszRozmej requested a review from alexb5dh December 5, 2025 21:25
@alexb5dh
Copy link
Contributor

alexb5dh commented Dec 6, 2025

Copy link
Contributor

@alexb5dh alexb5dh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly worried about replacing BlockParameterConverter with LongConverter.


private static AddressFilter GetAddress(object? address) =>
address switch
private static AddressFilter GetAddress(AddressAsKey[]? address)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter should probably be named addresses, just to avoid confusion.

else
{
FromBlock = ToBlock = BlockParameterConverter.GetBlockParameter(blockHash);
FromBlock = hasFromBlock ? new BlockParameter(LongConverter.FromString(fromBlockElement.ToString())) : BlockParameter.Earliest;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockParameterConverter also handled all non-integer values like earliest, latest, etc. I don't see this functionality in LongConverter, are these values still handled correctly?

In case if not - would be good to add some unit tests on these values specifically after a fix.

Copy link
Contributor

@alexb5dh alexb5dh Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also see that earliest/latest params were removed/replaced in many tests, was this intentional?

}

public AddressFilter(HashSet<AddressAsKey> addresses)
public AddressFilter(AddressAsKey[] addresses)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason behind replacing HashSet with an array?

ToBlock = BlockParameterConverter.GetBlockParameter(toBlockElement.ToString());
if (hasFromBlock || hasToBlock)
{
throw new ArgumentException("either (fromBlock and toBlock) or blockHash have to be specified");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, geth message looks better to me, but it may be subjective:

cannot specify both BlockHash and FromBlock/ToBlock

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

Successfully merging this pull request may close these issues.

3 participants