payload

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2025 License: BSD-3-Clause Imports: 3 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// AddressedCall payload type ID
	AddressedCallID uint32 = 0

	// Hash payload type ID
	HashID uint32 = 1

	// L1ValidatorRegistration payload type ID
	L1ValidatorRegistrationID uint32 = 2

	// RegisterL1Validator payload type ID
	RegisterL1ValidatorID uint32 = 3

	// SubnetToL1Conversion payload type ID
	SubnetToL1ConversionID uint32 = 4

	// L1ValidatorWeight payload type ID
	L1ValidatorWeightID uint32 = 5
)

Payload types

Variables

View Source
var (
	// ErrInvalidPayload is returned when a payload is invalid
	ErrInvalidPayload = errors.New("invalid payload")
)

Functions

This section is empty.

Types

type AddressedCall

type AddressedCall struct {
	SourceAddress []byte `serialize:"true"`
	Payload       []byte `serialize:"true"`
}

AddressedCall is a payload for cross-VM calls

func NewAddressedCall

func NewAddressedCall(sourceAddress []byte, payload []byte) (*AddressedCall, error)

NewAddressedCall creates a new addressed call payload

func (*AddressedCall) Bytes

func (a *AddressedCall) Bytes() []byte

Bytes returns the byte representation of the payload

func (*AddressedCall) Verify

func (a *AddressedCall) Verify() error

Verify verifies the addressed call payload

type Hash

type Hash struct {
	Hash []byte `serialize:"true"`
}

Hash is a simple hash payload

func NewHash

func NewHash(hash []byte) (*Hash, error)

NewHash creates a new hash payload

func (*Hash) Bytes

func (h *Hash) Bytes() []byte

Bytes returns the byte representation of the payload

func (*Hash) Verify

func (h *Hash) Verify() error

Verify verifies the hash payload

type L1ValidatorRegistration

type L1ValidatorRegistration struct {
	Valid      bool   `serialize:"true"`
	Validation []byte `serialize:"true"`
}

L1ValidatorRegistration represents a validator registration status

func NewL1ValidatorRegistration

func NewL1ValidatorRegistration(valid bool, validation []byte) (*L1ValidatorRegistration, error)

NewL1ValidatorRegistration creates a new L1 validator registration payload

func (*L1ValidatorRegistration) Bytes

func (r *L1ValidatorRegistration) Bytes() []byte

Bytes returns the byte representation of the payload

func (*L1ValidatorRegistration) Verify

func (r *L1ValidatorRegistration) Verify() error

Verify verifies the registration payload

type L1ValidatorWeight

type L1ValidatorWeight struct {
	ValidationID []byte `serialize:"true"`
	Nonce        uint64 `serialize:"true"`
	Weight       uint64 `serialize:"true"`
}

L1ValidatorWeight represents a validator weight update

func NewL1ValidatorWeight

func NewL1ValidatorWeight(
	validationID []byte,
	nonce uint64,
	weight uint64,
) (*L1ValidatorWeight, error)

NewL1ValidatorWeight creates a new validator weight payload

func (*L1ValidatorWeight) Bytes

func (w *L1ValidatorWeight) Bytes() []byte

Bytes returns the byte representation of the payload

func (*L1ValidatorWeight) Verify

func (w *L1ValidatorWeight) Verify() error

Verify verifies the weight payload

type Payload

type Payload interface {
	// Bytes returns the byte representation of the payload
	Bytes() []byte

	// Verify verifies the payload
	Verify() error
}

Payload is an interface for warp message payloads

func ParsePayload

func ParsePayload(bytes []byte) (Payload, error)

ParsePayload parses a payload from bytes

type RegisterL1Validator

type RegisterL1Validator struct {
	SubnetID         []byte `serialize:"true"`
	NodeID           []byte `serialize:"true"`
	Weight           uint64 `serialize:"true"`
	BLSPublicKey     []byte `serialize:"true"`
	RegistrationTime uint64 `serialize:"true"`
}

RegisterL1Validator adds a validator to a subnet

func NewRegisterL1Validator

func NewRegisterL1Validator(
	subnetID []byte,
	nodeID []byte,
	weight uint64,
	blsPublicKey []byte,
	registrationTime uint64,
) (*RegisterL1Validator, error)

NewRegisterL1Validator creates a new register L1 validator payload

func (*RegisterL1Validator) Bytes

func (r *RegisterL1Validator) Bytes() []byte

Bytes returns the byte representation of the payload

func (*RegisterL1Validator) Verify

func (r *RegisterL1Validator) Verify() error

Verify verifies the register validator payload

type SubnetToL1Conversion

type SubnetToL1Conversion struct {
	SubnetID []byte   `serialize:"true"`
	ChainID  []byte   `serialize:"true"`
	Address  []byte   `serialize:"true"`
	Managers [][]byte `serialize:"true"`
}

SubnetToL1Conversion represents a subnet conversion message

func NewSubnetToL1Conversion

func NewSubnetToL1Conversion(
	subnetID []byte,
	chainID []byte,
	address []byte,
	managers [][]byte,
) (*SubnetToL1Conversion, error)

NewSubnetToL1Conversion creates a new subnet to L1 conversion payload

func (*SubnetToL1Conversion) Bytes

func (c *SubnetToL1Conversion) Bytes() []byte

Bytes returns the byte representation of the payload

func (*SubnetToL1Conversion) Verify

func (c *SubnetToL1Conversion) Verify() error

Verify verifies the conversion payload

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL