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

Fix broken stateroots #1866

Merged
merged 6 commits into from
Mar 27, 2021
Merged

Fix broken stateroots #1866

merged 6 commits into from
Mar 27, 2021

Conversation

roman-khimov
Copy link
Member

Problem

They're broken.

Solution

Make them a little less broken.

As it's a part of the header.
It was completely ruined by bf20db0. MPT was
updating bc.dao directly which shouldn't ever happen, it must write into the
same cache and then Persist these KVs as usual.
Prevent

2021-03-27T00:05:23.382+0300    WARN    blockQueue: failed adding block into the blockchain     {"error": "error while trying to apply MPT changes: key not found", "blockHeight": 12757, "nextIndex": 12758}

after node restart (node reads "local" root hash that it doesn't have).
It's a local problem and returning error from here leads to peer disconnect
that isn't solving anything.
@roman-khimov roman-khimov added this to the v0.94.1 milestone Mar 26, 2021
@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #1866 (3b4dde0) into master (44c87a4) will increase coverage by 0.09%.
The diff coverage is 70.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1866      +/-   ##
==========================================
+ Coverage   83.31%   83.41%   +0.09%     
==========================================
  Files         283      283              
  Lines       22467    22476       +9     
==========================================
+ Hits        18719    18748      +29     
+ Misses       2592     2569      -23     
- Partials     1156     1159       +3     
Impacted Files Coverage Δ
pkg/services/stateroot/signature.go 70.37% <ø> (+4.85%) ⬆️
pkg/core/stateroot/store.go 70.00% <33.33%> (-3.34%) ⬇️
pkg/services/stateroot/service.go 78.43% <40.00%> (-4.55%) ⬇️
pkg/core/stateroot/module.go 80.32% <81.25%> (+2.55%) ⬆️
pkg/core/blockchain.go 79.84% <87.50%> (+0.06%) ⬆️
pkg/services/stateroot/network.go 75.86% <100.00%> (+0.42%) ⬆️
pkg/services/stateroot/validators.go 80.76% <100.00%> (+0.37%) ⬆️
pkg/network/server.go 71.49% <0.00%> (+0.14%) ⬆️
pkg/services/notary/notary.go 92.42% <0.00%> (+1.01%) ⬆️
pkg/services/oracle/request.go 55.64% <0.00%> (+6.45%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44c87a4...3b4dde0. Read the comment docs.

@roman-khimov roman-khimov merged commit 8d195e6 into master Mar 27, 2021
@roman-khimov roman-khimov deleted the fix-broken-stateroots branch March 27, 2021 08:14
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.

2 participants