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

Refactor tx filters #3626

Merged
merged 22 commits into from
Dec 6, 2021
Merged

Conversation

marcindsobczak
Copy link
Contributor

@marcindsobczak marcindsobczak commented Nov 19, 2021

Resolves #3623

Changes:

Changing ITxFilter to be like IIncomingTxFilter (returns AddTxResult? instead of string).

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing

  • Yes
  • No

@marcindsobczak marcindsobczak marked this pull request as draft November 19, 2021 19:24
@marcindsobczak marcindsobczak marked this pull request as ready for review November 19, 2021 19:34
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

We still have both ITxFilter and IIncomingTxFilter, we should unify and simplify. Then delete the obsolete one. That would probably make TxFilterAdapter obsolete too.

This is good first step but not enough for proper refactor.

src/Nethermind/Nethermind.TxPool/AddTxResult.cs Outdated Show resolved Hide resolved
@marcindsobczak marcindsobczak marked this pull request as draft November 23, 2021 08:55
@marcindsobczak marcindsobczak changed the title change ITxFilter to be like IIncomingTxFilter Refactor tx filters Dec 3, 2021
@marcindsobczak marcindsobczak marked this pull request as ready for review December 3, 2021 15:53
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Great work, but few details and improvements can be still done

src/Nethermind/Nethermind.TxPool/Filters/GapNonceFilter.cs Outdated Show resolved Hide resolved
src/Nethermind/Nethermind.TxPool/Filters/LowNonceFilter.cs Outdated Show resolved Hide resolved
{
args.Set(TxAction.Skip, txFilterResult.Reason);
args.Set(TxAction.Skip, txFilterResult.ToString());
Copy link
Member

Choose a reason for hiding this comment

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

maybe we should use AcceptTxResult further down the line instead of ToString() here? Not sure.

src/Nethermind/Nethermind.Blockchain/TxFilterAdapter.cs Outdated Show resolved Hide resolved
src/Nethermind/Nethermind.Blockchain/TxFilterAdapter.cs Outdated Show resolved Hide resolved
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

We could rename "result" to "accepted" or "allowed" in many places now so it would be more readable with those if's.

src/Nethermind/Nethermind.TxPool/AcceptTxResult.cs Outdated Show resolved Hide resolved
@marcindsobczak marcindsobczak merged commit 9b68ec0 into master Dec 6, 2021
@marcindsobczak marcindsobczak deleted the unify_ITxFilter_and_IIncomingTxFilter branch December 6, 2021 15:08
@prashantkumar1982
Copy link

This PR broke Chainlink integration.
The refactoring of error message broke our regular expression matching logic, which tells us why a Tx failed, and makes our StateMachine work.

A partial fix that Chainlink needed on our side is here: smartcontractkit/chainlink#7989

@marcindsobczak in future, please keep this in mind, and possibly, could you notify Chainlink before changing error response strings?

@marcindsobczak
Copy link
Contributor Author

Thank you @prashantkumar1982 for a message. We highly appreciate such a feedback, although we don't have a knowledge how your setup works, so it would be hard to catch which changes can possibly affect it. Possible solution could be to add integration tests which we can run on our CI. Could you please provide us such a tests? We would love to add it to our codebase and then it will be easy to remember to ping you every time when we change something and tests start failing

@dimriou
Copy link

dimriou commented Nov 24, 2022

Hey @marcindsobczak , thanks for the suggestions. We'll discuss this internally and let you know.

For reference, here (https://github.com/smartcontractkit/chainlink/blob/develop/core/chains/evm/client/errors.go#L170) you can find the regexes we use to match Nethermind's RPC responses. Depending on each response, we make a different decision on how to handle our pending transactions. As @prashantkumar1982 mentioned, if the regexes change this means that our Nodes will not be able to handle some of the responses, thus affecting our pending transactions.

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.

Unify ITxFilter and IIncomingTxFilter
5 participants