evm

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: AGPL-3.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UnitIDLength   = UnitPartLength + TypePartLength
	UnitPartLength = 32
	TypePartLength = 0
)
View Source
const DefaultBlockGasLimit = 15000000
View Source
const DefaultEvmTxSystemIdentifier types.SystemID = 0x00000003
View Source
const DefaultGasPrice = 210000000
View Source
const PayloadTypeEVMCall = "evm"

Variables

This section is empty.

Functions

func Execute

func Execute(currentBlockNumber uint64, stateDB *statedb.StateDB, blockDB keyvaluedb.KeyValueDB, attr *TxAttributes, systemIdentifier types.SystemID, gp *core.GasPool, gasUnitPrice *big.Int, fake bool, log *slog.Logger) (*types.ServerMetadata, error)

func NewBlockContext

func NewBlockContext(currentBlockNumber uint64, blockDB keyvaluedb.KeyValueDB) vm.BlockContext

func NewChainConfig

func NewChainConfig(chainID *big.Int) *params.ChainConfig

NewChainConfig returns an Ethereum ChainConfig for EVM state transitions.

func NewFeeCreditRecordID

func NewFeeCreditRecordID(shardPart []byte, unitPart []byte) types.UnitID

func NewTxContext

func NewTxContext(attr *TxAttributes, gasPrice *big.Int) vm.TxContext

func NewUnitData

func NewUnitData(unitID types.UnitID) (state.UnitData, error)

func NewVMConfig

func NewVMConfig() vm.Config

Types

type FeeAccount

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

func (FeeAccount) GenericTransactionValidator

func (m FeeAccount) GenericTransactionValidator() genericTransactionValidator

func (FeeAccount) TxExecutors

func (m FeeAccount) TxExecutors() map[string]txsystem.ExecuteFunc

type FeeCalculator

type FeeCalculator func() uint64

func FixedFee

func FixedFee(fee uint64) FeeCalculator

type Module

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

func NewEVMModule

func NewEVMModule(systemIdentifier types.SystemID, opts *Options, log *slog.Logger) (*Module, error)

func (*Module) GenericTransactionValidator

func (m *Module) GenericTransactionValidator() genericTransactionValidator

func (*Module) StartBlockFunc

func (m *Module) StartBlockFunc(blockGasLimit uint64) []func(blockNr uint64) error

func (*Module) TxExecutors

func (m *Module) TxExecutors() map[string]txsystem.ExecuteFunc

type Option

type Option func(*Options)

func WithBlockDB

func WithBlockDB(blockDB keyvaluedb.KeyValueDB) Option

func WithBlockGasLimit

func WithBlockGasLimit(limit uint64) Option

func WithGasPrice

func WithGasPrice(gasPrice uint64) Option

func WithHashAlgorithm

func WithHashAlgorithm(algorithm gocrypto.Hash) Option

func WithMoneyTXSystemIdentifier

func WithMoneyTXSystemIdentifier(moneyTxSystemID types.SystemID) Option

func WithState

func WithState(s *state.State) Option

func WithTrustBase

func WithTrustBase(tb map[string]crypto.Verifier) Option

type Options

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

type PredicateExecutor added in v0.4.0

type PredicateExecutor func(ctx context.Context, predicate types.PredicateBytes, args []byte, txo *types.TransactionOrder, env predicates.TxContext) (bool, error)

type ProcessingDetails

type ProcessingDetails struct {
	ErrorDetails string
	ReturnData   []byte
	ContractAddr common.Address
	Logs         []*statedb.LogEntry
	// contains filtered or unexported fields
}

func (*ProcessingDetails) Bytes

func (d *ProcessingDetails) Bytes() ([]byte, error)

type TxAttributes

type TxAttributes struct {
	From  []byte
	To    []byte
	Data  []byte
	Value *big.Int
	Gas   uint64
	Nonce uint64
	// contains filtered or unexported fields
}

func (*TxAttributes) AsMessage

func (t *TxAttributes) AsMessage(gasPrice *big.Int, fake bool) *core.Message

AsMessage returns the Alphabill transaction as a ethereum core.Message.

func (*TxAttributes) FromAddr

func (t *TxAttributes) FromAddr() common.Address

FromAddr - returns From as Address, if nil empty address is returned From is mandatory field and must not be nil in a valid TxAttributes

func (*TxAttributes) ToAddr

func (t *TxAttributes) ToAddr() *common.Address

ToAddr - returns To as Address pointer. To field is optional and not present on contract creation calls. If To is nil then nil pointer is returned

type TxSystem

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

func NewEVMTxSystem

func NewEVMTxSystem(systemIdentifier types.SystemID, log *slog.Logger, opts ...Option) (*TxSystem, error)

func (*TxSystem) BeginBlock

func (m *TxSystem) BeginBlock(blockNr uint64) error

func (*TxSystem) Commit

func (m *TxSystem) Commit(uc *types.UnicityCertificate) error

func (*TxSystem) CommittedUC

func (m *TxSystem) CommittedUC() *types.UnicityCertificate

func (*TxSystem) CurrentBlockNumber

func (m *TxSystem) CurrentBlockNumber() uint64

func (*TxSystem) EndBlock

func (m *TxSystem) EndBlock() (txsystem.StateSummary, error)

func (*TxSystem) Execute

func (m *TxSystem) Execute(tx *types.TransactionOrder) (sm *types.ServerMetadata, err error)

func (*TxSystem) Revert

func (m *TxSystem) Revert()

func (*TxSystem) State

func (m *TxSystem) State() txsystem.StateReader

func (*TxSystem) StateSummary

func (m *TxSystem) StateSummary() (txsystem.StateSummary, error)

type TxValidationContext

type TxValidationContext struct {
	Tx               *types.TransactionOrder
	Unit             *state.Unit
	SystemIdentifier types.SystemID
	BlockNumber      uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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