evm

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: LGPL-3.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

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

test constants

Variables

View Source
var (
	ID = ids.NewID([32]byte{'e', 'v', 'm'})
)

ID this VM should be referenced by

Functions

This section is empty.

Types

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

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) ID

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

ID implements the snowman.Block interface

func (*Block) Parent

func (b *Block) Parent() snowman.Block

Parent implements the snowman.Block interface

func (*Block) Reject

func (b *Block) Reject() error

Reject implements the snowman.Block interface

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) Verify

func (b *Block) Verify() error

Verify implements the snowman.Block interface

type Database

type Database struct{ database.Database }

Database implements ethdb.Database

func (Database) Ancient

func (db Database) Ancient(kind string, number uint64) ([]byte, error)

Ancient returns an error as we don't have a backing chain freezer.

func (Database) AncientSize

func (db Database) AncientSize(kind string) (uint64, error)

AncientSize returns an error as we don't have a backing chain freezer.

func (Database) Ancients

func (db Database) Ancients() (uint64, error)

Ancients returns an error as we don't have a backing chain freezer.

func (Database) AppendAncient

func (db Database) AppendAncient(number uint64, hash, header, body, receipts, td []byte) error

AppendAncient returns an error as we don't have a backing chain freezer.

func (Database) HasAncient

func (db Database) HasAncient(kind string, number uint64) (bool, error)

HasAncient returns an error as we don't have a backing chain freezer.

func (Database) NewBatch

func (db Database) NewBatch() ethdb.Batch

NewBatch implements ethdb.Database

func (Database) NewIterator

func (db Database) NewIterator() ethdb.Iterator

NewIterator implements ethdb.Database

func (Database) NewIteratorWithPrefix

func (db Database) NewIteratorWithPrefix(prefix []byte) ethdb.Iterator

NewIteratorWithPrefix implements ethdb.Database

func (Database) NewIteratorWithStart

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

NewIteratorWithStart implements ethdb.Database

func (Database) Sync

func (db Database) Sync() error

Sync returns an error as we don't have a backing chain freezer.

func (Database) TruncateAncients

func (db Database) TruncateAncients(items uint64) error

TruncateAncients returns an error as we don't have a backing chain freezer.

type DebugAPI

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

DebugAPI introduces helper functions for debuging

func (*DebugAPI) GetGenesisBalance

func (api *DebugAPI) GetGenesisBalance(ctx context.Context) (*hexutil.Big, error)

GetGenesisBalance returns the current funds in the genesis

func (*DebugAPI) IssueBlock

func (api *DebugAPI) IssueBlock(ctx context.Context) error

IssueBlock to the chain

func (*DebugAPI) SpendGenesis

func (api *DebugAPI) SpendGenesis(ctx context.Context, nonce uint64) error

SpendGenesis funds

type Factory

type Factory struct{}

Factory ...

func (*Factory) New

func (f *Factory) New() interface{}

New ...

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 NetAPI

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

NetAPI offers network related API methods

func NewNetAPI

func NewNetAPI(vm *VM) *NetAPI

NewNetAPI creates a new net API instance.

func (*NetAPI) Listening

func (s *NetAPI) Listening() bool

Listening returns an indication if the node is listening for network connections.

func (*NetAPI) PeerCount

func (s *NetAPI) PeerCount() hexutil.Uint

PeerCount returns the number of connected peers

func (*NetAPI) Version

func (s *NetAPI) Version() string

Version returns the current ethereum protocol version.

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

type StaticService

type StaticService struct{}

StaticService defines the static API services exposed by the evm

func (*StaticService) BuildGenesis

func (*StaticService) BuildGenesis(_ context.Context, args *core.Genesis) (formatting.CB58, error)

BuildGenesis returns the UTXOs such that at least one address in [args.Addresses] is referenced in the UTXO.

type VM

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

VM implements the snowman.ChainVM interface

func (*VM) BuildBlock

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

BuildBlock implements the snowman.ChainVM interface

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers() map[string]*commonEng.HTTPHandler

CreateHandlers makes new http handlers that can handle API calls

func (*VM) CreateStaticHandlers

func (vm *VM) CreateStaticHandlers() map[string]*commonEng.HTTPHandler

CreateStaticHandlers makes new http handlers that can handle API calls

func (*VM) GetBlock

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

GetBlock implements the snowman.ChainVM interface

func (*VM) Initialize

func (vm *VM) Initialize(
	ctx *snow.Context,
	db database.Database,
	b []byte,
	toEngine chan<- commonEng.Message,
	fxs []*commonEng.Fx,
) error

Initialize implements the snowman.ChainVM interface

func (*VM) LastAccepted

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

LastAccepted returns the ID of the block that was last accepted

func (*VM) ParseBlock

func (vm *VM) ParseBlock(b []byte) (snowman.Block, error)

ParseBlock implements the snowman.ChainVM interface

func (*VM) SetPreference

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

SetPreference sets what the current tail of the chain is

func (*VM) Shutdown

func (vm *VM) Shutdown() error

Shutdown implements the snowman.ChainVM interface

type Web3API

type Web3API struct{}

Web3API offers helper API methods

func (*Web3API) ClientVersion

func (s *Web3API) ClientVersion() string

ClientVersion returns the version of the vm running

func (*Web3API) Sha3

func (s *Web3API) Sha3(input hexutil.Bytes) hexutil.Bytes

Sha3 returns the bytes returned by hashing [input] with Keccak256

Jump to

Keyboard shortcuts

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