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

go/consensus/supplementarysanity: Fix checks for legacy validators #5168

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Feb 6, 2023

Before, when upgrading from 22.2.x the supplementary-sanity checks would fail for validator nodes that did not yet re-register with added P2P address.

(Unrelated change) update minNodeDescriptorVersion to 3, because V2 descriptors are automatically migrated to V3 in deserialization, so no need to allow V2 descriptors.

@ptrus ptrus force-pushed the ptrus/fix/validator-p2p-check branch from 8788bfc to 886aea1 Compare February 6, 2023 20:18
@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

Merging #5168 (886aea1) into master (364c7f4) will increase coverage by 0.25%.
The diff coverage is 56.09%.

❗ Current head 886aea1 differs from pull request most recent head f790a1f. Consider uploading reports for the commit f790a1f to get more accurate results

@@            Coverage Diff             @@
##           master    #5168      +/-   ##
==========================================
+ Coverage   66.73%   66.98%   +0.25%     
==========================================
  Files         497      499       +2     
  Lines       53300    53361      +61     
==========================================
+ Hits        35570    35745     +175     
+ Misses      13363    13256     -107     
+ Partials     4367     4360       -7     
Impacted Files Coverage Δ
go/common/node/node.go 73.52% <ø> (+2.45%) ⬆️
go/keymanager/api/api.go 75.86% <0.00%> (-7.00%) ⬇️
go/registry/api/api.go 54.39% <ø> (+1.81%) ⬆️
go/consensus/tendermint/apps/keymanager/genesis.go 56.14% <33.33%> (-2.05%) ⬇️
...nsensus/tendermint/apps/keymanager/transactions.go 47.72% <40.00%> (-1.06%) ⬇️
...onsensus/tendermint/apps/keymanager/state/state.go 67.21% <46.66%> (-6.70%) ⬇️
...o/consensus/tendermint/apps/keymanager/messages.go 56.52% <56.52%> (ø)
...nsus/tendermint/apps/supplementarysanity/checks.go 46.90% <60.00%> (+0.05%) ⬆️
go/keymanager/api/sanity_check.go 65.21% <65.21%> (ø)
go/oasis-node/cmd/genesis/genesis.go 54.36% <100.00%> (+0.26%) ⬆️
... and 35 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -709,6 +709,7 @@ func VerifyRegisterNodeArgs( // nolint: gocyclo
switch isGenesis {
case true:
// Allow legacy descriptor with optional p2p address for validator.
// XXX: Remove this after 22.3.x.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// XXX: Remove this after 22.3.x.
// XXX: Remove this after 23.0.x.

}

// If legacy nodes registered at genesis can be present, use isGenesis=true version of the sanity check
// to allow non-migrated nodes (for 22.3.x these are validator nodes with no p2p address).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// to allow non-migrated nodes (for 22.3.x these are validator nodes with no p2p address).
// to allow non-migrated nodes (for 23.0.x these are validator nodes with no p2p address).

@peternose
Copy link
Contributor

These changes also force that the public key has to be in the entity's node list for the first MaxNodeExpiration epochs (see 546). Not sure if this is a problem.

@kostko
Copy link
Member

kostko commented Feb 7, 2023

Note that this is only for supplementary sanity checks which are disabled by default, but yeah this seems like an unintended consequence as it could cause the sanity checks to incorrectly fail. Maybe it would be better to use the isSanityCheck flag in VerifyRegisterNodeArgs, e.g.:

	switch isGenesis || isSanityCheck {
	case true:
		// Allow legacy descriptor with optional p2p address for validator.

@ptrus ptrus force-pushed the ptrus/fix/validator-p2p-check branch from 886aea1 to d8b2c6a Compare February 7, 2023 10:01
@ptrus ptrus force-pushed the ptrus/fix/validator-p2p-check branch from d8b2c6a to f790a1f Compare February 7, 2023 10:01
@ptrus
Copy link
Member Author

ptrus commented Feb 7, 2023

Changed to use the isSanityCheck solution. Tried to avoid this before, since it's not the "correct fix", but it does make the logic much simpler, and it's also only a temporary special case anyway.

@ptrus ptrus requested a review from kostko February 7, 2023 10:05
@ptrus ptrus enabled auto-merge February 7, 2023 10:25
@ptrus ptrus merged commit 82199f2 into master Feb 7, 2023
@ptrus ptrus deleted the ptrus/fix/validator-p2p-check branch February 7, 2023 10:50
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.

3 participants