Skip to content

Commit

Permalink
Merge branch 'algorand:master' into new-opcode-modexp
Browse files Browse the repository at this point in the history
  • Loading branch information
mangoplane authored Oct 14, 2024
2 parents e42e864 + c9000bf commit b0da89b
Show file tree
Hide file tree
Showing 20 changed files with 719 additions and 316 deletions.
4 changes: 4 additions & 0 deletions cmd/algod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ func run() int {
log.Fatalf("Error validating DNSBootstrap input: %v", err)
}

// Apply network-specific consensus overrides, noting the configurable consensus protocols file
// takes precedence over network-specific overrides.
config.ApplyShorterUpgradeRoundsForDevNetworks(genesis.Network)

err = config.LoadConfigurableConsensusProtocols(absolutePath)
if err != nil {
// log is not setup yet, this will log to stderr
Expand Down
17 changes: 17 additions & 0 deletions config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,23 @@ func initConsensusProtocols() {
vAlpha4.ApprovedUpgrades[protocol.ConsensusVAlpha5] = 10000
}

// ApplyShorterUpgradeRoundsForDevNetworks applies a shorter upgrade round time for the Devnet and Betanet networks.
// This function should not take precedence over settings loaded via `PreloadConfigurableConsensusProtocols`.
func ApplyShorterUpgradeRoundsForDevNetworks(id protocol.NetworkID) {
if id == Betanet || id == Devnet {
// Go through all approved upgrades and set to the MinUpgradeWaitRounds valid where MinUpgradeWaitRounds is set
for _, p := range Consensus {
if p.ApprovedUpgrades != nil {
for v := range p.ApprovedUpgrades {
if p.MinUpgradeWaitRounds > 0 {
p.ApprovedUpgrades[v] = p.MinUpgradeWaitRounds
}
}
}
}
}
}

// Global defines global Algorand protocol parameters which should not be overridden.
type Global struct {
SmallLambda time.Duration // min amount of time to wait for leader's credential (i.e., time to propagate one credential)
Expand Down
77 changes: 77 additions & 0 deletions config/consensus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,83 @@ func TestConsensusUpgradeWindow(t *testing.T) {
}
}

func TestConsensusUpgradeWindow_NetworkOverrides(t *testing.T) {
partitiontest.PartitionTest(t)

ApplyShorterUpgradeRoundsForDevNetworks(Devnet)
for _, params := range Consensus {
for toVersion, delay := range params.ApprovedUpgrades {
if params.MinUpgradeWaitRounds != 0 || params.MaxUpgradeWaitRounds != 0 {
require.NotZerof(t, delay, "From :%v\nTo :%v", params, toVersion)
require.Equalf(t, delay, params.MinUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
// This check is not really needed, but leaving for sanity
require.LessOrEqualf(t, delay, params.MaxUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
} else {
// If no MinUpgradeWaitRounds is set, leaving everything as zero value is expected
require.Zerof(t, delay, "From :%v\nTo :%v", params, toVersion)
}
}
}

// Should be no-ops for Mainnet
Consensus = make(ConsensusProtocols)
initConsensusProtocols()

origConsensus := Consensus.DeepCopy()
ApplyShorterUpgradeRoundsForDevNetworks(Mainnet)
require.EqualValues(t, origConsensus, Consensus)
for _, params := range Consensus {
for toVersion, delay := range params.ApprovedUpgrades {
if params.MinUpgradeWaitRounds != 0 || params.MaxUpgradeWaitRounds != 0 {
require.NotZerof(t, delay, "From :%v\nTo :%v", params, toVersion)
require.GreaterOrEqualf(t, delay, params.MinUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
require.LessOrEqualf(t, delay, params.MaxUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
} else {
require.Zerof(t, delay, "From :%v\nTo :%v", params, toVersion)

}
}
}

// reset consensus settings
Consensus = make(ConsensusProtocols)
initConsensusProtocols()

ApplyShorterUpgradeRoundsForDevNetworks(Betanet)
for _, params := range Consensus {
for toVersion, delay := range params.ApprovedUpgrades {
if params.MinUpgradeWaitRounds != 0 || params.MaxUpgradeWaitRounds != 0 {
require.NotZerof(t, delay, "From :%v\nTo :%v", params, toVersion)
require.Equalf(t, delay, params.MinUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
// This check is not really needed, but leaving for sanity
require.LessOrEqualf(t, delay, params.MaxUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
} else {
// If no MinUpgradeWaitRounds is set, leaving everything as zero value is expected
require.Zerof(t, delay, "From :%v\nTo :%v", params, toVersion)
}
}
}

// should be no-ops for Testnet
Consensus = make(ConsensusProtocols)
initConsensusProtocols()

ApplyShorterUpgradeRoundsForDevNetworks(Testnet)
require.EqualValues(t, origConsensus, Consensus)
for _, params := range Consensus {
for toVersion, delay := range params.ApprovedUpgrades {
if params.MinUpgradeWaitRounds != 0 || params.MaxUpgradeWaitRounds != 0 {
require.NotZerof(t, delay, "From :%v\nTo :%v", params, toVersion)
require.GreaterOrEqualf(t, delay, params.MinUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
require.LessOrEqualf(t, delay, params.MaxUpgradeWaitRounds, "From :%v\nTo :%v", params, toVersion)
} else {
require.Zerof(t, delay, "From :%v\nTo :%v", params, toVersion)

}
}
}
}

func TestConsensusStateProofParams(t *testing.T) {
partitiontest.PartitionTest(t)

Expand Down
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const VersionMajor = 3

// 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 = 26
const VersionMinor = 27

// Version is the type holding our full version information.
type Version struct {
Expand Down
111 changes: 65 additions & 46 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,34 @@ require (
github.com/golang/snappy v0.0.4
github.com/google/go-cmp v0.6.0
github.com/google/go-querystring v1.0.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/mux v1.8.1
github.com/ipfs/go-log v1.0.5
github.com/ipfs/go-log/v2 v2.5.1
github.com/jmoiron/sqlx v1.2.0
github.com/jsimonetti/rtnetlink v1.4.2
github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c
github.com/labstack/echo/v4 v4.9.1
github.com/libp2p/go-libp2p v0.33.2
github.com/libp2p/go-libp2p-kad-dht v0.24.3
github.com/libp2p/go-libp2p-pubsub v0.10.0
github.com/libp2p/go-libp2p v0.36.2
github.com/libp2p/go-libp2p-kad-dht v0.26.1
github.com/libp2p/go-libp2p-pubsub v0.12.0
github.com/libp2p/go-yamux/v4 v4.0.1
github.com/mattn/go-sqlite3 v1.14.16
github.com/miekg/dns v1.1.58
github.com/multiformats/go-multiaddr v0.12.3
github.com/miekg/dns v1.1.62
github.com/multiformats/go-multiaddr v0.13.0
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/olivere/elastic v6.2.14+incompatible
github.com/prometheus/client_golang v1.18.0
github.com/prometheus/client_model v0.6.0
github.com/prometheus/client_golang v1.20.0
github.com/prometheus/client_model v0.6.1
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
go.opencensus.io v0.24.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.21.0
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
golang.org/x/sync v0.6.0
golang.org/x/sys v0.20.0
golang.org/x/text v0.14.0
golang.org/x/crypto v0.26.0
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
golang.org/x/sync v0.8.0
golang.org/x/sys v0.24.0
golang.org/x/text v0.17.0
gopkg.in/sohlich/elogrus.v3 v3.0.0-20180410122755-1fa29e2f2009
pgregory.net/rapid v0.6.2
)
Expand All @@ -64,7 +64,7 @@ require (
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.8.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
Expand All @@ -75,44 +75,44 @@ require (
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/fortytw2/leaktest v1.3.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.19.5 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/invopop/yaml v0.1.0 // indirect
github.com/ipfs/boxo v0.10.0 // indirect
github.com/ipfs/boxo v0.21.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipld/go-ipld-prime v0.20.0 // indirect
github.com/ipld/go-ipld-prime v0.21.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
Expand All @@ -123,6 +123,7 @@ require (
github.com/libp2p/go-libp2p-asn-util v0.4.1 // indirect
github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
github.com/libp2p/go-libp2p-routing-helpers v0.7.4 // indirect
github.com/libp2p/go-msgio v0.3.0 // indirect
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
Expand All @@ -147,44 +148,62 @@ require (
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo/v2 v2.20.0 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pion/datachannel v1.5.8 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/ice/v2 v2.3.34 // indirect
github.com/pion/interceptor v0.1.30 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/mdns v0.0.12 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.14 // indirect
github.com/pion/rtp v1.8.9 // indirect
github.com/pion/sctp v1.8.33 // indirect
github.com/pion/sdp/v3 v3.0.9 // indirect
github.com/pion/srtp/v2 v2.0.20 // indirect
github.com/pion/stun v0.6.1 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/turn/v2 v2.1.6 // indirect
github.com/pion/webrtc/v3 v3.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/common v0.47.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.42.0 // indirect
github.com/quic-go/webtransport-go v0.6.0 // indirect
github.com/quic-go/quic-go v0.46.0 // indirect
github.com/quic-go/webtransport-go v0.8.0 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/dig v1.17.1 // indirect
go.uber.org/fx v1.20.1 // indirect
github.com/wlynxg/anet v0.0.4 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
go.opentelemetry.io/otel/trace v1.27.0 // indirect
go.uber.org/dig v1.18.0 // indirect
go.uber.org/fx v1.22.2 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.18.0 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
lukechampine.com/blake3 v1.3.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading

0 comments on commit b0da89b

Please sign in to comment.