warp

package
v1.102.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: GPL-3.0, LGPL-3.0, LGPL-3.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ParseErrCode = iota + 1
	VerifyErrCode
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API introduces chain specific functionality to the evm

func NewAPI

func NewAPI(runtimeCtx runtime.VMContext, backend Backend, signatureAggregator *warp.SignatureAggregator, requirePrimaryNetworkSigners func() bool) *API

func (*API) GetBlockAggregateSignature

func (a *API) GetBlockAggregateSignature(ctx context.Context, blockID ids.ID, quorumNum uint64, chainIDStr string) (signedMessageBytes hexutil.Bytes, err error)

GetBlockAggregateSignature fetches the aggregate signature for the requested [blockID]

func (*API) GetBlockSignature

func (a *API) GetBlockSignature(ctx context.Context, blockID ids.ID) (hexutil.Bytes, error)

GetBlockSignature returns the BLS signature associated with a blockID.

func (*API) GetMessage

func (a *API) GetMessage(ctx context.Context, messageID ids.ID) (hexutil.Bytes, error)

GetMessage returns the Warp message associated with a messageID.

func (*API) GetMessageAggregateSignature

func (a *API) GetMessageAggregateSignature(ctx context.Context, messageID ids.ID, quorumNum uint64, chainIDStr string) (signedMessageBytes hexutil.Bytes, err error)

GetMessageAggregateSignature fetches the aggregate signature for the requested [messageID]

func (*API) GetMessageSignature

func (a *API) GetMessageSignature(ctx context.Context, messageID ids.ID) (hexutil.Bytes, error)

GetMessageSignature returns the BLS signature associated with a messageID.

type AppError added in v0.8.8

type AppError struct {
	Code    int
	Message string
}

AppError represents an application-level error with a code

func (*AppError) Error added in v0.8.8

func (e *AppError) Error() string

Error implements the error interface

type Backend

type Backend interface {
	// AddMessage signs [core] and adds it to the warp backend database.
	AddMessage(msg *warp.Message) error

	// GetMessageSignature validates the message and returns the signature of the requested message.
	GetMessageSignature(ctx context.Context, msg *warp.Message) ([]byte, error)

	// GetBlockSignature returns the signature of a hash payload containing blockID if it's the ID of an accepted block.
	GetBlockSignature(ctx context.Context, blockID ids.ID) ([]byte, error)

	// GetMessage retrieves the [core] from the warp backend database if available.
	GetMessage(messageHash ids.ID) (*warp.Message, error)

	// Verify verifies the signature of the message.
	Verify(ctx context.Context, msg *warp.Message, _ []byte) error
}

Backend tracks signature-eligible warp messages and provides an interface to fetch them. The backend is also used to query for warp message signatures by the signature request handler.

Post-ZAP the signed subject is the warp.Message (its D = ID() is what the BLS Beam signs via warp.BeamSigningBytes(D)); the deleted RLP unsigned-message type is gone.

func NewBackend

func NewBackend(
	networkID uint32,
	sourceChainID ids.ID,
	warpSigner warp.Signer,
	blockClient BlockClient,
	validatorReader interfaces.ValidatorReader,
	db database.Database,
	signatureCache cache.Cacher[ids.ID, []byte],
	offchainMessages [][]byte,
) (Backend, error)

NewBackend creates a new Backend, and initializes the signature cache and message tracking database.

type BlockClient

type BlockClient interface {
	GetAcceptedBlock(ctx context.Context, blockID ids.ID) (chain.Block, error)
}

type Client

type Client interface {
	GetMessage(ctx context.Context, messageID ids.ID) ([]byte, error)
	GetMessageSignature(ctx context.Context, messageID ids.ID) ([]byte, error)
	GetMessageAggregateSignature(ctx context.Context, messageID ids.ID, quorumNum uint64, chainIDStr string) ([]byte, error)
	GetBlockSignature(ctx context.Context, blockID ids.ID) ([]byte, error)
	GetBlockAggregateSignature(ctx context.Context, blockID ids.ID, quorumNum uint64, chainIDStr string) ([]byte, error)
}

func NewClient

func NewClient(uri, chain string) (Client, error)

NewClient returns a Client for interacting with EVM chain

Directories

Path Synopsis
warptest exposes common functionality for testing the warp package.
warptest exposes common functionality for testing the warp package.

Jump to

Keyboard shortcuts

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