types

package
v1.16.39 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: BSD-3-Clause Imports: 2 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package types defines the core interfaces for the Warp message format. Warp is a standardized message format for cross-chain messaging (XCM). These interfaces are designed to be implementation-agnostic and can be satisfied by different concrete types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address []byte

Address represents a blockchain address (size may vary by chain type)

type AddressedMessage

type AddressedMessage interface {
	Message

	// SourceAddress returns the source contract address
	SourceAddress() Address

	// DestinationAddress returns the destination contract address
	DestinationAddress() Address
}

AddressedMessage extends Message with contract addressing information

type ID

type ID [32]byte

ID represents a 32-byte identifier (chain ID, message ID, etc.)

type Message

type Message interface {
	// ID returns the unique identifier for this message
	ID() ID

	// SourceChainID returns the source blockchain identifier
	SourceChainID() ID

	// DestinationChainID returns the destination blockchain identifier
	DestinationChainID() ID

	// Payload returns the message payload
	Payload() []byte

	// Serialize returns the canonical byte representation for signing
	Serialize() ([]byte, error)
}

Message is the core interface for cross-chain messages

type MessageFactory

type MessageFactory interface {
	// NewMessage creates a new unsigned message
	NewMessage(sourceChain, destChain ID, payload []byte) UnsignedMessage

	// NewAddressedMessage creates a new addressed message
	NewAddressedMessage(sourceChain, destChain ID, sourceAddr, destAddr Address, payload []byte) AddressedMessage
}

MessageFactory creates messages

type SignedMessage

type SignedMessage interface {
	UnsignedMessage

	// Signature returns the aggregated BLS signature
	Signature() []byte

	// SignerBitmap indicates which validators signed
	SignerBitmap() []byte

	// Verify checks if the signatures are valid for the given validator set
	Verify(validators ValidatorSet) error
}

SignedMessage represents a message with validator signatures

type Signer

type Signer interface {
	// Sign creates a signature for the message
	Sign(ctx context.Context, message UnsignedMessage) ([]byte, error)
}

Signer signs messages

type UnsignedMessage

type UnsignedMessage interface {
	Message

	// Timestamp returns when the message was created
	Timestamp() time.Time

	// Nonce returns the replay protection nonce
	Nonce() uint64
}

UnsignedMessage represents a message that can be signed

type Validator

type Validator interface {
	// NodeID returns the validator's node identifier
	NodeID() ID

	// PublicKey returns the validator's public key
	PublicKey() []byte

	// Weight returns the validator's voting weight
	Weight() uint64
}

Validator represents a network validator

type ValidatorSet

type ValidatorSet interface {
	// GetValidator returns a validator by index
	GetValidator(index int) (Validator, error)

	// Validators returns all validators in the set
	Validators() []Validator

	// TotalWeight returns the total weight of all validators
	TotalWeight() uint64

	// Threshold returns the minimum weight needed for consensus
	Threshold() uint64

	// Height returns the blockchain height this set is valid for
	Height() uint64

	// Contains checks if a validator is in the set
	Contains(nodeID ID) (Validator, bool)
}

ValidatorSet represents a set of validators at a specific height

type Verifier

type Verifier interface {
	// Verify checks if a signature is valid
	Verify(message UnsignedMessage, signature []byte, validators ValidatorSet) error
}

Verifier verifies message signatures

Jump to

Keyboard shortcuts

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