-
Notifications
You must be signed in to change notification settings - Fork 523
V31 consensus upgrade #3553
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
V31 consensus upgrade #3553
Changes from all commits
8b54ef8
7d34cfa
355b97f
00e75f8
4236478
3ce0afb
4ba3d33
6326a0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,7 @@ func testExpirationAccounts(t *testing.T, fixture *fixtures.RestClientFixture, f | |
| _, currentRound := fixture.GetBalanceAndRound(richAccount) | ||
| // account adds part key | ||
| partKeyFirstValid := uint64(0) | ||
| partKeyValidityPeriod := uint64(150) | ||
| partKeyValidityPeriod := uint64(150) // TODO: maybe increase? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the units? I would have guessed rounds, but that would be very short.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes they are rounds and it is very short, maybe we should put 1000-3000 there instead, as no State Proof keys will be generated for such a short interval. |
||
| partKeyLastValid = currentRound + partKeyValidityPeriod | ||
| partkeyResponse, _, err := sClient.GenParticipationKeys(sAccount, partKeyFirstValid, partKeyLastValid, 0) | ||
| a.NoError(err) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -553,6 +553,9 @@ func TestAccountParticipationInfo(t *testing.T) { | |
| firstRound := basics.Round(params.LastRound + 1) | ||
| lastRound := basics.Round(params.LastRound + 1000) | ||
| dilution := uint64(100) | ||
| var stateproof merklesignature.Verifier | ||
| stateproof[0] = 1 // change some byte so the stateproof is not considered empty (required since consensus v31) | ||
|
|
||
| randomVotePKStr := randomString(32) | ||
| var votePK crypto.OneTimeSignatureVerifier | ||
| copy(votePK[:], []byte(randomVotePKStr)) | ||
|
|
@@ -576,6 +579,7 @@ func TestAccountParticipationInfo(t *testing.T) { | |
| VoteKeyDilution: dilution, | ||
| VoteFirst: firstRound, | ||
| VoteLast: lastRound, | ||
| StateProofPK: stateproof, | ||
| }, | ||
| } | ||
| txID, err := testClient.SignAndBroadcastTransaction(wh, nil, tx) | ||
|
|
@@ -590,6 +594,7 @@ func TestAccountParticipationInfo(t *testing.T) { | |
| a.Equal(uint64(firstRound), account.Participation.VoteFirst, "API must print correct first participation round") | ||
| a.Equal(uint64(lastRound), account.Participation.VoteLast, "API must print correct last participation round") | ||
| a.Equal(dilution, account.Participation.VoteKeyDilution, "API must print correct key dilution") | ||
| // TODO: should we update the v1 API to support state proof? Currently it does not return this field. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tsachiherman did we already address this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I copied this comment from @Aharonee 's PR, but I believe that the answer is no, and I think it's fine. We want to avoid updating the v1 endpoint any further.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed, if we are using v1 somewhere internally that needs it, we should just convert it to using v2 instead |
||
| } | ||
|
|
||
| func TestSupply(t *testing.T) { | ||
|
|
@@ -1063,9 +1068,6 @@ func TestStateProofInParticipationInfo(t *testing.T) { | |
| var localFixture fixtures.RestClientFixture | ||
|
|
||
| proto := config.Consensus[protocol.ConsensusCurrentVersion] | ||
| // TODO: remove these 2 lines when CurrentVersion contains them already | ||
| proto.EnableStateProofKeyregCheck = true | ||
| proto.MaxKeyregValidPeriod = config.Consensus[protocol.ConsensusFuture].MaxKeyregValidPeriod | ||
| localFixture.SetConsensus(config.ConsensusProtocols{protocol.ConsensusCurrentVersion: proto}) | ||
|
|
||
| localFixture.Setup(t, filepath.Join("nettemplates", "TwoNodes50Each.json")) | ||
|
|
@@ -1168,22 +1170,7 @@ func TestNilStateProofInParticipationInfo(t *testing.T) { | |
| a := require.New(fixtures.SynchronizedTest(t)) | ||
| var localFixture fixtures.RestClientFixture | ||
|
|
||
| // currently, the genesis creator uses the EnableStateProofKeyregCheck flag on the future | ||
| // version to write a statproof to the genesis file. | ||
| // we want to create a gensis file without state proof. | ||
| // + need to revert this change if other tests use that | ||
| tmp := config.Consensus[protocol.ConsensusFuture] | ||
| tmp.EnableStateProofKeyregCheck = false | ||
| config.Consensus[protocol.ConsensusFuture] = tmp | ||
|
|
||
| defer func() { | ||
| tmp := config.Consensus[protocol.ConsensusFuture] | ||
| tmp.EnableStateProofKeyregCheck = true | ||
| config.Consensus[protocol.ConsensusFuture] = tmp | ||
| }() | ||
|
|
||
| localFixture.SetConsensus(config.Consensus) | ||
| localFixture.Setup(t, filepath.Join("nettemplates", "TwoNodes50Each.json")) | ||
| localFixture.Setup(t, filepath.Join("nettemplates", "TwoNodes50EachV30.json")) | ||
| defer localFixture.Shutdown() | ||
|
|
||
| testClient := localFixture.LibGoalClient | ||
|
|
@@ -1226,7 +1213,6 @@ func TestNilStateProofInParticipationInfo(t *testing.T) { | |
| VotePK: votePK, | ||
| SelectionPK: selPK, | ||
| VoteFirst: firstRound, | ||
| StateProofPK: merklesignature.Verifier{}, | ||
| VoteLast: lastRound, | ||
| VoteKeyDilution: dilution, | ||
| Nonparticipation: false, | ||
|
|
||
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.
I was about to ask some questions about the numbers going into this formula, seems like intent is to address this in a follow on issue: #3257 cc @algonautshant
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.
The assumption is that the source of the truth is here:
v31.MaxKeyregValidPeriod = 256*(1<<16) - 1Anywhere else should be referencing this parameter.
The issue in #3257 is to make sure this variable is used for testing (instead of hardcoding the same value elsewhere), and fix the package dependency issue.
This is not a blocking issue.
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.
MaxKeyregValidPeriodcombines 256 and 16, which are based on two different limits.for example:
merklearray/merkle.go: MaxEncodedTreeDepth = 16