warp

package
v0.0.0-...-9e22ca1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: GPL-3.0, LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPIFetcher

func NewAPIFetcher(clients map[ids.NodeID]Client) *apiFetcher

Types

type API

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

API introduces snowman specific functionality to the evm

func NewAPI

func NewAPI(networkID uint32, sourceSubnetID ids.ID, sourceChainID ids.ID, state *validators.State, backend Backend, client peer.NetworkClient) *API

func (*API) GetBlockAggregateSignature

func (a *API) GetBlockAggregateSignature(ctx context.Context, blockID ids.ID, quorumNum uint64, subnetIDStr 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) GetMessageAggregateSignature

func (a *API) GetMessageAggregateSignature(ctx context.Context, messageID ids.ID, quorumNum uint64, subnetIDStr 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 Backend

type Backend interface {
	// AddMessage signs [unsignedMessage] and adds it to the warp backend database
	AddMessage(unsignedMessage *avalancheWarp.UnsignedMessage) error

	// GetMessageSignature returns the signature of the requested message hash.
	GetMessageSignature(messageID ids.ID) ([bls.SignatureLen]byte, error)

	// GetBlockSignature returns the signature of the requested message hash.
	GetBlockSignature(blockID ids.ID) ([bls.SignatureLen]byte, error)

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

	// Clear clears the entire db
	Clear() 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.

func NewBackend

func NewBackend(networkID uint32, sourceChainID ids.ID, warpSigner avalancheWarp.Signer, blockClient BlockClient, db database.Database, cacheSize int) Backend

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

type BlockClient

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

type Client

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

func NewClient

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

NewClient returns a Client for interacting with EVM [chain]

Directories

Path Synopsis
Package aggregator is a generated GoMock package.
Package aggregator is a generated GoMock package.

Jump to

Keyboard shortcuts

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