-
Notifications
You must be signed in to change notification settings - Fork 99
Make staterootinheader a proper block version 1 #3566
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: master
Are you sure you want to change the base?
Conversation
|
Work for 4-node network as well: |
|
Logic related to |
|
Don't forget to update |
Required to test nspcc-dev/neo-go#3566 and neo-project/neo#4161. Includes nspcc-dev/neo-go#4001. Signed-off-by: Anna Shaleva <[email protected]>
048779c to
db46d19
Compare
898699e to
b3132e4
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3566 +/- ##
==========================================
- Coverage 72.50% 72.46% -0.04%
==========================================
Files 364 364
Lines 56750 56715 -35
==========================================
- Hits 41146 41099 -47
- Misses 13873 13886 +13
+ Partials 1731 1730 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b3132e4 to
cbf59dd
Compare
cbf59dd to
2fd6ac2
Compare
Signed-off-by: Roman Khimov <[email protected]>
2fd6ac2 to
bd4cecb
Compare
|
Still a couple of TODOs left, will finish them. @roman-khimov, let's perform some initial review. |
| Basilisk: 10 | ||
| Cockatrice: 15 | ||
| Domovoi: 20 | ||
| Echidna: 50 |
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.
Why this change?
| if pr, ok := msg.(*prepareRequest); ok { | ||
| pr.prevHash = s.dbft.PrevHash | ||
| pr.version = coreb.VersionInitial | ||
| pr.version = coreb.VersionInitial // TODO: ? |
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.
Not sure why we doing it here at all, newPrepareRequest should be handling all this. It's HF-dependent anyway.
| if req.version != coreb.VersionInitial { | ||
| return errInvalidVersion | ||
| var ( | ||
| f = config.HFFaun |
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/f/faun/ maybe?
| recoveryMessageType, | ||
| } | ||
|
|
||
| func TestS(t *testing.T) { |
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.
Some better name needed for sure.
| // New creates a new blank block with proper state root setting. | ||
| func New(stateRootEnabled bool) *Block { | ||
| // New creates a new blank block of appropriate version. | ||
| func New(version uint32) *Block { |
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.
Not sure this parameter is useful.
| return fmt.Errorf("%w: %s != %s", | ||
| ErrHdrInvalidStateRoot, currHeader.PrevStateRoot.StringLE(), sr.StringLE()) | ||
| } | ||
| if currHeader.Version > block.VersionInitial && bc.stateRoot.CurrentLocalHeight() == prevHeader.Index { |
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.
You need to check that it's legal to have version 1 at this height as well.
| P2PSigExtensions bool | ||
| // StateRootInHeader is true if state root is contained in block header. | ||
| // Deprecated: this setting is left for compatibility with old NeoGo nodes | ||
| // and |
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.
and?
| p.ValidatorsCount = aux.ValidatorsCount | ||
| p.CommitteeHistory = aux.CommitteeHistory | ||
| p.P2PSigExtensions = aux.P2PSigExtensions | ||
| p.StateRootInHeader = aux.StateRootInHeader |
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.
But it should be unmarshaled for as long as we have it all, no?
| defer c.cacheLock.Unlock() | ||
|
|
||
| c.cache.network = version.Protocol.Network | ||
| c.cache.stateRootInHeader = version.Protocol.StateRootInHeader |
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.
Init() decription is outdated now, in fact it can be safely omitted. Same goes for other methods (block/header getters) that reference it.
| if bfs.chain.IsHardforkEnabled(&hf, index) { | ||
| v = block.VersionFaun | ||
| } | ||
| b := block.New(v) |
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.
But why? Block has everything needed internally (its version), no?
Very dirty, but works for the single node already: