Documentation
¶
Index ¶
- Constants
- func SignMessage(signer WarpSigner, msg *luxWarp.UnsignedMessage) ([]byte, error)
- type API
- func (a *API) GetBlockAggregateSignature(ctx context.Context, blockID ids.ID, quorumNum uint64, subnetIDStr string) (signedMessageBytes hexutil.Bytes, err error)
- func (a *API) GetBlockSignature(ctx context.Context, blockID ids.ID) (hexutil.Bytes, error)
- func (a *API) GetMessage(ctx context.Context, messageID ids.ID) (hexutil.Bytes, error)
- func (a *API) GetMessageAggregateSignature(ctx context.Context, messageID ids.ID, quorumNum uint64, subnetIDStr string) (signedMessageBytes hexutil.Bytes, err error)
- func (a *API) GetMessageSignature(ctx context.Context, messageID ids.ID) (hexutil.Bytes, error)
- type AppError
- type Backend
- type BlockClient
- type Client
- type LP118SignerAdapter
- type LocalSigner
- type WarpSigner
Constants ¶
const ( ParseErrCode = iota + 1 VerifyErrCode )
Variables ¶
This section is empty.
Functions ¶
func SignMessage ¶ added in v0.8.8
func SignMessage(signer WarpSigner, msg *luxWarp.UnsignedMessage) ([]byte, error)
SignMessage signs a warp unsigned message
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API introduces chain specific functionality to the evm
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 ¶
GetBlockSignature returns the BLS signature associated with a blockID.
func (*API) GetMessage ¶
GetMessage returns the Warp message associated with a messageID.
type Backend ¶
type Backend interface {
// AddMessage signs [unsignedMessage] and adds it to the warp backend database
AddMessage(unsignedMessage *luxWarp.UnsignedMessage) error
// GetMessageSignature validates the message and returns the signature of the requested message.
GetMessageSignature(ctx context.Context, message *luxWarp.UnsignedMessage) ([]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 [unsignedMessage] from the warp backend database if available
GetMessage(messageHash ids.ID) (*luxWarp.UnsignedMessage, error)
// Verify verifies the signature of the message
Verify(ctx context.Context, unsignedMessage *luxWarp.UnsignedMessage, _ []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.
func NewBackend ¶
func NewBackend( networkID uint32, sourceChainID ids.ID, warpSigner WarpSigner, 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 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, 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)
}
type LP118SignerAdapter ¶ added in v0.8.8
type LP118SignerAdapter struct {
// contains filtered or unexported fields
}
LP118SignerAdapter adapts a LocalSigner to the lp118.Signer interface
func NewLP118SignerAdapter ¶ added in v0.8.8
func NewLP118SignerAdapter(signer *LocalSigner) *LP118SignerAdapter
NewLP118SignerAdapter creates a new adapter
func (*LP118SignerAdapter) Sign ¶ added in v0.8.8
func (a *LP118SignerAdapter) Sign(unsignedMsg *platformWarp.UnsignedMessage) ([]byte, error)
Sign implements the lp118.Signer interface (using platformvm/warp.UnsignedMessage)
type LocalSigner ¶ added in v0.8.8
type LocalSigner struct {
// contains filtered or unexported fields
}
LocalSigner implements signing with luxfi/crypto/bls
func NewLocalSigner ¶ added in v0.8.8
func NewLocalSigner(sk *bls.SecretKey) *LocalSigner
NewLocalSigner creates a new local signer using luxfi/crypto/bls
func (*LocalSigner) GetPublicKey ¶ added in v0.8.8
func (s *LocalSigner) GetPublicKey() *bls.PublicKey
GetPublicKey returns the public key
func (*LocalSigner) NodeID ¶ added in v0.8.8
func (s *LocalSigner) NodeID() ids.NodeID
NodeID returns the node ID derived from the public key
func (*LocalSigner) PublicKey ¶ added in v0.8.8
func (s *LocalSigner) PublicKey() []byte
PublicKey returns the public key as bytes
func (*LocalSigner) Sign ¶ added in v0.8.8
func (s *LocalSigner) Sign(msg []byte) ([]byte, error)
Sign signs the message with the private key
func (*LocalSigner) SignUnsignedMessage ¶ added in v0.8.8
func (s *LocalSigner) SignUnsignedMessage(unsignedMsg *luxWarp.UnsignedMessage) ([]byte, error)
SignUnsignedMessage signs an unsigned warp message
type WarpSigner ¶ added in v0.8.8
type WarpSigner interface {
// Sign signs a message and returns the signature bytes
Sign(msg []byte) ([]byte, error)
// PublicKey returns the public key bytes
PublicKey() []byte
// NodeID returns the node ID
NodeID() ids.NodeID
}
WarpSigner defines the interface for signing warp messages
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
warptest exposes common functionality for testing the warp package.
|
warptest exposes common functionality for testing the warp package. |