// Code generated by "serde-generate"; DO NOT EDIT.

package gossip

import (
	"fmt"
	"github.com/novifinancial/serde-reflection/serde-generate/runtime/golang/bincode"
	"github.com/novifinancial/serde-reflection/serde-generate/runtime/golang/serde"
)

type BitVecU64 struct {
	Bits BitVecU64Inner
	Len  uint64
}

func (obj *BitVecU64) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.Bits.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Len); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *BitVecU64) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeBitVecU64(deserializer serde.Deserializer) (BitVecU64, error) {
	var obj BitVecU64
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeBitVecU64Inner(deserializer); err == nil {
		obj.Bits = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Len = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeBitVecU64(input []byte) (BitVecU64, error) {
	if input == nil {
		var obj BitVecU64
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeBitVecU64(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type BitVecU64Inner struct {
	Value *[]uint64
}

func (obj *BitVecU64Inner) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serialize_option_vector_u64(obj.Value, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *BitVecU64Inner) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeBitVecU64Inner(deserializer serde.Deserializer) (BitVecU64Inner, error) {
	var obj BitVecU64Inner
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserialize_option_vector_u64(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeBitVecU64Inner(input []byte) (BitVecU64Inner, error) {
	if input == nil {
		var obj BitVecU64Inner
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeBitVecU64Inner(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type BitVecU8 struct {
	Bits BitVecU8Inner
	Len  uint64
}

func (obj *BitVecU8) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.Bits.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Len); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *BitVecU8) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeBitVecU8(deserializer serde.Deserializer) (BitVecU8, error) {
	var obj BitVecU8
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeBitVecU8Inner(deserializer); err == nil {
		obj.Bits = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Len = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeBitVecU8(input []byte) (BitVecU8, error) {
	if input == nil {
		var obj BitVecU8
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeBitVecU8(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type BitVecU8Inner struct {
	Value *[]uint8
}

func (obj *BitVecU8Inner) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serialize_option_vector_u8(obj.Value, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *BitVecU8Inner) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeBitVecU8Inner(deserializer serde.Deserializer) (BitVecU8Inner, error) {
	var obj BitVecU8Inner
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserialize_option_vector_u8(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeBitVecU8Inner(input []byte) (BitVecU8Inner, error) {
	if input == nil {
		var obj BitVecU8Inner
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeBitVecU8Inner(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type Bloom struct {
	Keys       []uint64
	Bits       BitVecU64
	NumBitsSet uint64
}

func (obj *Bloom) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serialize_vector_u64(obj.Keys, serializer); err != nil {
		return err
	}
	if err := obj.Bits.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.NumBitsSet); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Bloom) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeBloom(deserializer serde.Deserializer) (Bloom, error) {
	var obj Bloom
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserialize_vector_u64(deserializer); err == nil {
		obj.Keys = val
	} else {
		return obj, err
	}
	if val, err := DeserializeBitVecU64(deserializer); err == nil {
		obj.Bits = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.NumBitsSet = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeBloom(input []byte) (Bloom, error) {
	if input == nil {
		var obj Bloom
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeBloom(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type CompressedSlots interface {
	isCompressedSlots()
	Serialize(serializer serde.Serializer) error
	BincodeSerialize() ([]byte, error)
}

func DeserializeCompressedSlots(deserializer serde.Deserializer) (CompressedSlots, error) {
	index, err := deserializer.DeserializeVariantIndex()
	if err != nil {
		return nil, err
	}

	switch index {
	case 0:
		if val, err := load_CompressedSlots__Flate2(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 1:
		if val, err := load_CompressedSlots__Uncompressed(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	default:
		return nil, fmt.Errorf("Unknown variant index for CompressedSlots: %d", index)
	}
}

func BincodeDeserializeCompressedSlots(input []byte) (CompressedSlots, error) {
	if input == nil {
		var obj CompressedSlots
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeCompressedSlots(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type CompressedSlots__Flate2 struct {
	Value SlotsFlate2
}

func (*CompressedSlots__Flate2) isCompressedSlots() {}

func (obj *CompressedSlots__Flate2) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(0)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CompressedSlots__Flate2) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_CompressedSlots__Flate2(deserializer serde.Deserializer) (CompressedSlots__Flate2, error) {
	var obj CompressedSlots__Flate2
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeSlotsFlate2(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CompressedSlots__Uncompressed struct {
	Value SlotsUncompressed
}

func (*CompressedSlots__Uncompressed) isCompressedSlots() {}

func (obj *CompressedSlots__Uncompressed) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(1)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CompressedSlots__Uncompressed) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_CompressedSlots__Uncompressed(deserializer serde.Deserializer) (CompressedSlots__Uncompressed, error) {
	var obj CompressedSlots__Uncompressed
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeSlotsUncompressed(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type ContactInfo struct {
	Id           Pubkey
	Gossip       SocketAddr
	Tvu          SocketAddr
	TvuForwards  SocketAddr
	Repair       SocketAddr
	Tpu          SocketAddr
	TpuForwards  SocketAddr
	TpuVote      SocketAddr
	Rpc          SocketAddr
	RpcPubsub    SocketAddr
	ServeRepair  SocketAddr
	Wallclock    uint64
	ShredVersion uint16
}

func (obj *ContactInfo) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.Id.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Gossip.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Tvu.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.TvuForwards.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Repair.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Tpu.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.TpuForwards.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.TpuVote.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Rpc.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.RpcPubsub.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.ServeRepair.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.ShredVersion); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *ContactInfo) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeContactInfo(deserializer serde.Deserializer) (ContactInfo, error) {
	var obj ContactInfo
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.Id = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.Gossip = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.Tvu = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.TvuForwards = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.Repair = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.Tpu = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.TpuForwards = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.TpuVote = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.Rpc = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.RpcPubsub = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSocketAddr(deserializer); err == nil {
		obj.ServeRepair = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.ShredVersion = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeContactInfo(input []byte) (ContactInfo, error) {
	if input == nil {
		var obj ContactInfo
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeContactInfo(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type CrdsData interface {
	isCrdsData()
	Serialize(serializer serde.Serializer) error
	BincodeSerialize() ([]byte, error)
	Pubkey() *Pubkey
}

func DeserializeCrdsData(deserializer serde.Deserializer) (CrdsData, error) {
	index, err := deserializer.DeserializeVariantIndex()
	if err != nil {
		return nil, err
	}

	switch index {
	case 0:
		if val, err := load_CrdsData__ContactInfo(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 1:
		if val, err := load_CrdsData__Vote(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 2:
		if val, err := load_CrdsData__LowestSlot(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 3:
		if val, err := load_CrdsData__SnapshotHashes(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 4:
		if val, err := load_CrdsData__AccountsHashes(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 5:
		if val, err := load_CrdsData__EpochSlots(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 6:
		if val, err := load_CrdsData__LegacyVersion(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 7:
		if val, err := load_CrdsData__Version(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 8:
		if val, err := load_CrdsData__NodeInstance(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 9:
		if val, err := load_CrdsData__DuplicateShred(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 10:
		if val, err := load_CrdsData__IncrementalSnapshotHashes(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	default:
		return nil, fmt.Errorf("Unknown variant index for CrdsData: %d", index)
	}
}

func BincodeDeserializeCrdsData(input []byte) (CrdsData, error) {
	if input == nil {
		var obj CrdsData
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeCrdsData(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type CrdsData__ContactInfo struct {
	Value ContactInfo
}

func (*CrdsData__ContactInfo) isCrdsData() {}

func (obj *CrdsData__ContactInfo) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(0)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__ContactInfo) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__ContactInfo) Pubkey() *Pubkey {
	return &obj.Value.Id
}

func load_CrdsData__ContactInfo(deserializer serde.Deserializer) (CrdsData__ContactInfo, error) {
	var obj CrdsData__ContactInfo
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeContactInfo(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__Vote struct {
	Field0 uint8
	Field1 Vote
}

func (*CrdsData__Vote) isCrdsData() {}

func (obj *CrdsData__Vote) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(1)
	if err := serializer.SerializeU8(obj.Field0); err != nil {
		return err
	}
	if err := obj.Field1.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__Vote) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__Vote) Pubkey() *Pubkey {
	return &obj.Field1.From
}

func load_CrdsData__Vote(deserializer serde.Deserializer) (CrdsData__Vote, error) {
	var obj CrdsData__Vote
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserializer.DeserializeU8(); err == nil {
		obj.Field0 = val
	} else {
		return obj, err
	}
	if val, err := DeserializeVote(deserializer); err == nil {
		obj.Field1 = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__LowestSlot struct {
	Field0 uint8
	Field1 LowestSlot
}

func (*CrdsData__LowestSlot) isCrdsData() {}

func (obj *CrdsData__LowestSlot) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(2)
	if err := serializer.SerializeU8(obj.Field0); err != nil {
		return err
	}
	if err := obj.Field1.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__LowestSlot) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__LowestSlot) Pubkey() *Pubkey {
	return &obj.Field1.From
}

func load_CrdsData__LowestSlot(deserializer serde.Deserializer) (CrdsData__LowestSlot, error) {
	var obj CrdsData__LowestSlot
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserializer.DeserializeU8(); err == nil {
		obj.Field0 = val
	} else {
		return obj, err
	}
	if val, err := DeserializeLowestSlot(deserializer); err == nil {
		obj.Field1 = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__SnapshotHashes struct {
	Value SnapshotHashes
}

func (*CrdsData__SnapshotHashes) isCrdsData() {}

func (obj *CrdsData__SnapshotHashes) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(3)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__SnapshotHashes) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__SnapshotHashes) Pubkey() *Pubkey {
	return &obj.Value.From
}

func load_CrdsData__SnapshotHashes(deserializer serde.Deserializer) (CrdsData__SnapshotHashes, error) {
	var obj CrdsData__SnapshotHashes
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeSnapshotHashes(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__AccountsHashes struct {
	Value SnapshotHashes
}

func (*CrdsData__AccountsHashes) isCrdsData() {}

func (obj *CrdsData__AccountsHashes) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(4)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__AccountsHashes) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__AccountsHashes) Pubkey() *Pubkey {
	return &obj.Value.From
}

func load_CrdsData__AccountsHashes(deserializer serde.Deserializer) (CrdsData__AccountsHashes, error) {
	var obj CrdsData__AccountsHashes
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeSnapshotHashes(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__EpochSlots struct {
	Field0 uint8
	Field1 EpochSlots
}

func (*CrdsData__EpochSlots) isCrdsData() {}

func (obj *CrdsData__EpochSlots) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(5)
	if err := serializer.SerializeU8(obj.Field0); err != nil {
		return err
	}
	if err := obj.Field1.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__EpochSlots) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__EpochSlots) Pubkey() *Pubkey {
	return &obj.Field1.From
}

func load_CrdsData__EpochSlots(deserializer serde.Deserializer) (CrdsData__EpochSlots, error) {
	var obj CrdsData__EpochSlots
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserializer.DeserializeU8(); err == nil {
		obj.Field0 = val
	} else {
		return obj, err
	}
	if val, err := DeserializeEpochSlots(deserializer); err == nil {
		obj.Field1 = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__LegacyVersion struct {
	From      Pubkey
	Wallclock uint64
	Major     uint16
	Minor     uint16
	Patch     uint16
	Commit    *uint32
}

func (*CrdsData__LegacyVersion) isCrdsData() {}

func (obj *CrdsData__LegacyVersion) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(6)
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.Major); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.Minor); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.Patch); err != nil {
		return err
	}
	if err := serialize_option_u32(obj.Commit, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__LegacyVersion) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__LegacyVersion) Pubkey() *Pubkey {
	return &obj.From
}

func load_CrdsData__LegacyVersion(deserializer serde.Deserializer) (CrdsData__LegacyVersion, error) {
	var obj CrdsData__LegacyVersion
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Major = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Minor = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Patch = val
	} else {
		return obj, err
	}
	if val, err := deserialize_option_u32(deserializer); err == nil {
		obj.Commit = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__Version struct {
	From       Pubkey
	Wallclock  uint64
	Major      uint16
	Minor      uint16
	Patch      uint16
	Commit     *uint32
	FeatureSet uint32
}

func (*CrdsData__Version) isCrdsData() {}

func (obj *CrdsData__Version) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(7)
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.Major); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.Minor); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.Patch); err != nil {
		return err
	}
	if err := serialize_option_u32(obj.Commit, serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU32(obj.FeatureSet); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__Version) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__Version) Pubkey() *Pubkey {
	return &obj.From
}

func load_CrdsData__Version(deserializer serde.Deserializer) (CrdsData__Version, error) {
	var obj CrdsData__Version
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Major = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Minor = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Patch = val
	} else {
		return obj, err
	}
	if val, err := deserialize_option_u32(deserializer); err == nil {
		obj.Commit = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU32(); err == nil {
		obj.FeatureSet = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__NodeInstance struct {
	From      Pubkey
	Wallclock uint64
	Timestamp uint64
	Token     uint64
}

func (*CrdsData__NodeInstance) isCrdsData() {}

func (obj *CrdsData__NodeInstance) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(8)
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Timestamp); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Token); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__NodeInstance) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__NodeInstance) Pubkey() *Pubkey {
	return &obj.From
}

func load_CrdsData__NodeInstance(deserializer serde.Deserializer) (CrdsData__NodeInstance, error) {
	var obj CrdsData__NodeInstance
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Timestamp = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Token = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__DuplicateShred struct {
	Field0 uint16
	Field1 DuplicateShred
}

func (*CrdsData__DuplicateShred) isCrdsData() {}

func (obj *CrdsData__DuplicateShred) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(9)
	if err := serializer.SerializeU16(obj.Field0); err != nil {
		return err
	}
	if err := obj.Field1.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__DuplicateShred) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__DuplicateShred) Pubkey() *Pubkey {
	return &obj.Field1.From
}

func load_CrdsData__DuplicateShred(deserializer serde.Deserializer) (CrdsData__DuplicateShred, error) {
	var obj CrdsData__DuplicateShred
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Field0 = val
	} else {
		return obj, err
	}
	if val, err := DeserializeDuplicateShred(deserializer); err == nil {
		obj.Field1 = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsData__IncrementalSnapshotHashes struct {
	Value IncrementalSnapshotHashes
}

func (*CrdsData__IncrementalSnapshotHashes) isCrdsData() {}

func (obj *CrdsData__IncrementalSnapshotHashes) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(10)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsData__IncrementalSnapshotHashes) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func (obj *CrdsData__IncrementalSnapshotHashes) Pubkey() *Pubkey {
	return &obj.Value.From
}

func load_CrdsData__IncrementalSnapshotHashes(deserializer serde.Deserializer) (CrdsData__IncrementalSnapshotHashes, error) {
	var obj CrdsData__IncrementalSnapshotHashes
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeIncrementalSnapshotHashes(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type CrdsFilter struct {
	Filter   Bloom
	Mask     uint64
	MaskBits uint32
}

func (obj *CrdsFilter) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.Filter.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Mask); err != nil {
		return err
	}
	if err := serializer.SerializeU32(obj.MaskBits); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsFilter) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeCrdsFilter(deserializer serde.Deserializer) (CrdsFilter, error) {
	var obj CrdsFilter
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeBloom(deserializer); err == nil {
		obj.Filter = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Mask = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU32(); err == nil {
		obj.MaskBits = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeCrdsFilter(input []byte) (CrdsFilter, error) {
	if input == nil {
		var obj CrdsFilter
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeCrdsFilter(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type CrdsValue struct {
	Signature Signature
	Data      CrdsData
}

func (obj *CrdsValue) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.Signature.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Data.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *CrdsValue) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeCrdsValue(deserializer serde.Deserializer) (CrdsValue, error) {
	var obj CrdsValue
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeSignature(deserializer); err == nil {
		obj.Signature = val
	} else {
		return obj, err
	}
	if val, err := DeserializeCrdsData(deserializer); err == nil {
		obj.Data = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeCrdsValue(input []byte) (CrdsValue, error) {
	if input == nil {
		var obj CrdsValue
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeCrdsValue(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type DuplicateShred struct {
	From       Pubkey
	Wallclock  uint64
	Slot       uint64
	ShredIndex uint32
	ShredType  uint8
	NumChunks  uint8
	ChunkIndex uint8
	Chunk      []uint8
}

func (obj *DuplicateShred) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Slot); err != nil {
		return err
	}
	if err := serializer.SerializeU32(obj.ShredIndex); err != nil {
		return err
	}
	if err := serializer.SerializeU8(obj.ShredType); err != nil {
		return err
	}
	if err := serializer.SerializeU8(obj.NumChunks); err != nil {
		return err
	}
	if err := serializer.SerializeU8(obj.ChunkIndex); err != nil {
		return err
	}
	if err := serialize_vector_u8(obj.Chunk, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *DuplicateShred) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeDuplicateShred(deserializer serde.Deserializer) (DuplicateShred, error) {
	var obj DuplicateShred
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Slot = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU32(); err == nil {
		obj.ShredIndex = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU8(); err == nil {
		obj.ShredType = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU8(); err == nil {
		obj.NumChunks = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU8(); err == nil {
		obj.ChunkIndex = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_u8(deserializer); err == nil {
		obj.Chunk = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeDuplicateShred(input []byte) (DuplicateShred, error) {
	if input == nil {
		var obj DuplicateShred
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeDuplicateShred(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type EpochSlots struct {
	From      Pubkey
	Slots     []CompressedSlots
	Wallclock uint64
}

func (obj *EpochSlots) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := serialize_vector_CompressedSlots(obj.Slots, serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *EpochSlots) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeEpochSlots(deserializer serde.Deserializer) (EpochSlots, error) {
	var obj EpochSlots
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_CompressedSlots(deserializer); err == nil {
		obj.Slots = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeEpochSlots(input []byte) (EpochSlots, error) {
	if input == nil {
		var obj EpochSlots
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeEpochSlots(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type Hash [32]uint8

func (obj *Hash) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serialize_array32_u8_array((([32]uint8)(*obj)), serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Hash) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeHash(deserializer serde.Deserializer) (Hash, error) {
	var obj [32]uint8
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return (Hash)(obj), err
	}
	if val, err := deserialize_array32_u8_array(deserializer); err == nil {
		obj = val
	} else {
		return ((Hash)(obj)), err
	}
	deserializer.DecreaseContainerDepth()
	return (Hash)(obj), nil
}

func BincodeDeserializeHash(input []byte) (Hash, error) {
	if input == nil {
		var obj Hash
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeHash(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type IncrementalSnapshotHashes struct {
	From      Pubkey
	Base      SlotHash
	Hashes    []SlotHash
	Wallclock uint64
}

func (obj *IncrementalSnapshotHashes) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Base.Serialize(serializer); err != nil {
		return err
	}
	if err := serialize_vector_SlotHash(obj.Hashes, serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *IncrementalSnapshotHashes) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeIncrementalSnapshotHashes(deserializer serde.Deserializer) (IncrementalSnapshotHashes, error) {
	var obj IncrementalSnapshotHashes
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSlotHash(deserializer); err == nil {
		obj.Base = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_SlotHash(deserializer); err == nil {
		obj.Hashes = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeIncrementalSnapshotHashes(input []byte) (IncrementalSnapshotHashes, error) {
	if input == nil {
		var obj IncrementalSnapshotHashes
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeIncrementalSnapshotHashes(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type LowestSlot struct {
	From      Pubkey
	Root      uint64
	Lowest    uint64
	Slots     []uint64
	Stash     []struct{}
	Wallclock uint64
}

func (obj *LowestSlot) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Root); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Lowest); err != nil {
		return err
	}
	if err := serialize_vector_u64(obj.Slots, serializer); err != nil {
		return err
	}
	if err := serialize_vector_unit(obj.Stash, serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *LowestSlot) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeLowestSlot(deserializer serde.Deserializer) (LowestSlot, error) {
	var obj LowestSlot
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Root = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Lowest = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_u64(deserializer); err == nil {
		obj.Slots = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_unit(deserializer); err == nil {
		obj.Stash = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeLowestSlot(input []byte) (LowestSlot, error) {
	if input == nil {
		var obj LowestSlot
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeLowestSlot(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type Message interface {
	isMessage()
	Serialize(serializer serde.Serializer) error
	BincodeSerialize() ([]byte, error)
}

func DeserializeMessage(deserializer serde.Deserializer) (Message, error) {
	index, err := deserializer.DeserializeVariantIndex()
	if err != nil {
		return nil, err
	}

	switch index {
	case 0:
		if val, err := load_Message__PullRequest(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 1:
		if val, err := load_Message__PullResponse(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 2:
		if val, err := load_Message__PushMessage(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 3:
		if val, err := load_Message__PruneMessage(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 4:
		if val, err := load_Message__Ping(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 5:
		if val, err := load_Message__Pong(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	default:
		return nil, fmt.Errorf("Unknown variant index for Message: %d", index)
	}
}

func BincodeDeserializeMessage(input []byte) (Message, error) {
	if input == nil {
		var obj Message
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeMessage(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type Message__PullRequest struct {
	Filter CrdsFilter
	Value  CrdsValue
}

func (*Message__PullRequest) isMessage() {}

func (obj *Message__PullRequest) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(0)
	if err := obj.Filter.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Message__PullRequest) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_Message__PullRequest(deserializer serde.Deserializer) (Message__PullRequest, error) {
	var obj Message__PullRequest
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeCrdsFilter(deserializer); err == nil {
		obj.Filter = val
	} else {
		return obj, err
	}
	if val, err := DeserializeCrdsValue(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type Message__PullResponse struct {
	Pubkey Pubkey
	Values []CrdsValue
}

func (*Message__PullResponse) isMessage() {}

func (obj *Message__PullResponse) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(1)
	if err := obj.Pubkey.Serialize(serializer); err != nil {
		return err
	}
	if err := serialize_vector_CrdsValue(obj.Values, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Message__PullResponse) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_Message__PullResponse(deserializer serde.Deserializer) (Message__PullResponse, error) {
	var obj Message__PullResponse
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.Pubkey = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_CrdsValue(deserializer); err == nil {
		obj.Values = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type Message__PushMessage struct {
	Pubkey Pubkey
	Values []CrdsValue
}

func (*Message__PushMessage) isMessage() {}

func (obj *Message__PushMessage) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(2)
	if err := obj.Pubkey.Serialize(serializer); err != nil {
		return err
	}
	if err := serialize_vector_CrdsValue(obj.Values, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Message__PushMessage) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_Message__PushMessage(deserializer serde.Deserializer) (Message__PushMessage, error) {
	var obj Message__PushMessage
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.Pubkey = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_CrdsValue(deserializer); err == nil {
		obj.Values = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type Message__PruneMessage struct {
	Pubkey Pubkey
	Data   PruneData
}

func (*Message__PruneMessage) isMessage() {}

func (obj *Message__PruneMessage) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(3)
	if err := obj.Pubkey.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Data.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Message__PruneMessage) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_Message__PruneMessage(deserializer serde.Deserializer) (Message__PruneMessage, error) {
	var obj Message__PruneMessage
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.Pubkey = val
	} else {
		return obj, err
	}
	if val, err := DeserializePruneData(deserializer); err == nil {
		obj.Data = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type Message__Ping struct {
	Value Ping
}

func (*Message__Ping) isMessage() {}

func (obj *Message__Ping) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(4)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Message__Ping) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_Message__Ping(deserializer serde.Deserializer) (Message__Ping, error) {
	var obj Message__Ping
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePing(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type Message__Pong struct {
	Value Ping
}

func (*Message__Pong) isMessage() {}

func (obj *Message__Pong) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(5)
	if err := obj.Value.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Message__Pong) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_Message__Pong(deserializer serde.Deserializer) (Message__Pong, error) {
	var obj Message__Pong
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePing(deserializer); err == nil {
		obj.Value = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

type Ping struct {
	From      Pubkey
	Token     Hash
	Signature Signature
}

func (obj *Ping) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Token.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Signature.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Ping) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializePing(deserializer serde.Deserializer) (Ping, error) {
	var obj Ping
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := DeserializeHash(deserializer); err == nil {
		obj.Token = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSignature(deserializer); err == nil {
		obj.Signature = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializePing(input []byte) (Ping, error) {
	if input == nil {
		var obj Ping
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializePing(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type PruneData struct {
	Pubkey      Pubkey
	Prunes      []Pubkey
	Signature   Signature
	Destination Pubkey
	Wallclock   uint64
}

func (obj *PruneData) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.Pubkey.Serialize(serializer); err != nil {
		return err
	}
	if err := serialize_vector_Pubkey(obj.Prunes, serializer); err != nil {
		return err
	}
	if err := obj.Signature.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Destination.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *PruneData) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializePruneData(deserializer serde.Deserializer) (PruneData, error) {
	var obj PruneData
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.Pubkey = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_Pubkey(deserializer); err == nil {
		obj.Prunes = val
	} else {
		return obj, err
	}
	if val, err := DeserializeSignature(deserializer); err == nil {
		obj.Signature = val
	} else {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.Destination = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializePruneData(input []byte) (PruneData, error) {
	if input == nil {
		var obj PruneData
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializePruneData(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type Pubkey [32]uint8

func (obj *Pubkey) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serialize_array32_u8_array((([32]uint8)(*obj)), serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Pubkey) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializePubkey(deserializer serde.Deserializer) (Pubkey, error) {
	var obj [32]uint8
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return (Pubkey)(obj), err
	}
	if val, err := deserialize_array32_u8_array(deserializer); err == nil {
		obj = val
	} else {
		return ((Pubkey)(obj)), err
	}
	deserializer.DecreaseContainerDepth()
	return (Pubkey)(obj), nil
}

func BincodeDeserializePubkey(input []byte) (Pubkey, error) {
	if input == nil {
		var obj Pubkey
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializePubkey(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type RawAddr interface {
	isRawAddr()
	Serialize(serializer serde.Serializer) error
	BincodeSerialize() ([]byte, error)
}

func DeserializeRawAddr(deserializer serde.Deserializer) (RawAddr, error) {
	index, err := deserializer.DeserializeVariantIndex()
	if err != nil {
		return nil, err
	}

	switch index {
	case 0:
		if val, err := load_RawAddr__V4(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	case 1:
		if val, err := load_RawAddr__V6(deserializer); err == nil {
			return &val, nil
		} else {
			return nil, err
		}

	default:
		return nil, fmt.Errorf("Unknown variant index for RawAddr: %d", index)
	}
}

func BincodeDeserializeRawAddr(input []byte) (RawAddr, error) {
	if input == nil {
		var obj RawAddr
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeRawAddr(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type RawAddr__V4 [4]uint8

func (*RawAddr__V4) isRawAddr() {}

func (obj *RawAddr__V4) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(0)
	if err := serialize_array4_u8_array((([4]uint8)(*obj)), serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *RawAddr__V4) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_RawAddr__V4(deserializer serde.Deserializer) (RawAddr__V4, error) {
	var obj [4]uint8
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return (RawAddr__V4)(obj), err
	}
	if val, err := deserialize_array4_u8_array(deserializer); err == nil {
		obj = val
	} else {
		return ((RawAddr__V4)(obj)), err
	}
	deserializer.DecreaseContainerDepth()
	return (RawAddr__V4)(obj), nil
}

type RawAddr__V6 [16]uint8

func (*RawAddr__V6) isRawAddr() {}

func (obj *RawAddr__V6) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	serializer.SerializeVariantIndex(1)
	if err := serialize_array16_u8_array((([16]uint8)(*obj)), serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *RawAddr__V6) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func load_RawAddr__V6(deserializer serde.Deserializer) (RawAddr__V6, error) {
	var obj [16]uint8
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return (RawAddr__V6)(obj), err
	}
	if val, err := deserialize_array16_u8_array(deserializer); err == nil {
		obj = val
	} else {
		return ((RawAddr__V6)(obj)), err
	}
	deserializer.DecreaseContainerDepth()
	return (RawAddr__V6)(obj), nil
}

type RawSocketAddr struct {
	Addr Addr
	Port uint16
}

func (obj *RawSocketAddr) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.Addr.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU16(obj.Port); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *RawSocketAddr) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeRawSocketAddr(deserializer serde.Deserializer) (RawSocketAddr, error) {
	var obj RawSocketAddr
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializeAddr(deserializer); err == nil {
		obj.Addr = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU16(); err == nil {
		obj.Port = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeRawSocketAddr(input []byte) (RawSocketAddr, error) {
	if input == nil {
		var obj RawSocketAddr
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeRawSocketAddr(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type Signature [64]uint8

func (obj *Signature) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serialize_array64_u8_array((([64]uint8)(*obj)), serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Signature) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeSignature(deserializer serde.Deserializer) (Signature, error) {
	var obj [64]uint8
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return (Signature)(obj), err
	}
	if val, err := deserialize_array64_u8_array(deserializer); err == nil {
		obj = val
	} else {
		return ((Signature)(obj)), err
	}
	deserializer.DecreaseContainerDepth()
	return (Signature)(obj), nil
}

func BincodeDeserializeSignature(input []byte) (Signature, error) {
	if input == nil {
		var obj Signature
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeSignature(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type SlotHash struct {
	Slot uint64
	Hash Hash
}

func (obj *SlotHash) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Slot); err != nil {
		return err
	}
	if err := obj.Hash.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *SlotHash) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeSlotHash(deserializer serde.Deserializer) (SlotHash, error) {
	var obj SlotHash
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Slot = val
	} else {
		return obj, err
	}
	if val, err := DeserializeHash(deserializer); err == nil {
		obj.Hash = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeSlotHash(input []byte) (SlotHash, error) {
	if input == nil {
		var obj SlotHash
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeSlotHash(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type SlotsFlate2 struct {
	FirstSlot  uint64
	Num        uint64
	Compressed []uint8
}

func (obj *SlotsFlate2) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.FirstSlot); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Num); err != nil {
		return err
	}
	if err := serialize_vector_u8(obj.Compressed, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *SlotsFlate2) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeSlotsFlate2(deserializer serde.Deserializer) (SlotsFlate2, error) {
	var obj SlotsFlate2
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.FirstSlot = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Num = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_u8(deserializer); err == nil {
		obj.Compressed = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeSlotsFlate2(input []byte) (SlotsFlate2, error) {
	if input == nil {
		var obj SlotsFlate2
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeSlotsFlate2(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type SlotsUncompressed struct {
	FirstSlot uint64
	Num       uint64
	Slots     BitVecU8
}

func (obj *SlotsUncompressed) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.FirstSlot); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Num); err != nil {
		return err
	}
	if err := obj.Slots.Serialize(serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *SlotsUncompressed) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeSlotsUncompressed(deserializer serde.Deserializer) (SlotsUncompressed, error) {
	var obj SlotsUncompressed
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.FirstSlot = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Num = val
	} else {
		return obj, err
	}
	if val, err := DeserializeBitVecU8(deserializer); err == nil {
		obj.Slots = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeSlotsUncompressed(input []byte) (SlotsUncompressed, error) {
	if input == nil {
		var obj SlotsUncompressed
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeSlotsUncompressed(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type SnapshotHashes struct {
	From      Pubkey
	Hashes    []SlotHash
	Wallclock uint64
}

func (obj *SnapshotHashes) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := serialize_vector_SlotHash(obj.Hashes, serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *SnapshotHashes) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeSnapshotHashes(deserializer serde.Deserializer) (SnapshotHashes, error) {
	var obj SnapshotHashes
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := deserialize_vector_SlotHash(deserializer); err == nil {
		obj.Hashes = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeSnapshotHashes(input []byte) (SnapshotHashes, error) {
	if input == nil {
		var obj SnapshotHashes
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeSnapshotHashes(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}

type Vote struct {
	From        Pubkey
	Transaction Transaction
	Wallclock   uint64
	Slot        *uint64
}

func (obj *Vote) Serialize(serializer serde.Serializer) error {
	if err := serializer.IncreaseContainerDepth(); err != nil {
		return err
	}
	if err := obj.From.Serialize(serializer); err != nil {
		return err
	}
	if err := obj.Transaction.Serialize(serializer); err != nil {
		return err
	}
	if err := serializer.SerializeU64(obj.Wallclock); err != nil {
		return err
	}
	if err := serialize_option_u64(obj.Slot, serializer); err != nil {
		return err
	}
	serializer.DecreaseContainerDepth()
	return nil
}

func (obj *Vote) BincodeSerialize() ([]byte, error) {
	if obj == nil {
		return nil, fmt.Errorf("Cannot serialize null object")
	}
	serializer := bincode.NewSerializer()
	if err := obj.Serialize(serializer); err != nil {
		return nil, err
	}
	return serializer.GetBytes(), nil
}

func DeserializeVote(deserializer serde.Deserializer) (Vote, error) {
	var obj Vote
	if err := deserializer.IncreaseContainerDepth(); err != nil {
		return obj, err
	}
	if val, err := DeserializePubkey(deserializer); err == nil {
		obj.From = val
	} else {
		return obj, err
	}
	if val, err := DeserializeTransaction(deserializer); err == nil {
		obj.Transaction = val
	} else {
		return obj, err
	}
	if val, err := deserializer.DeserializeU64(); err == nil {
		obj.Wallclock = val
	} else {
		return obj, err
	}
	if val, err := deserialize_option_u64(deserializer); err == nil {
		obj.Slot = val
	} else {
		return obj, err
	}
	deserializer.DecreaseContainerDepth()
	return obj, nil
}

func BincodeDeserializeVote(input []byte) (Vote, error) {
	if input == nil {
		var obj Vote
		return obj, fmt.Errorf("Cannot deserialize null array")
	}
	deserializer := bincode.NewDeserializer(input)
	obj, err := DeserializeVote(deserializer)
	if err == nil && deserializer.GetBufferOffset() < uint64(len(input)) {
		return obj, fmt.Errorf("Some input bytes were not read")
	}
	return obj, err
}
func serialize_array16_u8_array(value [16]uint8, serializer serde.Serializer) error {
	for _, item := range value {
		if err := serializer.SerializeU8(item); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_array16_u8_array(deserializer serde.Deserializer) ([16]uint8, error) {
	var obj [16]uint8
	for i := range obj {
		if val, err := deserializer.DeserializeU8(); err == nil {
			obj[i] = val
		} else {
			return obj, err
		}
	}
	return obj, nil
}

func serialize_array32_u8_array(value [32]uint8, serializer serde.Serializer) error {
	for _, item := range value {
		if err := serializer.SerializeU8(item); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_array32_u8_array(deserializer serde.Deserializer) ([32]uint8, error) {
	var obj [32]uint8
	for i := range obj {
		if val, err := deserializer.DeserializeU8(); err == nil {
			obj[i] = val
		} else {
			return obj, err
		}
	}
	return obj, nil
}

func serialize_array4_u8_array(value [4]uint8, serializer serde.Serializer) error {
	for _, item := range value {
		if err := serializer.SerializeU8(item); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_array4_u8_array(deserializer serde.Deserializer) ([4]uint8, error) {
	var obj [4]uint8
	for i := range obj {
		if val, err := deserializer.DeserializeU8(); err == nil {
			obj[i] = val
		} else {
			return obj, err
		}
	}
	return obj, nil
}

func serialize_array64_u8_array(value [64]uint8, serializer serde.Serializer) error {
	for _, item := range value {
		if err := serializer.SerializeU8(item); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_array64_u8_array(deserializer serde.Deserializer) ([64]uint8, error) {
	var obj [64]uint8
	for i := range obj {
		if val, err := deserializer.DeserializeU8(); err == nil {
			obj[i] = val
		} else {
			return obj, err
		}
	}
	return obj, nil
}

func serialize_option_u32(value *uint32, serializer serde.Serializer) error {
	if value != nil {
		if err := serializer.SerializeOptionTag(true); err != nil {
			return err
		}
		if err := serializer.SerializeU32((*value)); err != nil {
			return err
		}
	} else {
		if err := serializer.SerializeOptionTag(false); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_option_u32(deserializer serde.Deserializer) (*uint32, error) {
	tag, err := deserializer.DeserializeOptionTag()
	if err != nil {
		return nil, err
	}
	if tag {
		value := new(uint32)
		if val, err := deserializer.DeserializeU32(); err == nil {
			*value = val
		} else {
			return nil, err
		}
		return value, nil
	} else {
		return nil, nil
	}
}

func serialize_option_u64(value *uint64, serializer serde.Serializer) error {
	if value != nil {
		if err := serializer.SerializeOptionTag(true); err != nil {
			return err
		}
		if err := serializer.SerializeU64((*value)); err != nil {
			return err
		}
	} else {
		if err := serializer.SerializeOptionTag(false); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_option_u64(deserializer serde.Deserializer) (*uint64, error) {
	tag, err := deserializer.DeserializeOptionTag()
	if err != nil {
		return nil, err
	}
	if tag {
		value := new(uint64)
		if val, err := deserializer.DeserializeU64(); err == nil {
			*value = val
		} else {
			return nil, err
		}
		return value, nil
	} else {
		return nil, nil
	}
}

func serialize_option_vector_u64(value *[]uint64, serializer serde.Serializer) error {
	if value != nil {
		if err := serializer.SerializeOptionTag(true); err != nil {
			return err
		}
		if err := serialize_vector_u64((*value), serializer); err != nil {
			return err
		}
	} else {
		if err := serializer.SerializeOptionTag(false); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_option_vector_u64(deserializer serde.Deserializer) (*[]uint64, error) {
	tag, err := deserializer.DeserializeOptionTag()
	if err != nil {
		return nil, err
	}
	if tag {
		value := new([]uint64)
		if val, err := deserialize_vector_u64(deserializer); err == nil {
			*value = val
		} else {
			return nil, err
		}
		return value, nil
	} else {
		return nil, nil
	}
}

func serialize_option_vector_u8(value *[]uint8, serializer serde.Serializer) error {
	if value != nil {
		if err := serializer.SerializeOptionTag(true); err != nil {
			return err
		}
		if err := serialize_vector_u8((*value), serializer); err != nil {
			return err
		}
	} else {
		if err := serializer.SerializeOptionTag(false); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_option_vector_u8(deserializer serde.Deserializer) (*[]uint8, error) {
	tag, err := deserializer.DeserializeOptionTag()
	if err != nil {
		return nil, err
	}
	if tag {
		value := new([]uint8)
		if val, err := deserialize_vector_u8(deserializer); err == nil {
			*value = val
		} else {
			return nil, err
		}
		return value, nil
	} else {
		return nil, nil
	}
}

func serialize_vector_CompressedSlots(value []CompressedSlots, serializer serde.Serializer) error {
	if err := serializer.SerializeLen(uint64(len(value))); err != nil {
		return err
	}
	for _, item := range value {
		if err := item.Serialize(serializer); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_vector_CompressedSlots(deserializer serde.Deserializer) ([]CompressedSlots, error) {
	length, err := deserializer.DeserializeLen()
	if err != nil {
		return nil, err
	}
	obj := make([]CompressedSlots, length)
	for i := range obj {
		if val, err := DeserializeCompressedSlots(deserializer); err == nil {
			obj[i] = val
		} else {
			return nil, err
		}
	}
	return obj, nil
}

func serialize_vector_CrdsValue(value []CrdsValue, serializer serde.Serializer) error {
	if err := serializer.SerializeLen(uint64(len(value))); err != nil {
		return err
	}
	for _, item := range value {
		if err := item.Serialize(serializer); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_vector_CrdsValue(deserializer serde.Deserializer) ([]CrdsValue, error) {
	length, err := deserializer.DeserializeLen()
	if err != nil {
		return nil, err
	}
	obj := make([]CrdsValue, length)
	for i := range obj {
		if val, err := DeserializeCrdsValue(deserializer); err == nil {
			obj[i] = val
		} else {
			return nil, err
		}
	}
	return obj, nil
}

func serialize_vector_Pubkey(value []Pubkey, serializer serde.Serializer) error {
	if err := serializer.SerializeLen(uint64(len(value))); err != nil {
		return err
	}
	for _, item := range value {
		if err := item.Serialize(serializer); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_vector_Pubkey(deserializer serde.Deserializer) ([]Pubkey, error) {
	length, err := deserializer.DeserializeLen()
	if err != nil {
		return nil, err
	}
	obj := make([]Pubkey, length)
	for i := range obj {
		if val, err := DeserializePubkey(deserializer); err == nil {
			obj[i] = val
		} else {
			return nil, err
		}
	}
	return obj, nil
}

func serialize_vector_SlotHash(value []SlotHash, serializer serde.Serializer) error {
	if err := serializer.SerializeLen(uint64(len(value))); err != nil {
		return err
	}
	for _, item := range value {
		if err := item.Serialize(serializer); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_vector_SlotHash(deserializer serde.Deserializer) ([]SlotHash, error) {
	length, err := deserializer.DeserializeLen()
	if err != nil {
		return nil, err
	}
	obj := make([]SlotHash, length)
	for i := range obj {
		if val, err := DeserializeSlotHash(deserializer); err == nil {
			obj[i] = val
		} else {
			return nil, err
		}
	}
	return obj, nil
}

func serialize_vector_u64(value []uint64, serializer serde.Serializer) error {
	if err := serializer.SerializeLen(uint64(len(value))); err != nil {
		return err
	}
	for _, item := range value {
		if err := serializer.SerializeU64(item); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_vector_u64(deserializer serde.Deserializer) ([]uint64, error) {
	length, err := deserializer.DeserializeLen()
	if err != nil {
		return nil, err
	}
	obj := make([]uint64, length)
	for i := range obj {
		if val, err := deserializer.DeserializeU64(); err == nil {
			obj[i] = val
		} else {
			return nil, err
		}
	}
	return obj, nil
}

func serialize_vector_u8(value []uint8, serializer serde.Serializer) error {
	if err := serializer.SerializeLen(uint64(len(value))); err != nil {
		return err
	}
	for _, item := range value {
		if err := serializer.SerializeU8(item); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_vector_u8(deserializer serde.Deserializer) ([]uint8, error) {
	length, err := deserializer.DeserializeLen()
	if err != nil {
		return nil, err
	}
	obj := make([]uint8, length)
	for i := range obj {
		if val, err := deserializer.DeserializeU8(); err == nil {
			obj[i] = val
		} else {
			return nil, err
		}
	}
	return obj, nil
}

func serialize_vector_unit(value []struct{}, serializer serde.Serializer) error {
	if err := serializer.SerializeLen(uint64(len(value))); err != nil {
		return err
	}
	for _, item := range value {
		if err := serializer.SerializeUnit(item); err != nil {
			return err
		}
	}
	return nil
}

func deserialize_vector_unit(deserializer serde.Deserializer) ([]struct{}, error) {
	length, err := deserializer.DeserializeLen()
	if err != nil {
		return nil, err
	}
	obj := make([]struct{}, length)
	for i := range obj {
		if val, err := deserializer.DeserializeUnit(); err == nil {
			obj[i] = val
		} else {
			return nil, err
		}
	}
	return obj, nil
}
