aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm
diff options
context:
space:
mode:
authorTodd Stock <[email protected]>2020-12-21 11:44:31 -0500
committerTodd Stock <[email protected]>2020-12-21 11:44:31 -0500
commit4cc1b042e7c1a5836728ccbda51532384320e63a (patch)
tree39ce06693abd6a969edddfa07bd9fce31515aeab /plugin/evm
parent374b401198759f23bac435a78c5b1fa2c516aad9 (diff)
upgrade 1.1.1 codec
Diffstat (limited to 'plugin/evm')
-rw-r--r--plugin/evm/tx.go2
-rw-r--r--plugin/evm/vm.go13
2 files changed, 7 insertions, 8 deletions
diff --git a/plugin/evm/tx.go b/plugin/evm/tx.go
index 1c0ce48..c13592c 100644
--- a/plugin/evm/tx.go
+++ b/plugin/evm/tx.go
@@ -15,7 +15,7 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/utils"
- "github.com/ava-labs/avalanchego/utils/codec"
+ "github.com/ava-labs/avalanchego/codec"
"github.com/ava-labs/avalanchego/utils/crypto"
"github.com/ava-labs/avalanchego/utils/hashing"
"github.com/ava-labs/avalanchego/vms/components/verify"
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 9335b51..fa5d3f5 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -8,6 +8,8 @@ import (
"encoding/json"
"errors"
"fmt"
+ "github.com/ava-labs/avalanchego/codec/linearcodec"
+ "github.com/ava-labs/avalanchego/codec/reflectcodec"
"math/big"
"strings"
"sync"
@@ -40,7 +42,7 @@ import (
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/choices"
"github.com/ava-labs/avalanchego/snow/consensus/snowman"
- "github.com/ava-labs/avalanchego/utils/codec"
+ "github.com/ava-labs/avalanchego/codec"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto"
"github.com/ava-labs/avalanchego/utils/formatting"
@@ -122,14 +124,14 @@ var Codec codec.Manager
func init() {
Codec = codec.NewDefaultManager()
- c := codec.NewDefault()
+ c := linearcodec.New(reflectcodec.DefaultTagName, 1<<20)
errs := wrappers.Errs{}
errs.Add(
c.RegisterType(&UnsignedImportTx{}),
c.RegisterType(&UnsignedExportTx{}),
)
- c.Skip(3)
+ c.SkipRegistrations(3)
errs.Add(
c.RegisterType(&secp256k1fx.TransferInput{}),
c.RegisterType(&secp256k1fx.MintOutput{}),
@@ -225,9 +227,6 @@ func (vm *VM) getAtomicTx(block *types.Block) *Tx {
// Codec implements the secp256k1fx interface
func (vm *VM) Codec() codec.Manager { return vm.codec }
-// CodecRegistry implements the secp256k1fx interface
-func (vm *VM) CodecRegistry() codec.Registry { return vm.baseCodec }
-
// Clock implements the secp256k1fx interface
func (vm *VM) Clock() *timer.Clock { return &vm.clock }
@@ -418,7 +417,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 = codec.NewDefault()
+ vm.baseCodec = linearcodec.New(reflectcodec.DefaultTagName, 1<<20)
return vm.fx.Initialize(vm)
}