-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Track Previously Seen Merkle Index to Prevent Duplicate Log Spam #1566
Conversation
…m into fix-encoding-decoding
Codecov Report
@@ Coverage Diff @@
## master #1566 +/- ##
=========================================
- Coverage 71.98% 71.39% -0.6%
=========================================
Files 99 99
Lines 6732 6568 -164
=========================================
- Hits 4846 4689 -157
+ Misses 1471 1466 -5
+ Partials 415 413 -2 |
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.
just one small comment
BeaconDB: &db.BeaconDB{}, | ||
}) | ||
if err != nil { | ||
t.Fatalf("unable to setup web3 ETH1.0 chain service: %v", err) |
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.
s/unable/Unable
beacon-chain/powchain/service.go
Outdated
// ETH1.0 network, and prevents us from updating our trie | ||
// with the same log twice, causing an inconsistent state root. | ||
index := binary.LittleEndian.Uint64(merkleTreeIndex) | ||
if int64(index) == w.lastReceivedMerkleIndex { |
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.
Shouldn't it be
if int64(index) <= w.lastReceivedMerkleIndex {
?
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.
Nice catch
…o track-prev-index
Part of #1565
Description
Write why you are making the changes in this pull request
Sometimes we might receive duplicate logs from the ETH1.0 nodes we are connected to, causing our powchain service to unnecessarily update its deposit trie with this log even though we have already seen this Merkle index. This is a bug as it leaves our trie with an inconsistent root.
Write a summary of the changes you are making
This PR introduces a variable called
lastReceivedMerkleIndex
in our powchain service which we use to check if we have already seen a Merkle index, preventing unnecessary updates to the trie. This PR adds a test for this duplicate log spam to check the root does not change.