Skip to content
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
41 changes: 27 additions & 14 deletions config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -1435,24 +1435,37 @@ func initConsensusProtocols() {
// our current max is 250000
v39.ApprovedUpgrades[protocol.ConsensusV40] = 208000

// ConsensusFuture is used to test features that are implemented
// but not yet released in a production protocol version.
vFuture := v40
vFuture.ApprovedUpgrades = map[protocol.ConsensusVersion]uint64{}
v41 := v40
v41.ApprovedUpgrades = map[protocol.ConsensusVersion]uint64{}

v41.LogicSigVersion = 12

vFuture.LogicSigVersion = 12 // When moving this to a release, put a new higher LogicSigVersion here
vFuture.EnableAppVersioning = true // if not promoted when v12 goes into effect, update logic/field.go
vFuture.EnableSha512BlockHash = true
v41.EnableAppVersioning = true
v41.EnableSha512BlockHash = true

vFuture.EnableUnnamedBoxAccessInNewApps = true
v41.EnableUnnamedBoxAccessInNewApps = true

// txn.Access work
vFuture.MaxAppTxnAccounts = 8 // Accounts are no worse than others, they should be the same
vFuture.MaxAppAccess = 16 // Twice as many, though cross products are explicit
vFuture.BytesPerBoxReference = 2048 // Count is more important that bytes, loosen up
vFuture.EnableInnerClawbackWithoutSenderHolding = true
vFuture.LogicSigMsig = false
vFuture.LogicSigLMsig = true
v41.MaxAppTxnAccounts = 8 // Accounts are no worse than others, they should be the same
v41.MaxAppAccess = 16 // Twice as many, though cross products are explicit
v41.BytesPerBoxReference = 2048 // Count is more important that bytes, loosen up
v41.EnableInnerClawbackWithoutSenderHolding = true
v41.LogicSigMsig = false
v41.LogicSigLMsig = true

Consensus[protocol.ConsensusV41] = v41

// v40 can be upgraded to v41, with an update delay of 7d:
// 208000 = (7 * 24 * 60 * 60 / 2.9 ballpark round times)
// our current max is 250000
v40.ApprovedUpgrades[protocol.ConsensusV41] = 208000

// ConsensusFuture is used to test features that are implemented
// but not yet released in a production protocol version.
vFuture := v41
vFuture.ApprovedUpgrades = map[protocol.ConsensusVersion]uint64{}

vFuture.LogicSigVersion = 13 // When moving this to a release, put a new higher LogicSigVersion here

Consensus[protocol.ConsensusFuture] = vFuture

Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v1.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 1,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v10.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 10,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v11.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 11,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v12.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 12,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 2,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 3,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v4.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 4,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v5.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 5,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v6.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 6,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v7.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 7,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v8.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 8,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/langspec_v9.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Version": 9,
"LogicSigVersion": 11,
"LogicSigVersion": 12,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
8 changes: 4 additions & 4 deletions data/transactions/verify/txn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ byte base64 5rZMNsevs5sULO+54aN+OvU6lQ503z2X+SSYUABIx7E=
signedTxn[i].Txn.Sender = multiAddress[s]
signedTxn[i].Lsig.Args = [][]byte{[]byte("=0\x97S\x85H\xe9\x91B\xfd\xdb;1\xf5Z\xaec?\xae\xf2I\x93\x08\x12\x94\xaa~\x06\x08\x849b")}
signedTxn[i].Lsig.Logic = op.Program
program := logic.Program(op.Program)
program := logic.MultisigProgram{Addr: crypto.Digest(multiAddress[s]), Program: op.Program}

// create multi sig that 2 out of 3 has signed the txn
var sigs [2]crypto.MultisigSig
Expand All @@ -1069,7 +1069,7 @@ byte base64 5rZMNsevs5sULO+54aN+OvU6lQ503z2X+SSYUABIx7E=
}
msig, err := crypto.MultisigAssemble(sigs[:])
require.NoError(t, err)
signedTxn[i].Lsig.Msig = msig
signedTxn[i].Lsig.LMsig = msig
}

txnGroups := make([][]transactions.SignedTxn, len(signedTxn))
Expand All @@ -1079,10 +1079,10 @@ byte base64 5rZMNsevs5sULO+54aN+OvU6lQ503z2X+SSYUABIx7E=
}

breakSignatureFunc := func(txn *transactions.SignedTxn) {
txn.Lsig.Msig.Subsigs[0].Sig[0]++
txn.Lsig.LMsig.Subsigs[0].Sig[0]++
}
restoreSignatureFunc := func(txn *transactions.SignedTxn) {
txn.Lsig.Msig.Subsigs[0].Sig[0]--
txn.Lsig.LMsig.Subsigs[0].Sig[0]--
}

verifyGroup(t, txnGroups, &blkHdr, breakSignatureFunc, restoreSignatureFunc, crypto.ErrBatchHasFailedSigs.Error())
Expand Down
1 change: 1 addition & 0 deletions ledger/testing/consensusRange.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var consensusByNumber = []protocol.ConsensusVersion{
protocol.ConsensusV38, // AVM v9, ECDSA pre-check, stateproofs recoverability
protocol.ConsensusV39, // AVM v10, logicsig opcode budget pooling, elliptic curve ops, dynamic round times
protocol.ConsensusV40, // Consensus incentives, AVM v11, mimc
protocol.ConsensusV41, // AVM v12, txn access, Sha512BlockHash, AppVersioning
protocol.ConsensusFuture,
}

Expand Down
7 changes: 6 additions & 1 deletion protocol/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ const ConsensusV40 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/236dcc18c9c507d794813ab768e467ea42d1b4d9",
)

// ConsensusV41 enables txn access, Sha512BlockHash, AppVersioning and TEAL v12 including the falcon verify opcode
const ConsensusV41 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/953304de35264fc3ef91bcd05c123242015eeaed",
)

// 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(
Expand Down Expand Up @@ -253,7 +258,7 @@ const ConsensusVAlpha5 = ConsensusVersion("alpha5")

// ConsensusCurrentVersion is the latest version and should be used
// when a specific version is not provided.
const ConsensusCurrentVersion = ConsensusV40
const ConsensusCurrentVersion = ConsensusV41

// Error is used to indicate that an unsupported protocol has been detected.
type Error ConsensusVersion
Expand Down
Loading