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

core: filter out txs with invalid signatures as soon as possible #21170

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

duanhao0814
Copy link
Contributor

Once we detect an invalid transaction during recovering signatures, we should
directly exclude this transaction to avoid validating the signatures hereafter.

This should optimize the validations times of transactions with invalid signatures
to only one time.

Once we detect an invalid transaction during recovering signatures, we should
directly exclude this transaction to avoid validating the signatures hereafter.

This should optimize the validations times of transactions with invalid signatures
to only one time.
@karalabe
Copy link
Member

karalabe commented Jun 4, 2020

I don't really think this is worth the complexity. Transactions with invalid signatures do not get propagated across the network. At the worse a malicious sender is able to put some strain on the peers it's directly connected to, but not on anyone else.

@duanhao0814
Copy link
Contributor Author

Yes, I agree that transactions with invalid signatures will not get propagated across the network.

And I saw that we need to filter out duplicate transactions before acquire txpool lock and add into txpool, so I thought it's worth to filter out all possible invalid transactions.
At the same time, this change can reduce some lock occupation because currently invalid txs can only be detected after we acquired the lock. If we can filter out them before we try to add it into txpool, we can reduce some competition on the lock of txpool although I'm not sure if it is worth to do it.
So, if this change doesn't make much sense, I will close this PR.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

I think this makes sense -- it does the same amount of work as previously, but actually handles a possible error correctly too. I don't think it adds complexity

@karalabe karalabe added this to the 1.9.16 milestone Jun 16, 2020
@karalabe karalabe merged commit eb9d7d1 into ethereum:master Jun 16, 2020
@fjl fjl removed the status:triage label Jul 1, 2020
@gzliudan gzliudan mentioned this pull request May 11, 2024
20 tasks
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request May 13, 2024
…ereum#21170)

Once we detect an invalid transaction during recovering signatures, we should
directly exclude this transaction to avoid validating the signatures hereafter.

This should optimize the validations times of transactions with invalid signatures
to only one time.
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.

5 participants