-
Notifications
You must be signed in to change notification settings - Fork 551
eth, core: handle state-sync data in eth/69 messages #1710
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
base: avalkov/upstream-v1.16.1
Are you sure you want to change the base?
eth, core: handle state-sync data in eth/69 messages #1710
Conversation
borReceiptsCacheHit = metrics.NewRegisteredGauge("bor/receipts/cache/hit", nil) | ||
borReceiptsCacheMiss = metrics.NewRegisteredGauge("bor/receipts/cache/miss", nil) | ||
borReceiptsRLPCacheHit = metrics.NewRegisteredGauge("bor/rlpreceipts/cache/hit", nil) | ||
borReceiptsRLPCacheMiss = metrics.NewRegisteredGauge("bor/rlpreceipts/cache/miss", nil) |
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.
These metrics have been added to see the hit/miss ratio. For normal receipts, they've been removed from upstream. If the ratio is bad, probably worth removing for bor receipts as well.
if header.EmptyReceipts() && !isSprintEndBlock(borCfg, header.Number.Uint64()) { | ||
fetchReceipts = false | ||
} | ||
if syncMode == SnapSync && fetchReceipts { |
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.
Will be writing a new test around this change.
|
Description
This PR adds the ability to send state-sync transaction receipts (or bor receipts in short) in
eth/69
protocol (which is newly added from upstream). This will allow nodes using snap sync to persist the state-sync transaction receipts (as there's no execution involved in snap sync and hence they're not generated locally).This PR changes the implementation of 2 p2p messages:
Moreover, this PR also changes how receipts are handled in
InsertReceiptChain
function which didn't handle bor receipts earlier. Bor receipts can be identified by their 0 gas used field. Upon insertion, as they're stored separately from normal block receipts, they need to be extracted from the encoded packet which is handled in this PR.Note that this change is forward compatible and allows to do a hard fork in future where we include bor receipts as a part of receipt root without any p2p changes.
Changes
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Nodes audience
In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)
Checklist
Cross repository changes
Testing
Manual tests
Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it