From 45fbd5d14723725991bb635e052f2b1e0b0a635e Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 6 Mar 2024 16:38:46 -0500 Subject: [PATCH] Remove Durango codec check --- go.mod | 2 +- go.sum | 4 ++-- peer/network_test.go | 2 +- plugin/evm/codec.go | 26 +++++++------------------- plugin/evm/message/codec.go | 6 ++---- plugin/evm/test_tx.go | 3 +-- plugin/evm/vm.go | 2 +- predicate/predicate_results.go | 3 +-- scripts/versions.sh | 2 +- warp/aggregator/aggregator_test.go | 2 +- 10 files changed, 18 insertions(+), 34 deletions(-) diff --git a/go.mod b/go.mod index b728b2b9fb..419a90c406 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/VictoriaMetrics/fastcache v1.10.0 - github.com/ava-labs/avalanchego v1.11.2 + github.com/ava-labs/avalanchego v1.11.3-codec-cleanup github.com/cespare/cp v0.1.0 github.com/davecgh/go-spew v1.1.1 github.com/deckarep/golang-set/v2 v2.1.0 diff --git a/go.sum b/go.sum index 1a9ea18f1d..cf01879ab8 100644 --- a/go.sum +++ b/go.sum @@ -54,8 +54,8 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/ava-labs/avalanchego v1.11.2 h1:8iodZ+RjqpRwHdiXPPtvaNt72qravge7voGzw3yPRzg= -github.com/ava-labs/avalanchego v1.11.2/go.mod h1:oTVnF9idL57J4LM/6RByTmKhI4QvV6OCnF99ysyBljE= +github.com/ava-labs/avalanchego v1.11.3-codec-cleanup h1:vDaeub6mMehtmoYKDNrRf1V2DqGQmbHG2nnJgfvQv0s= +github.com/ava-labs/avalanchego v1.11.3-codec-cleanup/go.mod h1:oTVnF9idL57J4LM/6RByTmKhI4QvV6OCnF99ysyBljE= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/peer/network_test.go b/peer/network_test.go index 47c21cfa8d..b51ce75b31 100644 --- a/peer/network_test.go +++ b/peer/network_test.go @@ -844,7 +844,7 @@ func TestNetworkRouting(t *testing.T) { func buildCodec(t *testing.T, types ...interface{}) codec.Manager { codecManager := codec.NewDefaultManager() - c := linearcodec.NewDefault(time.Time{}) + c := linearcodec.NewDefault() for _, typ := range types { assert.NoError(t, c.RegisterType(typ)) } diff --git a/plugin/evm/codec.go b/plugin/evm/codec.go index 9217967714..e4c38761e3 100644 --- a/plugin/evm/codec.go +++ b/plugin/evm/codec.go @@ -5,7 +5,6 @@ package evm import ( "fmt" - "time" "github.com/ava-labs/avalanchego/codec" "github.com/ava-labs/avalanchego/codec/linearcodec" @@ -16,14 +15,12 @@ import ( // Codec does serialization and deserialization var Codec codec.Manager -// TODO: Remove after v1.11.x has activated -// -// Invariant: InitCodec and Codec must not be accessed concurrently -func InitCodec(durangoTime time.Time) error { +func init() { + Codec = codec.NewDefaultManager() + var ( - lc = linearcodec.NewDefault(durangoTime) - newCodec = codec.NewDefaultManager() - errs = wrappers.Errs{} + lc = linearcodec.NewDefault() + errs = wrappers.Errs{} ) errs.Add( lc.RegisterType(&UnsignedImportTx{}), @@ -38,19 +35,10 @@ func InitCodec(durangoTime time.Time) error { lc.RegisterType(&secp256k1fx.Credential{}), lc.RegisterType(&secp256k1fx.Input{}), lc.RegisterType(&secp256k1fx.OutputOwners{}), - newCodec.RegisterCodec(codecVersion, lc), + Codec.RegisterCodec(codecVersion, lc), ) if errs.Errored() { - return errs.Err - } - - Codec = newCodec - return nil -} - -func init() { - if err := InitCodec(time.Time{}); err != nil { - panic(err) + panic(errs.Err) } } diff --git a/plugin/evm/message/codec.go b/plugin/evm/message/codec.go index f1e2cfcb2e..ea37200665 100644 --- a/plugin/evm/message/codec.go +++ b/plugin/evm/message/codec.go @@ -4,8 +4,6 @@ package message import ( - "time" - "github.com/ava-labs/avalanchego/codec" "github.com/ava-labs/avalanchego/codec/linearcodec" "github.com/ava-labs/avalanchego/utils/units" @@ -24,7 +22,7 @@ var ( func init() { Codec = codec.NewManager(maxMessageSize) - c := linearcodec.NewDefault(time.Time{}) + c := linearcodec.NewDefault() errs := wrappers.Errs{} errs.Add( @@ -56,7 +54,7 @@ func init() { } CrossChainCodec = codec.NewManager(maxMessageSize) - ccc := linearcodec.NewDefault(time.Time{}) + ccc := linearcodec.NewDefault() errs = wrappers.Errs{} errs.Add( diff --git a/plugin/evm/test_tx.go b/plugin/evm/test_tx.go index 458059fe38..c057c874ad 100644 --- a/plugin/evm/test_tx.go +++ b/plugin/evm/test_tx.go @@ -6,7 +6,6 @@ package evm import ( "math/big" "math/rand" - "time" "github.com/ava-labs/avalanchego/utils" @@ -78,7 +77,7 @@ func (t *TestUnsignedTx) EVMStateTransfer(ctx *snow.Context, state *state.StateD func testTxCodec() codec.Manager { codec := codec.NewDefaultManager() - c := linearcodec.NewDefault(time.Time{}) + c := linearcodec.NewDefault() errs := wrappers.Errs{} errs.Add( diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 52e7bf125a..d76036a1d7 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -659,7 +659,7 @@ func (vm *VM) Initialize( // so [vm.baseCodec] is a dummy codec use to fulfill the secp256k1fx VM // interface. The fx will register all of its types, which can be safely // ignored by the VM's codec. - vm.baseCodec = linearcodec.NewDefault(time.Time{}) + vm.baseCodec = linearcodec.NewDefault() if err := vm.fx.Initialize(vm); err != nil { return err diff --git a/predicate/predicate_results.go b/predicate/predicate_results.go index c28d811fe4..f87b181f44 100644 --- a/predicate/predicate_results.go +++ b/predicate/predicate_results.go @@ -6,7 +6,6 @@ package predicate import ( "fmt" "strings" - "time" "github.com/ava-labs/avalanchego/codec" "github.com/ava-labs/avalanchego/codec/linearcodec" @@ -25,7 +24,7 @@ var Codec codec.Manager func init() { Codec = codec.NewManager(MaxResultsSize) - c := linearcodec.NewDefault(time.Time{}) + c := linearcodec.NewDefault() errs := wrappers.Errs{} errs.Add( c.RegisterType(Results{}), diff --git a/scripts/versions.sh b/scripts/versions.sh index 967bf9ca13..3624f80812 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -6,4 +6,4 @@ set -euo pipefail # Don't export them as they're used in the context of other calls -avalanche_version=${AVALANCHE_VERSION:-'v1.11.2'} +avalanche_version=${AVALANCHE_VERSION:-'v1.11.3-codec-cleanup'} diff --git a/warp/aggregator/aggregator_test.go b/warp/aggregator/aggregator_test.go index 07d2020756..a423f75b25 100644 --- a/warp/aggregator/aggregator_test.go +++ b/warp/aggregator/aggregator_test.go @@ -23,7 +23,7 @@ func newValidator(t testing.TB, weight uint64) (*bls.SecretKey, *avalancheWarp.V pk := bls.PublicFromSecretKey(sk) return sk, &avalancheWarp.Validator{ PublicKey: pk, - PublicKeyBytes: bls.PublicKeyToBytes(pk), + PublicKeyBytes: bls.PublicKeyToCompressedBytes(pk), Weight: weight, NodeIDs: []ids.NodeID{ids.GenerateTestNodeID()}, }