backend

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// AddMessage adds a message to be sent
	AddMessage(msg *warp.UnsignedMessage) error

	// GetMessage retrieves a verified message by index
	GetMessage(index uint32) (*warp.Message, error)

	// GetValidatorState returns the validator state
	GetValidatorState() warp.ValidatorState
}

Backend is the interface for warp message handling

type ChainBackend

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

ChainBackend is a backend that integrates with blockchain state

func NewChainBackend

func NewChainBackend(validatorState warp.ValidatorState, chainID common.Hash) *ChainBackend

NewChainBackend creates a new chain backend

func (*ChainBackend) AddMessage

func (b *ChainBackend) AddMessage(msg *warp.UnsignedMessage) error

AddMessage adds a message to be sent

func (*ChainBackend) AddVerifiedMessage

func (b *ChainBackend) AddVerifiedMessage(index uint32, msg *warp.Message) error

AddVerifiedMessage adds a pre-verified message

func (*ChainBackend) ClearPendingMessages

func (b *ChainBackend) ClearPendingMessages()

ClearPendingMessages clears all pending messages

func (*ChainBackend) GetMessage

func (b *ChainBackend) GetMessage(index uint32) (*warp.Message, error)

GetMessage retrieves a verified message by index

func (*ChainBackend) GetPendingMessages

func (b *ChainBackend) GetPendingMessages() []*warp.UnsignedMessage

GetPendingMessages returns all pending unsigned messages

func (*ChainBackend) GetValidatorState

func (b *ChainBackend) GetValidatorState() warp.ValidatorState

GetValidatorState returns the validator state

type MemoryBackend

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

MemoryBackend is an in-memory implementation of the warp backend

func NewMemoryBackend

func NewMemoryBackend(validatorState warp.ValidatorState, s signer.Signer) *MemoryBackend

NewMemoryBackend creates a new memory backend

func (*MemoryBackend) AddMessage

func (b *MemoryBackend) AddMessage(unsignedMsg *warp.UnsignedMessage) error

AddMessage adds a message to be sent

func (*MemoryBackend) GetMessage

func (b *MemoryBackend) GetMessage(index uint32) (*warp.Message, error)

GetMessage retrieves a verified message by index

func (*MemoryBackend) GetValidatorState

func (b *MemoryBackend) GetValidatorState() warp.ValidatorState

GetValidatorState returns the validator state

type MockValidatorState

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

MockValidatorState is a mock implementation of ValidatorState

func NewMockValidatorState

func NewMockValidatorState(validators []*warp.Validator, height uint64) *MockValidatorState

NewMockValidatorState creates a new mock validator state

func (*MockValidatorState) GetCurrentHeight

func (m *MockValidatorState) GetCurrentHeight() (uint64, error)

GetCurrentHeight returns the current height

func (*MockValidatorState) GetValidatorSet

func (m *MockValidatorState) GetValidatorSet(chainID ids.ID, height uint64) (map[ids.NodeID]*warp.Validator, error)

GetValidatorSet returns the validator set for a given chain ID at a given height

Jump to

Keyboard shortcuts

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