diff options
author | John Lee <64482439+algojohnlee@users.noreply.github.com> | 2022-06-08 10:40:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-08 10:40:45 -0400 |
commit | f945a21b0c4368bc6cf0208dc6d21a200fca64f2 (patch) | |
tree | 30867e9938884b08530e1abbe26ff22342553643 | |
parent | 79a08c81decb7979b35c2e721ce8e888f1ee2333 (diff) | |
parent | 29a3c36eab916584345bc14fb14c5d9a796caced (diff) |
Merge pull request #4091 from Algo-devops-service/relstable3.7.1v3.7.1-stable
-rw-r--r-- | buildnumber.dat | 2 | ||||
-rw-r--r-- | config/consensus.go | 4 | ||||
-rw-r--r-- | ledger/internal/apptxn_test.go | 38 |
3 files changed, 42 insertions, 2 deletions
diff --git a/buildnumber.dat b/buildnumber.dat index 573541ac9..d00491fd7 100644 --- a/buildnumber.dat +++ b/buildnumber.dat @@ -1 +1 @@ -0 +1 diff --git a/config/consensus.go b/config/consensus.go index 07aa9ba84..61ca55a2f 100644 --- a/config/consensus.go +++ b/config/consensus.go @@ -910,6 +910,9 @@ func initConsensusProtocols() { // Enable application support v24.Application = true + // Although Inners were not allowed yet, this gates downgrade checks, which must be allowed + v24.MinInnerApplVersion = 6 + // Enable rekeying v24.SupportRekeying = true @@ -1090,7 +1093,6 @@ func initConsensusProtocols() { v31.LogicSigVersion = 6 v31.EnableInnerTransactionPooling = true v31.IsolateClearState = true - v31.MinInnerApplVersion = 6 // stat proof key registration v31.EnableStateProofKeyregCheck = true diff --git a/ledger/internal/apptxn_test.go b/ledger/internal/apptxn_test.go index 4e2b64c1a..9194055c1 100644 --- a/ledger/internal/apptxn_test.go +++ b/ledger/internal/apptxn_test.go @@ -2070,6 +2070,10 @@ func TestAppDowngrade(t *testing.T) { partitiontest.PartitionTest(t) t.Parallel() + two, err := logic.AssembleStringWithVersion("int 1", 2) + require.NoError(t, err) + three, err := logic.AssembleStringWithVersion("int 1", 3) + require.NoError(t, err) four, err := logic.AssembleStringWithVersion("int 1", 4) require.NoError(t, err) five, err := logic.AssembleStringWithVersion("int 1", 5) @@ -2078,6 +2082,40 @@ func TestAppDowngrade(t *testing.T) { require.NoError(t, err) genBalances, addrs, _ := ledgertesting.NewTestGenesis() + + // Confirm that in old protocol version, downgrade is legal + // Start at 28 because we want to v4 app to downgrade to v3 + testConsensusRange(t, 28, 30, func(t *testing.T, ver int) { + dl := NewDoubleLedger(t, genBalances, consensusByNumber[ver]) + defer dl.Close() + + create := txntest.Txn{ + Type: "appl", + Sender: addrs[0], + ApprovalProgram: four.Program, + ClearStateProgram: four.Program, + } + + vb := dl.fullBlock(&create) + app := vb.Block().Payset[0].ApplicationID + + update := txntest.Txn{ + Type: "appl", + ApplicationID: app, + OnCompletion: transactions.UpdateApplicationOC, + Sender: addrs[0], + ApprovalProgram: three.Program, + ClearStateProgram: three.Program, + } + + // No change - legal + dl.fullBlock(&update) + + update.ApprovalProgram = two.Program + // Also legal, and let's check mismatched version while we're at it. + dl.fullBlock(&update) + }) + testConsensusRange(t, 31, 0, func(t *testing.T, ver int) { dl := NewDoubleLedger(t, genBalances, consensusByNumber[ver]) defer dl.Close() |