Documentation ¶
Overview ¶
Package vm implements custom VM.
Index ¶
- Constants
- Variables
- type BalanceArgs
- type BalanceReply
- type BlockBuilder
- type ClaimedArgs
- type ClaimedReply
- type Config
- type GenesisReply
- type HasTxArgs
- type HasTxReply
- type InfoArgs
- type InfoReply
- type IssueRawTxArgs
- type IssueRawTxReply
- type IssueTxArgs
- type IssueTxReply
- type LastAcceptedReply
- type ManualBuilder
- type NetworkReply
- type OwnedArgs
- type OwnedReply
- type PingReply
- type PublicService
- func (svc *PublicService) Balance(_ *http.Request, args *BalanceArgs, reply *BalanceReply) error
- func (svc *PublicService) Claimed(_ *http.Request, args *ClaimedArgs, reply *ClaimedReply) error
- func (svc *PublicService) Genesis(_ *http.Request, _ *struct{}, reply *GenesisReply) (err error)
- func (svc *PublicService) HasTx(_ *http.Request, args *HasTxArgs, reply *HasTxReply) error
- func (svc *PublicService) Info(_ *http.Request, args *InfoArgs, reply *InfoReply) error
- func (svc *PublicService) IssueRawTx(_ *http.Request, args *IssueRawTxArgs, reply *IssueRawTxReply) error
- func (svc *PublicService) IssueTx(_ *http.Request, args *IssueTxArgs, reply *IssueTxReply) error
- func (svc *PublicService) LastAccepted(_ *http.Request, _ *struct{}, reply *LastAcceptedReply) error
- func (svc *PublicService) Network(_ *http.Request, _ *struct{}, reply *NetworkReply) (err error)
- func (svc *PublicService) Owned(_ *http.Request, args *OwnedArgs, reply *OwnedReply) error
- func (svc *PublicService) Ping(_ *http.Request, _ *struct{}, reply *PingReply) (err error)
- func (svc *PublicService) RecentActivity(_ *http.Request, _ *struct{}, reply *RecentActivityReply) error
- func (svc *PublicService) Resolve(_ *http.Request, args *ResolveArgs, reply *ResolveReply) error
- func (svc *PublicService) SuggestedFee(_ *http.Request, args *SuggestedFeeArgs, reply *SuggestedFeeReply) error
- func (svc *PublicService) SuggestedRawFee(_ *http.Request, _ *struct{}, reply *SuggestedRawFeeReply) error
- type PushNetwork
- type RecentActivityReply
- type ResolveArgs
- type ResolveReply
- type SuggestedFeeArgs
- type SuggestedFeeReply
- type SuggestedRawFeeReply
- type TimeBuilder
- type VM
- func (vm *VM) Accepted(b *chain.StatelessBlock)
- func (vm *VM) AppGossip(nodeID ids.NodeID, msg []byte) error
- func (vm *VM) AppRequest(nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error
- func (vm *VM) AppRequestFailed(nodeID ids.NodeID, requestID uint32) error
- func (vm *VM) AppResponse(nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VM) BuildBlock() (snowman.Block, error)
- func (vm *VM) Connected(id ids.NodeID, nodeVersion *avagoversion.Application) error
- func (vm *VM) CreateHandlers() (map[string]*common.HTTPHandler, error)
- func (vm *VM) CreateStaticHandlers() (map[string]*common.HTTPHandler, error)
- func (vm *VM) Disconnected(id ids.NodeID) error
- func (vm *VM) ExecutionContext(currTime int64, lastBlock *chain.StatelessBlock) (*chain.Context, error)
- func (vm *VM) Genesis() *chain.Genesis
- func (vm *VM) GetBlock(id ids.ID) (snowman.Block, error)
- func (vm *VM) GetStatelessBlock(blkID ids.ID) (*chain.StatelessBlock, error)
- func (vm *VM) HealthCheck() (interface{}, error)
- func (vm *VM) Initialize(ctx *snow.Context, dbManager manager.Manager, genesisBytes []byte, ...) error
- func (vm *VM) IsBootstrapped() bool
- func (vm *VM) LastAccepted() (ids.ID, error)
- func (vm *VM) Mempool() chain.Mempool
- func (vm *VM) Network() *PushNetwork
- func (vm *VM) NewManualBuilder() *ManualBuilder
- func (vm *VM) NewPushNetwork() *PushNetwork
- func (vm *VM) NewTimeBuilder() *TimeBuilder
- func (vm *VM) ParseBlock(source []byte) (snowman.Block, error)
- func (vm *VM) Rejected(b *chain.StatelessBlock)
- func (vm *VM) SetBlockBuilder(b func() BlockBuilder)
- func (vm *VM) SetPreference(id ids.ID) error
- func (vm *VM) SetState(state snow.State) error
- func (vm *VM) Shutdown() error
- func (vm *VM) State() database.Database
- func (vm *VM) Submit(txs ...*chain.Transaction) (errs []error)
- func (vm *VM) SuggestedFee() (uint64, uint64, error)
- func (vm *VM) ValidBlockID(blockID ids.ID) (bool, error)
- func (vm *VM) Verified(b *chain.StatelessBlock)
- func (vm *VM) Version() (string, error)
Constants ¶
const ( Name = "spacesvm" PublicEndpoint = "/public" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BalanceArgs ¶
type BalanceReply ¶
type BalanceReply struct {
Balance uint64 `serialize:"true" json:"balance"`
}
type BlockBuilder ¶
type BlockBuilder interface { Build() Gossip() HandleGenerateBlock() }
type ClaimedArgs ¶
type ClaimedArgs struct {
Space string `serialize:"true" json:"space"`
}
type ClaimedReply ¶
type ClaimedReply struct {
Claimed bool `serialize:"true" json:"claimed"`
}
type Config ¶
type Config struct { BuildInterval time.Duration `serialize:"true" json:"buildInterval"` GossipInterval time.Duration `serialize:"true" json:"gossipInterval"` RegossipInterval time.Duration `serialize:"true" json:"regossipInterval"` PruneLimit int `serialize:"true" json:"pruneLimit"` PruneInterval time.Duration `serialize:"true" json:"pruneInterval"` FullPruneInterval time.Duration `serialize:"true" json:"fullPruneInterval"` CompactInterval time.Duration `serialize:"true" json:"compactInterval"` MempoolSize int `serialize:"true" json:"mempoolSize"` ActivityCacheSize int `serialize:"true" json:"activityCacheSize"` }
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
type GenesisReply ¶
type HasTxReply ¶
type HasTxReply struct {
Accepted bool `serialize:"true" json:"accepted"`
}
type InfoReply ¶
type InfoReply struct { Info *chain.SpaceInfo `serialize:"true" json:"info"` Values []*chain.KeyValueMeta `serialize:"true" json:"values"` }
type IssueRawTxArgs ¶
type IssueRawTxArgs struct {
Tx []byte `serialize:"true" json:"tx"`
}
type IssueRawTxReply ¶
type IssueTxArgs ¶
type IssueTxReply ¶
type LastAcceptedReply ¶
type ManualBuilder ¶
type ManualBuilder struct {
// contains filtered or unexported fields
}
func (*ManualBuilder) Build ¶
func (b *ManualBuilder) Build()
func (*ManualBuilder) Gossip ¶
func (b *ManualBuilder) Gossip()
func (*ManualBuilder) HandleGenerateBlock ¶
func (b *ManualBuilder) HandleGenerateBlock()
func (*ManualBuilder) NotifyBuild ¶
func (b *ManualBuilder) NotifyBuild()
type NetworkReply ¶
type OwnedReply ¶
type OwnedReply struct {
Spaces []string `serialize:"true" json:"spaces"`
}
type PublicService ¶
type PublicService struct {
// contains filtered or unexported fields
}
func (*PublicService) Balance ¶
func (svc *PublicService) Balance(_ *http.Request, args *BalanceArgs, reply *BalanceReply) error
func (*PublicService) Claimed ¶
func (svc *PublicService) Claimed(_ *http.Request, args *ClaimedArgs, reply *ClaimedReply) error
func (*PublicService) Genesis ¶
func (svc *PublicService) Genesis(_ *http.Request, _ *struct{}, reply *GenesisReply) (err error)
func (*PublicService) HasTx ¶
func (svc *PublicService) HasTx(_ *http.Request, args *HasTxArgs, reply *HasTxReply) error
func (*PublicService) IssueRawTx ¶
func (svc *PublicService) IssueRawTx(_ *http.Request, args *IssueRawTxArgs, reply *IssueRawTxReply) error
func (*PublicService) IssueTx ¶
func (svc *PublicService) IssueTx(_ *http.Request, args *IssueTxArgs, reply *IssueTxReply) error
func (*PublicService) LastAccepted ¶
func (svc *PublicService) LastAccepted(_ *http.Request, _ *struct{}, reply *LastAcceptedReply) error
func (*PublicService) Network ¶
func (svc *PublicService) Network(_ *http.Request, _ *struct{}, reply *NetworkReply) (err error)
func (*PublicService) Owned ¶
func (svc *PublicService) Owned(_ *http.Request, args *OwnedArgs, reply *OwnedReply) error
func (*PublicService) Ping ¶
func (svc *PublicService) Ping(_ *http.Request, _ *struct{}, reply *PingReply) (err error)
func (*PublicService) RecentActivity ¶
func (svc *PublicService) RecentActivity(_ *http.Request, _ *struct{}, reply *RecentActivityReply) error
func (*PublicService) Resolve ¶
func (svc *PublicService) Resolve(_ *http.Request, args *ResolveArgs, reply *ResolveReply) error
func (*PublicService) SuggestedFee ¶
func (svc *PublicService) SuggestedFee( _ *http.Request, args *SuggestedFeeArgs, reply *SuggestedFeeReply, ) error
func (*PublicService) SuggestedRawFee ¶
func (svc *PublicService) SuggestedRawFee( _ *http.Request, _ *struct{}, reply *SuggestedRawFeeReply, ) error
type PushNetwork ¶
type PushNetwork struct {
// contains filtered or unexported fields
}
func (*PushNetwork) GossipNewTxs ¶
func (n *PushNetwork) GossipNewTxs(newTxs []*chain.Transaction) error
func (*PushNetwork) RegossipTxs ¶
func (n *PushNetwork) RegossipTxs() error
Triggers "AppGossip" on the pending transactions in the mempool. "force" is true to re-gossip whether recently gossiped or not
type RecentActivityReply ¶
type ResolveArgs ¶
type ResolveArgs struct {
Path string `serialize:"true" json:"path"`
}
type ResolveReply ¶
type SuggestedFeeArgs ¶
type SuggestedFeeReply ¶
type SuggestedRawFeeReply ¶
type TimeBuilder ¶
type TimeBuilder struct {
// contains filtered or unexported fields
}
TimeBuilder tells the engine when to build blocks and gossip transactions
func (*TimeBuilder) Build ¶
func (b *TimeBuilder) Build()
func (*TimeBuilder) Gossip ¶
func (b *TimeBuilder) Gossip()
periodically but less aggressively force-regossip the pending
func (*TimeBuilder) HandleGenerateBlock ¶
func (b *TimeBuilder) HandleGenerateBlock()
HandleGenerateBlock should be called immediately after [BuildBlock]. [HandleGenerateBlock] invocation could lead to quiesence, building a block with some delay, or attempting to build another block immediately.
type VM ¶
type VM struct { AirdropData []byte // contains filtered or unexported fields }
func (*VM) Accepted ¶
func (vm *VM) Accepted(b *chain.StatelessBlock)
func (*VM) AppGossip ¶
Handles incoming "AppGossip" messages, parses them to transactions, and submits them to the mempool. The "AppGossip" message is sent by the other VM (spacesvm) 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. "avalanchego/vms/platformvm/network.AppGossip" ref. "coreeth/plugin/evm.GossipHandler.HandleEthTxs"
func (*VM) AppRequest ¶
func (vm *VM) AppRequest(nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error
implements "snowmanblock.ChainVM.commom.VM.AppHandler"
func (*VM) AppRequestFailed ¶
implements "snowmanblock.ChainVM.commom.VM.AppHandler"
func (*VM) AppResponse ¶
implements "snowmanblock.ChainVM.commom.VM.AppHandler"
func (*VM) BuildBlock ¶
implements "snowmanblock.ChainVM" called via "avalanchego" node over RPC
func (*VM) Connected ¶
func (vm *VM) Connected(id ids.NodeID, nodeVersion *avagoversion.Application) error
implements "snowmanblock.ChainVM.commom.VM.validators.Connector"
func (*VM) CreateHandlers ¶
func (vm *VM) CreateHandlers() (map[string]*common.HTTPHandler, error)
implements "snowmanblock.ChainVM.common.VM" for "ext/vm/[chainID]"
func (*VM) CreateStaticHandlers ¶
func (vm *VM) CreateStaticHandlers() (map[string]*common.HTTPHandler, error)
implements "snowmanblock.ChainVM.common.VM" for "ext/vm/[vmID]"
func (*VM) Disconnected ¶
implements "snowmanblock.ChainVM.commom.VM.validators.Connector"
func (*VM) ExecutionContext ¶
func (*VM) GetBlock ¶
implements "snowmanblock.ChainVM.commom.VM.Getter" replaces "core.SnowmanVM.GetBlock"
func (*VM) GetStatelessBlock ¶
func (*VM) HealthCheck ¶
implements "snowmanblock.ChainVM.commom.VM.health.Checkable"
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx *snow.Context, dbManager manager.Manager, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, toEngine chan<- common.Message, _ []*common.Fx, appSender common.AppSender, ) error
implements "snowmanblock.ChainVM.common.VM"
func (*VM) IsBootstrapped ¶
func (*VM) LastAccepted ¶
"LastAccepted" implements "snowmanblock.ChainVM" replaces "core.SnowmanVM.LastAccepted"
func (*VM) NewManualBuilder ¶
func (vm *VM) NewManualBuilder() *ManualBuilder
func (*VM) NewPushNetwork ¶
func (vm *VM) NewPushNetwork() *PushNetwork
func (*VM) NewTimeBuilder ¶
func (vm *VM) NewTimeBuilder() *TimeBuilder
func (*VM) ParseBlock ¶
implements "snowmanblock.ChainVM.commom.VM.Parser" replaces "core.SnowmanVM.ParseBlock"
func (*VM) Rejected ¶
func (vm *VM) Rejected(b *chain.StatelessBlock)
func (*VM) SetBlockBuilder ¶
func (vm *VM) SetBlockBuilder(b func() BlockBuilder)
[SetBlockBuilder] changes the BlockBuilder during runtime by stopping the previous block builder and then starting a new one.
func (*VM) SetPreference ¶
"SetPreference" implements "snowmanblock.ChainVM" replaces "core.SnowmanVM.SetPreference"
func (*VM) Verified ¶
func (vm *VM) Verified(b *chain.StatelessBlock)