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-algorand 3.7.1-stable Release PR #4091

Merged
merged 3 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildnumber.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0
1
4 changes: 3 additions & 1 deletion config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
38 changes: 38 additions & 0 deletions ledger/internal/apptxn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down