Documentation
¶
Index ¶
- Constants
- Variables
- type Admin
- func (p *Admin) GetVMConfig(_ *http.Request, _ *struct{}, reply *client.ConfigReply) error
- func (p *Admin) LockProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error
- func (p *Admin) MemoryProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error
- func (p *Admin) SetLogLevel(_ *http.Request, args *client.SetLogLevelArgs, reply *api.EmptyReply) error
- func (p *Admin) StartCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error
- func (p *Admin) StopCPUProfiler(r *http.Request, _ *struct{}, _ *api.EmptyReply) error
- type AdminAPI
- func (api *AdminAPI) ExportChain(ctx context.Context, file string, first, last uint64) (bool, error)
- func (api *AdminAPI) GetVMConfig(ctx context.Context) (interface{}, error)
- func (api *AdminAPI) ImportChain(ctx context.Context, file string) (*ImportChainResult, error)
- func (api *AdminAPI) LockProfile(ctx context.Context) error
- func (api *AdminAPI) MemoryProfile(ctx context.Context) error
- func (api *AdminAPI) SetLogLevel(ctx context.Context, level string) error
- func (api *AdminAPI) StartCPUProfiler(ctx context.Context) error
- func (api *AdminAPI) StopCPUProfiler(ctx context.Context) error
- type AutominingConfig
- type Block
- func (b *Block) Accept(context.Context) error
- func (b *Block) Bytes() []byte
- func (b *Block) Height() uint64
- func (b *Block) ID() ids.ID
- func (b *Block) Parent() ids.ID
- func (b *Block) ParentID() ids.ID
- func (b *Block) Reject(context.Context) error
- func (b *Block) SetStatus(status choices.Status)
- func (b *Block) ShouldVerifyWithContext(context.Context) (bool, error)
- func (b *Block) Status() uint8
- func (b *Block) String() string
- func (b *Block) Timestamp() time.Time
- func (b *Block) Verify(context.Context) error
- func (b *Block) VerifyWithContext(ctx context.Context, proposerVMBlockCtx *block.Context) error
- type BlockValidator
- type DatabaseConfig
- type EthPushGossiper
- type Factory
- type GossipEthTx
- type GossipEthTxMarshaller
- type GossipEthTxPool
- func (g *GossipEthTxPool) Add(tx *GossipEthTx) error
- func (g *GossipEthTxPool) GetFilter() ([]byte, []byte)
- func (g *GossipEthTxPool) Has(txID ids.ID) bool
- func (g *GossipEthTxPool) IsSubscribed() bool
- func (g *GossipEthTxPool) Iterate(f func(tx *GossipEthTx) bool)
- func (g *GossipEthTxPool) Subscribe(ctx context.Context)
- type ImportChainResult
- type StateSyncClient
- type StateSyncServer
- type Status
- type Syncer
- type TestSender
- func (s *TestSender) SendCrossChainError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, ...) error
- func (s *TestSender) SendCrossChainRequest(ctx context.Context, chainID ids.ID, requestID uint32, requestBytes []byte) error
- func (s *TestSender) SendCrossChainResponse(ctx context.Context, chainID ids.ID, requestID uint32, responseBytes []byte) error
- func (s *TestSender) SendError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, ...) error
- func (s *TestSender) SendGossip(ctx context.Context, config p2p.SendConfig, msg []byte) error
- func (s *TestSender) SendGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], msg []byte) error
- func (s *TestSender) SendRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...) error
- func (s *TestSender) SendResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- type VM
- func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (vm *VM) BuildBlock(ctx context.Context) (nodeblock.Block, error)
- func (vm *VM) BuildBlockWithContext(ctx context.Context, proposerVMBlockCtx *nodeblock.Context) (nodeblock.Block, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, ver *nodeblock.VersionInfo) error
- func (vm *VM) CreateHTTP2Handler(context.Context) (http.Handler, error)
- func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)
- func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *warp.AppError) error
- func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VM) GetAcceptedBlock(ctx context.Context, blkID ids.ID) (nodeblock.Block, error)
- func (vm *VM) GetBlock(ctx context.Context, id ids.ID) (nodeblock.Block, error)
- func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, error)
- func (vm *VM) GetCurrentNonce(address common.Address) (uint64, error)
- func (vm *VM) GetLastStateSummary(ctx context.Context) (nodeblock.StateSummary, error)
- func (vm *VM) GetOngoingSyncStateSummary(ctx context.Context) (nodeblock.StateSummary, error)
- func (vm *VM) GetStateSummary(ctx context.Context, height uint64) (nodeblock.StateSummary, error)
- func (vm *VM) HealthCheck(context.Context) (chain.HealthResult, error)
- func (vm *VM) Initialize(ctx context.Context, init block.Init) error
- func (vm *VM) NewBlockBuilder() *blockBuilder
- func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error)
- func (vm *VM) ParseBlock(ctx context.Context, b []byte) (nodeblock.Block, error)
- func (vm *VM) ParseEthBlock(b []byte) (*types.Block, error)
- func (vm *VM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (nodeblock.StateSummary, error)
- func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VM) SetState(_ context.Context, state uint32) error
- func (vm *VM) Shutdown(context.Context) error
- func (vm *VM) StateSyncEnabled(ctx context.Context) (bool, error)
- func (vm *VM) Version(context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (block.Message, error)
- type VMState
- type ValidatorsAPI
Constants ¶
const ( VMUnknown = vm.Unknown // 0 VMStarting = vm.Starting // 1 VMStateSyncing = vm.Syncing // 2 VMBootstrapping = vm.Bootstrapping // 3 VMNormalOp = vm.Ready // 4 VMDegraded = vm.Degraded // 5 VMStopping = vm.Stopping // 6 VMStopped = vm.Stopped // 7 )
Re-export canonical state constants from github.com/luxfi/vm. One and only one definition — these are aliases, not copies.
const ( // TxGossipHandlerID is the handler ID for transaction gossip TxGossipHandlerID = uint64(0x1) )
Variables ¶
var ( // ID this VM should be referenced by IDStr = "evm" ID = ids.ID{'e', 'v', 'm'} )
var ( // GitCommit is set by the build script GitCommit string // Version is the version of Lux EVM (set by build script via ldflags) Version string = "v0.8.12" )
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
Admin is the API service for admin API calls (legacy Gorilla RPC handler). Import functionality is handled by AdminAPI in admin_api.go via geth RPC.
func NewAdminService ¶
func (*Admin) GetVMConfig ¶
func (*Admin) LockProfile ¶
LockProfile runs a mutex profile writing to the specified file
func (*Admin) MemoryProfile ¶
MemoryProfile runs a memory profile writing to the specified file
func (*Admin) SetLogLevel ¶
func (p *Admin) SetLogLevel(_ *http.Request, args *client.SetLogLevelArgs, reply *api.EmptyReply) error
func (*Admin) StartCPUProfiler ¶
StartCPUProfiler starts a cpu profile writing to the specified file
func (*Admin) StopCPUProfiler ¶
StopCPUProfiler stops the cpu profile
type AdminAPI ¶
type AdminAPI struct {
// contains filtered or unexported fields
}
AdminAPI provides admin-level RPC methods using geth's RPC server This enables underscore notation: admin_importChain, admin_exportChain, etc.
func NewAdminAPI ¶
NewAdminAPI creates a new AdminAPI instance for geth RPC server
func (*AdminAPI) ExportChain ¶
func (api *AdminAPI) ExportChain(ctx context.Context, file string, first, last uint64) (bool, error)
ExportChain exports a blockchain to a local file RPC: admin_exportChain
func (*AdminAPI) GetVMConfig ¶
GetVMConfig returns the VM configuration RPC: admin_getVMConfig
func (*AdminAPI) ImportChain ¶
ImportChain imports a blockchain from a local file. State is committed periodically during import for restart-safety. RPC: admin_importChain
func (*AdminAPI) LockProfile ¶
LockProfile runs a mutex profile writing to the specified file RPC: admin_lockProfile
func (*AdminAPI) MemoryProfile ¶
MemoryProfile runs a memory profile writing to the specified file RPC: admin_memoryProfile
func (*AdminAPI) SetLogLevel ¶
SetLogLevel sets the log level RPC: admin_setLogLevel
func (*AdminAPI) StartCPUProfiler ¶
StartCPUProfiler starts a cpu profile writing to the specified file RPC: admin_startCPUProfiler
type AutominingConfig ¶
type AutominingConfig struct {
// BuildBlock builds a new block and returns it wrapped for consensus.
// The block must implement both Verify() and Accept() methods.
BuildBlock func(ctx context.Context) (interface {
Verify(context.Context) error
Accept(context.Context) error
}, error)
// Interval is the minimum time between block builds.
Interval time.Duration
}
AutominingConfig contains configuration for automining.
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block implements the chain.Block interface
func (*Block) SetStatus ¶
SetStatus implements the chain.Block interface This is required for chain.Block but not used in our implementation
func (*Block) ShouldVerifyWithContext ¶
ShouldVerifyWithContext implements the block.WithVerifyContext interface
type BlockValidator ¶
func NewBlockValidator ¶
func NewBlockValidator() BlockValidator
type DatabaseConfig ¶
type DatabaseConfig struct {
// If true, all writes are to memory and are discarded at shutdown.
ReadOnly bool `json:"readOnly"`
// Path to database
Path string `json:"path"`
// Name of the database type to use
Name string `json:"name"`
// Config bytes (JSON) for the database
// See relevant (pebbledb, leveldb) config options
Config []byte `json:"-"`
}
type EthPushGossiper ¶
type EthPushGossiper struct {
// contains filtered or unexported fields
}
EthPushGossiper is used by the ETH backend to push transactions issued over the RPC and added to the mempool to peers.
func (*EthPushGossiper) Add ¶
func (e *EthPushGossiper) Add(tx *types.Transaction)
type GossipEthTx ¶
type GossipEthTx struct {
Tx *types.Transaction
}
func (*GossipEthTx) GossipID ¶
func (tx *GossipEthTx) GossipID() ids.ID
type GossipEthTxMarshaller ¶
type GossipEthTxMarshaller struct{}
func (GossipEthTxMarshaller) MarshalGossip ¶
func (GossipEthTxMarshaller) MarshalGossip(tx *GossipEthTx) ([]byte, error)
func (GossipEthTxMarshaller) UnmarshalGossip ¶
func (GossipEthTxMarshaller) UnmarshalGossip(bytes []byte) (*GossipEthTx, error)
type GossipEthTxPool ¶
type GossipEthTxPool struct {
// contains filtered or unexported fields
}
func NewGossipEthTxPool ¶
func NewGossipEthTxPool(mempool *txpool.TxPool, registerer metric.Registerer) (*GossipEthTxPool, error)
func (*GossipEthTxPool) Add ¶
func (g *GossipEthTxPool) Add(tx *GossipEthTx) error
Add enqueues the transaction to the mempool. Subscribe should be called to receive an event if tx is actually added to the mempool or not.
func (*GossipEthTxPool) GetFilter ¶
func (g *GossipEthTxPool) GetFilter() ([]byte, []byte)
func (*GossipEthTxPool) Has ¶
func (g *GossipEthTxPool) Has(txID ids.ID) bool
Has should just return whether or not the [txID] is still in the mempool, not whether it is in the mempool AND pending.
func (*GossipEthTxPool) IsSubscribed ¶
func (g *GossipEthTxPool) IsSubscribed() bool
IsSubscribed returns whether or not the gossip subscription is active.
func (*GossipEthTxPool) Iterate ¶
func (g *GossipEthTxPool) Iterate(f func(tx *GossipEthTx) bool)
func (*GossipEthTxPool) Subscribe ¶
func (g *GossipEthTxPool) Subscribe(ctx context.Context)
type ImportChainResult ¶
type ImportChainResult struct {
Success bool `json:"success"`
BlocksImported int `json:"blocksImported,omitempty"`
HeightBefore uint64 `json:"heightBefore,omitempty"`
HeightAfter uint64 `json:"heightAfter,omitempty"`
Message string `json:"message,omitempty"`
}
ImportChainResult represents the response from admin_importChain
type StateSyncClient ¶
type StateSyncClient interface {
// methods that implement the client side of [block.StateSyncableVM]
StateSyncEnabled(context.Context) (bool, error)
GetOngoingSyncStateSummary(context.Context) (block.StateSummary, error)
ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error)
// additional methods required by the evm package
ClearOngoingSummary() error
Shutdown() error
Error() error
}
func NewStateSyncClient ¶
func NewStateSyncClient(config *stateSyncClientConfig) StateSyncClient
type StateSyncServer ¶
type StateSyncServer interface {
GetLastStateSummary(context.Context) (block.StateSummary, error)
GetStateSummary(context.Context, uint64) (block.StateSummary, error)
}
func NewStateSyncServer ¶
func NewStateSyncServer(config *stateSyncServerConfig) StateSyncServer
type Status ¶
type Status uint32
Status ...
List of possible status values Unknown Zero value, means the status is not known Dropped means the transaction was in the mempool, but was dropped because it failed verification Processing means the transaction is in the mempool Accepted means the transaction was accepted
type Syncer ¶
Syncer represents a step in state sync, along with Start/Done methods to control and monitor progress. Error returns an error if any was encountered.
type TestSender ¶
type TestSender struct {
T *testing.T
CantSendGossip bool
CantSendGossipSpecific bool
CantSendRequest bool
CantSendResponse bool
CantSendError bool
SendGossipF func(context.Context, p2p.SendConfig, []byte) error
SendGossipSpecificF func(context.Context, set.Set[ids.NodeID], []byte) error
SendRequestF func(context.Context, set.Set[ids.NodeID], uint32, []byte) error
SendResponseF func(context.Context, ids.NodeID, uint32, []byte) error
SendErrorF func(context.Context, ids.NodeID, uint32, int32, string) error
SendCrossChainRequestF func(context.Context, ids.ID, uint32, []byte) error
SendCrossChainResponseF func(context.Context, ids.ID, uint32, []byte) error
SendCrossChainErrorF func(context.Context, ids.ID, uint32, int32, string) error
// Channel for capturing sent gossip messages
SentGossip chan []byte
}
TestSender is a test implementation of the p2p.Sender interface
func (*TestSender) SendCrossChainError ¶
func (s *TestSender) SendCrossChainError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) error
SendCrossChainError sends a cross-chain error
func (*TestSender) SendCrossChainRequest ¶
func (s *TestSender) SendCrossChainRequest(ctx context.Context, chainID ids.ID, requestID uint32, requestBytes []byte) error
SendCrossChainRequest sends a cross-chain request
func (*TestSender) SendCrossChainResponse ¶
func (s *TestSender) SendCrossChainResponse(ctx context.Context, chainID ids.ID, requestID uint32, responseBytes []byte) error
SendCrossChainResponse sends a cross-chain response
func (*TestSender) SendError ¶
func (s *TestSender) SendError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error
SendError implements p2p.Sender
func (*TestSender) SendGossip ¶
func (s *TestSender) SendGossip(ctx context.Context, config p2p.SendConfig, msg []byte) error
SendGossip implements p2p.Sender
func (*TestSender) SendGossipSpecific ¶
func (s *TestSender) SendGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], msg []byte) error
SendGossipSpecific sends gossip to specific nodes
func (*TestSender) SendRequest ¶
func (s *TestSender) SendRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, request []byte) error
SendRequest implements p2p.Sender
func (*TestSender) SendResponse ¶
func (s *TestSender) SendResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
SendResponse implements p2p.Sender
type VM ¶
type VM struct {
// *nodeChain.State helps to implement the VM interface by wrapping blocks
// with an efficient caching layer.
*nodeChain.State
Network *network.Network
// State sync server and client
StateSyncServer
StateSyncClient
// contains filtered or unexported fields
}
func (*VM) AppRequestFailed ¶
func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *warp.AppError) error
AppRequestFailed implements the VM interface
func (*VM) BuildBlock ¶
BuildBlock implements the ChainVM interface Uses State.BuildBlock to ensure proper block tracking (for LastAccepted, etc.)
func (*VM) BuildBlockWithContext ¶
func (vm *VM) BuildBlockWithContext(ctx context.Context, proposerVMBlockCtx *nodeblock.Context) (nodeblock.Block, error)
BuildBlockWithContext implements the BuildBlockWithContextChainVM interface
func (*VM) CreateHTTP2Handler ¶
func (*VM) CreateHandlers ¶
CreateHandlers makes new http handlers that can handle API calls
func (*VM) CrossChainAppRequestFailed ¶
func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *warp.AppError) error
CrossChainAppRequestFailed implements the VM interface
func (*VM) GetAcceptedBlock ¶
GetAcceptedBlock attempts to retrieve block [blkID] from the VM. This method only returns accepted blocks.
func (*VM) GetBlock ¶
getBlock attempts to retrieve block [id] from the VM to be wrapped by ChainState. GetBlock implements the ChainVM interface
func (*VM) GetBlockIDAtHeight ¶
GetBlockIDAtHeight returns the canonical block at [height]. Note: the engine assumes that if a block is not found at [height], then database.ErrNotFound will be returned. This indicates that the VM has state synced and does not have all historical blocks available.
func (*VM) GetCurrentNonce ¶
GetCurrentNonce returns the nonce associated with the address at the preferred block
func (*VM) GetLastStateSummary ¶
GetLastStateSummary implements the StateSyncableVM interface
func (*VM) GetOngoingSyncStateSummary ¶
GetOngoingSyncStateSummary implements the StateSyncableVM interface
func (*VM) GetStateSummary ¶
GetStateSummary implements the StateSyncableVM interface
func (*VM) HealthCheck ¶
HealthCheck returns the health status of this chain.
func (*VM) Initialize ¶
Initialize implements the chain.ChainVM interface
func (*VM) NewBlockBuilder ¶
func (vm *VM) NewBlockBuilder() *blockBuilder
func (*VM) NewHTTPHandler ¶
NewHTTPHandler implements the chain.ChainVM interface
func (*VM) ParseBlock ¶
ParseBlock implements nodeblock.ChainVM interface
func (*VM) ParseStateSummary ¶
func (vm *VM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (nodeblock.StateSummary, error)
ParseStateSummary implements the StateSyncableVM interface
func (*VM) SetPreference ¶
SetPreference sets what the current tail of the chain is
func (*VM) StateSyncEnabled ¶
StateSyncEnabled implements the StateSyncableVM interface
type ValidatorsAPI ¶
type ValidatorsAPI struct {
// contains filtered or unexported fields
}
func (*ValidatorsAPI) GetCurrentValidators ¶
func (api *ValidatorsAPI) GetCurrentValidators(_ *http.Request, req *client.GetCurrentValidatorsRequest, reply *client.GetCurrentValidatorsResponse) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
blockgascost implements the block gas cost logic
|
blockgascost implements the block gas cost logic |
|
upgrade
|
|
|
feewindow
feewindow defines the dynamic fee window used by EVM.
|
feewindow defines the dynamic fee window used by EVM. |
|
state/interfaces
Package interfaces is a generated GoMock package.
|
Package interfaces is a generated GoMock package. |