Documentation
¶
Index ¶
- func ApplyMessage(evm *corevm.EVM, msg core.Message, gp *core.GasPool, ...) (*core.ExecutionResult, error)
- type Keeper
- func (k Keeper) Account(c context.Context, req *evmtypes.QueryAccountRequest) (*evmtypes.QueryAccountResponse, error)
- func (k *Keeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer corevm.EVMLogger, commit bool) (*evmtypes.MsgEthereumTxResponse, error)
- func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, tracer corevm.EVMLogger, commit bool, ...) (*evmtypes.MsgEthereumTxResponse, error)
- func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*evmtypes.MsgEthereumTxResponse, error)
- func (k Keeper) Balance(c context.Context, req *evmtypes.QueryBalanceRequest) (*evmtypes.QueryBalanceResponse, error)
- func (k Keeper) BaseFee(c context.Context, _ *evmtypes.QueryBaseFeeRequest) (*evmtypes.QueryBaseFeeResponse, error)
- func (k *Keeper) BeginBlock(ctx sdk.Context)
- func (k Keeper) Code(c context.Context, req *evmtypes.QueryCodeRequest) (*evmtypes.QueryCodeResponse, error)
- func (k Keeper) CosmosAccount(c context.Context, req *evmtypes.QueryCosmosAccountRequest) (*evmtypes.QueryCosmosAccountResponse, error)
- func (k *Keeper) DeleteCodeHash(ctx sdk.Context, addr []byte)
- func (k *Keeper) EVMConfig(ctx sdk.Context, overrideProposerAddress sdk.ConsAddress) (*evmvm.EVMConfig, error)
- func (k Keeper) EmitBlockBloomEvent(ctx sdk.Context, bloom ethtypes.Bloom)
- func (k *Keeper) EndBlock(ctx sdk.Context)
- func (k Keeper) EstimateGas(c context.Context, req *evmtypes.EthCallRequest) (*evmtypes.EstimateGasResponse, error)
- func (k Keeper) EthCall(c context.Context, req *evmtypes.EthCallRequest) (*evmtypes.MsgEthereumTxResponse, error)
- func (k *Keeper) EthereumTx(goCtx context.Context, msg *evmtypes.MsgEthereumTx) (*evmtypes.MsgEthereumTxResponse, error)
- func (k *Keeper) ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key, value common.Hash) bool)
- func (k Keeper) ForTest_RemoveEip155ChainId(ctx sdk.Context)
- func (k Keeper) GetAccountStorage(ctx sdk.Context, address common.Address) evmtypes.Storage
- func (k *Keeper) GetBalance(ctx sdk.Context, addr common.Address) *big.Int
- func (k Keeper) GetBaseFee(ctx sdk.Context) sdkmath.Int
- func (k Keeper) GetBlockHashByBlockNumber(ctx sdk.Context, height int64) common.Hash
- func (k Keeper) GetChainConfig(ctx sdk.Context) *ethparams.ChainConfig
- func (k *Keeper) GetCode(ctx sdk.Context, codeHash common.Hash) []byte
- func (k *Keeper) GetCodeHash(ctx sdk.Context, addr []byte) common.Hash
- func (k Keeper) GetCoinbaseAddress(ctx sdk.Context, overrideProposerAddress sdk.ConsAddress) (common.Address, error)
- func (k Keeper) GetCumulativeLogCountTransient(ctx sdk.Context, exceptCurrent bool) uint64
- func (k Keeper) GetEip155ChainId(ctx sdk.Context) evmtypes.Eip155ChainId
- func (k Keeper) GetGasUsedForTdxIndexTransient(ctx sdk.Context, txIdx uint64) uint64
- func (k Keeper) GetHashFn(ctx sdk.Context) corevm.GetHashFunc
- func (k *Keeper) GetNonce(ctx sdk.Context, addr common.Address) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params evmtypes.Params)
- func (k Keeper) GetRawTxCountTransient(ctx sdk.Context) uint64
- func (k *Keeper) GetState(ctx sdk.Context, addr common.Address, key common.Hash) common.Hash
- func (k Keeper) GetTxCountTransient(ctx sdk.Context) uint64
- func (k Keeper) GetTxReceiptsTransient(ctx sdk.Context) (receipts ethtypes.Receipts)
- func (k Keeper) IncreaseTxCountTransient(ctx sdk.Context)
- func (k *Keeper) IsEmptyAccount(ctx sdk.Context, addr common.Address) bool
- func (k Keeper) IsNoBaseFeeEnabled(ctx sdk.Context) bool
- func (k Keeper) IsSenderNonceIncreasedByAnteHandle(ctx sdk.Context) bool
- func (k Keeper) IsSenderPaidTxFeeInAnteHandle(ctx sdk.Context) bool
- func (k Keeper) IterateContracts(ctx sdk.Context, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k *Keeper) NewEVM(ctx sdk.Context, msg core.Message, cfg *evmvm.EVMConfig, ...) *corevm.EVM
- func (k *Keeper) NewTxConfig(ctx sdk.Context, tx *ethtypes.Transaction) evmvm.TxConfig
- func (k *Keeper) NewTxConfigFromMessage(ctx sdk.Context, msg core.Message) evmvm.TxConfig
- func (k Keeper) Params(c context.Context, _ *evmtypes.QueryParamsRequest) (*evmtypes.QueryParamsResponse, error)
- func (k *Keeper) ResetGasMeterAndConsumeGas(ctx sdk.Context, gasUsed uint64)
- func (k Keeper) SetBlockHashForCurrentBlockAndPruneOld(ctx sdk.Context)
- func (k *Keeper) SetCode(ctx sdk.Context, codeHash, code []byte)
- func (k *Keeper) SetCodeHash(ctx sdk.Context, addr common.Address, codeHash common.Hash)
- func (k Keeper) SetEip155ChainId(ctx sdk.Context, chainId evmtypes.Eip155ChainId)
- func (k Keeper) SetFlagEnableNoBaseFee(ctx sdk.Context, enable bool)
- func (k Keeper) SetFlagSenderNonceIncreasedByAnteHandle(ctx sdk.Context, increased bool)
- func (k Keeper) SetFlagSenderPaidTxFeeInAnteHandle(ctx sdk.Context, paid bool)
- func (k Keeper) SetGasUsedForCurrentTxTransient(ctx sdk.Context, gas uint64)
- func (k Keeper) SetLogCountForCurrentTxTransient(ctx sdk.Context, count uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params evmtypes.Params) error
- func (k *Keeper) SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte)
- func (k Keeper) SetTxReceiptForCurrentTxTransient(ctx sdk.Context, receiptBz []byte)
- func (k Keeper) SetupExecutionContext(ctx sdk.Context, ethTx *ethtypes.Transaction) sdk.Context
- func (k Keeper) Storage(c context.Context, req *evmtypes.QueryStorageRequest) (*evmtypes.QueryStorageResponse, error)
- func (k Keeper) TraceBlock(c context.Context, req *evmtypes.QueryTraceBlockRequest) (*evmtypes.QueryTraceBlockResponse, error)
- func (k Keeper) TraceTx(c context.Context, req *evmtypes.QueryTraceTxRequest) (*evmtypes.QueryTraceTxResponse, error)
- func (k *Keeper) UpdateParams(goCtx context.Context, req *evmtypes.MsgUpdateParams) (*evmtypes.MsgUpdateParamsResponse, error)
- func (k Keeper) ValidatorAccount(c context.Context, req *evmtypes.QueryValidatorAccountRequest) (*evmtypes.QueryValidatorAccountResponse, error)
- func (k Keeper) WithChainID(ctx sdk.Context)
- func (k *Keeper) WithCpcKeeper(ck cpckeeper.Keeper) *Keeper
- type Migrator
- type StateTransition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyMessage ¶
func ApplyMessage(evm *corevm.EVM, msg core.Message, gp *core.GasPool, beforeRun func(transition *StateTransition)) (*core.ExecutionResult, error)
ApplyMessage computes the new state by applying the given message against the old state within the environment.
ApplyMessage returns the bytes returned by any EVM execution (if it took place), the gas used (which includes gas refunds) and an error if it failed. An error always indicates a core error meaning that the message would always fail for that particular state and would never be accepted within a block.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper grants access to the EVM module state and implements the go-ethereum StateDB interface.
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, transientKey storetypes.StoreKey, authority sdk.AccAddress, ak authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, sk evmtypes.StakingKeeper, fmk evmtypes.FeeMarketKeeper, tracer string, ss paramstypes.Subspace, ) *Keeper
NewKeeper generates new evm module keeper
func (Keeper) Account ¶
func (k Keeper) Account(c context.Context, req *evmtypes.QueryAccountRequest) (*evmtypes.QueryAccountResponse, error)
Account implements the Query/Account gRPC method
func (*Keeper) ApplyMessage ¶
func (k *Keeper) ApplyMessage(ctx sdk.Context, msg core.Message, tracer corevm.EVMLogger, commit bool) (*evmtypes.MsgEthereumTxResponse, error)
ApplyMessage calls ApplyMessageWithConfig with an empty TxConfig.
func (*Keeper) ApplyMessageWithConfig ¶
func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context, msg core.Message, tracer corevm.EVMLogger, commit bool, cfg *evmvm.EVMConfig, txConfig evmvm.TxConfig, ) (*evmtypes.MsgEthereumTxResponse, error)
ApplyMessageWithConfig computes the new state by applying the given message against the existing state. If the message fails, the VM execution error with the reason will be returned to the client and the transaction won't be committed to the store.
Reverted state ¶
The snapshot and rollback are supported by the `Context-based StateDB`.
Different Callers ¶
It's called in three scenarios: 1. `ApplyTransaction`, in the transaction processing flow. 2. `EthCall/EthEstimateGas` grpc query handler. 3. Called by other native modules directly (system call).
Tracer parameter ¶
It should be a `vm.Tracer` object or nil, if pass `nil`, it'll create a default one based on keeper options.
Commit parameter ¶
If commit is true, the `StateDB` will be committed, otherwise discarded.
func (*Keeper) ApplyTransaction ¶
func (k *Keeper) ApplyTransaction(ctx sdk.Context, tx *ethtypes.Transaction) (*evmtypes.MsgEthereumTxResponse, error)
ApplyTransaction runs and attempts to perform a state transition with the given transaction (i.e Message), that will only be persisted (committed) to the underlying KVStore if the transaction does not fail.
Gas tracking ¶
Ethereum consumes gas according to the EVM opcodes instead of general reads and writes to store. Because of this, the state transition needs to ignore the SDK gas consumption mechanism defined by the GasKVStore and instead consume the amount of gas used by the VM execution. The amount of gas used is tracked by the EVM and returning within the execution result.
Prior to the execution, the starting tx gas meter is saved and replaced with an infinite gas meter in a new context in order to ignore the SDK gas consumption config values (read, write, has, delete). After the execution, the gas used from the message execution will be added to the starting gas consumed, taking into consideration the amount of gas returned. Finally, the context is updated with the EVM gas consumed value prior to returning.
For relevant discussion see: https://github.com/cosmos/cosmos-sdk/discussions/9072
func (Keeper) Balance ¶
func (k Keeper) Balance(c context.Context, req *evmtypes.QueryBalanceRequest) (*evmtypes.QueryBalanceResponse, error)
Balance implements the Query/Balance gRPC method
func (Keeper) BaseFee ¶
func (k Keeper) BaseFee(c context.Context, _ *evmtypes.QueryBaseFeeRequest) (*evmtypes.QueryBaseFeeResponse, error)
BaseFee implements the Query/BaseFee gRPC method
func (*Keeper) BeginBlock ¶
BeginBlock sets the sdk Context and EIP155 chain id to the Keeper.
func (Keeper) Code ¶
func (k Keeper) Code(c context.Context, req *evmtypes.QueryCodeRequest) (*evmtypes.QueryCodeResponse, error)
Code implements the Query/Code gRPC method
func (Keeper) CosmosAccount ¶
func (k Keeper) CosmosAccount(c context.Context, req *evmtypes.QueryCosmosAccountRequest) (*evmtypes.QueryCosmosAccountResponse, error)
func (*Keeper) DeleteCodeHash ¶
DeleteCodeHash delete the code hash for the given address.
func (*Keeper) EVMConfig ¶
func (k *Keeper) EVMConfig(ctx sdk.Context, overrideProposerAddress sdk.ConsAddress) (*evmvm.EVMConfig, error)
EVMConfig creates the EVMConfig based on current state
func (Keeper) EmitBlockBloomEvent ¶
EmitBlockBloomEvent emit block bloom events
func (*Keeper) EndBlock ¶
EndBlock also retrieves the bloom filter value from the transient store and commits it to the KVStore. The EVM end block logic doesn't update the validator set, thus it returns an empty slice.
func (Keeper) EstimateGas ¶
func (k Keeper) EstimateGas(c context.Context, req *evmtypes.EthCallRequest) (*evmtypes.EstimateGasResponse, error)
EstimateGas implements eth_estimateGas rpc api.
func (Keeper) EthCall ¶
func (k Keeper) EthCall(c context.Context, req *evmtypes.EthCallRequest) (*evmtypes.MsgEthereumTxResponse, error)
EthCall implements eth_call rpc api.
func (*Keeper) EthereumTx ¶
func (k *Keeper) EthereumTx(goCtx context.Context, msg *evmtypes.MsgEthereumTx) (*evmtypes.MsgEthereumTxResponse, error)
EthereumTx implements the gRPC MsgServer interface. It receives a transaction which is then executed (eg: applied) using the go-ethereum EVM. The provided SDK Context is set to the Keeper so that it can implement and call the StateDB methods without receiving it as a function parameter.
func (*Keeper) ForEachStorage ¶
func (k *Keeper) ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key, value common.Hash) bool)
ForEachStorage iterate contract storage, callback return false to break early
func (Keeper) ForTest_RemoveEip155ChainId ¶
ForTest_RemoveEip155ChainId removes the EIP155 chain id from KVStore and returns it. NOTE: for testing purpose only.
func (Keeper) GetAccountStorage ¶
GetAccountStorage return state storage associated with an account
func (*Keeper) GetBalance ¶
GetBalance returns account token balance based on EVM denom.
func (Keeper) GetBaseFee ¶
GetBaseFee returns current base fee.
func (Keeper) GetBlockHashByBlockNumber ¶
GetBlockHashByBlockNumber returns the block hash by block number.
func (Keeper) GetChainConfig ¶
func (k Keeper) GetChainConfig(ctx sdk.Context) *ethparams.ChainConfig
func (*Keeper) GetCodeHash ¶
GetCodeHash returns the code hash for the corresponding account address.
func (Keeper) GetCoinbaseAddress ¶
func (k Keeper) GetCoinbaseAddress(ctx sdk.Context, overrideProposerAddress sdk.ConsAddress) (common.Address, error)
GetCoinbaseAddress returns the block proposer's validator operator address from the context proposer address. The proposer address can be overridden with the provided address. If the proposer address is empty, it returns empty address instead of an error.
func (Keeper) GetCumulativeLogCountTransient ¶
GetCumulativeLogCountTransient returns the total log count for all transactions in the current block.
func (Keeper) GetEip155ChainId ¶
func (k Keeper) GetEip155ChainId(ctx sdk.Context) evmtypes.Eip155ChainId
GetEip155ChainId returns the EIP155 chain id from KVStore.
func (Keeper) GetGasUsedForTdxIndexTransient ¶
GetGasUsedForTdxIndexTransient returns gas used for tx by index from the transient store.
func (Keeper) GetHashFn ¶
func (k Keeper) GetHashFn(ctx sdk.Context) corevm.GetHashFunc
GetHashFn implements vm.GetHashFunc for EverLast.
func (*Keeper) GetNonce ¶
GetNonce returns the sequence number of an account, returns 0 if not exists.
func (Keeper) GetRawTxCountTransient ¶
GetRawTxCountTransient returns the raw count of transaction being processed in the current block.
func (Keeper) GetTxCountTransient ¶
GetTxCountTransient returns the count of transaction being processed in the current block. Notice: if not set, it returns 1
func (Keeper) GetTxReceiptsTransient ¶
GetTxReceiptsTransient returns the receipts for all transactions in the current block.
func (Keeper) IncreaseTxCountTransient ¶
IncreaseTxCountTransient increase the count of transaction being processed in the current block
func (*Keeper) IsEmptyAccount ¶
IsEmptyAccount returns true if the account is empty, decided by:
- Nonce is zero
- Balance is zero
- CodeHash is empty
- No state
func (Keeper) IsNoBaseFeeEnabled ¶
IsNoBaseFeeEnabled returns the flag if no-base-fee enabled and should be used by EVM config.
func (Keeper) IsSenderNonceIncreasedByAnteHandle ¶
IsSenderNonceIncreasedByAnteHandle returns the flag whether the sender nonce has been increased by AnteHandler.
func (Keeper) IsSenderPaidTxFeeInAnteHandle ¶
IsSenderPaidTxFeeInAnteHandle returns the flag whether the sender had paid for tx fee in AnteHandler. This is used to prevent adding balance into the sender account during refund mechanism if the sender didn't pay the tx fee.
func (Keeper) IterateContracts ¶
func (k Keeper) IterateContracts(ctx sdk.Context, callback func(addr common.Address, codeHash common.Hash) (stop bool))
IterateContracts iterating through all code hash, represents for all smart contracts
func (*Keeper) NewEVM ¶
func (k *Keeper) NewEVM( ctx sdk.Context, msg core.Message, cfg *evmvm.EVMConfig, tracer corevm.EVMLogger, stateDB corevm.StateDB, ) *corevm.EVM
NewEVM generates a go-ethereum VM from the provided Message fields and the chain parameters (ChainConfig and module Params). It additionally sets the validator operator address as the coinbase address to make it available for the COINBASE opcode, even though there is no beneficiary of the coinbase transaction (since we're not mining).
NOTE: the RANDOM opcode is currently not supported since it requires RANDAO implementation. See https://github.com/evmos/ethermint/pull/1520#pullrequestreview-1200504697 for more information. TODO EVL: support RANDOM opcode
func (*Keeper) NewTxConfig ¶
NewTxConfig loads `TxConfig` from current transient storage. Note: if tx is nil, the tx hash and tx type is not set in the TxConfig.
func (*Keeper) NewTxConfigFromMessage ¶
NewTxConfigFromMessage loads `TxConfig` from current transient storage, based on the input core message. Note: since the message does not contain the tx hash, it is not set in the TxConfig.
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, _ *evmtypes.QueryParamsRequest) (*evmtypes.QueryParamsResponse, error)
Params implements the Query/Params gRPC method
func (*Keeper) ResetGasMeterAndConsumeGas ¶
ResetGasMeterAndConsumeGas reset first the gas meter consumed value to zero and set it back to the new value 'gasUsed'
func (Keeper) SetBlockHashForCurrentBlockAndPruneOld ¶
SetBlockHashForCurrentBlockAndPruneOld stores the block hash of current block into KVStore, and prunes the block hash of the 256th block before the current block.
func (*Keeper) SetCodeHash ¶
SetCodeHash sets the code hash for the given address.
func (Keeper) SetEip155ChainId ¶
func (k Keeper) SetEip155ChainId(ctx sdk.Context, chainId evmtypes.Eip155ChainId)
SetEip155ChainId sets the EIP155 chain id into KVStore.
func (Keeper) SetFlagEnableNoBaseFee ¶
SetFlagEnableNoBaseFee sets the flag whether to enable no-base-fee of EVM config. Go-Ethereum used this setting for `eth_call` and smt like that.
func (Keeper) SetFlagSenderNonceIncreasedByAnteHandle ¶
SetFlagSenderNonceIncreasedByAnteHandle sets the flag whether the sender nonce has been increased by AnteHandler.
func (Keeper) SetFlagSenderPaidTxFeeInAnteHandle ¶
SetFlagSenderPaidTxFeeInAnteHandle sets the flag whether the sender has paid for tx fee, which deducted by AnteHandler. This logic is needed because unlike go-ethereum which send buys gas right before state transition, we deduct fee using Deduct Fee Decorator, So if sender not paid the tx fee, the refund logic will not add balance to the sender account. Because in theory, only transaction going through AnteHandler while system call like `x/erc20` does not.
func (Keeper) SetGasUsedForCurrentTxTransient ¶
SetGasUsedForCurrentTxTransient sets the gas used for the current transaction in the transient store, based on the transient tx counter.
func (Keeper) SetLogCountForCurrentTxTransient ¶
SetLogCountForCurrentTxTransient sets the log count for the current transaction in the transient store, based on the transient tx counter.
func (Keeper) SetParams ¶
SetParams sets the EVM params each in their individual key for better get performance
func (Keeper) SetTxReceiptForCurrentTxTransient ¶
SetTxReceiptForCurrentTxTransient sets the receipt for the current transaction in the transient store.
func (Keeper) SetupExecutionContext ¶
SetupExecutionContext setups the execution context for the EVM transaction execution:
- Use zero gas config
- Replace the gas meter with `infinite gas meter with limit`
- Set the block hash for the current block
- Increase the count of transaction being processed in the current block
- Set the gas used for the current transaction, assume tx failed so gas used = tx gas
- Set the failed receipt for the current transaction, assume tx failed
This should be called before the EVM transaction execution for traditional/valid Ethereum transactions like `x/evm` module's MsgEthereumTx. For the abnormal cases like system calls from `x/erc20` module, this should not be called.
func (Keeper) Storage ¶
func (k Keeper) Storage(c context.Context, req *evmtypes.QueryStorageRequest) (*evmtypes.QueryStorageResponse, error)
Storage implements the Query/Storage gRPC method
func (Keeper) TraceBlock ¶
func (k Keeper) TraceBlock(c context.Context, req *evmtypes.QueryTraceBlockRequest) (*evmtypes.QueryTraceBlockResponse, error)
TraceBlock configures a new tracer according to the provided configuration, and executes the given message in the provided environment for all the transactions in the queried block. The return value will be tracer dependent.
func (Keeper) TraceTx ¶
func (k Keeper) TraceTx(c context.Context, req *evmtypes.QueryTraceTxRequest) (*evmtypes.QueryTraceTxResponse, error)
TraceTx configures a new tracer according to the provided configuration, and executes the given message in the provided environment. The return value will be tracer dependent.
func (*Keeper) UpdateParams ¶
func (k *Keeper) UpdateParams(goCtx context.Context, req *evmtypes.MsgUpdateParams) (*evmtypes.MsgUpdateParamsResponse, error)
UpdateParams implements the gRPC MsgServer interface. When an UpdateParams proposal passes, it updates the module parameters. The update can only be performed if the requested authority is the Cosmos SDK governance module account.
func (Keeper) ValidatorAccount ¶
func (k Keeper) ValidatorAccount(c context.Context, req *evmtypes.QueryValidatorAccountRequest) (*evmtypes.QueryValidatorAccountResponse, error)
ValidatorAccount implements the Query/Balance gRPC method
func (Keeper) WithChainID ¶
WithChainID sets the chain id to the local variable in the keeper
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶
NewMigrator returns a new Migrator.
type StateTransition ¶
type StateTransition struct { /** * SenderPaidTheFee is a flag that indicates if the sender paid the fee in the AnteHandle. * It is used to avoid refund gas to the sender which transition does not come from a tx, like system call from `x/erc20`. */ SenderPaidTheFee bool // contains filtered or unexported fields }
StateTransition Model
A state transition is a change made when a transaction is applied to the current world state The state transitioning model does all the necessary work to work out a valid new state root.
1) Nonce handling 2) Pre pay gas 3) Create a new state object if the recipient is \0*32 4) Value transfer == If contract creation ==
4a) Attempt to run transaction data 4b) If valid, use result as code for the new state object
== end == 5) Run Script section 6) Derive new state root
func NewStateTransition ¶
NewStateTransition initialises and returns a new state transition object.
func (*StateTransition) TransitionDb ¶
func (st *StateTransition) TransitionDb() (*core.ExecutionResult, error)
TransitionDb will transition the state by applying the current message and returning the evm execution result with following fields.
- used gas: total gas used (including gas being refunded)
- returndata: the returned data from evm
- concrete execution error: various **EVM** error which aborts the execution, e.g. ErrOutOfGas, ErrExecutionReverted
However if any consensus issue encountered, return the error directly with nil evm execution result.