Documentation ¶
Index ¶
- Constants
- Variables
- func SubnetEVMJSONFormat(alias string) log.Format
- func SubnetEVMTermFormat(alias string) log.Format
- type Admin
- func (p *Admin) GetVMConfig(_ *http.Request, _ *struct{}, reply *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 *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 Batch
- type Block
- func (b *Block) Accept() 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) Reject() error
- func (b *Block) SetStatus(status choices.Status)
- func (b *Block) Status() choices.Status
- func (b *Block) String() string
- func (b *Block) Timestamp() time.Time
- func (b *Block) Verify() error
- type BlockValidator
- type BuildGenesisArgs
- type BuildGenesisReply
- type Client
- type Config
- type ConfigReply
- type Database
- type DecodeGenesisArgs
- type DecodeGenesisReply
- type Duration
- type Factory
- type GetAcceptedFrontReply
- type GossipHandler
- type GossipReceivedStats
- type GossipSentStats
- type GossipStats
- type Gossiper
- type SetLogLevelArgs
- type SnowmanAPI
- type StateSyncClient
- type StateSyncServer
- type StaticService
- type Status
- type SubnetEVMLogger
- type Syncer
- type Timer
- type VM
- func (vm *VM) CreateHandlers() (map[string]*commonEng.HTTPHandler, error)
- func (vm *VM) CreateStaticHandlers() (map[string]*commonEng.HTTPHandler, error)
- func (vm *VM) GetActivationTime() time.Time
- func (vm *VM) GetBlockIDAtHeight(blkHeight uint64) (ids.ID, error)
- func (vm *VM) GetCurrentNonce(address common.Address) (uint64, error)
- func (vm *VM) HealthCheck() (interface{}, error)
- func (vm *VM) Initialize(ctx *snow.Context, dbManager manager.Manager, genesisBytes []byte, ...) error
- func (vm *VM) NewBlockBuilder(notifyBuildBlockChan chan<- commonEng.Message) *blockBuilder
- func (vm *VM) ParseEthBlock(b []byte) (*types.Block, error)
- func (vm *VM) SetPreference(blkID ids.ID) error
- func (vm *VM) SetState(state snow.State) error
- func (vm *VM) Shutdown() error
- func (vm *VM) VerifyHeightIndex() error
- func (vm *VM) Version() (string, error)
Constants ¶
const ( GenesisTestAddr = "0x751a0b96e1042bee789452ecb20253fba40dbe85" GenesisTestKey = "0xabd71b35d559563fea757f0f5edbde286fb8c043105b15abb7cd57189306d7d1" )
test constants
Variables ¶
var ( // GitCommit is set by the build script GitCommit string // Version is the version of Subnet EVM Version string )
var ( // ID this VM should be referenced by ID = ids.ID{'s', 'u', 'b', 'n', 'e', 't', 'e', 'v', 'm'} )
Functions ¶
func SubnetEVMJSONFormat ¶ added in v0.4.6
func SubnetEVMTermFormat ¶ added in v0.4.6
Types ¶
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
Admin is the API service for admin API calls
func NewAdminService ¶
func (*Admin) GetVMConfig ¶ added in v0.4.6
func (p *Admin) GetVMConfig(_ *http.Request, _ *struct{}, reply *ConfigReply) error
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 *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 Batch ¶
Batch implements ethdb.Batch
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block implements the snowman.Block interface
func (*Block) SetStatus ¶
SetStatus implements the InternalBlock interface allowing ChainState to set the status on an existing block
type BlockValidator ¶
func NewBlockValidator ¶ added in v0.4.6
func NewBlockValidator() BlockValidator
type BuildGenesisArgs ¶
type BuildGenesisArgs struct { GenesisData *core.Genesis `json:"genesisData"` Encoding formatting.Encoding `json:"encoding"` }
BuildGenesisArgs are arguments for BuildGenesis
type BuildGenesisReply ¶
type BuildGenesisReply struct { GenesisBytes string `json:"genesisBytes"` Encoding formatting.Encoding `json:"encoding"` }
BuildGenesisReply is the reply from BuildGenesis
type Client ¶
type Client interface { StartCPUProfiler(ctx context.Context) error StopCPUProfiler(ctx context.Context) error MemoryProfile(ctx context.Context) error LockProfile(ctx context.Context) error SetLogLevel(ctx context.Context, level log.Lvl) error GetVMConfig(ctx context.Context) (*Config, error) }
Client interface for interacting with EVM chain
func NewCChainClient ¶
NewCChainClient returns a Client for interacting with the C Chain
type Config ¶
type Config struct { // Subnet EVM APIs SnowmanAPIEnabled bool `json:"snowman-api-enabled"` AdminAPIEnabled bool `json:"admin-api-enabled"` AdminAPIDir string `json:"admin-api-dir"` // EnabledEthAPIs is a list of Ethereum services that should be enabled // If none is specified, then we use the default list [defaultEnabledAPIs] EnabledEthAPIs []string `json:"eth-apis"` // Continuous Profiler ContinuousProfilerDir string `json:"continuous-profiler-dir"` // If set to non-empty string creates a continuous profiler ContinuousProfilerFrequency Duration `json:"continuous-profiler-frequency"` // Frequency to run continuous profiler if enabled ContinuousProfilerMaxFiles int `json:"continuous-profiler-max-files"` // Maximum number of files to maintain // Gas/Price Caps RPCGasCap uint64 `json:"rpc-gas-cap"` RPCTxFeeCap float64 `json:"rpc-tx-fee-cap"` // Cache settings TrieCleanCache int `json:"trie-clean-cache"` // Size of the trie clean cache (MB) TrieCleanJournal string `json:"trie-clean-journal"` // Directory to use to save the trie clean cache (must be populated to enable journaling the trie clean cache) TrieCleanRejournal Duration `json:"trie-clean-rejournal"` // Frequency to re-journal the trie clean cache to disk (minimum 1 minute, must be populated to enable journaling the trie clean cache) TrieDirtyCache int `json:"trie-dirty-cache"` // Size of the trie dirty cache (MB) TrieDirtyCommitTarget int `json:"trie-dirty-commit-target"` // Memory limit to target in the dirty cache before performing a commit (MB) SnapshotCache int `json:"snapshot-cache"` // Size of the snapshot disk layer clean cache (MB) // Eth Settings Preimages bool `json:"preimages-enabled"` SnapshotAsync bool `json:"snapshot-async"` SnapshotVerify bool `json:"snapshot-verification-enabled"` // Pruning Settings Pruning bool `json:"pruning-enabled"` // If enabled, trie roots are only persisted every 4096 blocks AcceptorQueueLimit int `json:"accepted-queue-limit"` // Maximum blocks to queue before blocking during acceptance CommitInterval uint64 `json:"commit-interval"` // Specifies the commit interval at which to persist EVM and atomic tries. AllowMissingTries bool `json:"allow-missing-tries"` // If enabled, warnings preventing an incomplete trie index are suppressed PopulateMissingTries *uint64 `json:"populate-missing-tries,omitempty"` // Sets the starting point for re-populating missing tries. Disables re-generation if nil. PopulateMissingTriesParallelism int `json:"populate-missing-tries-parallelism"` // Number of concurrent readers to use when re-populating missing tries on startup. // Metric Settings MetricsExpensiveEnabled bool `json:"metrics-expensive-enabled"` // Debug-level metrics that might impact runtime performance // API Settings LocalTxsEnabled bool `json:"local-txs-enabled"` APIMaxDuration Duration `json:"api-max-duration"` WSCPURefillRate Duration `json:"ws-cpu-refill-rate"` WSCPUMaxStored Duration `json:"ws-cpu-max-stored"` MaxBlocksPerRequest int64 `json:"api-max-blocks-per-request"` AllowUnfinalizedQueries bool `json:"allow-unfinalized-queries"` AllowUnprotectedTxs bool `json:"allow-unprotected-txs"` // Keystore Settings KeystoreDirectory string `json:"keystore-directory"` // both absolute and relative supported KeystoreExternalSigner string `json:"keystore-external-signer"` KeystoreInsecureUnlockAllowed bool `json:"keystore-insecure-unlock-allowed"` // Gossip Settings RemoteGossipOnlyEnabled bool `json:"remote-gossip-only-enabled"` RegossipFrequency Duration `json:"regossip-frequency"` RegossipMaxTxs int `json:"regossip-max-txs"` RegossipTxsPerAddress int `json:"regossip-txs-per-address"` PriorityRegossipFrequency Duration `json:"priority-regossip-frequency"` PriorityRegossipMaxTxs int `json:"priority-regossip-max-txs"` PriorityRegossipTxsPerAddress int `json:"priority-regossip-txs-per-address"` PriorityRegossipAddresses []common.Address `json:"priority-regossip-addresses"` // Log LogLevel string `json:"log-level"` LogJSONFormat bool `json:"log-json-format"` // Address for Tx Fees (must be empty if not supported by blockchain) FeeRecipient string `json:"feeRecipient"` // Offline Pruning Settings OfflinePruning bool `json:"offline-pruning-enabled"` OfflinePruningBloomFilterSize uint64 `json:"offline-pruning-bloom-filter-size"` OfflinePruningDataDirectory string `json:"offline-pruning-data-directory"` // VM2VM network MaxOutboundActiveRequests int64 `json:"max-outbound-active-requests"` // Sync settings StateSyncEnabled bool `json:"state-sync-enabled"` StateSyncSkipResume bool `json:"state-sync-skip-resume"` // Forces state sync to use the highest available summary block StateSyncServerTrieCache int `json:"state-sync-server-trie-cache"` StateSyncIDs string `json:"state-sync-ids"` StateSyncCommitInterval uint64 `json:"state-sync-commit-interval"` StateSyncMinBlocks uint64 `json:"state-sync-min-blocks"` }
Config ...
func (Config) EthAPIs ¶
EthAPIs returns an array of strings representing the Eth APIs that should be enabled
func (Config) EthBackendSettings ¶
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
type ConfigReply ¶ added in v0.4.6
type ConfigReply struct {
Config *Config `json:"config"`
}
type Database ¶
Database implements ethdb.Database
func (Database) NewBatchWithSize ¶ added in v0.4.6
NewBatchWithSize implements ethdb.Database TODO: propagate size through avalanchego Database interface
func (Database) NewIterator ¶
NewIterator implements ethdb.Database
Note: This method assumes that the prefix is NOT part of the start, so there's no need for the caller to prepend the prefix to the start.
func (Database) NewIteratorWithStart ¶
NewIteratorWithStart implements ethdb.Database
type DecodeGenesisArgs ¶
type DecodeGenesisArgs struct { GenesisBytes string `json:"genesisBytes"` Encoding formatting.Encoding `json:"encoding"` }
DecodeGenesisArgs are arguments for DecodeGenesis
type DecodeGenesisReply ¶
type DecodeGenesisReply struct { Genesis *core.Genesis `json:"genesisData"` Encoding formatting.Encoding `json:"encoding"` }
DecodeGenesisReply is the reply from DecodeGenesis
type Duration ¶
func (Duration) MarshalJSON ¶ added in v0.4.6
String implements the stringer interface.
func (*Duration) UnmarshalJSON ¶
type GetAcceptedFrontReply ¶
type GetAcceptedFrontReply struct { Hash common.Hash `json:"hash"` Number *big.Int `json:"number"` }
GetAcceptedFrontReply defines the reply that will be sent from the GetAcceptedFront API call
type GossipHandler ¶
type GossipHandler struct {
// contains filtered or unexported fields
}
GossipHandler handles incoming gossip messages
func NewGossipHandler ¶ added in v0.4.6
func NewGossipHandler(vm *VM, stats GossipReceivedStats) *GossipHandler
type GossipReceivedStats ¶ added in v0.4.6
type GossipReceivedStats interface { IncEthTxsGossipReceived() // new vs. known txs received IncEthTxsGossipReceivedKnown() IncEthTxsGossipReceivedNew() }
GossipReceivedStats groups functions for incoming gossip stats.
type GossipSentStats ¶ added in v0.4.6
type GossipSentStats interface { IncEthTxsGossipSent() // regossip IncEthTxsRegossipQueued() IncEthTxsRegossipQueuedLocal(count int) IncEthTxsRegossipQueuedRemote(count int) }
GossipSentStats groups functions for outgoing gossip stats.
type GossipStats ¶ added in v0.4.6
type GossipStats interface { GossipReceivedStats GossipSentStats }
GossipStats contains methods for updating incoming and outgoing gossip stats.
func NewGossipStats ¶ added in v0.4.6
func NewGossipStats() GossipStats
type Gossiper ¶ added in v0.4.6
type Gossiper interface { // GossipTxs sends AppGossip message containing the given [txs] GossipTxs(txs []*types.Transaction) error }
Gossiper handles outgoing gossip of transactions
type SetLogLevelArgs ¶
type SetLogLevelArgs struct {
Level string `json:"level"`
}
type SnowmanAPI ¶
type SnowmanAPI struct {
// contains filtered or unexported fields
}
SnowmanAPI introduces snowman specific functionality to the evm
func (*SnowmanAPI) GetAcceptedFront ¶
func (api *SnowmanAPI) GetAcceptedFront(ctx context.Context) (*GetAcceptedFrontReply, error)
GetAcceptedFront returns the last accepted block's hash and height
func (*SnowmanAPI) IssueBlock ¶
func (api *SnowmanAPI) IssueBlock(ctx context.Context) error
IssueBlock to the chain
type StateSyncClient ¶ added in v0.4.6
type StateSyncClient interface { // methods that implement the client side of [block.StateSyncableVM] StateSyncEnabled() (bool, error) GetOngoingSyncStateSummary() (block.StateSummary, error) ParseStateSummary(summaryBytes []byte) (block.StateSummary, error) // additional methods required by the evm package StateSyncClearOngoingSummary() error Shutdown() error Error() error }
func NewStateSyncClient ¶ added in v0.4.6
func NewStateSyncClient(config *stateSyncClientConfig) StateSyncClient
type StateSyncServer ¶ added in v0.4.6
type StateSyncServer interface { GetLastStateSummary() (block.StateSummary, error) GetStateSummary(uint64) (block.StateSummary, error) }
func NewStateSyncServer ¶ added in v0.4.6
func NewStateSyncServer(config *stateSyncServerConfig) StateSyncServer
type StaticService ¶
type StaticService struct{}
StaticService defines the static API services exposed by the evm
func CreateStaticService ¶
func CreateStaticService() *StaticService
func (*StaticService) BuildGenesis ¶
func (ss *StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, reply *BuildGenesisReply) error
BuildGenesis constructs a genesis file.
func (*StaticService) DecodeGenesis ¶
func (ss *StaticService) DecodeGenesis(_ *http.Request, args *DecodeGenesisArgs, reply *DecodeGenesisReply) error
BuildGenesis constructs a genesis file.
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 SubnetEVMLogger ¶ added in v0.4.6
func InitLogger ¶ added in v0.4.6
func InitLogger(alias string, level string, jsonFormat bool, writer io.Writer) (SubnetEVMLogger, error)
InitLogger initializes logger with alias and sets the log level and format with the original os.StdErr interface along with the context logger.
func (*SubnetEVMLogger) SetLogLevel ¶ added in v0.4.6
func (c *SubnetEVMLogger) SetLogLevel(level string) error
SetLogLevel sets the log level of initialized log handler.
type Syncer ¶ added in v0.4.6
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 Timer ¶ added in v0.4.7
type Timer struct {
// contains filtered or unexported fields
}
Timer wraps a timer object. This allows a user to specify a handler. Once specifying the handler, the dispatch thread can be called. The dispatcher will only return after calling Stop. SetTimeoutIn will result in calling the handler in the specified amount of time.
func NewStagedTimer ¶ added in v0.4.7
NewStagedTimer returns a timer that will execute [f] when a timeout occurs and execute an additional timeout after the returned duration if [f] returns true and some duration.
func NewTimer ¶ added in v0.4.7
func NewTimer(handler func()) *Timer
NewTimer creates a new timer object
func (*Timer) Cancel ¶ added in v0.4.7
func (t *Timer) Cancel()
Cancel the currently scheduled event
func (*Timer) SetTimeoutIn ¶ added in v0.4.7
SetTimeoutIn will set the timer to fire the handler in [duration]
type VM ¶
type VM struct { // *chain.State helps to implement the VM interface by wrapping blocks // with an efficient caching layer. *chain.State peer.Network // State sync server and client StateSyncServer StateSyncClient // contains filtered or unexported fields }
VM implements the snowman.ChainVM interface
func (*VM) CreateHandlers ¶
func (vm *VM) CreateHandlers() (map[string]*commonEng.HTTPHandler, error)
CreateHandlers makes new http handlers that can handle API calls
func (*VM) CreateStaticHandlers ¶
func (vm *VM) CreateStaticHandlers() (map[string]*commonEng.HTTPHandler, error)
CreateStaticHandlers makes new http handlers that can handle API calls
func (*VM) GetActivationTime ¶
implements SnowmanPlusPlusVM interface
func (*VM) GetBlockIDAtHeight ¶ added in v0.4.6
GetBlockAtHeight implements the HeightIndexedChainVM interface and returns the canonical block at [blkHeight]. If [blkHeight] is less than the height of the last accepted block, this will return the block accepted at that height. Otherwise, it may return a blkID that has not yet been accepted. Note: the engine assumes that if a block is not found at [blkHeight], 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) HealthCheck ¶
Health returns nil if this chain is healthy. Also returns details, which should be one of: string, []byte, map[string]string
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx *snow.Context, dbManager manager.Manager, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, toEngine chan<- commonEng.Message, fxs []*commonEng.Fx, appSender commonEng.AppSender, ) error
Initialize implements the snowman.ChainVM interface
func (*VM) NewBlockBuilder ¶
func (*VM) ParseEthBlock ¶ added in v0.4.6
func (*VM) SetPreference ¶
SetPreference sets what the current tail of the chain is
func (*VM) VerifyHeightIndex ¶ added in v0.4.6
VerifyHeightIndex always returns a nil error since the index is maintained by vm.blockChain.