evm

package
v0.0.0-...-3922e60 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: LGPL-3.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenesisTestAddr = "0x751a0b96e1042bee789452ecb20253fba40dbe85"
	GenesisTestKey  = "0xabd71b35d559563fea757f0f5edbde286fb8c043105b15abb7cd57189306d7d1"
)

test constants

Variables

View Source
var (
	// GitCommit is set by the build script
	GitCommit string
	// Version is the version of Subnet EVM
	Version string
)
View Source
var (
	// ID this VM should be referenced by
	ID = ids.ID{'s', 'u', 'b', 'n', 'e', 't', 'e', 'v', 'm'}
)

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

func NewAdminService

func NewAdminService(vm *VM, performanceDir string) *Admin

func (*Admin) LockProfile

func (p *Admin) LockProfile(r *http.Request, args *struct{}, reply *api.SuccessResponse) error

LockProfile runs a mutex profile writing to the specified file

func (*Admin) MemoryProfile

func (p *Admin) MemoryProfile(r *http.Request, args *struct{}, reply *api.SuccessResponse) error

MemoryProfile runs a memory profile writing to the specified file

func (*Admin) SetLogLevel

func (p *Admin) SetLogLevel(r *http.Request, args *SetLogLevelArgs, reply *api.SuccessResponse) error

func (*Admin) StartCPUProfiler

func (p *Admin) StartCPUProfiler(r *http.Request, args *struct{}, reply *api.SuccessResponse) error

StartCPUProfiler starts a cpu profile writing to the specified file

func (*Admin) StopCPUProfiler

func (p *Admin) StopCPUProfiler(r *http.Request, args *struct{}, reply *api.SuccessResponse) error

StopCPUProfiler stops the cpu profile

type Batch

type Batch struct{ database.Batch }

Batch implements ethdb.Batch

func (Batch) Replay

func (batch Batch) Replay(w ethdb.KeyValueWriter) error

Replay implements ethdb.Batch

func (Batch) ValueSize

func (batch Batch) ValueSize() int

ValueSize implements ethdb.Batch

type Block

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

Block implements the snowman.Block interface

func (*Block) Accept

func (b *Block) Accept() error

Accept implements the snowman.Block interface

func (*Block) Bytes

func (b *Block) Bytes() []byte

Bytes implements the snowman.Block interface

func (*Block) Height

func (b *Block) Height() uint64

Height implements the snowman.Block interface

func (*Block) ID

func (b *Block) ID() ids.ID

ID implements the snowman.Block interface

func (*Block) Parent

func (b *Block) Parent() ids.ID

Parent implements the snowman.Block interface

func (*Block) Reject

func (b *Block) Reject() error

Reject implements the snowman.Block interface

func (*Block) SetStatus

func (b *Block) SetStatus(status choices.Status)

SetStatus implements the InternalBlock interface allowing ChainState to set the status on an existing block

func (*Block) Status

func (b *Block) Status() choices.Status

Status implements the snowman.Block interface

func (*Block) String

func (b *Block) String() string

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

Timestamp implements the snowman.Block interface

func (*Block) Verify

func (b *Block) Verify() error

Verify implements the snowman.Block interface

type BlockValidator

type BlockValidator interface {
	SyntacticVerify(b *Block) error
}

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) (bool, error)
	StopCPUProfiler(ctx context.Context) (bool, error)
	MemoryProfile(ctx context.Context) (bool, error)
	LockProfile(ctx context.Context) (bool, error)
	SetLogLevel(ctx context.Context, level log.Lvl) (bool, error)
}

Client interface for interacting with EVM chain

func NewCChainClient

func NewCChainClient(uri string) Client

NewCChainClient returns a Client for interacting with the C Chain

func NewClient

func NewClient(uri, chain string) Client

NewClient returns a Client for interacting with EVM 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"`

	// Eth Settings
	Preimages      bool `json:"preimages-enabled"`
	Pruning        bool `json:"pruning-enabled"`
	SnapshotAsync  bool `json:"snapshot-async"`
	SnapshotVerify bool `json:"snapshot-verification-enabled"`

	// Metric Settings
	MetricsEnabled          bool `json:"metrics-enabled"`
	MetricsExpensiveEnabled bool `json:"metrics-expensive-enabled"`

	// 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
	RemoteTxGossipOnlyEnabled bool     `json:"remote-tx-gossip-only-enabled"`
	TxRegossipFrequency       Duration `json:"tx-regossip-frequency"`
	TxRegossipMaxSize         int      `json:"tx-regossip-max-size"`

	// Log level
	LogLevel string `json:"log-level"`

	// 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"`
}

Config ...

func (Config) EthAPIs

func (c Config) EthAPIs() []string

EthAPIs returns an array of strings representing the Eth APIs that should be enabled

func (Config) EthBackendSettings

func (c Config) EthBackendSettings() eth.Settings

func (*Config) SetDefaults

func (c *Config) SetDefaults()

type Database

type Database struct{ database.Database }

Database implements ethdb.Database

func (Database) NewBatch

func (db Database) NewBatch() ethdb.Batch

NewBatch implements ethdb.Database

func (Database) NewIterator

func (db Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator

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

func (db Database) NewIteratorWithStart(start []byte) ethdb.Iterator

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

type Duration struct {
	time.Duration
}

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) (err error)

type Factory

type Factory struct{}

func (*Factory) New

func (f *Factory) New(*snow.Context) (interface{}, error)

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

func NewGossipHandler(vm *VM) *GossipHandler

func (*GossipHandler) HandleTxs

func (h *GossipHandler) HandleTxs(nodeID ids.ShortID, msg *message.Txs) error

type Gossiper

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 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 ...

const (
	Unknown Status = iota
	Dropped
	Processing
	Accepted
)

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

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (Status) String

func (s Status) String() string

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

func (Status) Valid

func (s Status) Valid() error

Valid returns nil if the status is a valid status.

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

	PythStreamer streamer.PythStreamer // Gattaca Mod
	// 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

func (vm *VM) GetActivationTime() time.Time

implements SnowmanPlusPlusVM interface

func (*VM) GetBlockIDAtHeight

func (vm *VM) GetBlockIDAtHeight(blkHeight uint64) (ids.ID, error)

GetBlockIDAtHeight retrieves the blkID of the canonical block at [blkHeight] if [blkHeight] is less than the height of the last accepted block, this will return a canonical block. Otherwise, it may return a blkID that has not yet been accepted.

func (*VM) GetCurrentNonce

func (vm *VM) GetCurrentNonce(address common.Address) (uint64, error)

GetCurrentNonce returns the nonce associated with the address at the preferred block

func (*VM) HealthCheck

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

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 *VM) NewBlockBuilder(notifyBuildBlockChan chan<- commonEng.Message) *blockBuilder

func (*VM) SetPreference

func (vm *VM) SetPreference(blkID ids.ID) error

SetPreference sets what the current tail of the chain is

func (*VM) SetState

func (vm *VM) SetState(state snow.State) error

func (*VM) Shutdown

func (vm *VM) Shutdown() error

Shutdown implements the snowman.ChainVM interface

func (*VM) VerifyHeightIndex

func (vm *VM) VerifyHeightIndex() error

func (*VM) Version

func (vm *VM) Version() (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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