vm

package
v0.0.0-...-3f8a4bd Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 53 Imported by: 4

Documentation

Overview

Package vm is a generated GoMock package.

Index

Constants

View Source
const (
	Endpoint = "/rpc"
)

Variables

View Source
var (
	ErrNotAdded       = errors.New("not added")
	ErrDropped        = errors.New("dropped")
	ErrNotReady       = errors.New("not ready")
	ErrStateMissing   = errors.New("state missing")
	ErrMessageMissing = errors.New("message missing")
	ErrStateSyncing   = errors.New("state still syncing")
)

Functions

func PrefixBlockHeightKey

func PrefixBlockHeightKey(height uint64) []byte

func PrefixBlockIDKey

func PrefixBlockIDKey(id ids.ID) []byte

func PrefixWarpFetchKey

func PrefixWarpFetchKey(txID ids.ID) []byte

func PrefixWarpSignatureKey

func PrefixWarpSignatureKey(txID ids.ID, signer *bls.PublicKey) []byte

Types

type BlockRPCClient

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

If you don't keep up, you will data

func NewBlockRPCClient

func NewBlockRPCClient(uri string) (*BlockRPCClient, error)

func (*BlockRPCClient) Close

func (c *BlockRPCClient) Close() error

func (*BlockRPCClient) Listen

func (c *BlockRPCClient) Listen(
	parser chain.Parser,
) (*chain.StatefulBlock, []*chain.Result, error)

type Config

type Config interface {
	GetTraceConfig() *trace.Config
	GetParallelism() int // how many cores to use during verification
	GetMempoolSize() int
	GetMempoolPayerSize() int
	GetMempoolExemptPayers() [][]byte
	GetDecisionsPort() uint16
	GetBlocksPort() uint16
	GetStreamingBacklogSize() int
	GetStateHistoryLength() int // how many roots back of data to keep to serve state queries
	GetStateCacheSize() int     // how many items to keep in value cache and node cache
	GetAcceptorSize() int       // how far back we can fall in processing accepted blocks
	GetStateSyncParallelism() int
	GetStateSyncMinBlocks() uint64
	GetStateSyncServerDelay() time.Duration
	GetBlockLRUSize() int
}

type Controller

type Controller interface {
	Initialize(
		inner *VM,
		snowCtx *snow.Context,
		gatherer ametrics.MultiGatherer,
		genesisBytes []byte,
		upgradeBytes []byte,
		configBytes []byte,
	) (
		config Config,
		genesis Genesis,
		builder builder.Builder,
		gossiper gossiper.Gossiper,

		vmDB database.Database,
		stateDB database.Database,
		handler Handlers,
		actionRegistry chain.ActionRegistry,
		authRegistry chain.AuthRegistry,
		err error,
	)

	Rules(t int64) chain.Rules

	// StateManager is used by the VM to request keys to store required
	// information in state (without clobbering things the Controller is
	// storing).
	StateManager() chain.StateManager

	// Anything that the VM wishes to store outside of state or blocks must be
	// recorded here
	Accepted(ctx context.Context, blk *chain.StatelessBlock) error
	Rejected(ctx context.Context, blk *chain.StatelessBlock) error

	// Shutdown should be used by the [Controller] to terminate any async
	// processes it may be running in the background. It is invoked when
	// `vm.Shutdown` is called.
	Shutdown(context.Context) error
}

type DecisionRPCClient

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

If you don't keep up, you will data

func NewDecisionRPCClient

func NewDecisionRPCClient(uri string) (*DecisionRPCClient, error)

func (*DecisionRPCClient) Close

func (d *DecisionRPCClient) Close() error

func (*DecisionRPCClient) IssueTx

func (d *DecisionRPCClient) IssueTx(tx *chain.Transaction) error

func (*DecisionRPCClient) Listen

func (d *DecisionRPCClient) Listen() (ids.ID, error, *chain.Result, error)

type Genesis

type Genesis interface {
	GetHRP() string
	Load(context.Context, atrace.Tracer, chain.Database) error
}

type GetWarpSignaturesArgs

type GetWarpSignaturesArgs struct {
	TxID ids.ID `json:"txID"`
}

type GetWarpSignaturesReply

type GetWarpSignaturesReply struct {
	Validators []*WarpValidator      `json:"validators"`
	Message    *warp.UnsignedMessage `json:"message"`
	Signatures []*WarpSignature      `json:"signatures"`
}

type Handler

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

func (*Handler) BlocksPort

func (h *Handler) BlocksPort(_ *http.Request, _ *struct{}, reply *PortReply) error

func (*Handler) DecisionsPort

func (h *Handler) DecisionsPort(_ *http.Request, _ *struct{}, reply *PortReply) error

func (*Handler) GetWarpSignatures

func (h *Handler) GetWarpSignatures(
	req *http.Request,
	args *GetWarpSignaturesArgs,
	reply *GetWarpSignaturesReply,
) error

func (*Handler) LastAccepted

func (h *Handler) LastAccepted(_ *http.Request, _ *struct{}, reply *LastAcceptedReply) error

func (*Handler) Network

func (h *Handler) Network(_ *http.Request, _ *struct{}, reply *NetworkReply) (err error)

func (*Handler) Ping

func (h *Handler) Ping(_ *http.Request, _ *struct{}, reply *PingReply) (err error)

func (*Handler) SubmitTx

func (h *Handler) SubmitTx(req *http.Request, args *SubmitTxArgs, reply *SubmitTxReply) error

func (*Handler) SuggestedRawFee

func (h *Handler) SuggestedRawFee(
	req *http.Request,
	_ *struct{},
	reply *SuggestedRawFeeReply,
) error

type Handlers

type Handlers map[string]*common.HTTPHandler

type LastAcceptedReply

type LastAcceptedReply struct {
	Height    uint64 `json:"height"`
	BlockID   ids.ID `json:"blockId"`
	Timestamp int64  `json:"timestamp"`
}

type Metrics

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

type MockController

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

MockController is a mock of Controller interface.

func NewMockController

func NewMockController(ctrl *gomock.Controller) *MockController

NewMockController creates a new mock instance.

func (*MockController) Accepted

func (m *MockController) Accepted(arg0 context.Context, arg1 *chain.StatelessBlock) error

Accepted mocks base method.

func (*MockController) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockController) Initialize

Initialize mocks base method.

func (*MockController) Rejected

func (m *MockController) Rejected(arg0 context.Context, arg1 *chain.StatelessBlock) error

Rejected mocks base method.

func (*MockController) Rules

func (m *MockController) Rules(arg0 int64) chain.Rules

Rules mocks base method.

func (*MockController) Shutdown

func (m *MockController) Shutdown(arg0 context.Context) error

Shutdown mocks base method.

func (*MockController) StateManager

func (m *MockController) StateManager() chain.StateManager

StateManager mocks base method.

type MockControllerMockRecorder

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

MockControllerMockRecorder is the mock recorder for MockController.

func (*MockControllerMockRecorder) Accepted

func (mr *MockControllerMockRecorder) Accepted(arg0, arg1 interface{}) *gomock.Call

Accepted indicates an expected call of Accepted.

func (*MockControllerMockRecorder) Initialize

func (mr *MockControllerMockRecorder) Initialize(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call

Initialize indicates an expected call of Initialize.

func (*MockControllerMockRecorder) Rejected

func (mr *MockControllerMockRecorder) Rejected(arg0, arg1 interface{}) *gomock.Call

Rejected indicates an expected call of Rejected.

func (*MockControllerMockRecorder) Rules

func (mr *MockControllerMockRecorder) Rules(arg0 interface{}) *gomock.Call

Rules indicates an expected call of Rules.

func (*MockControllerMockRecorder) Shutdown

func (mr *MockControllerMockRecorder) Shutdown(arg0 interface{}) *gomock.Call

Shutdown indicates an expected call of Shutdown.

func (*MockControllerMockRecorder) StateManager

func (mr *MockControllerMockRecorder) StateManager() *gomock.Call

StateManager indicates an expected call of StateManager.

type NetworkHandler

type NetworkHandler interface {
	Connected(ctx context.Context, nodeID ids.NodeID, v *version.Application) error
	Disconnected(ctx context.Context, nodeID ids.NodeID) error

	AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

	AppRequest(
		ctx context.Context,
		nodeID ids.NodeID,
		requestID uint32,
		deadline time.Time,
		request []byte,
	) error
	AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
	AppResponse(
		ctx context.Context,
		nodeID ids.NodeID,
		requestID uint32,
		response []byte,
	) error

	CrossChainAppRequest(context.Context, ids.ID, uint32, time.Time, []byte) error
	CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error
	CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error
}

type NetworkManager

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

func NewNetworkManager

func NewNetworkManager(vm *VM, sender common.AppSender) *NetworkManager

func (*NetworkManager) AppGossip

func (n *NetworkManager) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

Handles incoming "AppGossip" messages, parses them to transactions, and submits them to the mempool. The "AppGossip" message is sent by the other VM via "common.AppSender" to receive txs and forward them to the other node (validator).

implements "snowmanblock.ChainVM.commom.VM.AppHandler" assume gossip via proposervm has been activated ref. "node/vms/platformvm/network.AppGossip"

func (*NetworkManager) AppRequest

func (n *NetworkManager) AppRequest(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	deadline time.Time,
	request []byte,
) error

implements "block.ChainVM.commom.VM.AppHandler"

func (*NetworkManager) AppRequestFailed

func (n *NetworkManager) AppRequestFailed(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
) error

implements "block.ChainVM.commom.VM.AppHandler"

func (*NetworkManager) AppResponse

func (n *NetworkManager) AppResponse(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	response []byte,
) error

implements "block.ChainVM.commom.VM.AppHandler"

func (*NetworkManager) Connected

func (n *NetworkManager) Connected(
	ctx context.Context,
	nodeID ids.NodeID,
	v *version.Application,
) error

implements "block.ChainVM.commom.VM.validators.Connector"

func (*NetworkManager) CrossChainAppRequest

func (n *NetworkManager) CrossChainAppRequest(
	ctx context.Context,
	chainID ids.ID,
	requestID uint32,
	deadline time.Time,
	msg []byte,
) error

func (*NetworkManager) CrossChainAppRequestFailed

func (n *NetworkManager) CrossChainAppRequestFailed(
	ctx context.Context,
	chainID ids.ID,
	requestID uint32,
) error

func (*NetworkManager) CrossChainAppResponse

func (n *NetworkManager) CrossChainAppResponse(
	ctx context.Context,
	chainID ids.ID,
	requestID uint32,
	response []byte,
) error

func (*NetworkManager) Disconnected

func (n *NetworkManager) Disconnected(ctx context.Context, nodeID ids.NodeID) error

implements "block.ChainVM.commom.VM.validators.Connector"

func (*NetworkManager) Register

func (n *NetworkManager) Register() (uint8, common.AppSender)

func (*NetworkManager) SetHandler

func (n *NetworkManager) SetHandler(handler uint8, h NetworkHandler)

Some callers take a sender before the handler is initialized, so we need to set the handler after initialization to avoid a potential panic.

TODO: in the future allow for queueing messages during the time between Register and SetHandler (should both happen in init so should not be an issue for standard usage)

type NetworkReply

type NetworkReply struct {
	NetworkID uint32 `json:"networkId"`
	SubnetID  ids.ID `json:"subnetId"`
	ChainID   ids.ID `json:"chainId"`
}

type PingReply

type PingReply struct {
	Success bool `json:"success"`
}

type PortReply

type PortReply struct {
	Port uint16 `json:"port"`
}

type ProposerMonitor

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

func NewProposerMonitor

func NewProposerMonitor(vm *VM) *ProposerMonitor

func (*ProposerMonitor) IsValidator

func (p *ProposerMonitor) IsValidator(ctx context.Context, nodeID ids.NodeID) (bool, error)

func (*ProposerMonitor) Proposers

func (p *ProposerMonitor) Proposers(
	ctx context.Context,
	diff int,
	depth int,
) (set.Set[ids.NodeID], error)

func (*ProposerMonitor) Validators

func (p *ProposerMonitor) Validators(
	ctx context.Context,
) (map[ids.NodeID]*validators.GetValidatorOutput, map[string]struct{})

type StateSyncHandler

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

func NewStateSyncHandler

func NewStateSyncHandler(vm *VM) *StateSyncHandler

func (*StateSyncHandler) AppGossip

func (*StateSyncHandler) AppRequest

func (s *StateSyncHandler) AppRequest(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	deadline time.Time,
	request []byte,
) error

func (*StateSyncHandler) AppRequestFailed

func (s *StateSyncHandler) AppRequestFailed(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
) error

func (*StateSyncHandler) AppResponse

func (s *StateSyncHandler) AppResponse(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	response []byte,
) error

func (*StateSyncHandler) Connected

func (s *StateSyncHandler) Connected(
	ctx context.Context,
	nodeID ids.NodeID,
	v *version.Application,
) error

func (*StateSyncHandler) CrossChainAppRequest

func (*StateSyncHandler) CrossChainAppRequest(
	context.Context,
	ids.ID,
	uint32,
	time.Time,
	[]byte,
) error

func (*StateSyncHandler) CrossChainAppRequestFailed

func (*StateSyncHandler) CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error

func (*StateSyncHandler) CrossChainAppResponse

func (*StateSyncHandler) CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error

func (*StateSyncHandler) Disconnected

func (s *StateSyncHandler) Disconnected(ctx context.Context, nodeID ids.NodeID) error

type SubmitTxArgs

type SubmitTxArgs struct {
	Tx []byte `json:"tx"`
}

type SubmitTxReply

type SubmitTxReply struct {
	TxID ids.ID `json:"txId"`
}

type SuggestedRawFeeReply

type SuggestedRawFeeReply struct {
	UnitPrice uint64 `json:"unitPrice"`
	BlockCost uint64 `json:"blockCost"`
}

type TxGossipHandler

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

func NewTxGossipHandler

func NewTxGossipHandler(vm *VM) *TxGossipHandler

func (*TxGossipHandler) AppGossip

func (t *TxGossipHandler) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

func (*TxGossipHandler) AppRequest

func (*TxGossipHandler) AppRequestFailed

func (*TxGossipHandler) AppRequestFailed(
	context.Context,
	ids.NodeID,
	uint32,
) error

func (*TxGossipHandler) AppResponse

func (*TxGossipHandler) AppResponse(
	context.Context,
	ids.NodeID,
	uint32,
	[]byte,
) error

func (*TxGossipHandler) Connected

func (*TxGossipHandler) CrossChainAppRequest

func (*TxGossipHandler) CrossChainAppRequest(
	context.Context,
	ids.ID,
	uint32,
	time.Time,
	[]byte,
) error

func (*TxGossipHandler) CrossChainAppRequestFailed

func (*TxGossipHandler) CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error

func (*TxGossipHandler) CrossChainAppResponse

func (*TxGossipHandler) CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error

func (*TxGossipHandler) Disconnected

func (*TxGossipHandler) Disconnected(context.Context, ids.NodeID) error

type VM

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

func New

func New(c Controller, v *version.Semantic) *VM

func (*VM) Accepted

func (vm *VM) Accepted(ctx context.Context, b *chain.StatelessBlock)

func (*VM) AcceptedSyncableBlock

func (vm *VM) AcceptedSyncableBlock(
	ctx context.Context,
	sb *chain.SyncableBlock,
) (block.StateSyncMode, error)

func (*VM) AppGossip

func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

Handles incoming "AppGossip" messages, parses them to transactions, and submits them to the mempool. The "AppGossip" message is sent by the other VM via "common.AppSender" to receive txs and forward them to the other node (validator).

implements "snowmanblock.ChainVM.commom.VM.AppHandler" assume gossip via proposervm has been activated ref. "node/vms/platformvm/network.AppGossip"

func (*VM) AppRequest

func (vm *VM) AppRequest(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	deadline time.Time,
	request []byte,
) error

implements "block.ChainVM.commom.VM.AppHandler"

func (*VM) AppRequestFailed

func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

implements "block.ChainVM.commom.VM.AppHandler"

func (*VM) AppResponse

func (vm *VM) AppResponse(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	response []byte,
) error

implements "block.ChainVM.commom.VM.AppHandler"

func (*VM) BlocksPort

func (vm *VM) BlocksPort() uint16

func (*VM) BuildBlock

func (vm *VM) BuildBlock(ctx context.Context) (snowman.Block, error)

implements "block.ChainVM"

func (*VM) BuildBlockWithContext

func (vm *VM) BuildBlockWithContext(
	ctx context.Context,
	blockContext *smblock.Context,
) (snowman.Block, error)

implements "block.BuildBlockWithContextChainVM"

func (*VM) Builder

func (vm *VM) Builder() builder.Builder

Used for integration and load testing

func (*VM) ChainID

func (vm *VM) ChainID() ids.ID

func (*VM) Connected

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, v *version.Application) error

implements "block.ChainVM.commom.VM.validators.Connector"

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers(_ context.Context) (map[string]*common.HTTPHandler, error)

implements "block.ChainVM.common.VM" for "ext/vm/[chainID]"

func (*VM) CreateStaticHandlers

func (*VM) CreateStaticHandlers(_ context.Context) (map[string]*common.HTTPHandler, error)

implements "block.ChainVM.common.VM" for "ext/vm/[vmID]"

func (*VM) CrossChainAppRequest

func (vm *VM) CrossChainAppRequest(
	ctx context.Context,
	nodeID ids.ID,
	requestID uint32,
	deadline time.Time,
	request []byte,
) error

func (*VM) CrossChainAppRequestFailed

func (vm *VM) CrossChainAppRequestFailed(
	ctx context.Context,
	nodeID ids.ID,
	requestID uint32,
) error

func (*VM) CrossChainAppResponse

func (vm *VM) CrossChainAppResponse(
	ctx context.Context,
	nodeID ids.ID,
	requestID uint32,
	response []byte,
) error

func (*VM) DecisionsPort

func (vm *VM) DecisionsPort() uint16

func (*VM) DeleteDiskBlock

func (vm *VM) DeleteDiskBlock(bid ids.ID) error

func (*VM) Disconnected

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

implements "block.ChainVM.commom.VM.validators.Connector"

func (*VM) EngineChan

func (vm *VM) EngineChan() chan<- common.Message

func (*VM) ForceReady

func (vm *VM) ForceReady()

ForceReady is used in integration testing

func (*VM) GetBlock

func (vm *VM) GetBlock(ctx context.Context, id ids.ID) (snowman.Block, error)

implements "block.ChainVM.commom.VM.Getter" replaces "core.SnowmanVM.GetBlock"

func (*VM) GetBlockIDAtHeight

func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, error)

GetBlockIDAtHeight implements snowmanblock.HeightIndexedChainVM Note: must return database.ErrNotFound if the index at height is unknown.

func (*VM) GetDiskBlock

func (vm *VM) GetDiskBlock(bid ids.ID) (*chain.StatefulBlock, error)

func (*VM) GetDiskBlockIDAtHeight

func (vm *VM) GetDiskBlockIDAtHeight(height uint64) (ids.ID, error)

func (*VM) GetDiskIsSyncing

func (vm *VM) GetDiskIsSyncing() (bool, error)

func (*VM) GetLastAccepted

func (vm *VM) GetLastAccepted() (ids.ID, error)

func (*VM) GetLastStateSummary

func (vm *VM) GetLastStateSummary(context.Context) (block.StateSummary, error)

GetLastStateSummary returns the latest state summary. If no summary is available, database.ErrNotFound must be returned.

func (*VM) GetOngoingSyncStateSummary

func (vm *VM) GetOngoingSyncStateSummary(ctx context.Context) (block.StateSummary, error)

func (*VM) GetOutgoingWarpMessage

func (vm *VM) GetOutgoingWarpMessage(txID ids.ID) (*warp.UnsignedMessage, error)

func (*VM) GetStateSummary

func (vm *VM) GetStateSummary(ctx context.Context, height uint64) (block.StateSummary, error)

GetStateSummary implements StateSyncableVM and returns a summary corresponding to the provided [height] if the node can serve state sync data for that key. If not, database.ErrNotFound must be returned.

func (*VM) GetStatelessBlock

func (vm *VM) GetStatelessBlock(ctx context.Context, blkID ids.ID) (*chain.StatelessBlock, error)

func (*VM) GetWarpFetch

func (vm *VM) GetWarpFetch(txID ids.ID) (int64, error)

func (*VM) GetWarpSignature

func (vm *VM) GetWarpSignature(txID ids.ID, signer *bls.PublicKey) (*WarpSignature, error)

func (*VM) GetWarpSignatures

func (vm *VM) GetWarpSignatures(txID ids.ID) ([]*WarpSignature, error)

func (*VM) Gossiper

func (vm *VM) Gossiper() gossiper.Gossiper

func (*VM) HRP

func (vm *VM) HRP() string

func (*VM) Handler

func (vm *VM) Handler() *Handler

func (*VM) HasLastAccepted

func (vm *VM) HasLastAccepted() (bool, error)

func (*VM) HealthCheck

func (vm *VM) HealthCheck(context.Context) (interface{}, error)

implements "block.ChainVM.commom.VM.health.Checkable"

func (*VM) Initialize

func (vm *VM) Initialize(
	ctx context.Context,
	snowCtx *snow.Context,
	manager manager.Manager,
	genesisBytes []byte,
	upgradeBytes []byte,
	configBytes []byte,
	toEngine chan<- common.Message,
	_ []*common.Fx,
	appSender common.AppSender,
) error

implements "block.ChainVM.common.VM"

func (*VM) IsBootstrapped

func (vm *VM) IsBootstrapped() bool

func (*VM) IsRepeat

func (vm *VM) IsRepeat(ctx context.Context, txs []*chain.Transaction) bool

func (*VM) IsValidator

func (vm *VM) IsValidator(ctx context.Context, nid ids.NodeID) (bool, error)

func (*VM) LastAccepted

func (vm *VM) LastAccepted(_ context.Context) (ids.ID, error)

"LastAccepted" implements "block.ChainVM" replaces "core.SnowmanVM.LastAccepted"

func (*VM) LastAcceptedBlock

func (vm *VM) LastAcceptedBlock() *chain.StatelessBlock

func (*VM) Logger

func (vm *VM) Logger() logging.Logger

func (*VM) Manager

func (vm *VM) Manager() manager.Manager

func (*VM) Mempool

func (vm *VM) Mempool() chain.Mempool

func (*VM) NewStateSyncClient

func (vm *VM) NewStateSyncClient(
	gatherer ametrics.MultiGatherer,
) *stateSyncerClient

TODO: break out into own package

func (*VM) NodeID

func (vm *VM) NodeID() ids.NodeID

func (*VM) ParseBlock

func (vm *VM) ParseBlock(ctx context.Context, source []byte) (snowman.Block, error)

implements "block.ChainVM.commom.VM.Parser" replaces "core.SnowmanVM.ParseBlock"

func (*VM) ParseStateSummary

func (vm *VM) ParseStateSummary(ctx context.Context, bytes []byte) (block.StateSummary, error)

func (*VM) PreferredBlock

func (vm *VM) PreferredBlock(ctx context.Context) (*chain.StatelessBlock, error)

func (*VM) Proposers

func (vm *VM) Proposers(ctx context.Context, diff int, depth int) (set.Set[ids.NodeID], error)

func (*VM) PutDiskIsSyncing

func (vm *VM) PutDiskIsSyncing(v bool) error

func (*VM) ReadState

func (vm *VM) ReadState(ctx context.Context, keys [][]byte) ([][]byte, []error)

func (*VM) Registry

func (vm *VM) Registry() (chain.ActionRegistry, chain.AuthRegistry)

func (*VM) Rejected

func (vm *VM) Rejected(ctx context.Context, b *chain.StatelessBlock)

func (*VM) Rules

func (vm *VM) Rules(t int64) chain.Rules

func (*VM) SetLastAccepted

func (vm *VM) SetLastAccepted(block *chain.StatelessBlock) error

func (*VM) SetPreference

func (vm *VM) SetPreference(_ context.Context, id ids.ID) error

"SetPreference" implements "block.ChainVM" replaces "core.SnowmanVM.SetPreference"

func (*VM) SetState

func (vm *VM) SetState(_ context.Context, state snow.State) error

func (*VM) Shutdown

func (vm *VM) Shutdown(ctx context.Context) error

implements "block.ChainVM.common.VM"

func (*VM) State

func (vm *VM) State() (*merkledb.Database, error)

func (*VM) StateManager

func (vm *VM) StateManager() chain.StateManager

func (*VM) StateReady

func (vm *VM) StateReady() bool

func (*VM) StateSyncEnabled

func (vm *VM) StateSyncEnabled(ctx context.Context) (bool, error)

func (*VM) StopChan

func (vm *VM) StopChan() chan struct{}

func (*VM) StoreWarpFetch

func (vm *VM) StoreWarpFetch(txID ids.ID) error

func (*VM) StoreWarpSignature

func (vm *VM) StoreWarpSignature(txID ids.ID, signer *bls.PublicKey, signature []byte) error

func (*VM) Submit

func (vm *VM) Submit(
	ctx context.Context,
	verifySig bool,
	txs []*chain.Transaction,
) (errs []error)

func (*VM) SuggestedFee

func (vm *VM) SuggestedFee(ctx context.Context) (uint64, uint64, error)

func (*VM) Tracer

func (vm *VM) Tracer() trace.Tracer

func (*VM) UpdateSyncTarget

func (vm *VM) UpdateSyncTarget(b *chain.StatelessBlock) (bool, error)

func (*VM) ValidatorState

func (vm *VM) ValidatorState() validators.State

func (*VM) Verified

func (vm *VM) Verified(ctx context.Context, b *chain.StatelessBlock)

func (*VM) VerifyHeightIndex

func (*VM) VerifyHeightIndex(context.Context) error

VerifyHeightIndex implements snowmanblock.HeightIndexedChainVM

func (*VM) Version

func (vm *VM) Version(_ context.Context) (string, error)

implements "block.ChainVM.common.VM" TODO: this must be callable in the factory before initializing

func (*VM) Workers

func (vm *VM) Workers() *workers.Workers

type WarpHandler

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

func NewWarpHandler

func NewWarpHandler(vm *VM) *WarpHandler

func (*WarpHandler) AppGossip

func (*WarpHandler) AppGossip(context.Context, ids.NodeID, []byte) error

func (*WarpHandler) AppRequest

func (w *WarpHandler) AppRequest(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	_ time.Time,
	request []byte,
) error

func (*WarpHandler) AppRequestFailed

func (w *WarpHandler) AppRequestFailed(
	_ context.Context,
	_ ids.NodeID,
	requestID uint32,
) error

func (*WarpHandler) AppResponse

func (w *WarpHandler) AppResponse(
	_ context.Context,
	_ ids.NodeID,
	requestID uint32,
	response []byte,
) error

func (*WarpHandler) Connected

func (*WarpHandler) CrossChainAppRequest

func (*WarpHandler) CrossChainAppRequest(context.Context, ids.ID, uint32, time.Time, []byte) error

func (*WarpHandler) CrossChainAppRequestFailed

func (*WarpHandler) CrossChainAppRequestFailed(context.Context, ids.ID, uint32) error

func (*WarpHandler) CrossChainAppResponse

func (*WarpHandler) CrossChainAppResponse(context.Context, ids.ID, uint32, []byte) error

func (*WarpHandler) Disconnected

func (*WarpHandler) Disconnected(context.Context, ids.NodeID) error

type WarpManager

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

WarpManager takes requests to get signatures from other nodes and then stores the result in our DB for future usage.

func NewWarpManager

func NewWarpManager(vm *VM) *WarpManager

func (*WarpManager) AppRequest

func (w *WarpManager) AppRequest(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	request []byte,
) error

func (*WarpManager) Done

func (w *WarpManager) Done()

func (*WarpManager) GatherSignatures

func (w *WarpManager) GatherSignatures(ctx context.Context, txID ids.ID, msg []byte)

GatherSignatures makes a best effort to acquire signatures from other validators and store them inside the vmDB.

GatherSignatures may be called when a block is accepted (optimistically) or may be triggered by RPC (if missing signatures are detected). To prevent RPC abuse, we limit how frequently we attempt to gather signatures for a given TxID.

func (*WarpManager) HandleRequestFailed

func (w *WarpManager) HandleRequestFailed(requestID uint32) error

func (*WarpManager) HandleResponse

func (w *WarpManager) HandleResponse(requestID uint32, msg []byte) error

func (*WarpManager) Run

func (w *WarpManager) Run(appSender common.AppSender)

type WarpSignature

type WarpSignature struct {
	PublicKey []byte `json:"publicKey"`
	Signature []byte `json:"signature"`
}

type WarpValidator

type WarpValidator struct {
	NodeID    ids.NodeID `json:"nodeID"`
	PublicKey []byte     `json:"publicKey"`
	Weight    uint64     `json:"weight"`
}

type WrappedAppSender

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

WrappedAppSender is used to get a shared requestID and to prepend messages with the handler identifier.

func (*WrappedAppSender) SendAppGossip

func (w *WrappedAppSender) SendAppGossip(ctx context.Context, appGossipBytes []byte) error

Gossip an application-level message. A non-nil error should be considered fatal.

func (*WrappedAppSender) SendAppGossipSpecific

func (w *WrappedAppSender) SendAppGossipSpecific(
	ctx context.Context,
	nodeIDs set.Set[ids.NodeID],
	appGossipBytes []byte,
) error

func (*WrappedAppSender) SendAppRequest

func (w *WrappedAppSender) SendAppRequest(
	ctx context.Context,
	nodeIDs set.Set[ids.NodeID],
	requestID uint32,
	appRequestBytes []byte,
) error

Send an application-level request. A nil return value guarantees that for each nodeID in [nodeIDs], the VM corresponding to this AppSender eventually receives either: * An AppResponse from nodeID with ID [requestID] * An AppRequestFailed from nodeID with ID [requestID] Exactly one of the above messages will eventually be received per nodeID. A non-nil error should be considered fatal.

func (*WrappedAppSender) SendAppResponse

func (w *WrappedAppSender) SendAppResponse(
	ctx context.Context,
	nodeID ids.NodeID,
	requestID uint32,
	appResponseBytes []byte,
) error

Send an application-level response to a request. This response must be in response to an AppRequest that the VM corresponding to this AppSender received from [nodeID] with ID [requestID]. A non-nil error should be considered fatal.

func (*WrappedAppSender) SendCrossChainAppRequest

func (w *WrappedAppSender) SendCrossChainAppRequest(
	ctx context.Context,
	chainID ids.ID,
	requestID uint32,
	appRequestBytes []byte,
) error

SendCrossChainAppRequest sends an application-level request to a specific chain.

A nil return value guarantees that the VM corresponding to this CrossChainAppSender eventually receives either: * A CrossChainAppResponse from [chainID] with ID [requestID] * A CrossChainAppRequestFailed from [chainID] with ID [requestID] Exactly one of the above messages will eventually be received from [chainID]. A non-nil error should be considered fatal.

func (*WrappedAppSender) SendCrossChainAppResponse

func (w *WrappedAppSender) SendCrossChainAppResponse(
	ctx context.Context,
	chainID ids.ID,
	requestID uint32,
	appResponseBytes []byte,
) error

SendCrossChainAppResponse sends an application-level response to a specific chain

This response must be in response to a CrossChainAppRequest that the VM corresponding to this CrossChainAppSender received from [chainID] with ID [requestID]. A non-nil error should be considered fatal.

Jump to

Keyboard shortcuts

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