-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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, miner: avoid miscaching while getting sender from tx #14773
Conversation
0628250
to
3b6a4aa
Compare
Could you detail a bit what the exact issue was, the scenario where it came up and why this fix solves it? I don't quite understand what you're trying to fix here. |
In our team, we are trying to set up a private blockchain environment to evaluate the system performance. We found |
3ca65fb
to
2568646
Compare
@karalabe Do you have any other comments for this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karalabe deriveSigner can pick the homestead signer, which is usually not the one cached in the tx struct. It's hard to put a number on this change, but I'm convinced that it's correct and may be faster.
core/types/transaction.go
Outdated
func (t *TransactionsByPriceAndNonce) Shift() { | ||
signer := deriveSigner(t.heads[0].data.V) | ||
// derive signer but don't cache. | ||
func (t *TransactionsByPriceAndNonce) Shift(signer Signer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pinged @karalabe in a voice call and he doesn't like this change because calling Shift
with some signer other than EIP155 can derive a different sender address and mess up the tx set. A suggestion: maybe we should store the signer to use on the TransactionsByPriceAndNonce
struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fjl Thanks for the feedback. I updated my commit to store the signer in TransactionsByPriceAndNonce
and check the sender address before we construct it. Please help review. Thanks!
@karalabe ping |
@karalabe Do you have other suggestion for this PR? |
The tx sender is usually mis-cached because of different signer if we are running a new chain. Get the correct signer to get sender cache.