diff options
author | Gary <982483+gmalouf@users.noreply.github.com> | 2023-12-14 14:46:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 14:46:21 -0500 |
commit | 937c559abd60348fd0d3c534980274288b66398e (patch) | |
tree | 0937899c5fb7a1182a66610ee45f77363a79f6ad | |
parent | ec60b1130b8d31c5f4d49551bf90d4d5092cd693 (diff) |
Consensus: Upgrade to consensus version v39. (#5868)
22 files changed, 107 insertions, 74 deletions
diff --git a/agreement/player_permutation_test.go b/agreement/player_permutation_test.go index bd2c2c84d..2c598ff77 100644 --- a/agreement/player_permutation_test.go +++ b/agreement/player_permutation_test.go @@ -811,17 +811,16 @@ func TestPlayerPermutation(t *testing.T) { } func playerPermutationCheck(t *testing.T, enableDynamicFilterTimeout bool) { - // create a protocol version where dynamic filter is enabled - version, _, configCleanup := createDynamicFilterConfig() + // create a protocol where dynamic filter is set based on the enableDynamicFilterTimeout flag + dynamicFilterOverriddenProtocol, _, configCleanup := overrideConfigWithDynamicFilterParam(enableDynamicFilterTimeout) defer configCleanup() for i := 0; i < 7; i++ { for j := 0; j < 14; j++ { _, pMachine, helper := getPlayerPermutation(t, i) inMsg := getMessageEventPermutation(t, j, helper) - if enableDynamicFilterTimeout { - inMsg.Proto = ConsensusVersionView{Version: version} - } + inMsg.Proto = ConsensusVersionView{Version: dynamicFilterOverriddenProtocol} + err, panicErr := pMachine.transition(inMsg) fmt.Println(pMachine.getTrace().events) fmt.Println("") diff --git a/agreement/player_test.go b/agreement/player_test.go index 2bb2ffe81..a60c9f44c 100644 --- a/agreement/player_test.go +++ b/agreement/player_test.go @@ -37,7 +37,7 @@ func init() { } func makeTimeoutEvent() timeoutEvent { - return timeoutEvent{T: timeout, RandomEntropy: crypto.RandUint64()} + return timeoutEvent{T: timeout, RandomEntropy: crypto.RandUint64(), Proto: ConsensusVersionView{Version: protocol.ConsensusCurrentVersion}} } func generateProposalEvents(t *testing.T, player player, accs testAccountData, f testBlockFactory, ledger Ledger) (voteBatch []event, payloadBatch []event, lowestProposal proposalValue) { @@ -3240,7 +3240,7 @@ func TestPlayerAlwaysResynchsPinnedValue(t *testing.T) { func TestPlayerRetainsReceivedValidatedAtOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(131) pWhite, pM, helper := setupP(t, r-1, p, soft) @@ -3262,7 +3262,7 @@ func TestPlayerRetainsReceivedValidatedAtOneSample(t *testing.T) { func TestPlayerRetainsReceivedValidatedAtCredentialHistory(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-credentialRoundLag-1, p, soft) @@ -3301,7 +3301,7 @@ func TestPlayerRetainsReceivedValidatedAtCredentialHistory(t *testing.T) { func TestPlayerRetainsEarlyReceivedValidatedAtOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-1, p, soft) @@ -3339,7 +3339,7 @@ func testClockForRound(t *testing.T, pWhite *player, fixedDur time.Duration, cur func TestPlayerRetainsLateReceivedValidatedAtOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-1, p, soft) @@ -3382,7 +3382,7 @@ func TestPlayerRetainsReceivedValidatedAtForHistoryWindowLateBetter(t *testing.T } func testPlayerRetainsReceivedValidatedAtForHistoryWindow(t *testing.T, addBetterLate bool) { - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-1, p, soft) @@ -3449,7 +3449,7 @@ func testPlayerRetainsReceivedValidatedAtForHistoryWindow(t *testing.T, addBette func TestPlayerRetainsReceivedValidatedAtPPOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version, _, configCleanup := createDynamicFilterConfig() + version, _, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() const r = round(20239) const p = period(0) @@ -3505,7 +3505,7 @@ func TestPlayerRetainsReceivedValidatedAtPPOneSample(t *testing.T) { func TestPlayerRetainsEarlyReceivedValidatedAtPPOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version, _, configCleanup := createDynamicFilterConfig() + version, _, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() const r = round(20239) @@ -3559,7 +3559,7 @@ func TestPlayerRetainsEarlyReceivedValidatedAtPPOneSample(t *testing.T) { func TestPlayerRetainsLateReceivedValidatedAtPPOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version, _, configCleanup := createDynamicFilterConfig() + version, _, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() const r = round(20239) const p = period(0) @@ -3613,7 +3613,7 @@ func TestPlayerRetainsLateReceivedValidatedAtPPOneSample(t *testing.T) { func TestPlayerRetainsReceivedValidatedAtPPForHistoryWindow(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-1, p, soft) @@ -3655,7 +3655,7 @@ func TestPlayerRetainsReceivedValidatedAtAVPPOneSample(t *testing.T) { partitiontest.PartitionTest(t) // create a protocol version where dynamic lambda is enabled - version, _, configCleanup := createDynamicFilterConfig() + version, _, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() const r = round(20239) const p = period(0) @@ -3710,7 +3710,7 @@ func TestPlayerRetainsReceivedValidatedAtAVPPOneSample(t *testing.T) { func TestPlayerRetainsEarlyReceivedValidatedAtAVPPOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-1, p, soft) @@ -3729,7 +3729,7 @@ func TestPlayerRetainsEarlyReceivedValidatedAtAVPPOneSample(t *testing.T) { require.Equal(t, pWhite.lowestCredentialArrivals.writePtr, 0) // create a protocol version where dynamic filter is enabled - version, _, configCleanup := createDynamicFilterConfig() + version, _, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() // send votePresent message (mimicking the first AV message validating) @@ -3767,7 +3767,7 @@ func TestPlayerRetainsEarlyReceivedValidatedAtAVPPOneSample(t *testing.T) { func TestPlayerRetainsLateReceivedValidatedAtAVPPOneSample(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-1, p, soft) @@ -3786,7 +3786,7 @@ func TestPlayerRetainsLateReceivedValidatedAtAVPPOneSample(t *testing.T) { require.Equal(t, pWhite.lowestCredentialArrivals.writePtr, 0) // create a protocol version where dynamic filter is enabled - version, _, configCleanup := createDynamicFilterConfig() + version, _, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() // send votePresent message (mimicking the first AV message validating) @@ -3821,7 +3821,7 @@ func TestPlayerRetainsLateReceivedValidatedAtAVPPOneSample(t *testing.T) { func TestPlayerRetainsReceivedValidatedAtAVPPHistoryWindow(t *testing.T) { partitiontest.PartitionTest(t) - version := protocol.ConsensusFuture + version := protocol.ConsensusCurrentVersion const r = round(20239) const p = period(0) pWhite, pM, helper := setupP(t, r-1, p, soft) diff --git a/agreement/service_test.go b/agreement/service_test.go index bea5eda8d..0a7ef55f9 100644 --- a/agreement/service_test.go +++ b/agreement/service_test.go @@ -1050,10 +1050,10 @@ func TestAgreementHistoricalClocksCleanup(t *testing.T) { simulateAgreement(t, 5, int(credentialRoundLag)+10, disabled) } -func createDynamicFilterConfig() (version protocol.ConsensusVersion, consensusVersion func(r basics.Round) (protocol.ConsensusVersion, error), configCleanup func()) { +func overrideConfigWithDynamicFilterParam(dynamicFilterTimeoutEnabled bool) (version protocol.ConsensusVersion, consensusVersion func(r basics.Round) (protocol.ConsensusVersion, error), configCleanup func()) { version = protocol.ConsensusVersion("test-protocol-filtertimeout") protoParams := config.Consensus[protocol.ConsensusCurrentVersion] - protoParams.DynamicFilterTimeout = true + protoParams.DynamicFilterTimeout = dynamicFilterTimeoutEnabled config.Consensus[version] = protoParams consensusVersion = func(r basics.Round) (protocol.ConsensusVersion, error) { @@ -1074,7 +1074,7 @@ func TestAgreementSynchronousFuture5_DynamicFilterRounds(t *testing.T) { t.Skip("Skipping agreement integration test") } - _, consensusVersion, configCleanup := createDynamicFilterConfig() + _, consensusVersion, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() if dynamicFilterCredentialArrivalHistory <= 0 { @@ -1105,7 +1105,7 @@ func TestDynamicFilterTimeoutResets(t *testing.T) { t.Skip("Skipping agreement integration test") } - version, consensusVersion, configCleanup := createDynamicFilterConfig() + version, consensusVersion, configCleanup := overrideConfigWithDynamicFilterParam(true) defer configCleanup() if dynamicFilterCredentialArrivalHistory <= 0 { diff --git a/catchup/service_test.go b/catchup/service_test.go index 0c4cb5cc6..c712fab5a 100644 --- a/catchup/service_test.go +++ b/catchup/service_test.go @@ -1135,7 +1135,7 @@ func TestDownloadBlocksToSupportStateProofs(t *testing.T) { lookback := lookbackForStateproofsSupport(&topBlk) oldestRound := topBlk.BlockHeader.Round.SubSaturate(basics.Round(lookback)) - assert.Equal(t, uint64(oldestRound), 512-config.Consensus[protocol.ConsensusFuture].StateProofInterval-config.Consensus[protocol.ConsensusFuture].StateProofVotersLookback) + assert.Equal(t, uint64(oldestRound), 512-config.Consensus[protocol.ConsensusCurrentVersion].StateProofInterval-config.Consensus[protocol.ConsensusCurrentVersion].StateProofVotersLookback) // the network has made progress and now it is on round 8000. in this case we would not download blocks to cover 512. // instead, we will download blocks to confirm only the recovery period lookback. @@ -1150,7 +1150,7 @@ func TestDownloadBlocksToSupportStateProofs(t *testing.T) { oldestRound = topBlk.BlockHeader.Round.SubSaturate(basics.Round(lookback)) lowestRoundToRetain := 8000 - (8000 % config.Consensus[protocol.ConsensusCurrentVersion].StateProofInterval) - - config.Consensus[protocol.ConsensusCurrentVersion].StateProofInterval*(config.Consensus[protocol.ConsensusCurrentVersion].StateProofMaxRecoveryIntervals+1) - config.Consensus[protocol.ConsensusFuture].StateProofVotersLookback + config.Consensus[protocol.ConsensusCurrentVersion].StateProofInterval*(config.Consensus[protocol.ConsensusCurrentVersion].StateProofMaxRecoveryIntervals+1) - config.Consensus[protocol.ConsensusCurrentVersion].StateProofVotersLookback assert.Equal(t, uint64(oldestRound), lowestRoundToRetain) diff --git a/config/consensus.go b/config/consensus.go index 992cc90ce..a1baa9204 100644 --- a/config/consensus.go +++ b/config/consensus.go @@ -1383,22 +1383,34 @@ func initConsensusProtocols() { // for the sake of future manual calculations, we'll round that down a bit : v37.ApprovedUpgrades[protocol.ConsensusV38] = 10000 - // ConsensusFuture is used to test features that are implemented - // but not yet released in a production protocol version. - vFuture := v38 + v39 := v38 + v39.ApprovedUpgrades = map[protocol.ConsensusVersion]uint64{} - vFuture.ApprovedUpgrades = map[protocol.ConsensusVersion]uint64{} + v39.LogicSigVersion = 10 + v39.EnableLogicSigCostPooling = true + + v39.AgreementDeadlineTimeoutPeriod0 = 4 * time.Second + + v39.DynamicFilterTimeout = true - vFuture.LogicSigVersion = 10 // When moving this to a release, put a new higher LogicSigVersion here - vFuture.EnableLogicSigCostPooling = true + v39.StateProofBlockHashInLightHeader = true - vFuture.AgreementDeadlineTimeoutPeriod0 = 4 * time.Second + // For future upgrades, round times will likely be shorter so giving ourselves some buffer room + v39.MaxUpgradeWaitRounds = 250000 - vFuture.StateProofBlockHashInLightHeader = true + Consensus[protocol.ConsensusV39] = v39 + + // v38 can be upgraded to v39, with an update delay of 7d: + // 157000 = (7 * 24 * 60 * 60 / 3.3 round times currently) + // but our current max is 150000 so using that : + v38.ApprovedUpgrades[protocol.ConsensusV39] = 150000 + + // ConsensusFuture is used to test features that are implemented + // but not yet released in a production protocol version. + vFuture := v39 + vFuture.ApprovedUpgrades = map[protocol.ConsensusVersion]uint64{} - // Setting DynamicFilterTimeout in vFuture will impact e2e test performance - // by reducing round time. Hence, it is commented out for now. - vFuture.DynamicFilterTimeout = true + vFuture.LogicSigVersion = 11 // When moving this to a release, put a new higher LogicSigVersion here Consensus[protocol.ConsensusFuture] = vFuture diff --git a/data/bookkeeping/block_test.go b/data/bookkeeping/block_test.go index 2b4fa8c81..a4cc3d638 100644 --- a/data/bookkeeping/block_test.go +++ b/data/bookkeeping/block_test.go @@ -832,9 +832,9 @@ func TestBlock_ContentsMatchHeader(t *testing.T) { copy(block.BlockHeader.TxnCommitments.Sha256Commitment[:], rootSliceSHA256) a.False(block.ContentsMatchHeader()) - /* Test Consensus Future */ + /* Test Consensus Current */ // Create a block with SHA256 TxnCommitments - block.CurrentProtocol = protocol.ConsensusFuture + block.CurrentProtocol = protocol.ConsensusCurrentVersion block.BlockHeader.TxnCommitments.NativeSha512_256Commitment = crypto.Digest{} block.BlockHeader.TxnCommitments.Sha256Commitment = crypto.Digest{} diff --git a/data/transactions/logic/assembler_test.go b/data/transactions/logic/assembler_test.go index 0963ee148..c45c0af77 100644 --- a/data/transactions/logic/assembler_test.go +++ b/data/transactions/logic/assembler_test.go @@ -438,6 +438,8 @@ const spliceNonsence = ` const v10Nonsense = v9Nonsense + pairingNonsense + spliceNonsence +const v11Nonsense = v10Nonsense + const v6Compiled = "2004010002b7a60c26050242420c68656c6c6f20776f726c6421070123456789abcd208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292b0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f2310231123122313231418191a1b1c28171615400003290349483403350222231d4a484848482b50512a632223524100034200004322602261222704634848222862482864286548482228246628226723286828692322700048482371004848361c0037001a0031183119311b311d311e311f312023221e312131223123312431253126312731283129312a312b312c312d312e312f447825225314225427042455220824564c4d4b0222382124391c0081e80780046a6f686e2281d00f23241f880003420001892224902291922494249593a0a1a2a3a4a5a6a7a8a9aaabacadae24af3a00003b003c003d816472064e014f012a57000823810858235b235a2359b03139330039b1b200b322c01a23c1001a2323c21a23c3233e233f8120af06002a494905002a49490700b400b53a03b6b7043cb8033a0c2349c42a9631007300810881088120978101c53a8101c6003a" const randomnessCompiled = "81ffff03d101d000" @@ -458,6 +460,8 @@ const spliceCompiled = "d2d3" const v10Compiled = v9Compiled + pairingCompiled + spliceCompiled +const V11Compiled = v10Compiled + var nonsense = map[uint64]string{ 1: v1Nonsense, 2: v2Nonsense, @@ -469,20 +473,21 @@ var nonsense = map[uint64]string{ 8: v8Nonsense, 9: v9Nonsense, 10: v10Nonsense, + 11: v11Nonsense, } var compiled = map[uint64]string{ - 1: "012008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f2310231123122313231418191a1b1c2b1716154000032903494", - 2: "022008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f2310231123122313231418191a1b1c2b171615400003290349483403350222231d4a484848482a50512a63222352410003420000432105602105612105270463484821052b62482b642b65484821052b2106662b21056721072b682b692107210570004848210771004848361c0037001a0031183119311b311d311e311f3120210721051e312131223123312431253126312731283129312a312b312c312d312e312f", - 3: "032008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f2310231123122313231418191a1b1c2b171615400003290349483403350222231d4a484848482a50512a63222352410003420000432105602105612105270463484821052b62482b642b65484821052b2106662b21056721072b682b692107210570004848210771004848361c0037001a0031183119311b311d311e311f3120210721051e312131223123312431253126312731283129312a312b312c312d312e312f4478222105531421055427042106552105082106564c4d4b02210538212106391c0081e80780046a6f686e", - 4: "042004010200b7a60c26040242420c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f2310231123122313231418191a1b1c28171615400003290349483403350222231d4a484848482a50512a632223524100034200004322602261222b634848222862482864286548482228236628226724286828692422700048482471004848361c0037001a0031183119311b311d311e311f312024221e312131223123312431253126312731283129312a312b312c312d312e312f44782522531422542b2355220823564c4d4b0222382123391c0081e80780046a6f686e2281d00f24231f880003420001892223902291922394239593a0a1a2a3a4a5a6a7a8a9aaabacadae23af3a00003b003c003d8164", - 5: "052004010002b7a60c26050242420c68656c6c6f20776f726c6421070123456789abcd208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292b0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f2310231123122313231418191a1b1c28171615400003290349483403350222231d4a484848482b50512a632223524100034200004322602261222704634848222862482864286548482228246628226723286828692322700048482371004848361c0037001a0031183119311b311d311e311f312023221e312131223123312431253126312731283129312a312b312c312d312e312f447825225314225427042455220824564c4d4b0222382124391c0081e80780046a6f686e2281d00f23241f880003420001892224902291922494249593a0a1a2a3a4a5a6a7a8a9aaabacadae24af3a00003b003c003d816472064e014f012a57000823810858235b235a2359b03139330039b1b200b322c01a23c1001a2323c21a23c3233e233f8120af06002a494905002a49490700b400b53a03", - 6: "06" + v6Compiled, - 7: "07" + v7Compiled, - 8: "08" + v8Compiled, - 9: "09" + v9Compiled, - + 1: "012008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f2310231123122313231418191a1b1c2b1716154000032903494", + 2: "022008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f2310231123122313231418191a1b1c2b171615400003290349483403350222231d4a484848482a50512a63222352410003420000432105602105612105270463484821052b62482b642b65484821052b2106662b21056721072b682b692107210570004848210771004848361c0037001a0031183119311b311d311e311f3120210721051e312131223123312431253126312731283129312a312b312c312d312e312f", + 3: "032008b7a60cf8acd19181cf959a12f8acd19181cf951af8acd19181cf15f8acd191810f01020026050212340c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d024242047465737400320032013202320328292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e0102222324252104082209240a220b230c240d250e230f2310231123122313231418191a1b1c2b171615400003290349483403350222231d4a484848482a50512a63222352410003420000432105602105612105270463484821052b62482b642b65484821052b2106662b21056721072b682b692107210570004848210771004848361c0037001a0031183119311b311d311e311f3120210721051e312131223123312431253126312731283129312a312b312c312d312e312f4478222105531421055427042106552105082106564c4d4b02210538212106391c0081e80780046a6f686e", + 4: "042004010200b7a60c26040242420c68656c6c6f20776f726c6421208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292a0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f2310231123122313231418191a1b1c28171615400003290349483403350222231d4a484848482a50512a632223524100034200004322602261222b634848222862482864286548482228236628226724286828692422700048482471004848361c0037001a0031183119311b311d311e311f312024221e312131223123312431253126312731283129312a312b312c312d312e312f44782522531422542b2355220823564c4d4b0222382123391c0081e80780046a6f686e2281d00f24231f880003420001892223902291922394239593a0a1a2a3a4a5a6a7a8a9aaabacadae23af3a00003b003c003d8164", + 5: "052004010002b7a60c26050242420c68656c6c6f20776f726c6421070123456789abcd208dae2087fbba51304eb02b91f656948397a7946390e8cb70fc9ea4d95f92251d047465737400320032013202320380021234292929292b0431003101310231043105310731083109310a310b310c310d310e310f3111311231133114311533000033000133000233000433000533000733000833000933000a33000b33000c33000d33000e33000f3300113300123300133300143300152d2e01022581f8acd19181cf959a1281f8acd19181cf951a81f8acd19181cf1581f8acd191810f082209240a220b230c240d250e230f2310231123122313231418191a1b1c28171615400003290349483403350222231d4a484848482b50512a632223524100034200004322602261222704634848222862482864286548482228246628226723286828692322700048482371004848361c0037001a0031183119311b311d311e311f312023221e312131223123312431253126312731283129312a312b312c312d312e312f447825225314225427042455220824564c4d4b0222382124391c0081e80780046a6f686e2281d00f23241f880003420001892224902291922494249593a0a1a2a3a4a5a6a7a8a9aaabacadae24af3a00003b003c003d816472064e014f012a57000823810858235b235a2359b03139330039b1b200b322c01a23c1001a2323c21a23c3233e233f8120af06002a494905002a49490700b400b53a03", + 6: "06" + v6Compiled, + 7: "07" + v7Compiled, + 8: "08" + v8Compiled, + 9: "09" + v9Compiled, 10: "0a" + v10Compiled, + 11: "0b" + V11Compiled, } func pseudoOp(opcode string) bool { @@ -536,7 +541,7 @@ func TestAssemble(t *testing.T) { } } -var experiments = []uint64{pairingVersion, spliceVersion} +var experiments = []uint64{} // TestExperimental forces a conscious choice to promote "experimental" opcode // groups. This will fail when we increment vFuture's LogicSigVersion. If we had diff --git a/data/transactions/logic/eval_test.go b/data/transactions/logic/eval_test.go index 481f9544f..05e578601 100644 --- a/data/transactions/logic/eval_test.go +++ b/data/transactions/logic/eval_test.go @@ -1235,6 +1235,10 @@ global AssetOptInMinBalance; int 1001; ==; && global GenesisHash; len; int 32; ==; && ` +const globalV11TestProgram = globalV10TestProgram + ` +// No new globals in v11 +` + func TestGlobal(t *testing.T) { partitiontest.PartitionTest(t) @@ -1256,6 +1260,7 @@ func TestGlobal(t *testing.T) { 8: {CallerApplicationAddress, globalV8TestProgram}, 9: {CallerApplicationAddress, globalV9TestProgram}, 10: {GenesisHash, globalV10TestProgram}, + 11: {GenesisHash, globalV11TestProgram}, } // tests keys are versions so they must be in a range 1..AssemblerMaxVersion plus zero version require.LessOrEqual(t, len(tests), AssemblerMaxVersion+1) @@ -1767,6 +1772,11 @@ assert int 1 ` +const testTxnProgramTextV11 = testTxnProgramTextV10 + ` +assert +int 1 +` + func makeSampleTxn() transactions.SignedTxn { var txn transactions.SignedTxn copy(txn.Txn.Sender[:], []byte("aoeuiaoeuiaoeuiaoeuiaoeuiaoeui00")) @@ -1870,17 +1880,17 @@ func TestTxn(t *testing.T) { t.Parallel() tests := map[uint64]string{ - 1: testTxnProgramTextV1, - 2: testTxnProgramTextV2, - 3: testTxnProgramTextV3, - 4: testTxnProgramTextV4, - 5: testTxnProgramTextV5, - 6: testTxnProgramTextV6, - 7: testTxnProgramTextV7, - 8: testTxnProgramTextV8, - 9: testTxnProgramTextV9, - + 1: testTxnProgramTextV1, + 2: testTxnProgramTextV2, + 3: testTxnProgramTextV3, + 4: testTxnProgramTextV4, + 5: testTxnProgramTextV5, + 6: testTxnProgramTextV6, + 7: testTxnProgramTextV7, + 8: testTxnProgramTextV8, + 9: testTxnProgramTextV9, 10: testTxnProgramTextV10, + 11: testTxnProgramTextV11, } for i, txnField := range TxnFieldNames { diff --git a/data/transactions/logic/langspec_v1.json b/data/transactions/logic/langspec_v1.json index b659e662a..6839e4092 100644 --- a/data/transactions/logic/langspec_v1.json +++ b/data/transactions/logic/langspec_v1.json @@ -1,6 +1,6 @@ { "Version": 1, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v10.json b/data/transactions/logic/langspec_v10.json index 2141e8fe0..d971b2715 100644 --- a/data/transactions/logic/langspec_v10.json +++ b/data/transactions/logic/langspec_v10.json @@ -1,6 +1,6 @@ { "Version": 10, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v2.json b/data/transactions/logic/langspec_v2.json index b518b1a42..a832f8664 100644 --- a/data/transactions/logic/langspec_v2.json +++ b/data/transactions/logic/langspec_v2.json @@ -1,6 +1,6 @@ { "Version": 2, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v3.json b/data/transactions/logic/langspec_v3.json index a8bc6df0d..f1566b528 100644 --- a/data/transactions/logic/langspec_v3.json +++ b/data/transactions/logic/langspec_v3.json @@ -1,6 +1,6 @@ { "Version": 3, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v4.json b/data/transactions/logic/langspec_v4.json index ffc428822..49591c10f 100644 --- a/data/transactions/logic/langspec_v4.json +++ b/data/transactions/logic/langspec_v4.json @@ -1,6 +1,6 @@ { "Version": 4, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v5.json b/data/transactions/logic/langspec_v5.json index 2b946629c..ccde5509f 100644 --- a/data/transactions/logic/langspec_v5.json +++ b/data/transactions/logic/langspec_v5.json @@ -1,6 +1,6 @@ { "Version": 5, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v6.json b/data/transactions/logic/langspec_v6.json index 20575dae5..72e1d9c64 100644 --- a/data/transactions/logic/langspec_v6.json +++ b/data/transactions/logic/langspec_v6.json @@ -1,6 +1,6 @@ { "Version": 6, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v7.json b/data/transactions/logic/langspec_v7.json index d8be33960..7229ee534 100644 --- a/data/transactions/logic/langspec_v7.json +++ b/data/transactions/logic/langspec_v7.json @@ -1,6 +1,6 @@ { "Version": 7, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v8.json b/data/transactions/logic/langspec_v8.json index 4963f4c85..2f1576864 100644 --- a/data/transactions/logic/langspec_v8.json +++ b/data/transactions/logic/langspec_v8.json @@ -1,6 +1,6 @@ { "Version": 8, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/langspec_v9.json b/data/transactions/logic/langspec_v9.json index 50418be82..3ec2d39af 100644 --- a/data/transactions/logic/langspec_v9.json +++ b/data/transactions/logic/langspec_v9.json @@ -1,6 +1,6 @@ { "Version": 9, - "LogicSigVersion": 9, + "LogicSigVersion": 10, "NamedTypes": [ { "Name": "[32]byte", diff --git a/data/transactions/logic/opcodes.go b/data/transactions/logic/opcodes.go index fa3fd2262..1f595dfb7 100644 --- a/data/transactions/logic/opcodes.go +++ b/data/transactions/logic/opcodes.go @@ -27,7 +27,7 @@ import ( ) // LogicVersion defines default assembler and max eval versions -const LogicVersion = 10 +const LogicVersion = 11 // rekeyingEnabledVersion is the version of TEAL where RekeyTo functionality // was enabled. This is important to remember so that old TEAL accounts cannot diff --git a/ledger/testing/consensusRange.go b/ledger/testing/consensusRange.go index 019b50271..97693bbe2 100644 --- a/ledger/testing/consensusRange.go +++ b/ledger/testing/consensusRange.go @@ -60,6 +60,7 @@ var consensusByNumber = []protocol.ConsensusVersion{ protocol.ConsensusV36, // AVM v8, box storage protocol.ConsensusV37, protocol.ConsensusV38, // AVM v9, ECDSA pre-check, stateproofs recoverability + protocol.ConsensusV39, // AVM v10, logicsig opcode budget pooling, elliptic curve ops, dynamic round times protocol.ConsensusFuture, } diff --git a/ledger/testing/consensusRange_test.go b/ledger/testing/consensusRange_test.go index 26e042094..f1a9c179e 100644 --- a/ledger/testing/consensusRange_test.go +++ b/ledger/testing/consensusRange_test.go @@ -56,6 +56,6 @@ func TestReleasedVersion(t *testing.T) { } require.Equal(t, versionStringFromIndex(len(consensusByNumber)-1), "vFuture") - require.Equal(t, versionStringFromIndex(38), "v38") + require.Equal(t, versionStringFromIndex(39), "v39") } diff --git a/protocol/consensus.go b/protocol/consensus.go index b32e24566..928ba4b6f 100644 --- a/protocol/consensus.go +++ b/protocol/consensus.go @@ -217,6 +217,12 @@ const ConsensusV38 = ConsensusVersion( "https://github.com/algorandfoundation/specs/tree/abd3d4823c6f77349fc04c3af7b1e99fe4df699f", ) +// ConsensusV39 enables dynamic filter timeouts, a deadline timeout of 4 seconds, +// TEAL v10 logicSig opcode budget pooling along with elliptic curve ops on some pairing friendly curves. +const ConsensusV39 = ConsensusVersion( + "https://github.com/algorandfoundation/specs/tree/925a46433742afb0b51bb939354bd907fa88bf95", +) + // ConsensusFuture is a protocol that should not appear in any production // network, but is used to test features before they are released. const ConsensusFuture = ConsensusVersion( @@ -246,7 +252,7 @@ const ConsensusVAlpha5 = ConsensusVersion("alpha5") // ConsensusCurrentVersion is the latest version and should be used // when a specific version is not provided. -const ConsensusCurrentVersion = ConsensusV38 +const ConsensusCurrentVersion = ConsensusV39 // Error is used to indicate that an unsupported protocol has been detected. type Error ConsensusVersion |