Skip to content

Commit

Permalink
Consensus version v40, set major release to 4 and reset minor.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalouf committed Dec 19, 2024
1 parent 38ce41c commit d14e43d
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 33 deletions.
48 changes: 30 additions & 18 deletions config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -1512,30 +1512,42 @@ func initConsensusProtocols() {
// 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{}
v40 := v39
v40.ApprovedUpgrades = map[protocol.ConsensusVersion]uint64{}

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

vFuture.EnableLogicSigSizePooling = true
v40.EnableLogicSigSizePooling = true

vFuture.Payouts.Enabled = true
vFuture.Payouts.Percent = 50
vFuture.Payouts.GoOnlineFee = 2_000_000 // 2 algos
vFuture.Payouts.MinBalance = 30_000_000_000 // 30,000 algos
vFuture.Payouts.MaxBalance = 70_000_000_000_000 // 70M algos
vFuture.Payouts.MaxMarkAbsent = 32
vFuture.Payouts.ChallengeInterval = 1000
vFuture.Payouts.ChallengeGracePeriod = 200
vFuture.Payouts.ChallengeBits = 5
v40.Payouts.Enabled = true
v40.Payouts.Percent = 50
v40.Payouts.GoOnlineFee = 2_000_000 // 2 algos
v40.Payouts.MinBalance = 30_000_000_000 // 30,000 algos
v40.Payouts.MaxBalance = 70_000_000_000_000 // 70M algos
v40.Payouts.MaxMarkAbsent = 32
v40.Payouts.ChallengeInterval = 1000
v40.Payouts.ChallengeGracePeriod = 200
v40.Payouts.ChallengeBits = 5

vFuture.Bonus.BaseAmount = 10_000_000 // 10 Algos
v40.Bonus.BaseAmount = 10_000_000 // 10 Algos
// 2.9 sec rounds gives about 10.8M rounds per year.
vFuture.Bonus.DecayInterval = 1_000_000 // .99^(10.8M/1M) ~ .897. So ~10% decay per year
v40.Bonus.DecayInterval = 1_000_000 // .99^(10.8M/1M) ~ .897. So ~10% decay per year

v40.Heartbeat = true

Consensus[protocol.ConsensusV40] = v40

// v39 can be upgraded to v40, with an update delay of 7d:
// 208000 = (7 * 24 * 60 * 60 / 2.9 ballpark round times)
// 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{}

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

Consensus[protocol.ConsensusFuture] = vFuture

Expand Down
4 changes: 2 additions & 2 deletions config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import (

// VersionMajor is the Major semantic version number (#.y.z) - changed when first public release (0.y.z -> 1.y.z)
// and when backwards compatibility is broken.
const VersionMajor = 3
const VersionMajor = 4

// VersionMinor is the Minor semantic version number (x.#.z) - changed when backwards-compatible features are introduced.
// Not enforced until after initial public release (x > 0).
const VersionMinor = 28
const VersionMinor = 0

// Version is the type holding our full version information.
type Version struct {
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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"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": 10,
"LogicSigVersion": 11,
"NamedTypes": [
{
"Name": "[]byte",
Expand Down
1 change: 1 addition & 0 deletions ledger/testing/consensusRange.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var consensusByNumber = []protocol.ConsensusVersion{
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.ConsensusV40, // Consensus incentives, AVM v11, mimc
protocol.ConsensusFuture,
}

Expand Down
2 changes: 1 addition & 1 deletion ledger/testing/consensusRange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ func TestReleasedVersion(t *testing.T) {
}

require.Equal(t, versionStringFromIndex(len(consensusByNumber)-1), "vFuture")
require.Equal(t, versionStringFromIndex(39), "v39")
require.Equal(t, versionStringFromIndex(40), "v40")

}
7 changes: 6 additions & 1 deletion protocol/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ const ConsensusV39 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/925a46433742afb0b51bb939354bd907fa88bf95",
)

// ConsensusV40 enables consensus incentives and TEAL v11 featuring the mimc opcode
const ConsensusV40 = ConsensusVersion(
"https://github.com/algorandfoundation/specs/tree/236dcc18c9c507d794813ab768e467ea42d1b4d9",
)

// 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 @@ -252,7 +257,7 @@ const ConsensusVAlpha5 = ConsensusVersion("alpha5")

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

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

0 comments on commit d14e43d

Please sign in to comment.