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

bump coreth past upgrade schedule refactor #3278

Merged
merged 11 commits into from
Aug 13, 2024
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
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/DataDog/zstd v1.5.2
github.com/NYTimes/gziphandler v1.1.1
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d
github.com/ava-labs/coreth v0.13.8-fix-genesis-upgrade
github.com/ava-labs/ledger-avalanche/go v0.0.0-20240610153809-9c955cc90a95
github.com/btcsuite/btcd/btcutil v1.1.3
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
Expand All @@ -34,7 +34,7 @@ require (
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d
github.com/onsi/ginkgo/v2 v2.13.1
github.com/pires/go-proxyproto v0.6.2
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_model v0.3.0
github.com/prometheus/common v0.42.0
github.com/rs/cors v1.7.0
Expand Down Expand Up @@ -156,7 +156,7 @@ require (
github.com/zondax/ledger-go v0.14.3 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.17.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax
github.com/antithesishq/antithesis-sdk-go v0.3.8 h1:OvGoHxIcOXFJLyn9IJQ5DzByZ3YVAWNBc394ObzDRb8=
github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl3v2yvUZjmKncl7U91fup7E=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d h1:klPTcKVvqfA2KSKaRvQAO56Pd4XAqGhwgMTQ6/W+w7w=
github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d/go.mod h1:tXDujonxXFOF6oK5HS2EmgtSXJK3Gy6RpZxb5WzR9rM=
github.com/ava-labs/coreth v0.13.8-fix-genesis-upgrade h1:xWsvSGtZcGna3B2BLU2BvK3qskbcc9ZNtgC0ck91CkI=
github.com/ava-labs/coreth v0.13.8-fix-genesis-upgrade/go.mod h1:Ouul9dJouniUIJVX1gDqx8CrHyGvmwZkK28mrgKb/4I=
github.com/ava-labs/ledger-avalanche/go v0.0.0-20240610153809-9c955cc90a95 h1:dOVbtdnZL++pENdTCNZ1nu41eYDQkTML4sWebDnnq8c=
github.com/ava-labs/ledger-avalanche/go v0.0.0-20240610153809-9c955cc90a95/go.mod h1:pJxaT9bUgeRNVmNRgtCHb7sFDIRKy7CzTQVi8gGNT6g=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
Expand Down Expand Up @@ -498,8 +498,8 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
Expand Down Expand Up @@ -644,8 +644,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
golang.org/x/crypto v0.0.0-20170613210332-850760c427c5/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down
4 changes: 3 additions & 1 deletion tests/fixture/tmpnet/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/ava-labs/avalanchego/genesis"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/secp256k1"
"github.com/ava-labs/avalanchego/utils/formatting/address"
Expand Down Expand Up @@ -149,7 +150,8 @@ func NewTestGenesis(
// Define C-Chain genesis
cChainGenesis := &core.Genesis{
Config: params.AvalancheLocalChainConfig,
Difficulty: big.NewInt(0), // Difficulty is a mandatory field
Difficulty: big.NewInt(0), // Difficulty is a mandatory field
Timestamp: uint64(upgrade.InitiallyActiveTime.Unix()), // This time enables Avalanche upgrades by default
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed for backwards compatibility as params.AvalancheLocalChainConfig now uses avalanchego InitiallyActiveTime instead of genesis to activate avalanche upgrades (specifically ap3 which also impacts the outcome of genesis)

GasLimit: defaultGasLimit,
Alloc: cChainBalances,
}
Expand Down
28 changes: 16 additions & 12 deletions tests/fixture/tmpnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,7 @@ func (n *Network) Create(rootDir string) error {
}

if n.NetworkID == 0 && n.Genesis == nil {
// Pre-fund known legacy keys to support ad-hoc testing. Usage of a legacy key will
// require knowing the key beforehand rather than retrieving it from the set of pre-funded
// keys exposed by a network. Since allocation will not be exclusive, a test using a
// legacy key is unlikely to be a good candidate for parallel execution.
keysToFund := []*secp256k1.PrivateKey{
genesis.VMRQKey,
genesis.EWOQKey,
HardhatKey,
}
keysToFund = append(keysToFund, n.PreFundedKeys...)

genesis, err := NewTestGenesis(defaultNetworkID, n.Nodes, keysToFund)
genesis, err := n.DefaultGenesis()
if err != nil {
return err
}
Expand All @@ -328,6 +317,21 @@ func (n *Network) Create(rootDir string) error {
return n.Write()
}

func (n *Network) DefaultGenesis() (*genesis.UnparsedConfig, error) {
// Pre-fund known legacy keys to support ad-hoc testing. Usage of a legacy key will
// require knowing the key beforehand rather than retrieving it from the set of pre-funded
// keys exposed by a network. Since allocation will not be exclusive, a test using a
// legacy key is unlikely to be a good candidate for parallel execution.
keysToFund := []*secp256k1.PrivateKey{
genesis.VMRQKey,
genesis.EWOQKey,
HardhatKey,
}
keysToFund = append(keysToFund, n.PreFundedKeys...)

return NewTestGenesis(defaultNetworkID, n.Nodes, keysToFund)
}

// Starts the specified nodes
func (n *Network) StartNodes(ctx context.Context, w io.Writer, nodesToStart ...*Node) error {
if len(nodesToStart) == 0 {
Expand Down
22 changes: 22 additions & 0 deletions tests/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
package upgrade

import (
"encoding/json"
"flag"
"fmt"
"testing"

"github.com/ava-labs/coreth/core"
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/tests/fixture/e2e"
"github.com/ava-labs/avalanchego/tests/fixture/tmpnet"
"github.com/ava-labs/avalanchego/upgrade"
)

func TestUpgrade(t *testing.T) {
Expand Down Expand Up @@ -45,6 +48,25 @@ var _ = ginkgo.Describe("[Upgrade]", func() {

ginkgo.It("can upgrade versions", func() {
network := tmpnet.NewDefaultNetwork("avalanchego-upgrade")

marun marked this conversation as resolved.
Show resolved Hide resolved
{
// Get the default genesis so we can modify it
genesis, err := network.DefaultGenesis()
require.NoError(err)
network.Genesis = genesis
// Etna enables Cancun which modifies the outcome of the C-Chain genesis
// This is because of new header fields that modify the genesis block hash.
// This code can be removed once the Etna upgrade is activated.
cChainGenesis := new(core.Genesis)
cChainGenesisStr := network.Genesis.CChainGenesis
require.NoError(json.Unmarshal([]byte(cChainGenesisStr), cChainGenesis))
unscheduledActivationTime := uint64(upgrade.UnscheduledActivationTime.Unix())
cChainGenesis.Config.EUpgradeTime = &unscheduledActivationTime
cChainGenesisBytes, err := json.Marshal(cChainGenesis)
require.NoError(err)
network.Genesis.CChainGenesis = string(cChainGenesisBytes)
}

e2e.StartNetwork(tc, network, avalancheGoExecPath, "" /* pluginDir */, 0 /* shutdownDelay */, false /* reuseNetwork */)

tc.By(fmt.Sprintf("restarting all nodes with %q binary", avalancheGoExecPathToUpgradeTo))
Expand Down
75 changes: 0 additions & 75 deletions version/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import (
"time"

_ "embed"

"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/utils/constants"
)

const (
Expand Down Expand Up @@ -67,78 +64,6 @@ var (
// set of avalanchego versions that supported that version. This is not used
// by avalanchego, but is useful for downstream libraries.
RPCChainVMProtocolCompatibility map[uint][]*Semantic

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhase1Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhase1Time,
constants.FujiID: upgrade.Fuji.ApricotPhase1Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhase2Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhase2Time,
constants.FujiID: upgrade.Fuji.ApricotPhase2Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhase3Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhase3Time,
constants.FujiID: upgrade.Fuji.ApricotPhase3Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhase4Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhase4Time,
constants.FujiID: upgrade.Fuji.ApricotPhase4Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhase5Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhase5Time,
constants.FujiID: upgrade.Fuji.ApricotPhase5Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhasePre6Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhasePre6Time,
constants.FujiID: upgrade.Fuji.ApricotPhasePre6Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhase6Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhase6Time,
constants.FujiID: upgrade.Fuji.ApricotPhase6Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
ApricotPhasePost6Times = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.ApricotPhasePost6Time,
constants.FujiID: upgrade.Fuji.ApricotPhasePost6Time,
}

// Deprecated: This will be removed once coreth no longer uses it.
BanffTimes = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.BanffTime,
constants.FujiID: upgrade.Fuji.BanffTime,
}

// Deprecated: This will be removed once coreth no longer uses it.
CortinaTimes = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.CortinaTime,
constants.FujiID: upgrade.Fuji.CortinaTime,
}

// Deprecated: This will be removed once coreth no longer uses it.
DurangoTimes = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.DurangoTime,
constants.FujiID: upgrade.Fuji.DurangoTime,
}

// Deprecated: This will be removed once coreth no longer uses it.
EUpgradeTimes = map[uint32]time.Time{
constants.MainnetID: upgrade.Mainnet.EtnaTime,
constants.FujiID: upgrade.Fuji.EtnaTime,
}
)

func init() {
Expand Down
Loading