github.com/dim4egster/coreth@v0.10.2/plugin/evm/message/codec.go (about) 1 // (c) 2019-2022, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package message 5 6 import ( 7 "github.com/dim4egster/qmallgo/codec" 8 "github.com/dim4egster/qmallgo/codec/linearcodec" 9 "github.com/dim4egster/qmallgo/utils/units" 10 "github.com/dim4egster/qmallgo/utils/wrappers" 11 ) 12 13 const ( 14 Version = uint16(0) 15 maxMessageSize = 1 * units.MiB 16 ) 17 18 var Codec codec.Manager 19 20 func init() { 21 Codec = codec.NewManager(maxMessageSize) 22 c := linearcodec.NewDefault() 23 24 errs := wrappers.Errs{} 25 errs.Add( 26 // Gossip types 27 c.RegisterType(AtomicTxGossip{}), 28 c.RegisterType(EthTxsGossip{}), 29 30 // Types for state sync frontier consensus 31 c.RegisterType(SyncSummary{}), 32 33 // state sync types 34 c.RegisterType(BlockRequest{}), 35 c.RegisterType(BlockResponse{}), 36 c.RegisterType(LeafsRequest{}), 37 c.RegisterType(LeafsResponse{}), 38 c.RegisterType(CodeRequest{}), 39 c.RegisterType(CodeResponse{}), 40 41 Codec.RegisterCodec(Version, c), 42 ) 43 44 if errs.Errored() { 45 panic(errs.Err) 46 } 47 }