types

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 68 Imported by: 6

Documentation

Overview

Copyright 2017 The go-ethereum Authors This file is part of the go-ethereum library.

The go-ethereum library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The go-ethereum library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	// bloomServiceThreads is the number of goroutines used globally by an Ethereum
	// instance to service bloombits lookups for all running filters.
	BloomServiceThreads = 16

	// bloomFilterThreads is the number of goroutines used locally per filter to
	// multiplex requests onto the global servicing goroutines.
	BloomFilterThreads = 3

	// bloomRetrievalBatch is the maximum number of bloom bit retrievals to service
	// in a single batch.
	BloomRetrievalBatch = 16

	// bloomRetrievalWait is the maximum time to wait for enough bloom bit requests
	// to accumulate request an entire batch (avoiding hysteresis).
	BloomRetrievalWait = time.Duration(0)

	// BloomBitsBlocks is the number of blocks a single bloom bit section vector
	// contains on the server side.
	BloomBitsBlocks uint64 = 4096
)
View Source
const (
	MsgEthereumTxName = "ethermint/MsgEthereumTx"
	ChainConfigName   = "ethermint/ChainConfig"
	TxDataName        = "ethermint/TxData"

	ManageContractDeploymentWhitelistProposalName = "okexchain/evm/ManageContractDeploymentWhitelistProposal"
	ManageContractBlockedListProposalName         = "okexchain/evm/ManageContractBlockedListProposal"
)
View Source
const (
	CodeGetChainHeightFailed   uint32 = 62004
	CodeGetBlockTxHashesFailed uint32 = 62005
)
View Source
const (
	EventTypeEthereumTx = TypeMsgEthereumTx

	AttributeKeyContractAddress = "contract"
	AttributeKeyRecipient       = "recipient"
	AttributeValueCategory      = ModuleName
)

Evm module events

View Source
const (
	// ModuleName string name of module
	ModuleName = "evm"

	// StoreKey key for ethereum storage data, account code (StateDB) or block
	// related data for Web3.
	// The EVM module should use a prefix store.
	StoreKey = ModuleName

	// RouterKey uses module name for routing
	RouterKey = ModuleName
)
View Source
const (
	QueryBalance       = "balance"
	QueryBlockNumber   = "blockNumber"
	QueryStorage       = "storage"
	QueryStorageProof  = "storageProof"
	QueryStorageRoot   = "storageRoot"
	QueryStorageByKey  = "storageKey"
	QueryCode          = "code"
	QueryCodeByHash    = "codeHash"
	QueryNonce         = "nonce"
	QueryHashToHeight  = "hashToHeight"
	QueryBloom         = "bloom"
	QueryAccount       = "account"
	QueryExportAccount = "exportAccount"
	// QueryParameters defines 	QueryParameters = "params" query route path
	QueryParameters                  = "params"
	QueryHeightToHash                = "heightToHash"
	QuerySection                     = "section"
	QueryContractDeploymentWhitelist = "contract-deployment-whitelist"
	QueryContractBlockedList         = "contract-blocked-list"
	QueryContractMethodBlockedList   = "contract-method-blocked-list"
)

Supported endpoints

View Source
const (
	ContractMethodBlockedCacheSize = 10000
)
View Source
const (
	DefaultCodespace string = ModuleName
)

NOTE: We can't use 1 since that error code is reserved for internal errors.

View Source
const (
	// DefaultParamspace for params keeper
	DefaultParamspace = ModuleName
)
View Source
const (
	FlagEnableBloomFilter = "enable-bloom-filter"
)
View Source
const (
	FlagTrieUseCompositeKey = "trie.use-composite-key"
)
View Source
const IGNORE_HEIGHT_CHECKING = -1
View Source
const (
	// TypeMsgEthereumTx defines the type string of an Ethereum tranasction
	TypeMsgEthereumTx = "ethereum"
)

message type and route constants

View Source
const (
	Uint64Length = 8
)

Variables

View Source
var (
	// ErrInvalidState returns an error resulting from an invalid Storage State.
	ErrInvalidState = sdkerrors.Register(ModuleName, 2, "invalid storage state")

	// ErrChainConfigNotFound returns an error if the chain config cannot be found on the store.
	ErrChainConfigNotFound = sdkerrors.Register(ModuleName, 3, "chain configuration not found")

	// ErrInvalidChainConfig returns an error resulting from an invalid ChainConfig.
	ErrInvalidChainConfig = sdkerrors.Register(ModuleName, 4, "invalid chain configuration")

	// ErrCreateDisabled returns an error if the EnableCreate parameter is false.
	ErrCreateDisabled = sdkerrors.Register(ModuleName, 5, "EVM Create operation is disabled")

	// ErrCallDisabled returns an error if the EnableCall parameter is false.
	ErrCallDisabled = sdkerrors.Register(ModuleName, 6, "EVM Call operation is disabled")

	// ErrKeyNotFound returns an error if the target key not found in database.
	ErrKeyNotFound = sdkerrors.Register(ModuleName, 8, "Key not found in database")

	// ErrStrConvertFailed returns an error if failed to convert string
	ErrStrConvertFailed = sdkerrors.Register(ModuleName, 9, "Failed to convert string")

	// ErrUnexpectedProposalType returns an error when the proposal type is not supported in evm module
	ErrUnexpectedProposalType = sdkerrors.Register(ModuleName, 10, "Unsupported proposal type of evm module")

	// ErrEmptyAddressList returns an error if the address list is empty
	ErrEmptyAddressList = sdkerrors.Register(ModuleName, 11, "Empty account address list")

	// ErrDuplicatedAddr returns an error if the address is duplicated in address list
	ErrDuplicatedAddr = sdkerrors.Register(ModuleName, 12, "Duplicated address in address list")

	// ErrDuplicatedAddr returns an error if the address is duplicated in address list
	ErrOperation = sdkerrors.Register(ModuleName, 16, "Special contract method blocked operation can not change blocked contract list")

	// ErrDuplicatedMethod returns an error if the contract method is duplicated
	ErrDuplicatedMethod = sdkerrors.Register(ModuleName, 17, "Duplicated contract method in address list")

	// ErrEmptyMethod returns an error if the contract method is empty
	ErrEmptyMethod = sdkerrors.Register(ModuleName, 18, "Empty contract method blocked is not allowed")

	// ErrEmptyAddressBlockedContract returns an error if the contract method is empty
	ErrEmptyAddressBlockedContract = sdkerrors.Register(ModuleName, 19, "Empty address in contract method blocked list is not allowed")

	CodeSpaceEvmCallFailed = uint32(7)

	ErrorHexData = "HexData"

	ErrorContractMethodBlockedIsNotExist = errors.New("it's not exist in contract method blocked list")
)
View Source
var (
	KeyPrefixBlockHash                   = []byte{0x01}
	KeyPrefixBloom                       = []byte{0x02}
	KeyPrefixCode                        = []byte{0x04}
	KeyPrefixStorage                     = []byte{0x05}
	KeyPrefixChainConfig                 = []byte{0x06}
	KeyPrefixHeightHash                  = []byte{0x07}
	KeyPrefixContractDeploymentWhitelist = []byte{0x08}
	KeyPrefixContractBlockedList         = []byte{0x09}

	KeyPrefixEvmRootHash = []byte("evmRootHash")
)

KVStore key prefixes

View Source
var (
	ParamStoreKeyEnableCreate                = []byte("EnableCreate")
	ParamStoreKeyEnableCall                  = []byte("EnableCall")
	ParamStoreKeyExtraEIPs                   = []byte("EnableExtraEIPs")
	ParamStoreKeyContractDeploymentWhitelist = []byte("EnableContractDeploymentWhitelist")
	ParamStoreKeyContractBlockedList         = []byte("EnableContractBlockedList")
	ParamStoreKeyMaxGasLimitPerTx            = []byte("MaxGasLimitPerTx")
)

Parameter keys

View Source
var DefaultDeployContractFnSignature = ethcmn.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000001")
View Source
var DefaultSendCoinFnSignature = ethcmn.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000010")
View Source
var ModuleCdc = codec.New()

ModuleCdc defines the evm module's codec

View Source
var (
	TrieUseCompositeKey = true
)
View Source
var (
	UpgradedKeyPrefixCode = rawdb.CodePrefix // Old: KeyPrefixCode = []byte{0x04}
)

Below are the keys which are different from the key in iavl

Functions

func AddressStoragePrefix

func AddressStoragePrefix(address ethcmn.Address) []byte

AddressStoragePrefix returns a prefix to iterate over a given account storage.

func AppendBlockHashKey added in v1.5.0

func AppendBlockHashKey(blockHash []byte) []byte

* KeyPrefixBlockHash = []byte{0x01} * KeyPrefixBloom = []byte{0x02} * UpgradedKeyPrefixCode = []byte{"c"} * KeyPrefixStorage not stored in db directly * KeyPrefixChainConfig = []byte{0x06} * KeyPrefixHeightHash = []byte{0x07} * * Below are functions used for setting in DiskDB

* Append

func AppendBloomKey added in v1.5.0

func AppendBloomKey(height int64) []byte

func AppendHeightHashKey added in v1.5.0

func AppendHeightHashKey(height uint64) []byte

func AppendUpgradedCodeKey added in v1.5.0

func AppendUpgradedCodeKey(codeHash []byte) []byte

func BlockedContractListIsEqual added in v1.0.0

func BlockedContractListIsEqual(t *testing.T, src, dst BlockedContractList) bool

func BloomDb

func BloomDb() dbm.DB

func BloomKey

func BloomKey(height int64) []byte

BloomKey defines the store key for a block Bloom

func CloseIndexer added in v0.19.9

func CloseIndexer()

func ContractMethodsIsEqual added in v1.0.0

func ContractMethodsIsEqual(src, dst ContractMethods) bool

func EncodeResultData

func EncodeResultData(data *ResultData) ([]byte, error)

EncodeResultData takes all of the necessary data from the EVM execution and returns the data as a byte slice encoded with amino

func ErrBlockedContractMethodIsNotExist added in v1.0.0

func ErrBlockedContractMethodIsNotExist(address sdk.Address, err error) sdk.EnvelopedErr

ErrBlockedContractMethodIsNotExist returns an error when the blocked contract method is not exist

func ErrCallBlockedContract

func ErrCallBlockedContract(descriptor string) sdk.EnvelopedErr

ErrCallBlockedContract returns an error when the blocked contract is invoked

func ErrOversizeAddrList

func ErrOversizeAddrList(length int) sdk.EnvelopedErr

ErrOversizeAddrList returns an error when the length of address list in the proposal is larger than the max limitation

func ErrUnauthorizedAccount

func ErrUnauthorizedAccount(distributorAddr sdk.AccAddress) sdk.EnvelopedErr

ErrUnauthorizedAccount returns an error when an account not in the whitelist tries to create a contract

func EthAddressToString added in v1.2.0

func EthAddressToString(address *ethcmn.Address) string

func GenerateEthAddress

func GenerateEthAddress() ethcmn.Address

GenerateEthAddress generates an Ethereum address.

func GetContractBlockedListMemberKey added in v0.18.7

func GetContractBlockedListMemberKey(contractAddr sdk.AccAddress) []byte

getContractBlockedListMemberKey builds the key for a blocked contract address

func GetContractDeploymentWhitelistMemberKey added in v0.18.7

func GetContractDeploymentWhitelistMemberKey(distributorAddr sdk.AccAddress) []byte

getContractDeploymentWhitelistMemberKey builds the key for an approved contract deployer

func GetEnableBloomFilter

func GetEnableBloomFilter() bool

func GetHashFn

func GetHashFn(ctx sdk.Context, csdb *CommitStateDB) vm.GetHashFunc

GetHashFn implements vm.GetHashFunc for Ethermint. It handles 3 cases:

  1. The requested height matches the current height (and thus same epoch number)
  2. The requested height is from an previous height from the same chain epoch
  3. The requested height is from a height greater than the latest one

func GetStorageByAddressKey added in v1.5.0

func GetStorageByAddressKey(prefix, key []byte) ethcmn.Hash

GetStorageByAddressKey returns a hash of the composite key for a state object's storage prefixed with it's address.

func GetTracerResult added in v1.1.7

func GetTracerResult(tracer vm.Tracer, result *core.ExecutionResult) ([]byte, error)

func HeightHashKey

func HeightHashKey(height uint64) []byte

HeightHashKey returns the key for the given chain epoch and height. The key will be composed in the following order:

key = prefix + bytes(height)

This ordering facilitates the iteration by height for the EVM GetHashFn queries.

func InitIndexer

func InitIndexer(db dbm.DB)

func IsBlockHashKey added in v1.5.0

func IsBlockHashKey(key []byte) bool

* IsKey

func IsBloomKey added in v1.5.0

func IsBloomKey(key []byte) bool

func IsCodeHashKey added in v1.5.0

func IsCodeHashKey(key []byte) bool

func IsHeightHashKey added in v1.5.0

func IsHeightHashKey(key []byte) bool

func Keccak256HashWithCache added in v0.19.14

func Keccak256HashWithCache(compositeKey []byte) ethcmn.Hash

Keccak256HashWithCache returns the Keccak256 hash of the given data. this function should not keep the reference of the input data after return.

func MarshalEthLogToAmino added in v0.19.16

func MarshalEthLogToAmino(log *ethtypes.Log) ([]byte, error)

func MarshalLogs

func MarshalLogs(logs []*ethtypes.Log) ([]byte, error)

MarshalLogs encodes an array of logs using amino

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable returns the parameter key table.

func ReadBloomBits

func ReadBloomBits(db ethdb.KeyValueReader, bit uint, section uint64, head common.Hash) ([]byte, error)

ReadBloomBits retrieves the compressed bloom bit vector belonging to the given section and bit index from the.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers all the necessary types and interfaces for the evm module

func ResetCommitStateDB added in v1.6.0

func ResetCommitStateDB(csdb *CommitStateDB, csdbParams CommitStateDBParams, ctx *sdk.Context)

func SetEvmParamsNeedUpdate added in v1.1.10

func SetEvmParamsNeedUpdate()

func SortContractMethods added in v1.0.0

func SortContractMethods(cms []ContractMethod)

func SplitUpgradedCodeHashKey added in v1.5.0

func SplitUpgradedCodeHashKey(key []byte) []byte

* Split

func TestTracerConfig added in v1.3.0

func TestTracerConfig(traceConfig *TraceConfig) error

func TxDecoder

func TxDecoder(cdc codec.CdcAbstraction) sdk.TxDecoder

func UnmarshalEthLogFromAmino added in v1.0.0

func UnmarshalEthLogFromAmino(data []byte) (*ethtypes.Log, error)

func UnmarshalLogs

func UnmarshalLogs(in []byte) ([]*ethtypes.Log, error)

UnmarshalLogs decodes an amino-encoded byte array into an array of logs

func ValidateLog

func ValidateLog(log *ethtypes.Log) error

ValidateLog performs a basic validation of an ethereum Log fields.

func ValidateSigner

func ValidateSigner(signBytes, sig []byte, signer ethcmn.Address) error

ValidateSigner attempts to validate a signer for a given slice of bytes over which a signature and signer is given. An error is returned if address derived from the signature and bytes signed does not match the given signer.

func WriteBloomBits

func WriteBloomBits(batch dbm.Batch, bit uint, section uint64, head common.Hash, bits []byte)

WriteBloomBits stores the compressed bloom bits vector belonging to the given section and bit index.

Types

type AccountKeeper

type AccountKeeper interface {
	NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
	GetAllAccounts(ctx sdk.Context) (accounts []authexported.Account)
	IterateAccounts(ctx sdk.Context, cb func(account authexported.Account) bool)
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
	SetAccount(ctx sdk.Context, account authexported.Account)
	RemoveAccount(ctx sdk.Context, account authexported.Account)
	SetObserverKeeper(observer auth.ObserverI)
}

AccountKeeper defines the expected account keeper interface

type AddressList

type AddressList []sdk.AccAddress

AddressList is the type alias for []sdk.AccAddress

func (AddressList) String

func (al AddressList) String() string

String returns a human readable string representation of AddressList

type BankKeeper added in v0.18.7

type BankKeeper interface {
	BlacklistedAddr(addr sdk.AccAddress) bool
}

type BlockedContract added in v1.0.0

type BlockedContract struct {
	//Contract Address
	Address sdk.AccAddress `json:"address" yaml:"address"`
	//the list of method which is blocked. If it's length equal to 0,it means all method is blocked.
	BlockMethods ContractMethods `json:"block_methods" yaml:"block_methods"`
}

BlockedContract i the contract which method or all-method is blocked

func NewBlockContract added in v1.0.0

func NewBlockContract(addr sdk.AccAddress, methods ContractMethods) *BlockedContract

NewBlockContract return point of BlockedContract

func (BlockedContract) IsAllMethodBlocked added in v1.0.0

func (bc BlockedContract) IsAllMethodBlocked() bool

IsAllMethodBlocked return true if all method of contract is blocked.

func (BlockedContract) IsMethodBlocked added in v1.0.0

func (bc BlockedContract) IsMethodBlocked(method string) bool

IsMethodBlocked return true if the method of contract is blocked.

func (BlockedContract) String added in v1.0.0

func (bc BlockedContract) String() string

String returns BlockedContract string

func (BlockedContract) ValidateBasic added in v1.0.0

func (bc BlockedContract) ValidateBasic() sdk.Error

ValidateBasic validates BlockedContract

type BlockedContractList added in v1.0.0

type BlockedContractList []BlockedContract

BlockedContractList is the list of contract which method or all-method is blocked

func (BlockedContractList) String added in v1.0.0

func (bl BlockedContractList) String() string

String returns string which is the list of blocked contract

func (BlockedContractList) ValidateBasic added in v1.0.0

func (bl BlockedContractList) ValidateBasic() sdk.Error

ValidateBasic validates the list of contract which method or all-method is blocked

type Cache added in v1.1.10

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

func GetEvmParamsCache added in v1.1.10

func GetEvmParamsCache() *Cache

func NewCache added in v1.1.10

func NewCache() *Cache

func (*Cache) GetBlockedContractMethod added in v1.1.10

func (c *Cache) GetBlockedContractMethod(addr string) (contract *BlockedContract)

func (*Cache) GetParams added in v1.1.10

func (c *Cache) GetParams() Params

func (*Cache) IsNeedBlockedUpdate added in v1.1.10

func (c *Cache) IsNeedBlockedUpdate() bool

func (*Cache) IsNeedParamsUpdate added in v1.1.10

func (c *Cache) IsNeedParamsUpdate() bool

func (*Cache) SetNeedBlockedUpdate added in v1.1.10

func (c *Cache) SetNeedBlockedUpdate()

func (*Cache) SetNeedParamsUpdate added in v1.1.10

func (c *Cache) SetNeedParamsUpdate()

func (*Cache) UpdateBlockedContractMethod added in v1.1.10

func (c *Cache) UpdateBlockedContractMethod(bcl BlockedContractList, isCheckTx bool)

func (*Cache) UpdateParams added in v1.1.10

func (c *Cache) UpdateParams(params Params, isCheckTx bool)

type CacheCode added in v0.18.7

type CacheCode struct {
	CodeHash []byte
	Code     []byte
}

type ChainConfig

type ChainConfig struct {
	HomesteadBlock sdk.Int `json:"homestead_block" yaml:"homestead_block"` // Homestead switch block (< 0 no fork, 0 = already homestead)

	DAOForkBlock   sdk.Int `json:"dao_fork_block" yaml:"dao_fork_block"`     // TheDAO hard-fork switch block (< 0 no fork)
	DAOForkSupport bool    `json:"dao_fork_support" yaml:"dao_fork_support"` // Whether the nodes supports or opposes the DAO hard-fork

	// EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150)
	EIP150Block sdk.Int `json:"eip150_block" yaml:"eip150_block"` // EIP150 HF block (< 0 no fork)
	EIP150Hash  string  `json:"eip150_hash" yaml:"eip150_hash"`   // EIP150 HF hash (needed for header only clients as only gas pricing changed)

	EIP155Block sdk.Int `json:"eip155_block" yaml:"eip155_block"` // EIP155 HF block
	EIP158Block sdk.Int `json:"eip158_block" yaml:"eip158_block"` // EIP158 HF block

	ByzantiumBlock      sdk.Int `json:"byzantium_block" yaml:"byzantium_block"`           // Byzantium switch block (< 0 no fork, 0 = already on byzantium)
	ConstantinopleBlock sdk.Int `json:"constantinople_block" yaml:"constantinople_block"` // Constantinople switch block (< 0 no fork, 0 = already activated)
	PetersburgBlock     sdk.Int `json:"petersburg_block" yaml:"petersburg_block"`         // Petersburg switch block (< 0 same as Constantinople)
	IstanbulBlock       sdk.Int `json:"istanbul_block" yaml:"istanbul_block"`             // Istanbul switch block (< 0 no fork, 0 = already on istanbul)
	MuirGlacierBlock    sdk.Int `json:"muir_glacier_block" yaml:"muir_glacier_block"`     // Eip-2384 (bomb delay) switch block (< 0 no fork, 0 = already activated)

	YoloV2Block sdk.Int `json:"yoloV2_block" yaml:"yoloV2_block"` // YOLO v1: https://github.com/ethereum/EIPs/pull/2657 (Ephemeral testnet)
	EWASMBlock  sdk.Int `json:"ewasm_block" yaml:"ewasm_block"`   // EWASM switch block (< 0 no fork, 0 = already activated)
}

ChainConfig defines the Ethereum ChainConfig parameters using sdk.Int values instead of big.Int.

NOTE 1: Since empty/uninitialized Ints (i.e with a nil big.Int value) are parsed to zero, we need to manually specify that negative Int values will be considered as nil. See getBlockValue for reference.

NOTE 2: This type is not a configurable Param since the SDK does not allow for validation against a previous stored parameter values or the current block height (retrieved from context). If you want to update the config values, use an software upgrade procedure.

func DefaultChainConfig

func DefaultChainConfig() ChainConfig

DefaultChainConfig returns default evm parameters. Th

func (ChainConfig) EthereumConfig

func (cc ChainConfig) EthereumConfig(chainID *big.Int) *params.ChainConfig

EthereumConfig returns an Ethereum ChainConfig for EVM state transitions. All the negative or nil values are converted to nil

func (ChainConfig) IsHomestead

func (cc ChainConfig) IsHomestead() bool

IsHomestead returns whether the Homestead version is enabled.

func (ChainConfig) IsIstanbul

func (cc ChainConfig) IsIstanbul() bool

IsIstanbul returns whether the Istanbul version is enabled.

func (ChainConfig) String

func (cc ChainConfig) String() string

String implements the fmt.Stringer interface

func (*ChainConfig) UnmarshalFromAmino added in v0.19.16

func (config *ChainConfig) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

func (ChainConfig) Validate

func (cc ChainConfig) Validate() error

Validate performs a basic validation of the ChainConfig params. The function will return an error if any of the block values is uninitialized (i.e nil) or if the EIP150Hash is an invalid hash.

type CommitStateDB

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

CommitStateDB implements the Geth state.StateDB interface. Instead of using a trie and database for querying and persistence, the Keeper uses KVStores and an account mapper is used to facilitate state transitions.

TODO: This implementation is subject to change in regards to its statefull manner. In otherwords, how this relates to the keeper in this module.

func CreateEmptyCommitStateDB

func CreateEmptyCommitStateDB(csdbParams CommitStateDBParams, ctx sdk.Context) *CommitStateDB

func NewCommitStateDB added in v1.5.0

func NewCommitStateDB(csdbParams CommitStateDBParams) *CommitStateDB

NewCommitStateDB returns a reference to a newly initialized CommitStateDB which implements Geth's state.StateDB interface.

CONTRACT: Stores used for state must be cache-wrapped as the ordering of the key/value space matters in determining the merkle root.

func (*CommitStateDB) AddAddressToAccessList

func (csdb *CommitStateDB) AddAddressToAccessList(addr ethcmn.Address)

AddAddressToAccessList adds the given address to the access list

func (*CommitStateDB) AddBalance

func (csdb *CommitStateDB) AddBalance(addr ethcmn.Address, amount *big.Int)

AddBalance adds amount to the account associated with addr.

func (*CommitStateDB) AddLog

func (csdb *CommitStateDB) AddLog(log *ethtypes.Log)

AddLog adds a new log to the state and sets the log metadata from the state.

func (*CommitStateDB) AddPreimage

func (csdb *CommitStateDB) AddPreimage(hash ethcmn.Hash, preimage []byte)

AddPreimage records a SHA3 preimage seen by the VM.

func (*CommitStateDB) AddRefund

func (csdb *CommitStateDB) AddRefund(gas uint64)

AddRefund adds gas to the refund counter.

func (*CommitStateDB) AddSlotToAccessList

func (csdb *CommitStateDB) AddSlotToAccessList(addr ethcmn.Address, slot ethcmn.Hash)

AddSlotToAccessList adds the given (address, slot)-tuple to the access list

func (*CommitStateDB) AddressInAccessList

func (csdb *CommitStateDB) AddressInAccessList(addr ethcmn.Address) bool

AddressInAccessList returns true if the given address is in the access list.

func (*CommitStateDB) BlockHash

func (csdb *CommitStateDB) BlockHash() ethcmn.Hash

BlockHash returns the current block hash set by Prepare.

func (*CommitStateDB) ClearStateObjects

func (csdb *CommitStateDB) ClearStateObjects()

ClearStateObjects clears cache of state objects to handle account changes outside of the EVM

func (*CommitStateDB) Commit

func (csdb *CommitStateDB) Commit(deleteEmptyObjects bool) (ethcmn.Hash, error)

Commit writes the state to the appropriate KVStores. For each state object in the cache, it will either be removed, or have it's code set and/or it's state (storage) updated. In addition, the state object (account) itself will be written. Finally, the root hash (version) will be returned.

func (*CommitStateDB) CommitMpt added in v1.5.0

func (csdb *CommitStateDB) CommitMpt(prefetcher *mpt.TriePrefetcher) (ethcmn.Hash, error)

func (*CommitStateDB) CreateAccount

func (csdb *CommitStateDB) CreateAccount(addr ethcmn.Address)

CreateAccount explicitly creates a state object. If a state object with the address already exists the balance is carried over to the new account.

CreateAccount is called during the EVM CREATE operation. The situation might arise that a contract does the following:

  1. sends funds to sha(account ++ (nonce + 1))
  2. tx_create(sha(account ++ nonce)) (note that this gets the address of 1)

Carrying over the balance ensures that Ether doesn't disappear.

func (*CommitStateDB) Database

func (csdb *CommitStateDB) Database() ethstate.Database

Database retrieves the low level database supporting the lower level trie ops. It is not used in Ethermint, so it returns nil.

func (*CommitStateDB) DeleteAccountStorageInfo added in v1.5.0

func (csdb *CommitStateDB) DeleteAccountStorageInfo(so *stateObject)

func (*CommitStateDB) DeleteContractBlockedList

func (csdb *CommitStateDB) DeleteContractBlockedList(addrList AddressList)

DeleteContractBlockedList deletes the target address list from blocked list store

func (*CommitStateDB) DeleteContractDeploymentWhitelist

func (csdb *CommitStateDB) DeleteContractDeploymentWhitelist(addrList AddressList)

DeleteContractDeploymentWhitelist deletes the target address list from whitelist store

func (*CommitStateDB) DeleteContractMethodBlockedList added in v1.0.0

func (csdb *CommitStateDB) DeleteContractMethodBlockedList(contractList BlockedContractList) sdk.Error

DeleteContractMethodBlockedList delete the list of contract method blocked from blocked list store

func (*CommitStateDB) DeleteLogs

func (csdb *CommitStateDB) DeleteLogs(hash ethcmn.Hash)

DeleteLogs removes the logs from the KVStore. It is used during journal.Revert.

func (*CommitStateDB) Empty

func (csdb *CommitStateDB) Empty(addr ethcmn.Address) bool

Empty returns whether the state object is either non-existent or empty according to the EIP161 specification (balance = nonce = code = 0).

func (*CommitStateDB) Error

func (csdb *CommitStateDB) Error() error

Error returns the first non-nil error the StateDB encountered.

func (*CommitStateDB) Exist

func (csdb *CommitStateDB) Exist(addr ethcmn.Address) bool

Exist reports whether the given account address exists in the state. Notably, this also returns true for suicided accounts.

func (*CommitStateDB) Finalise

func (csdb *CommitStateDB) Finalise(deleteEmptyObjects bool)

Finalise finalizes the state objects (accounts) state by setting their state, removing the csdb destructed objects and clearing the journal as well as the refunds.

func (*CommitStateDB) ForEachStorage

func (csdb *CommitStateDB) ForEachStorage(addr ethcmn.Address, cb func(key, value ethcmn.Hash) (stop bool)) error

ForEachStorage iterates over each storage items, all invoke the provided callback on each key, value pair.

func (*CommitStateDB) ForEachStorageMpt added in v1.5.0

func (csdb *CommitStateDB) ForEachStorageMpt(so *stateObject, cb func(key, value ethcmn.Hash) (stop bool)) error

func (*CommitStateDB) GetBalance

func (csdb *CommitStateDB) GetBalance(addr ethcmn.Address) *big.Int

GetBalance retrieves the balance from the given address or 0 if object not found.

func (*CommitStateDB) GetCacheCode added in v0.18.3

func (csdb *CommitStateDB) GetCacheCode(addr ethcmn.Address) *CacheCode

func (*CommitStateDB) GetCode

func (csdb *CommitStateDB) GetCode(addr ethcmn.Address) []byte

GetCode returns the code for a given account.

func (*CommitStateDB) GetCodeByHash added in v0.18.7

func (csdb *CommitStateDB) GetCodeByHash(hash ethcmn.Hash) []byte

GetCode returns the code for a given code hash.

func (*CommitStateDB) GetCodeByHashInRawDB added in v1.5.0

func (csdb *CommitStateDB) GetCodeByHashInRawDB(hash ethcmn.Hash) []byte

func (*CommitStateDB) GetCodeHash

func (csdb *CommitStateDB) GetCodeHash(addr ethcmn.Address) ethcmn.Hash

GetCodeHash returns the code hash for a given account.

func (*CommitStateDB) GetCodeSize

func (csdb *CommitStateDB) GetCodeSize(addr ethcmn.Address) int

GetCodeSize returns the code size for a given account.

func (*CommitStateDB) GetCommittedState

func (csdb *CommitStateDB) GetCommittedState(addr ethcmn.Address, hash ethcmn.Hash) ethcmn.Hash

GetCommittedState retrieves a value from the given account's committed storage.

func (*CommitStateDB) GetContractBlockedList

func (csdb *CommitStateDB) GetContractBlockedList() (blockedList AddressList)

GetContractBlockedList gets the whole contract blocked list currently

func (*CommitStateDB) GetContractDeploymentWhitelist

func (csdb *CommitStateDB) GetContractDeploymentWhitelist() (whitelist AddressList)

GetContractDeploymentWhitelist gets the whole contract deployment whitelist currently

func (*CommitStateDB) GetContractMethodBlockedByAddress added in v1.0.0

func (csdb *CommitStateDB) GetContractMethodBlockedByAddress(contractAddr sdk.AccAddress) *BlockedContract

GetContractMethodBlockedByAddress gets contract methods blocked by address

func (*CommitStateDB) GetContractMethodBlockedList added in v1.0.0

func (csdb *CommitStateDB) GetContractMethodBlockedList() (blockedContractList BlockedContractList)

GetContractMethodBlockedList get the list of contract method blocked from blocked list store

func (*CommitStateDB) GetHeightHash

func (csdb *CommitStateDB) GetHeightHash(height uint64) ethcmn.Hash

GetHeightHash returns the block header hash associated with a given block height and chain epoch number.

func (*CommitStateDB) GetLogSize

func (csdb *CommitStateDB) GetLogSize() uint

func (*CommitStateDB) GetLogs

func (csdb *CommitStateDB) GetLogs(hash ethcmn.Hash) ([]*ethtypes.Log, error)

GetLogs returns the current logs for a given transaction hash from the KVStore.

func (*CommitStateDB) GetNonce

func (csdb *CommitStateDB) GetNonce(addr ethcmn.Address) uint64

GetNonce returns the nonce (sequence number) for a given account.

func (*CommitStateDB) GetOrNewStateObject

func (csdb *CommitStateDB) GetOrNewStateObject(addr ethcmn.Address) StateObject

GetOrNewStateObject retrieves a state object or create a new state object if nil.

func (*CommitStateDB) GetParams

func (csdb *CommitStateDB) GetParams() Params

GetParams returns the total set of evm parameters.

func (*CommitStateDB) GetProof added in v1.5.0

func (csdb *CommitStateDB) GetProof(addr ethcmn.Address) ([][]byte, error)

GetProof returns the Merkle proof for a given account.

func (*CommitStateDB) GetProofByHash added in v1.5.0

func (csdb *CommitStateDB) GetProofByHash(addrHash ethcmn.Hash) ([][]byte, error)

GetProofByHash returns the Merkle proof for a given account.

func (*CommitStateDB) GetRefund

func (csdb *CommitStateDB) GetRefund() uint64

GetRefund returns the current value of the refund counter.

func (*CommitStateDB) GetRootTrie added in v1.5.0

func (csdb *CommitStateDB) GetRootTrie() ethstate.Trie

func (*CommitStateDB) GetState

func (csdb *CommitStateDB) GetState(addr ethcmn.Address, hash ethcmn.Hash) ethcmn.Hash

GetState retrieves a value from the given account's storage store.

func (*CommitStateDB) GetStateByKey added in v0.18.7

func (csdb *CommitStateDB) GetStateByKey(addr ethcmn.Address, key ethcmn.Hash) ethcmn.Hash

GetStateByKey retrieves a value from the given account's storage store.

func (*CommitStateDB) GetStateByKeyMpt added in v1.5.0

func (csdb *CommitStateDB) GetStateByKeyMpt(addr ethcmn.Address, key ethcmn.Hash) ethcmn.Hash

func (*CommitStateDB) GetStorageProof added in v1.5.0

func (csdb *CommitStateDB) GetStorageProof(a ethcmn.Address, key ethcmn.Hash) ([][]byte, error)

GetStorageProof returns the Merkle proof for given storage slot.

func (*CommitStateDB) HasSuicided

func (csdb *CommitStateDB) HasSuicided(addr ethcmn.Address) bool

HasSuicided returns if the given account for the specified address has been killed.

func (*CommitStateDB) InsertContractMethodBlockedList added in v1.0.0

func (csdb *CommitStateDB) InsertContractMethodBlockedList(contractList BlockedContractList) sdk.Error

InsertContractMethodBlockedList sets the list of contract method blocked into blocked list store

func (*CommitStateDB) IntermediateRoot

func (csdb *CommitStateDB) IntermediateRoot(deleteEmptyObjects bool) ethcmn.Hash

IntermediateRoot returns the current root hash of the state. It is called in between transactions to get the root hash that goes into transaction receipts.

NOTE: The SDK has not concept or method of getting any intermediate merkle root as commitment of the merkle-ized tree doesn't happen until the BaseApps' EndBlocker.

func (*CommitStateDB) IsContractInBlockedList

func (csdb *CommitStateDB) IsContractInBlockedList(contractAddr sdk.AccAddress) bool

IsContractInBlockedList checks whether the contract address is in the blocked list

func (*CommitStateDB) IsContractMethodBlocked added in v1.0.0

func (csdb *CommitStateDB) IsContractMethodBlocked(contractAddr sdk.AccAddress, method string) bool

IsContractMethodBlocked checks whether the contract method is blocked

func (*CommitStateDB) IsDeployerInWhitelist

func (csdb *CommitStateDB) IsDeployerInWhitelist(deployerAddr sdk.AccAddress) bool

IsDeployerInWhitelist checks whether the deployer is in the whitelist as a distributor

func (*CommitStateDB) IteratorCode added in v0.18.7

func (csdb *CommitStateDB) IteratorCode(cb func(addr ethcmn.Address, c CacheCode) bool)

func (*CommitStateDB) Logger added in v1.5.0

func (csdb *CommitStateDB) Logger() log.Logger

func (*CommitStateDB) MarkUpdatedAcc added in v1.5.0

func (csdb *CommitStateDB) MarkUpdatedAcc(addList []ethcmn.Address)

func (*CommitStateDB) Preimages

func (csdb *CommitStateDB) Preimages() map[ethcmn.Hash][]byte

Preimages returns a list of SHA3 preimages that have been submitted.

func (*CommitStateDB) Prepare

func (csdb *CommitStateDB) Prepare(thash, bhash ethcmn.Hash, txi int)

Prepare sets the current transaction hash and index and block hash which is used when the EVM emits new state logs.

func (*CommitStateDB) PrepareAccessList added in v0.19.5

func (csdb *CommitStateDB) PrepareAccessList(sender ethcmn.Address, dest *ethcmn.Address, precompiles []ethcmn.Address, txAccesses ethtypes.AccessList)

func (*CommitStateDB) RawDump

func (csdb *CommitStateDB) RawDump() ethstate.Dump

RawDump returns a raw state dump.

TODO: Implement if we need it, especially for the RPC API.

func (*CommitStateDB) Reset

func (csdb *CommitStateDB) Reset(_ ethcmn.Hash) error

Reset clears out all ephemeral state objects from the state db, but keeps the underlying account mapper and store keys to avoid reloading data for the next operations.

func (*CommitStateDB) RevertToSnapshot

func (csdb *CommitStateDB) RevertToSnapshot(revID int)

RevertToSnapshot reverts all state changes made since the given revision.

func (*CommitStateDB) SetBalance

func (csdb *CommitStateDB) SetBalance(addr ethcmn.Address, amount *big.Int)

SetBalance sets the balance of an account.

func (*CommitStateDB) SetBlockHash

func (csdb *CommitStateDB) SetBlockHash(hash ethcmn.Hash)

func (*CommitStateDB) SetCode

func (csdb *CommitStateDB) SetCode(addr ethcmn.Address, code []byte)

SetCode sets the code for a given account.

func (*CommitStateDB) SetContractBlockedList

func (csdb *CommitStateDB) SetContractBlockedList(addrList AddressList)

SetContractBlockedList sets the target address list into blocked list store

func (*CommitStateDB) SetContractDeploymentWhitelist

func (csdb *CommitStateDB) SetContractDeploymentWhitelist(addrList AddressList)

SetContractDeploymentWhitelistMember sets the target address list into whitelist store

func (*CommitStateDB) SetContractMethodBlocked added in v1.0.0

func (csdb *CommitStateDB) SetContractMethodBlocked(contract BlockedContract)

SetContractMethodBlocked sets contract method blocked into blocked list store

func (*CommitStateDB) SetError added in v1.5.0

func (csdb *CommitStateDB) SetError(err error)

SetError remembers the first non-nil error it is called with.

func (*CommitStateDB) SetHeightHash

func (csdb *CommitStateDB) SetHeightHash(height uint64, hash ethcmn.Hash)

SetHeightHash sets the block header hash associated with a given height.

func (*CommitStateDB) SetInternalDb added in v0.18.7

func (csdb *CommitStateDB) SetInternalDb(dba DbAdapter)

func (*CommitStateDB) SetLogSize

func (csdb *CommitStateDB) SetLogSize(logSize uint)

func (*CommitStateDB) SetLogs

func (csdb *CommitStateDB) SetLogs(hash ethcmn.Hash, logs []*ethtypes.Log) error

SetLogs sets the logs for a transaction in the KVStore.

func (*CommitStateDB) SetNonce

func (csdb *CommitStateDB) SetNonce(addr ethcmn.Address, nonce uint64)

SetNonce sets the nonce (sequence number) of an account.

func (*CommitStateDB) SetParams

func (csdb *CommitStateDB) SetParams(params Params)

SetParams sets the evm parameters to the param space.

func (*CommitStateDB) SetState

func (csdb *CommitStateDB) SetState(addr ethcmn.Address, key, value ethcmn.Hash)

SetState sets the storage state with a key, value pair for an account.

func (*CommitStateDB) SetStorage added in v1.2.3

func (csdb *CommitStateDB) SetStorage(addr common.Address, storage map[common.Hash]common.Hash)

SetStorage replaces the entire storage for the specified account with given storage. This function should only be used for debugging.

func (*CommitStateDB) SlotInAccessList

func (csdb *CommitStateDB) SlotInAccessList(addr ethcmn.Address, slot ethcmn.Hash) (bool, bool)

SlotInAccessList returns true if the given (address, slot)-tuple is in the access list.

func (*CommitStateDB) Snapshot

func (csdb *CommitStateDB) Snapshot() int

Snapshot returns an identifier for the current revision of the state.

func (*CommitStateDB) StartPrefetcher added in v1.5.0

func (csdb *CommitStateDB) StartPrefetcher(namespace string)

StartPrefetcher initializes a new trie prefetcher to pull in nodes from the state trie concurrently while the state is mutated so that when we reach the commit phase, most of the needed data is already hot.

func (*CommitStateDB) StopPrefetcher added in v1.5.0

func (csdb *CommitStateDB) StopPrefetcher()

StopPrefetcher terminates a running prefetcher and reports any leftover stats from the gathered metrics.

func (*CommitStateDB) StorageTrie

func (csdb *CommitStateDB) StorageTrie(addr ethcmn.Address) ethstate.Trie

StorageTrie returns nil as the state in Ethermint does not use a direct storage trie.

func (*CommitStateDB) SubBalance

func (csdb *CommitStateDB) SubBalance(addr ethcmn.Address, amount *big.Int)

SubBalance subtracts amount from the account associated with addr.

func (*CommitStateDB) SubRefund

func (csdb *CommitStateDB) SubRefund(gas uint64)

SubRefund removes gas from the refund counter. It will panic if the refund counter goes below zero.

func (*CommitStateDB) Suicide

func (csdb *CommitStateDB) Suicide(addr ethcmn.Address) bool

Suicide marks the given account as suicided and clears the account balance.

The account's state object is still available until the state is committed, getStateObject will return a non-nil account after Suicide.

func (*CommitStateDB) TxIndex

func (csdb *CommitStateDB) TxIndex() int

TxIndex returns the current transaction index set by Prepare.

func (*CommitStateDB) UpdateAccountStorageInfo added in v1.5.0

func (csdb *CommitStateDB) UpdateAccountStorageInfo(so *stateObject)

func (*CommitStateDB) WithContext

func (csdb *CommitStateDB) WithContext(ctx sdk.Context) *CommitStateDB

WithContext returns a Database with an updated SDK context

func (*CommitStateDB) WithHistoricalTrie added in v1.5.0

func (csdb *CommitStateDB) WithHistoricalTrie() *CommitStateDB

type CommitStateDBParams

type CommitStateDBParams struct {
	StoreKey      sdk.StoreKey
	ParamSpace    Subspace
	AccountKeeper AccountKeeper
	SupplyKeeper  SupplyKeeper
	BankKeeper    BankKeeper
	Ada           DbAdapter
	// Amino codec
	Cdc *codec.Codec

	DB       ethstate.Database
	Trie     ethstate.Trie
	RootHash ethcmn.Hash
}

type ContractMethod added in v1.0.0

type ContractMethod struct {
	Sign  string `json:"sign" yaml:"sign"`
	Extra string `json:"extra" yaml:"extra"`
}

ContractMethod is the blocked contract method Name is method name Extra is a extend data is useless

func (ContractMethod) String added in v1.0.0

func (cm ContractMethod) String() string

type ContractMethodBlockedCache added in v1.0.0

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

func NewContractMethodBlockedCache added in v1.0.0

func NewContractMethodBlockedCache() *ContractMethodBlockedCache

func (*ContractMethodBlockedCache) GetContractMethod added in v1.0.0

func (cmbc *ContractMethodBlockedCache) GetContractMethod(keyData []byte) (ContractMethods, bool)

func (*ContractMethodBlockedCache) SetContractMethod added in v1.0.0

func (cmbc *ContractMethodBlockedCache) SetContractMethod(keyData []byte, bc ContractMethods)

type ContractMethods added in v1.0.0

type ContractMethods []ContractMethod

ContractMethods is the list of blocked contract method

func (*ContractMethods) DeleteContractMethodMap added in v1.0.0

func (cms *ContractMethods) DeleteContractMethodMap(methods ContractMethods) (ContractMethods, error)

DeleteContractMethodMap delete the list of ContractMethod from cms. if method is not exist,it can not be panic or error

func (ContractMethods) GetContractMethodsMap added in v1.0.0

func (cms ContractMethods) GetContractMethodsMap() map[string]ContractMethod

GetContractMethodsMap return map which key is method,value is ContractMethod.

func (*ContractMethods) InsertContractMethods added in v1.0.0

func (cms *ContractMethods) InsertContractMethods(methods ContractMethods) (ContractMethods, error)

InsertContractMethods insert the list of ContractMethod into cms. if repeated,methods will cover cms

func (ContractMethods) IsContain added in v1.0.0

func (cms ContractMethods) IsContain(method string) bool

IsContain return true if the method of contract contains ContractMethods.

func (ContractMethods) String added in v1.0.0

func (cms ContractMethods) String() string

String returns ContractMethods string

func (ContractMethods) ValidateBasic added in v1.0.0

func (cms ContractMethods) ValidateBasic() sdk.Error

ValidateBasic validates the list of blocked contract method

type ContractVerifier added in v1.0.0

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

ContractVerifier which verify contract method whether blocked

func NewContractVerifier added in v1.0.0

func NewContractVerifier(params Params) *ContractVerifier

NewContractVerifier return a point of ContractVerifier

func (ContractVerifier) Verify added in v1.0.0

func (cv ContractVerifier) Verify(stateDB vm.StateDB, op vm.OpCode, from, to common.Address, input []byte, value *big.Int) error

Verify check the contract whether is blocked. It never return error,because in this chain if it blocked, not allow to execute next opCode.In Ethereum call failed,the call err is deal in contract code ether evm. If current call/delegatecall/callcode contract method is blocked,it will be panic,then it's deal logic at defer{recover}. If contract all method blocked,it will not be panic in Verify. it will be panic in stateDb.GetCode().

type DbAdapter added in v0.18.7

type DbAdapter interface {
	NewStore(parent types.KVStore, prefix []byte) StoreProxy
}

type DefaultPrefixDb added in v0.18.7

type DefaultPrefixDb struct {
}

func (DefaultPrefixDb) NewStore added in v0.18.7

func (d DefaultPrefixDb) NewStore(parent types.KVStore, Prefix []byte) StoreProxy

type ErrContractBlockedVerify added in v1.0.0

type ErrContractBlockedVerify struct {
	Descriptor string
}

type EthAddressStringer added in v1.1.9

type EthAddressStringer ethcmn.Address

func (EthAddressStringer) String added in v1.1.9

func (address EthAddressStringer) String() string

type EthHashStringer added in v1.1.9

type EthHashStringer ethcmn.Hash

func (EthHashStringer) String added in v1.1.9

func (h EthHashStringer) String() string

type EvmHooks added in v1.3.0

type EvmHooks interface {
	// PostTxProcessing Must be called after tx is processed successfully, if return an error, the whole transaction is reverted.
	PostTxProcessing(ctx sdk.Context, from common.Address, to *common.Address, receipt *ethtypes.Receipt) error
}

EvmHooks event hooks for evm tx processing

type EvmLogHandler added in v1.3.0

type EvmLogHandler interface {
	// EventID Return the id of the log signature it handles
	EventID() common.Hash
	// Handle Process the log
	Handle(ctx sdk.Context, contract common.Address, data []byte) error
}

EvmLogHandler defines the interface for evm log handler

type ExecutionResult

type ExecutionResult struct {
	Logs      []*ethtypes.Log
	Bloom     *big.Int
	Result    *sdk.Result
	GasInfo   GasInfo
	TraceLogs []byte
}

ExecutionResult represents what's returned from a transition

type GasInfo

type GasInfo struct {
	GasLimit    uint64
	GasConsumed uint64
	GasRefunded uint64
}

GasInfo returns the gas limit, gas consumed and gas refunded from the EVM transition execution

type GenesisAccount

type GenesisAccount struct {
	Address string        `json:"address"`
	Code    hexutil.Bytes `json:"code,omitempty"`
	Storage Storage       `json:"storage,omitempty"`
}

GenesisAccount defines an account to be initialized in the genesis state. Its main difference between with Geth's GenesisAccount is that it uses a custom storage type and that it doesn't contain the private key field. NOTE: balance is omitted as it is imported from the auth account balance.

func (GenesisAccount) MarshalJSON

func (ga GenesisAccount) MarshalJSON() ([]byte, error)

func (*GenesisAccount) UnmarshalJSON

func (ga *GenesisAccount) UnmarshalJSON(input []byte) error

func (GenesisAccount) Validate

func (ga GenesisAccount) Validate() error

Validate performs a basic validation of a GenesisAccount fields.

type GenesisState

type GenesisState struct {
	Accounts                    []GenesisAccount    `json:"accounts"`
	TxsLogs                     []TransactionLogs   `json:"txs_logs"`
	ContractDeploymentWhitelist AddressList         `json:"contract_deployment_whitelist"`
	ContractBlockedList         AddressList         `json:"contract_blocked_list"`
	ContractMethodBlockedList   BlockedContractList `json:"contract_method_blocked_list,omitempty"`
	ChainConfig                 ChainConfig         `json:"chain_config"`
	Params                      Params              `json:"params"`
}

GenesisState defines the evm module genesis state

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState sets default evm genesis state with empty accounts and default params and chain config values.

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

type Indexer

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

Indexer does a post-processing job for equally sized sections of the canonical chain (like BlooomBits and CHT structures). A Indexer is connected to the blockchain through the event system by starting a ChainHeadEventLoop in a goroutine.

Further child ChainIndexers can be added which use the output of the parent section indexer. These child indexers receive new head notifications only after an entire section has been finished or in case of rollbacks that might affect already finished sections.

func GetIndexer

func GetIndexer() *Indexer

func (*Indexer) GetDB

func (b *Indexer) GetDB() dbm.DB

GetDB get db of bloomIndexer

func (*Indexer) GetValidSections

func (i *Indexer) GetValidSections() uint64

GetValidSections reads the number of valid sections from the index database and caches is into the local state.

func (*Indexer) IsProcessing

func (i *Indexer) IsProcessing() bool

func (*Indexer) NotifyNewHeight added in v0.18.8

func (i *Indexer) NotifyNewHeight(ctx sdk.Context)

func (*Indexer) ProcessSection

func (i *Indexer) ProcessSection(ctx sdk.Context, k Keeper, interval uint64, bloomData *[]*KV)

func (*Indexer) StoredSection

func (i *Indexer) StoredSection() uint64

type KV added in v1.0.0

type KV struct {
	Key   []byte `json:"key"`
	Value []byte `json:"value"`
}

func (*KV) MarshalToAmino added in v1.1.6

func (k *KV) MarshalToAmino(cdc *amino.Codec) ([]byte, error)

MarshalToAmino encode KV data to amino bytes

func (*KV) UnmarshalFromAmino added in v1.1.6

func (k *KV) UnmarshalFromAmino(_ *amino.Codec, data []byte) error

UnmarshalFromAmino unmarshal amino bytes to this object

type Keeper

type Keeper interface {
	GetBlockBloom(ctx sdk.Context, height int64) ethtypes.Bloom
	GetHeightHash(ctx sdk.Context, height uint64) common.Hash
}

type ManageContractBlockedListProposal

type ManageContractBlockedListProposal struct {
	Title         string      `json:"title" yaml:"title"`
	Description   string      `json:"description" yaml:"description"`
	ContractAddrs AddressList `json:"contract_addresses" yaml:"contract_addresses"`
	IsAdded       bool        `json:"is_added" yaml:"is_added"`
}

ManageContractBlockedListProposal - structure for the proposal to add or delete a contract address from blocked list

func NewManageContractBlockedListProposal

func NewManageContractBlockedListProposal(title, description string, contractAddrs AddressList, isAdded bool,
) ManageContractBlockedListProposal

NewManageContractBlockedListProposal creates a new instance of ManageContractBlockedListProposal

func (ManageContractBlockedListProposal) GetDescription

func (mp ManageContractBlockedListProposal) GetDescription() string

GetDescription returns description of a manage contract blocked list proposal object

func (ManageContractBlockedListProposal) GetTitle

GetTitle returns title of a manage contract blocked list proposal object

func (ManageContractBlockedListProposal) ProposalRoute

func (mp ManageContractBlockedListProposal) ProposalRoute() string

ProposalRoute returns route key of a manage contract blocked list proposal object

func (ManageContractBlockedListProposal) ProposalType

func (mp ManageContractBlockedListProposal) ProposalType() string

ProposalType returns type of a manage contract blocked list proposal object

func (ManageContractBlockedListProposal) String

String returns a human readable string representation of a ManageContractBlockedListProposal

func (ManageContractBlockedListProposal) ValidateBasic

func (mp ManageContractBlockedListProposal) ValidateBasic() sdk.Error

ValidateBasic validates a manage contract blocked list proposal

type ManageContractDeploymentWhitelistProposal

type ManageContractDeploymentWhitelistProposal struct {
	Title            string      `json:"title" yaml:"title"`
	Description      string      `json:"description" yaml:"description"`
	DistributorAddrs AddressList `json:"distributor_addresses" yaml:"distributor_addresses"`
	IsAdded          bool        `json:"is_added" yaml:"is_added"`
}

ManageContractDeploymentWhitelistProposal - structure for the proposal to add or delete deployer addresses from whitelist

func NewManageContractDeploymentWhitelistProposal

func NewManageContractDeploymentWhitelistProposal(title, description string, distributorAddrs []sdk.AccAddress, isAdded bool,
) ManageContractDeploymentWhitelistProposal

NewManageContractDeploymentWhitelistProposal creates a new instance of ManageContractDeploymentWhitelistProposal

func (ManageContractDeploymentWhitelistProposal) GetDescription

GetDescription returns description of a manage contract deployment whitelist proposal object

func (ManageContractDeploymentWhitelistProposal) GetTitle

GetTitle returns title of a manage contract deployment whitelist proposal object

func (ManageContractDeploymentWhitelistProposal) ProposalRoute

ProposalRoute returns route key of a manage contract deployment whitelist proposal object

func (ManageContractDeploymentWhitelistProposal) ProposalType

ProposalType returns type of a manage contract deployment whitelist proposal object

func (ManageContractDeploymentWhitelistProposal) String

String returns a human readable string representation of a ManageContractDeploymentWhitelistProposal

func (ManageContractDeploymentWhitelistProposal) ValidateBasic

ValidateBasic validates a manage contract deployment whitelist proposal

type ManageContractMethodBlockedListProposal added in v1.0.0

type ManageContractMethodBlockedListProposal struct {
	Title        string              `json:"title" yaml:"title"`
	Description  string              `json:"description" yaml:"description"`
	ContractList BlockedContractList `json:"contract_addresses" yaml:"contract_addresses"`
	IsAdded      bool                `json:"is_added" yaml:"is_added"`
}

ManageContractMethodBlockedListProposal - structure for the proposal to add or delete a contract method from blocked list

func NewManageContractMethodBlockedListProposal added in v1.0.0

func NewManageContractMethodBlockedListProposal(title, description string, contractList BlockedContractList, isAdded bool,
) ManageContractMethodBlockedListProposal

NewManageContractMethodBlockedListProposal creates a new instance of ManageContractMethodBlockedListProposal

func (ManageContractMethodBlockedListProposal) GetDescription added in v1.0.0

func (mp ManageContractMethodBlockedListProposal) GetDescription() string

GetDescription returns description of a manage contract blocked list proposal object

func (ManageContractMethodBlockedListProposal) GetTitle added in v1.0.0

GetTitle returns title of a manage contract blocked list proposal object

func (ManageContractMethodBlockedListProposal) ProposalRoute added in v1.0.0

ProposalRoute returns route key of a manage contract blocked list proposal object

func (ManageContractMethodBlockedListProposal) ProposalType added in v1.0.0

ProposalType returns type of a manage contract blocked list proposal object

func (ManageContractMethodBlockedListProposal) String added in v1.0.0

String returns a human readable string representation of a ManageContractMethodBlockedListProposal

func (ManageContractMethodBlockedListProposal) ValidateBasic added in v1.0.0

ValidateBasic validates a manage contract blocked list proposal

type MsgEthereumTx

type MsgEthereumTx struct {
	Data TxData

	sdk.BaseTx `json:"-" rlp:"-"`
}

MsgEthereumTx encapsulates an Ethereum transaction as an SDK message.

func NewMsgEthereumTx

func NewMsgEthereumTx(
	nonce uint64, to *ethcmn.Address, amount *big.Int,
	gasLimit uint64, gasPrice *big.Int, payload []byte,
) *MsgEthereumTx

NewMsgEthereumTx returns a reference to a new Ethereum transaction message.

func NewMsgEthereumTxContract

func NewMsgEthereumTxContract(
	nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, payload []byte,
) *MsgEthereumTx

NewMsgEthereumTxContract returns a reference to a new Ethereum transaction message designated for contract creation.

func (*MsgEthereumTx) AccountAddress added in v1.2.0

func (msg *MsgEthereumTx) AccountAddress() sdk.AccAddress

From loads the ethereum sender address from the sigcache and returns an sdk.AccAddress from its bytes

func (*MsgEthereumTx) CalcCostTo added in v1.6.2

func (msg *MsgEthereumTx) CalcCostTo(total *big.Int) *big.Int

CalcCostTo set total to amount + gasprice * gaslimit and return it

func (*MsgEthereumTx) CalcFee added in v1.6.2

func (msg *MsgEthereumTx) CalcFee(fee *big.Int) *big.Int

CalcFee set fee to gasprice * gaslimit and return fee

func (*MsgEthereumTx) ChainID

func (msg *MsgEthereumTx) ChainID() *big.Int

ChainID returns which chain id this transaction was signed for (if at all)

func (*MsgEthereumTx) Cost

func (msg *MsgEthereumTx) Cost() *big.Int

Cost returns amount + gasprice * gaslimit.

func (*MsgEthereumTx) DecodeRLP

func (msg *MsgEthereumTx) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface.

func (*MsgEthereumTx) EncodeRLP

func (msg *MsgEthereumTx) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface.

func (*MsgEthereumTx) EthereumAddress added in v1.2.0

func (msg *MsgEthereumTx) EthereumAddress() ethcmn.Address

func (*MsgEthereumTx) Fee

func (msg *MsgEthereumTx) Fee() *big.Int

Fee returns gasprice * gaslimit.

func (MsgEthereumTx) FeePayer

func (msg MsgEthereumTx) FeePayer(ctx sdk.Context) sdk.AccAddress

func (*MsgEthereumTx) GetFee

func (msg *MsgEthereumTx) GetFee() sdk.Coins

func (*MsgEthereumTx) GetFrom added in v1.2.0

func (tx *MsgEthereumTx) GetFrom() string

GetFrom returns sender address of MsgEthereumTx if signature is valid, or returns "".

func (*MsgEthereumTx) GetGas

func (msg *MsgEthereumTx) GetGas() uint64

GetGas implements the GasTx interface. It returns the GasLimit of the transaction.

func (*MsgEthereumTx) GetGasPrice added in v0.19.12

func (msg *MsgEthereumTx) GetGasPrice() *big.Int

GetGasPrice return gas price

func (*MsgEthereumTx) GetMsgs

func (msg *MsgEthereumTx) GetMsgs() []sdk.Msg

GetMsgs returns a single MsgEthereumTx as an sdk.Msg.

func (*MsgEthereumTx) GetNonce added in v1.2.0

func (msg *MsgEthereumTx) GetNonce() uint64

func (MsgEthereumTx) GetSender added in v1.6.2

func (msg MsgEthereumTx) GetSender(ctx sdk.Context) string

func (*MsgEthereumTx) GetSignBytes

func (msg *MsgEthereumTx) GetSignBytes() []byte

GetSignBytes returns the Amino bytes of an Ethereum transaction message used for signing.

NOTE: This method cannot be used as a chain ID is needed to create valid bytes to sign over. Use 'RLPSignBytes' instead.

func (*MsgEthereumTx) GetSigners

func (msg *MsgEthereumTx) GetSigners() []sdk.AccAddress

GetSigners returns the expected signers for an Ethereum transaction message. For such a message, there should exist only a single 'signer'.

NOTE: This method panics if 'VerifySig' hasn't been called first.

func (*MsgEthereumTx) GetTxFnSignatureInfo added in v0.19.16

func (msg *MsgEthereumTx) GetTxFnSignatureInfo() ([]byte, int)

func (*MsgEthereumTx) GetType added in v1.1.5

func (tx *MsgEthereumTx) GetType() sdk.TransactionType

func (*MsgEthereumTx) HomesteadSignHash

func (msg *MsgEthereumTx) HomesteadSignHash() ethcmn.Hash

Hash returns the hash to be signed by the sender. It does not uniquely identify the transaction.

func (*MsgEthereumTx) RLPSignBytes

func (msg *MsgEthereumTx) RLPSignBytes(chainID *big.Int) (h ethcmn.Hash)

RLPSignBytes returns the RLP hash of an Ethereum transaction message with a given chainID used for signing.

func (*MsgEthereumTx) RawSignatureValues

func (msg *MsgEthereumTx) RawSignatureValues() (v, r, s *big.Int)

RawSignatureValues returns the V, R, S signature values of the transaction. The return values should not be modified by the caller.

func (*MsgEthereumTx) Route

func (msg *MsgEthereumTx) Route() string

Route returns the route value of an MsgEthereumTx.

func (*MsgEthereumTx) SetFrom added in v1.1.6

func (tx *MsgEthereumTx) SetFrom(addr string)

func (*MsgEthereumTx) Sign

func (msg *MsgEthereumTx) Sign(chainID *big.Int, priv *ecdsa.PrivateKey) error

Sign calculates a secp256k1 ECDSA signature and signs the transaction. It takes a private key and chainID to sign an Ethereum transaction according to EIP155 standard. It mutates the transaction as it populates the V, R, S fields of the Transaction's Signature.

func (*MsgEthereumTx) String

func (msg *MsgEthereumTx) String() string

func (*MsgEthereumTx) To

func (msg *MsgEthereumTx) To() *ethcmn.Address

To returns the recipient address of the transaction. It returns nil if the transaction is a contract creation.

func (*MsgEthereumTx) Type

func (msg *MsgEthereumTx) Type() string

Type returns the type value of an MsgEthereumTx.

func (*MsgEthereumTx) UnmarshalFromAmino added in v0.19.16

func (msg *MsgEthereumTx) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

func (*MsgEthereumTx) ValidateBasic

func (msg *MsgEthereumTx) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface. It performs basic validation checks of a Transaction. If returns an error if validation fails.

func (*MsgEthereumTx) VerifySig

func (msg *MsgEthereumTx) VerifySig(chainID *big.Int, height int64) error

VerifySig attempts to verify a Transaction's signature for a given chainID. A derived address is returned upon success or an error if recovery fails.

type NoOpTracer added in v1.1.7

type NoOpTracer struct{}

NoOpTracer is an empty implementation of vm.Tracer interface

func NewNoOpTracer added in v1.1.7

func NewNoOpTracer() *NoOpTracer

NewNoOpTracer creates a no-op vm.Tracer

func (NoOpTracer) CaptureEnd added in v1.1.7

func (dt NoOpTracer) CaptureEnd(
	output []byte,
	gasUsed uint64,
	t time.Duration,
	err error,
)

CaptureEnd implements vm.Tracer interface

func (NoOpTracer) CaptureEnter added in v1.1.7

func (dt NoOpTracer) CaptureEnter(
	typ vm.OpCode,
	from common.Address,
	to common.Address,
	input []byte,
	gas uint64,
	value *big.Int,
)

CaptureEnter implements vm.Tracer interface

func (NoOpTracer) CaptureExit added in v1.1.7

func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error)

CaptureExit implements vm.Tracer interface

func (NoOpTracer) CaptureFault added in v1.1.7

func (dt NoOpTracer) CaptureFault(
	env *vm.EVM,
	pc uint64,
	op vm.OpCode,
	gas, cost uint64,
	scope *vm.ScopeContext,
	depth int,
	err error,
)

CaptureFault implements vm.Tracer interface

func (NoOpTracer) CaptureStart added in v1.1.7

func (dt NoOpTracer) CaptureStart(
	env *vm.EVM,
	from, to common.Address,
	create bool,
	input []byte,
	gas uint64,
	value *big.Int,
)

CaptureStart implements vm.Tracer interface

func (NoOpTracer) CaptureState added in v1.1.7

func (dt NoOpTracer) CaptureState(
	env *vm.EVM,
	pc uint64,
	op vm.OpCode,
	gas, cost uint64,
	scope *vm.ScopeContext,
	rData []byte,
	depth int,
	err error,
)

CaptureState implements vm.Tracer interface

type OverrideAccount added in v1.2.3

type OverrideAccount struct {
	Nonce     *hexutil.Uint64              `json:"nonce"`
	Code      *hexutil.Bytes               `json:"code"`
	Balance   **hexutil.Big                `json:"balance"`
	State     *map[common.Hash]common.Hash `json:"state"`
	StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
}

Account indicates the overriding fields of account during the execution of a message call. NOTE: state and stateDiff can't be specified at the same time. If state is set, message execution will only use the data in the given state. Otherwise if statDiff is set, all diff will be applied first and then execute the call message.

type Params

type Params struct {
	// EnableCreate toggles state transitions that use the vm.Create function
	EnableCreate bool `json:"enable_create" yaml:"enable_create"`
	// EnableCall toggles state transitions that use the vm.Call function
	EnableCall bool `json:"enable_call" yaml:"enable_call"`
	// ExtraEIPs defines the additional EIPs for the vm.Config
	ExtraEIPs []int `json:"extra_eips" yaml:"extra_eips"`
	// EnableContractDeploymentWhitelist controls the authorization of contract deployer
	EnableContractDeploymentWhitelist bool `json:"enable_contract_deployment_whitelist" yaml:"enable_contract_deployment_whitelist"`
	// EnableContractBlockedList controls the availability of contracts
	EnableContractBlockedList bool `json:"enable_contract_blocked_list" yaml:"enable_contract_blocked_list"`
	// MaxGasLimit defines the max gas limit in transaction
	MaxGasLimitPerTx uint64 `json:"max_gas_limit_per_tx" yaml:"max_gas_limit_per_tx"`
}

Params defines the EVM module parameters

func DefaultParams

func DefaultParams() Params

DefaultParams returns default evm parameters

func NewParams

func NewParams(enableCreate, enableCall, enableContractDeploymentWhitelist, enableContractBlockedList bool, maxGasLimitPerTx uint64,
	extraEIPs ...int) Params

NewParams creates a new Params instance

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs returns the parameter set pairs.

func (Params) String

func (p Params) String() string

String implements the fmt.Stringer interface

func (Params) Validate

func (p Params) Validate() error

Validate performs basic validation on evm parameters.

type QueryBloomFilter

type QueryBloomFilter struct {
	Bloom ethtypes.Bloom `json:"bloom"`
}

QueryBloomFilter is response type for tx logs query

func (QueryBloomFilter) String

func (q QueryBloomFilter) String() string

type QueryETHLogs

type QueryETHLogs struct {
	Logs []*ethtypes.Log `json:"logs"`
}

QueryETHLogs is response type for tx logs query

func (QueryETHLogs) String

func (q QueryETHLogs) String() string

type QueryResAccount

type QueryResAccount struct {
	Balance  string `json:"balance"`
	CodeHash []byte `json:"codeHash"`
	Nonce    uint64 `json:"nonce"`
}

QueryAccount is response type for querying Ethereum state objects

type QueryResBalance

type QueryResBalance struct {
	Balance string `json:"balance"`
}

QueryResBalance is response type for balance query

func (QueryResBalance) String

func (q QueryResBalance) String() string

type QueryResBlockNumber

type QueryResBlockNumber struct {
	Number int64 `json:"blockNumber"`
}

QueryResBlockNumber is response type for block number query

func (QueryResBlockNumber) String

func (q QueryResBlockNumber) String() string

type QueryResCode

type QueryResCode struct {
	Code []byte
}

QueryResCode is response type for code query

func (QueryResCode) String

func (q QueryResCode) String() string

type QueryResExportAccount

type QueryResExportAccount = GenesisAccount

type QueryResNonce

type QueryResNonce struct {
	Nonce uint64 `json:"nonce"`
}

QueryResNonce is response type for Nonce query

func (QueryResNonce) String

func (q QueryResNonce) String() string

type QueryResStorage

type QueryResStorage struct {
	Value []byte `json:"value"`
}

QueryResStorage is response type for storage query

func (QueryResStorage) String

func (q QueryResStorage) String() string

type QueryResStorageProof added in v1.5.0

type QueryResStorageProof struct {
	Value []byte   `json:"value"`
	Proof [][]byte `json:"proof"`
}

QueryResStorage is response type for storage query

func (QueryResStorageProof) String added in v1.5.0

func (q QueryResStorageProof) String() string

type ResultData

type ResultData struct {
	ContractAddress ethcmn.Address  `json:"contract_address"`
	Bloom           ethtypes.Bloom  `json:"bloom"`
	Logs            []*ethtypes.Log `json:"logs"`
	Ret             []byte          `json:"ret"`
	TxHash          ethcmn.Hash     `json:"tx_hash"`
}

ResultData represents the data returned in an sdk.Result

func DecodeResultData

func DecodeResultData(in []byte) (ResultData, error)

DecodeResultData decodes an amino-encoded byte slice into ResultData

func (*ResultData) MarshalToAmino added in v0.19.16

func (rd *ResultData) MarshalToAmino(_ *amino.Codec) ([]byte, error)

func (ResultData) String

func (rd ResultData) String() string

String implements fmt.Stringer interface.

func (*ResultData) UnmarshalFromAmino added in v1.0.0

func (rd *ResultData) UnmarshalFromAmino(_ *amino.Codec, data []byte) error

type State

type State struct {
	Key   ethcmn.Hash `json:"key"`
	Value ethcmn.Hash `json:"value"`
}

State represents a single Storage key value pair item.

func NewState

func NewState(key, value ethcmn.Hash) State

NewState creates a new State instance

func (State) MarshalJSON

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

func (*State) UnmarshalJSON

func (s *State) UnmarshalJSON(input []byte) error

func (State) Validate

func (s State) Validate() error

Validate performs a basic validation of the State fields.

type StateObject

type StateObject interface {
	GetCommittedState(db ethstate.Database, key ethcmn.Hash) ethcmn.Hash
	GetState(db ethstate.Database, key ethcmn.Hash) ethcmn.Hash
	SetState(db ethstate.Database, key, value ethcmn.Hash)

	Code(db ethstate.Database) []byte
	SetCode(codeHash ethcmn.Hash, code []byte)
	CodeHash() []byte

	AddBalance(amount *big.Int)
	SubBalance(amount *big.Int)
	SetBalance(amount *big.Int)

	Balance() *big.Int
	ReturnGas(gas *big.Int)
	Address() ethcmn.Address

	SetNonce(nonce uint64)
	Nonce() uint64

	SetStorage(storage map[ethcmn.Hash]ethcmn.Hash)
}

StateObject interface for interacting with state object

type StateOverrides added in v1.2.3

type StateOverrides map[common.Address]OverrideAccount

StateOverride is the collection of overridden accounts.

func (*StateOverrides) Apply added in v1.2.3

func (diff *StateOverrides) Apply(state *CommitStateDB)

Apply overrides the fields of specified accounts into the given state.

func (*StateOverrides) Check added in v1.2.3

func (diff *StateOverrides) Check() error

func (*StateOverrides) GetBytes added in v1.2.3

func (diff *StateOverrides) GetBytes() ([]byte, error)

func (*StateOverrides) ToString added in v1.2.3

func (diff *StateOverrides) ToString() (string, error)

type StateTransition

type StateTransition struct {
	// TxData fields
	AccountNonce uint64
	Price        *big.Int
	GasLimit     uint64
	Recipient    *common.Address
	Amount       *big.Int
	Payload      []byte

	ChainID    *big.Int
	Csdb       *CommitStateDB
	TxHash     *common.Hash
	Sender     common.Address
	Simulate   bool // i.e CheckTx execution
	TraceTx    bool // reexcute tx or its predesessors
	TraceTxLog bool // trace tx for its evm logs (predesessors are set to false)
}

StateTransition defines data to transitionDB in evm

func (StateTransition) TransitionDb

func (st StateTransition) TransitionDb(ctx sdk.Context, config ChainConfig) (exeRes *ExecutionResult, resData *ResultData, err error, innerTxs, erc20Contracts interface{})

TransitionDb will transition the state by applying the current transaction and returning the evm execution result. NOTE: State transition checks are run during AnteHandler execution.

type Storage

type Storage []State

Storage represents the account Storage map as a slice of single key value State pairs. This is to prevent non determinism at genesis initialization or export.

func (Storage) Copy

func (s Storage) Copy() Storage

Copy returns a copy of storage.

func (Storage) String

func (s Storage) String() string

String implements the stringer interface

func (Storage) Validate

func (s Storage) Validate() error

Validate performs a basic validation of the Storage fields.

type StoreProxy added in v0.18.7

type StoreProxy interface {
	Set(key, value []byte)
	Get(key []byte) []byte
	Delete(key []byte)
	Has(key []byte) bool
}

type StructLogRes added in v0.19.14

type StructLogRes struct {
	Pc      uint64             `json:"pc"`
	Op      string             `json:"op"`
	Gas     uint64             `json:"gas"`
	GasCost uint64             `json:"gasCost"`
	Depth   int                `json:"depth"`
	Error   error              `json:"error,omitempty"`
	Stack   *[]string          `json:"stack,omitempty"`
	Memory  *[]string          `json:"memory,omitempty"`
	Storage *map[string]string `json:"storage,omitempty"`
}

StructLogRes stores a structured log emitted by the EVM while replaying a transaction in debug mode

func FormatLogs added in v0.19.14

func FormatLogs(logs []vm.StructLog) []*StructLogRes

FormatLogs formats EVM returned structured logs for json output

type Subspace added in v0.18.7

type Subspace interface {
	GetParamSet(ctx sdk.Context, ps params.ParamSet)
	SetParamSet(ctx sdk.Context, ps params.ParamSet)
	CustomKVStore(ctx sdk.Context) sdk.KVStore
}

type SupplyKeeper

type SupplyKeeper interface {
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
}

type TraceConfig added in v1.3.0

type TraceConfig struct {
	// custom javascript tracer
	Tracer string `json:"tracer"`
	// disable stack capture
	DisableStack bool `json:"disableStack"`
	// disable storage capture
	DisableStorage bool `json:"disableStorage"`
	// print output during capture end
	Debug bool `json:"debug"`
	// enable memory capture
	DisableMemory bool `json:"disableMemory"`
	// enable return data capture
	DisableReturnData bool `json:"disableReturnData"`
}

type TraceExecutionResult added in v0.19.14

type TraceExecutionResult struct {
	Gas         uint64          `json:"gas"`
	Failed      bool            `json:"failed"`
	ReturnValue string          `json:"returnValue"`
	StructLogs  []*StructLogRes `json:"structLogs"`
}

TraceExecutionResult groups all structured logs emitted by the EVM while replaying a transaction in debug mode as well as transaction execution status, the amount of gas used and the return value

type TransactionLogs

type TransactionLogs struct {
	Hash ethcmn.Hash     `json:"hash"`
	Logs []*ethtypes.Log `json:"logs"`
}

TransactionLogs define the logs generated from a transaction execution with a given hash. It it used for import/export data as transactions are not persisted on blockchain state after an upgrade.

func NewTransactionLogs

func NewTransactionLogs(hash ethcmn.Hash, logs []*ethtypes.Log) TransactionLogs

NewTransactionLogs creates a new NewTransactionLogs instance.

func (TransactionLogs) Validate

func (tx TransactionLogs) Validate() error

Validate performs a basic validation of a GenesisAccount fields.

type TxData

type TxData struct {
	AccountNonce uint64          `json:"nonce"`
	Price        *big.Int        `json:"gasPrice"`
	GasLimit     uint64          `json:"gas"`
	Recipient    *ethcmn.Address `json:"to" rlp:"nil"` // nil means contract creation
	Amount       *big.Int        `json:"value"`
	Payload      []byte          `json:"input"`

	// signature values
	V *big.Int `json:"v"`
	R *big.Int `json:"r"`
	S *big.Int `json:"s"`

	// hash is only used when marshaling to JSON
	Hash *ethcmn.Hash `json:"hash" rlp:"-"`
}

TxData implements the Ethereum transaction data structure. It is used solely as intended in Ethereum abiding by the protocol.

func (TxData) MarshalAmino

func (td TxData) MarshalAmino() ([]byte, error)

MarshalAmino defines custom encoding scheme for TxData

func (TxData) String

func (td TxData) String() string

func (*TxData) UnmarshalAmino

func (td *TxData) UnmarshalAmino(data []byte) error

UnmarshalAmino defines custom decoding scheme for TxData

func (*TxData) UnmarshalFromAmino added in v0.19.16

func (td *TxData) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

type Unmarshaler added in v1.3.0

type Unmarshaler func(bytes []byte, ptr interface{}) error

Unmarshaler is a generic type for Unmarshal functions

type Watcher added in v0.18.7

type Watcher interface {
	SaveAccount(account auth.Account, isDirectly bool)
	AddDelAccMsg(account auth.Account, isDirectly bool)
	SaveState(addr ethcmn.Address, key, value []byte)
	Enabled() bool
	SaveContractBlockedListItem(addr sdk.AccAddress)
	SaveContractDeploymentWhitelistItem(addr sdk.AccAddress)
	DeleteContractBlockedList(addr sdk.AccAddress)
	DeleteContractDeploymentWhitelist(addr sdk.AccAddress)
	SaveContractMethodBlockedListItem(addr sdk.AccAddress, methods []byte)
}

Jump to

Keyboard shortcuts

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