github.com/ava-labs/avalanchego@v1.11.11/vms/platformvm/warp/payload/codec.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package payload 5 6 import ( 7 "errors" 8 9 "github.com/ava-labs/avalanchego/codec" 10 "github.com/ava-labs/avalanchego/codec/linearcodec" 11 "github.com/ava-labs/avalanchego/utils/units" 12 ) 13 14 const ( 15 CodecVersion = 0 16 17 MaxMessageSize = 24 * units.KiB 18 ) 19 20 var Codec codec.Manager 21 22 func init() { 23 Codec = codec.NewManager(MaxMessageSize) 24 lc := linearcodec.NewDefault() 25 26 err := errors.Join( 27 lc.RegisterType(&Hash{}), 28 lc.RegisterType(&AddressedCall{}), 29 Codec.RegisterCodec(CodecVersion, lc), 30 ) 31 if err != nil { 32 panic(err) 33 } 34 }