Documentation ¶
Index ¶
- Variables
- func AbciHeaderToTendermint(header *abci.Header) tmtypes.Header
- func EstimateGas(evm *ethvm.EVM, msg Message, gp *ethcore.GasPool) (uint64, error)
- func EthereumConfig(chainID string) *ethparams.ChainConfig
- func GetEvent(pairs kv.Pairs, eventType string) []types.Event
- func GetHashFn(s *CommitStateDB) ethvm.GetHashFunc
- func IntrinsicGas(data []byte, accessList ethtypes.AccessList, isContractCreation bool, ...) (uint64, error)
- func IsEmptyHash(hash string) bool
- func IsZeroAmount(amount *big.Int) bool
- func MarshalLogs(logs []*ethtypes.Log) ([]byte, error)
- func RegisterTxType(value Type, name string)
- func UintTag(key string, value uint64) kv.Pair
- func UnmarshalLogs(in []byte) ([]*ethtypes.Log, error)
- func ValidateBasic(data []byte, signerAddr []Address, signatures []Signature) error
- func ValidateFee(feeOpt *fees.FeeOption, fee Fee) error
- type Address
- type Amount
- type Balance
- type CommitStateDB
- func (s *CommitStateDB) AddAddressToAccessList(addr ethcmn.Address)
- func (s *CommitStateDB) AddBalance(addr ethcmn.Address, amount *big.Int)
- func (s *CommitStateDB) AddLog(log *ethtypes.Log)
- func (s *CommitStateDB) AddPreimage(hash ethcmn.Hash, preimage []byte)
- func (s *CommitStateDB) AddRefund(gas uint64)
- func (s *CommitStateDB) AddSlotToAccessList(addr ethcmn.Address, slot ethcmn.Hash)
- func (s *CommitStateDB) AddressInAccessList(addr ethcmn.Address) bool
- func (s *CommitStateDB) Commit(deleteEmptyObjects bool) (ethcmn.Hash, error)
- func (s *CommitStateDB) CreateAccount(addr ethcmn.Address)
- func (s *CommitStateDB) DeleteLogs(hash ethcmn.Hash)
- func (s *CommitStateDB) Empty(addr ethcmn.Address) bool
- func (s *CommitStateDB) Exist(addr ethcmn.Address) bool
- func (s *CommitStateDB) Finalise(deleteEmptyObjects bool) error
- func (s *CommitStateDB) ForEachStorage(addr ethcmn.Address, cb func(key, value ethcmn.Hash) bool) error
- func (s *CommitStateDB) GetAccountKeeper() balance.AccountKeeper
- func (s *CommitStateDB) GetBalance(addr ethcmn.Address) *big.Int
- func (s *CommitStateDB) GetCode(addr ethcmn.Address) []byte
- func (s *CommitStateDB) GetCodeHash(addr ethcmn.Address) ethcmn.Hash
- func (s *CommitStateDB) GetCodeSize(addr ethcmn.Address) int
- func (s *CommitStateDB) GetCommittedState(addr ethcmn.Address, hash ethcmn.Hash) ethcmn.Hash
- func (s *CommitStateDB) GetHeightHash(height uint64) ethcmn.Hash
- func (s *CommitStateDB) GetLogs(hash ethcmn.Hash) ([]*ethtypes.Log, error)
- func (s *CommitStateDB) GetNonce(addr ethcmn.Address) uint64
- func (s *CommitStateDB) GetOrNewStateObject(addr ethcmn.Address) StateObject
- func (s *CommitStateDB) GetRefund() uint64
- func (s *CommitStateDB) GetState(addr ethcmn.Address, hash ethcmn.Hash) ethcmn.Hash
- func (s *CommitStateDB) HasSuicided(addr ethcmn.Address) bool
- func (s *CommitStateDB) Prepare(thash ethcmn.Hash)
- func (s *CommitStateDB) PrepareAccessList(sender ethcmn.Address, dst *ethcmn.Address, precompiles []ethcmn.Address, ...)
- func (s *CommitStateDB) Reset(_ ethcmn.Hash) error
- func (s *CommitStateDB) RevertToSnapshot(revID int)
- func (s *CommitStateDB) SetBlockHash(hash ethcmn.Hash)
- func (s *CommitStateDB) SetCode(addr ethcmn.Address, code []byte)
- func (s *CommitStateDB) SetHeightHash(height uint64, hash ethcmn.Hash)
- func (s *CommitStateDB) SetLogs(hash ethcmn.Hash, logs []*ethtypes.Log) error
- func (s *CommitStateDB) SetNonce(addr ethcmn.Address, nonce uint64)
- func (s *CommitStateDB) SetState(addr ethcmn.Address, key, value ethcmn.Hash)
- func (s *CommitStateDB) SlotInAccessList(addr ethcmn.Address, slot ethcmn.Hash) (bool, bool)
- func (s *CommitStateDB) Snapshot() int
- func (s *CommitStateDB) SubBalance(addr ethcmn.Address, amount *big.Int)
- func (s *CommitStateDB) SubRefund(gas uint64)
- func (s *CommitStateDB) Suicide(addr ethcmn.Address) bool
- func (s *CommitStateDB) UpdateAccounts()
- func (s *CommitStateDB) WithState(state *storage.State) *CommitStateDB
- type Context
- type EVMConfig
- type EVMTransaction
- func (etx *EVMTransaction) Apply(vmenv *ethvm.EVM, tx RawTx) (*ExecutionResult, error)
- func (etx *EVMTransaction) EstimateGas(vmenv *ethvm.EVM, tx RawTx) (uint64, error)
- func (etx *EVMTransaction) From() ethcmn.Address
- func (etx *EVMTransaction) NewEVM() *ethvm.EVM
- func (etx *EVMTransaction) Origin() ethcmn.Address
- func (etx *EVMTransaction) To() *ethcmn.Address
- type ExecutionResult
- type Fee
- type FunctionBehaviour
- type Gas
- type GovernaceUpdateAndValidate
- type Message
- type Msg
- type MsgData
- type RawTx
- type Response
- func BasicFeeHandling(ctx *Context, signedTx SignedTx, start Gas, size Gas, signatureCnt Gas) (bool, Response)
- func ContractFeeHandling(ctx *Context, signedTx SignedTx, gasUsed Gas) (bool, Response)
- func StakingPayerFeeHandling(ctx *Context, feePayer keys.Address, signedTx SignedTx, start Gas, size Gas, ...) (bool, Response)
- type Router
- type Signature
- type SignedTx
- type State
- type StateObject
- type StateTransition
- type Storage
- type Tx
- type TxTypeDescribe
- type TxTypeMap
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingData = codes.ProtocolError{codes.TxErrMissingData, "missing data in transaction"} ErrUnserializable = codes.ProtocolError{codes.TxErrUnserializable, "unserializable tx"} ErrWrongTxType = codes.ProtocolError{codes.TxErrWrongTxType, "wrong tx type"} ErrInvalidAmount = codes.ProtocolError{codes.TxErrInvalidAmount, "invalid amount"} ErrInvalidPubkey = codes.ProtocolError{codes.TxErrInvalidPubKey, "invalid pubkey"} ErrUnmatchSigner = codes.ProtocolError{codes.TxErrUnmatchedSigner, "unmatch signers"} ErrInvalidSignature = codes.ProtocolError{codes.TxErrInvalidSignature, "invalid signatures"} ErrInvalidFeeCurrency = codes.ProtocolError{codes.TxErrInvalidFeeCurrency, "invalid fees currency"} ErrInvalidFeePrice = codes.ProtocolError{codes.TxErrInvalidFeePrice, "fee price is smaller than minimal fee"} ErrPoolDoesNotExist = codes.ProtocolError{codes.TxErrPoolDoesNotExist, "Pool does not exist"} ErrNotEnoughFund = codes.ProtocolError{codes.TxErrInsufficientFunds, "not enough fund"} ErrGasOverflow = codes.ProtocolError{codes.TxErrGasOverflow, "gas used exceed limit"} ErrInvalidExtTx = codes.ProtocolError{codes.TxErrInvalidExtTx, "invalid external tx"} ErrInvalidAddress = codes.ErrBadAddress ErrInvalidCurrency = codes.ProtocolError{codes.TxErrInvalidFeeCurrency, "invalid fee currency"} ErrTokenNotSupported = codes.ProtocolError{codes.ExternalErrTokenNotSuported, "Token not supported"} ErrTransactionNotSupported = codes.ProtocolError{codes.ExternalTransactionNotSupported, "TX not supported"} ErrGettingValidatorList = codes.ProtocolError{codes.GovErrGettingValidatorList, "fund proposal failed in getting validator list"} ErrGettingWitnessList = codes.ProtocolError{codes.GovErrGettingWitnessList, "failed in getting witness list"} ErrInvalidValidatorAddr = codes.ProtocolError{codes.GovErrInvalidValidatorAddr, "invalid validator address"} ErrStakeAddressInUse = codes.ProtocolError{codes.DelgErrStakeAddressInUse, "current stake address is in use"} ErrStakeAddressMismatch = codes.ProtocolError{codes.DelgErrStakeAddressMismatch, "stake address does not match"} )
Functions ¶
func AbciHeaderToTendermint ¶ added in v0.17.0
AbciHeaderToTendermint is a util function to parse a tendermint ABCI Header to tendermint types Header.
func EstimateGas ¶ added in v0.17.0
EstimateGas used to estimate gas with the maximum limit of the gas
func EthereumConfig ¶ added in v0.17.0
func EthereumConfig(chainID string) *ethparams.ChainConfig
func GetHashFn ¶ added in v0.17.0
func GetHashFn(s *CommitStateDB) ethvm.GetHashFunc
GetHashFn implements vm.GetHashFunc for protocol.
func IntrinsicGas ¶ added in v0.17.0
func IntrinsicGas(data []byte, accessList ethtypes.AccessList, isContractCreation bool, isHomestead, isEIP2028 bool) (uint64, error)
IntrinsicGas computes the 'intrinsic gas' for a message with the given data.
func IsEmptyHash ¶ added in v0.17.0
func IsZeroAmount ¶ added in v0.17.0
chec if zero amount in coin
func RegisterTxType ¶ added in v0.16.1
func ValidateBasic ¶ added in v0.10.8
Types ¶
type Amount ¶
Amount is an easily serializable representation of coin. Nodes can create coin from the Amount object received over the network
func (Amount) IsValid ¶
func (a Amount) IsValid(list *balance.CurrencySet) bool
IsValid checks the validity of the currency and the amount string in the account object, which may be received over a network.
func (Amount) ToCoin ¶
func (a Amount) ToCoin(list *balance.CurrencySet) balance.Coin
ToCoin converts an easier to transport Amount object to a Coin object in Oneledger protocol. It takes the action context to determine the currency from which to create the coin.
func (Amount) ToCoinWithBase ¶ added in v0.14.3
func (a Amount) ToCoinWithBase(list *balance.CurrencySet) balance.Coin
type CommitStateDB ¶ added in v0.17.0
type CommitStateDB struct {
// contains filtered or unexported fields
}
func NewCommitStateDB ¶ added in v0.17.0
func NewCommitStateDB(cs *evm.ContractStore, ak balance.AccountKeeper, logger *log.Logger) *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 ¶ added in v0.17.0
func (s *CommitStateDB) AddAddressToAccessList(addr ethcmn.Address)
AddAddressToAccessList adds the given address to the access list
func (*CommitStateDB) AddBalance ¶ added in v0.17.0
func (s *CommitStateDB) AddBalance(addr ethcmn.Address, amount *big.Int)
AddBalance adds amount to the account associated with addr.
func (*CommitStateDB) AddLog ¶ added in v0.17.0
func (s *CommitStateDB) AddLog(log *ethtypes.Log)
AddLog adds a new log to the state and sets the log metadata from the state.
func (*CommitStateDB) AddPreimage ¶ added in v0.17.0
func (s *CommitStateDB) AddPreimage(hash ethcmn.Hash, preimage []byte)
AddPreimage records a SHA3 preimage seen by the VM.
func (*CommitStateDB) AddRefund ¶ added in v0.17.0
func (s *CommitStateDB) AddRefund(gas uint64)
AddRefund adds gas to the refund counter.
func (*CommitStateDB) AddSlotToAccessList ¶ added in v0.17.0
func (s *CommitStateDB) AddSlotToAccessList(addr ethcmn.Address, slot ethcmn.Hash)
AddSlotToAccessList adds the given (address, slot)-tuple to the access list
func (*CommitStateDB) AddressInAccessList ¶ added in v0.17.0
func (s *CommitStateDB) AddressInAccessList(addr ethcmn.Address) bool
AddressInAccessList returns true if the given address is in the access list.
func (*CommitStateDB) Commit ¶ added in v0.17.0
func (s *CommitStateDB) Commit(deleteEmptyObjects bool) (ethcmn.Hash, error)
Commit writes the state to the appropriate stores. 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) CreateAccount ¶ added in v0.17.0
func (s *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:
- sends funds to sha(account ++ (nonce + 1))
- 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) DeleteLogs ¶ added in v0.17.0
func (s *CommitStateDB) DeleteLogs(hash ethcmn.Hash)
DeleteLogs removes the logs from the store. It is used during journal.Revert.
func (*CommitStateDB) Empty ¶ added in v0.17.0
func (s *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) Exist ¶ added in v0.17.0
func (s *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 ¶ added in v0.17.0
func (s *CommitStateDB) Finalise(deleteEmptyObjects bool) error
Finalise finalizes the state objects (accounts) state by setting their state, removing the s destructed objects and clearing the journal as well as the refunds.
func (*CommitStateDB) ForEachStorage ¶ added in v0.17.0
func (s *CommitStateDB) ForEachStorage(addr ethcmn.Address, cb func(key, value ethcmn.Hash) bool) error
ForEachStorage iterates over each storage items, all invoke the provided callback on each key, value pair. Only used in tests https://github.com/ethereum/go-ethereum/search?q=ForEachStorage
func (*CommitStateDB) GetAccountKeeper ¶ added in v0.17.0
func (s *CommitStateDB) GetAccountKeeper() balance.AccountKeeper
func (*CommitStateDB) GetBalance ¶ added in v0.17.0
func (s *CommitStateDB) GetBalance(addr ethcmn.Address) *big.Int
GetBalance retrieves the balance from the given address or 0 if object not found.
func (*CommitStateDB) GetCode ¶ added in v0.17.0
func (s *CommitStateDB) GetCode(addr ethcmn.Address) []byte
GetCode returns the code for a given account.
func (*CommitStateDB) GetCodeHash ¶ added in v0.17.0
func (s *CommitStateDB) GetCodeHash(addr ethcmn.Address) ethcmn.Hash
GetCodeHash returns the code hash for a given account.
func (*CommitStateDB) GetCodeSize ¶ added in v0.17.0
func (s *CommitStateDB) GetCodeSize(addr ethcmn.Address) int
GetCodeSize returns the code size for a given account.
func (*CommitStateDB) GetCommittedState ¶ added in v0.17.0
GetCommittedState retrieves a value from the given account's committed storage.
func (*CommitStateDB) GetHeightHash ¶ added in v0.17.0
func (s *CommitStateDB) GetHeightHash(height uint64) ethcmn.Hash
GetHeightHash returns the block header hash associated with a given block height and chain epoch number.
func (*CommitStateDB) GetLogs ¶ added in v0.17.0
GetLogs returns the current logs for a given transaction hash from the store.
func (*CommitStateDB) GetNonce ¶ added in v0.17.0
func (s *CommitStateDB) GetNonce(addr ethcmn.Address) uint64
GetNonce returns the nonce (sequence number) for a given account.
func (*CommitStateDB) GetOrNewStateObject ¶ added in v0.17.0
func (s *CommitStateDB) GetOrNewStateObject(addr ethcmn.Address) StateObject
GetOrNewStateObject retrieves a state object or create a new state object if nil.
func (*CommitStateDB) GetRefund ¶ added in v0.17.0
func (s *CommitStateDB) GetRefund() uint64
GetRefund returns the current value of the refund counter.
func (*CommitStateDB) GetState ¶ added in v0.17.0
GetState retrieves a value from the given account's storage store.
func (*CommitStateDB) HasSuicided ¶ added in v0.17.0
func (s *CommitStateDB) HasSuicided(addr ethcmn.Address) bool
HasSuicided returns if the given account for the specified address has been killed.
func (*CommitStateDB) Prepare ¶ added in v0.17.0
func (s *CommitStateDB) Prepare(thash ethcmn.Hash)
Prepare sets the current transaction hash which is used when the EVM emits new state logs.
func (*CommitStateDB) PrepareAccessList ¶ added in v0.17.0
func (s *CommitStateDB) PrepareAccessList(sender ethcmn.Address, dst *ethcmn.Address, precompiles []ethcmn.Address, list ethtypes.AccessList)
PrepareAccessList handles the preparatory steps for executing a state transition with regards to both EIP-2929 and EIP-2930:
- Add sender to access list (2929) - Add destination to access list (2929) - Add precompiles to access list (2929) - Add the contents of the optional tx access list (2930)
This method should only be called if Yolov3/Berlin/2929+2930 is applicable at the current number.
func (*CommitStateDB) Reset ¶ added in v0.17.0
func (s *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 ¶ added in v0.17.0
func (s *CommitStateDB) RevertToSnapshot(revID int)
RevertToSnapshot reverts all state changes made since the given revision.
func (*CommitStateDB) SetBlockHash ¶ added in v0.17.0
func (s *CommitStateDB) SetBlockHash(hash ethcmn.Hash)
SetBlockHash set hash of the block
func (*CommitStateDB) SetCode ¶ added in v0.17.0
func (s *CommitStateDB) SetCode(addr ethcmn.Address, code []byte)
SetCode sets the code for a given account.
func (*CommitStateDB) SetHeightHash ¶ added in v0.17.0
func (s *CommitStateDB) SetHeightHash(height uint64, hash ethcmn.Hash)
SetHeightHash sets the block header hash associated with a given height.
func (*CommitStateDB) SetLogs ¶ added in v0.17.0
SetLogs sets the logs for a transaction in the store.
func (*CommitStateDB) SetNonce ¶ added in v0.17.0
func (s *CommitStateDB) SetNonce(addr ethcmn.Address, nonce uint64)
SetNonce sets the nonce (sequence number) of an account.
func (*CommitStateDB) SetState ¶ added in v0.17.0
func (s *CommitStateDB) SetState(addr ethcmn.Address, key, value ethcmn.Hash)
SetState sets the storage state with a key, value pair for an account.
func (*CommitStateDB) SlotInAccessList ¶ added in v0.17.0
SlotInAccessList returns true if the given (address, slot)-tuple is in the access list.
func (*CommitStateDB) Snapshot ¶ added in v0.17.0
func (s *CommitStateDB) Snapshot() int
Snapshot returns an identifier for the current revision of the state.
func (*CommitStateDB) SubBalance ¶ added in v0.17.0
func (s *CommitStateDB) SubBalance(addr ethcmn.Address, amount *big.Int)
SubBalance subtracts amount from the account associated with addr.
func (*CommitStateDB) SubRefund ¶ added in v0.17.0
func (s *CommitStateDB) SubRefund(gas uint64)
SubRefund removes gas from the refund counter. It will panic if the refund counter goes below zero.
func (*CommitStateDB) Suicide ¶ added in v0.17.0
func (s *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) UpdateAccounts ¶ added in v0.17.0
func (s *CommitStateDB) UpdateAccounts()
UpdateAccounts updates the nonce and coin balances of accounts
func (*CommitStateDB) WithState ¶ added in v0.17.0
func (s *CommitStateDB) WithState(state *storage.State) *CommitStateDB
type Context ¶
type Context struct { Router Router State *storage.State Header *abci.Header Accounts accounts.Wallet Balances *balance.Store Domains *ons.DomainStore Delegators *delegation.DelegationStore NetwkDelegators *netwkDeleg.MasterStore EvidenceStore *evidence.EvidenceStore FeePool *fees.Store Currencies *balance.CurrencySet FeeOpt *fees.FeeOption Validators *identity.ValidatorStore Witnesses *identity.WitnessStore BTCTrackers *bitcoin.TrackerStore ETHTrackers *ethereum.TrackerStore Logger *log.Logger JobStore *jobs.JobStore LockScriptStore *bitcoin.LockScriptStore ProposalMasterStore *governance.ProposalMasterStore RewardMasterStore *rewards.RewardMasterStore GovernanceStore *governance.Store ExtStores data.Router GovUpdate *GovernaceUpdateAndValidate // evm StateDB *CommitStateDB }
func NewContext ¶
func NewContext(r Router, header *abci.Header, state *storage.State, wallet accounts.Wallet, balances *balance.Store, currencies *balance.CurrencySet, feePool *fees.Store, validators *identity.ValidatorStore, witnesses *identity.WitnessStore, domains *ons.DomainStore, delegators *delegation.DelegationStore, netwkDelegators *netwkDeleg.MasterStore, evidenceStore *evidence.EvidenceStore, btcTrackers *bitcoin.TrackerStore, ethTrackers *ethereum.TrackerStore, jobStore *jobs.JobStore, lockScriptStore *bitcoin.LockScriptStore, logger *log.Logger, proposalmaster *governance.ProposalMasterStore, rewardmaster *rewards.RewardMasterStore, govern *governance.Store, extStores data.Router, govUpdate *GovernaceUpdateAndValidate, stateDB *CommitStateDB, ) *Context
type EVMConfig ¶ added in v0.17.0
type EVMConfig struct {
// contains filtered or unexported fields
}
type EVMTransaction ¶ added in v0.17.0
type EVMTransaction struct {
// contains filtered or unexported fields
}
func NewEVMTransaction ¶ added in v0.17.0
func (*EVMTransaction) Apply ¶ added in v0.17.0
func (etx *EVMTransaction) Apply(vmenv *ethvm.EVM, tx RawTx) (*ExecutionResult, error)
func (*EVMTransaction) EstimateGas ¶ added in v0.17.0
func (*EVMTransaction) From ¶ added in v0.17.0
func (etx *EVMTransaction) From() ethcmn.Address
func (*EVMTransaction) NewEVM ¶ added in v0.17.0
func (etx *EVMTransaction) NewEVM() *ethvm.EVM
func (*EVMTransaction) Origin ¶ added in v0.17.0
func (etx *EVMTransaction) Origin() ethcmn.Address
func (*EVMTransaction) To ¶ added in v0.17.0
func (etx *EVMTransaction) To() *ethcmn.Address
type ExecutionResult ¶ added in v0.17.0
type ExecutionResult struct { UsedGas uint64 // Total used gas but include the refunded gas Err error // Any error encountered during the execution(listed in core/vm/errors.go) ReturnData []byte // Returned data from evm(function result or data supplied with revert opcode) ContractAddress keys.Address }
ExecutionResult includes all output after executing given evm message no matter the execution itself is successful or not.
func ApplyMessage ¶ added in v0.17.0
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.
func (*ExecutionResult) Failed ¶ added in v0.17.0
func (result *ExecutionResult) Failed() bool
Failed returns the indicator whether the execution is successful or not
func (*ExecutionResult) Return ¶ added in v0.17.0
func (result *ExecutionResult) Return() []byte
Return is a helper function to help caller distinguish between revert reason and function return. Return returns the data after execution if no error occurs.
func (*ExecutionResult) Revert ¶ added in v0.17.0
func (result *ExecutionResult) Revert() []byte
Revert returns the concrete revert reason if the execution is aborted by `REVERT` opcode. Note the reason can be nil if no data supplied with revert opcode.
func (*ExecutionResult) Unwrap ¶ added in v0.17.0
func (result *ExecutionResult) Unwrap() error
Unwrap returns the internal evm error which allows us for further analysis outside.
type FunctionBehaviour ¶ added in v0.15.1
type FunctionBehaviour int
const ( ValidateOnly FunctionBehaviour = 0 ValidateAndUpdate FunctionBehaviour = 1 )
type GovernaceUpdateAndValidate ¶ added in v0.15.1
type GovernaceUpdateAndValidate struct {
GovernanceUpdateFunction map[string]func(interface{}, *Context, FunctionBehaviour) (bool, error)
}
func NewGovUpdate ¶ added in v0.15.1
func NewGovUpdate() *GovernaceUpdateAndValidate
type Message ¶ added in v0.17.0
type Message interface { From() ethcmn.Address To() *ethcmn.Address GasPrice() *big.Int Gas() uint64 Value() *big.Int Nonce() uint64 CheckNonce() bool Data() []byte AccessList() ethtypes.AccessList }
Message represents a message sent to a contract.
type RawTx ¶ added in v0.10.8
type Response ¶
type Response struct { Data []byte Events []types.Event Log string Info string GasWanted int64 GasUsed int64 }
func BasicFeeHandling ¶ added in v0.12.0
func ContractFeeHandling ¶ added in v0.17.0
type Router ¶
Router interface supplies functionality to add a handler function and Handle a request.
type SignedTx ¶ added in v0.10.8
func (*SignedTx) SignedBytes ¶ added in v0.10.8
type StateObject ¶ added in v0.17.0
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 }
StateObject interface for interacting with state object
type StateTransition ¶ added in v0.17.0
type StateTransition struct {
// contains filtered or unexported fields
}
The State Transitioning 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 ¶ added in v0.17.0
NewStateTransition initialises and returns a new state transition object.
func (*StateTransition) EstimateGas ¶ added in v0.17.0
func (st *StateTransition) EstimateGas() (uint64, error)
func (*StateTransition) TransitionDb ¶ added in v0.17.0
func (st *StateTransition) TransitionDb() (*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.
type Tx ¶
type Tx interface { //it should be able to validate a tx by itself, non-valid tx will be reject by the node directly //without going to node process Validate(ctx *Context, signedTx SignedTx) (bool, error) //check tx on the first node who receives it, if process check failed, the tx will not be broadcast //could store a version of checked value in storage, but not implemented now ProcessCheck(ctx *Context, tx RawTx) (bool, Response) //deliver tx on the chain by changing the storage values, which should only be committed at Application //commit stage ProcessDeliver(ctx *Context, tx RawTx) (bool, Response) //process the charge of fees ProcessFee(ctx *Context, signedTx SignedTx, start Gas, size Gas, gasUsed Gas) (bool, Response) }
type TxTypeDescribe ¶ added in v0.14.0
type Type ¶
type Type int
const ( SEND Type = 0x01 SENDPOOL Type = 0x02 //staking related transaction STAKE Type = 0x11 UNSTAKE Type = 0x12 WITHDRAW Type = 0x13 //network network_delegation ADD_NETWORK_DELEGATE Type = 0x51 NETWORK_UNDELEGATE Type = 0x52 REWARDS_WITHDRAW_NETWORK_DELEGATE Type = 0x53 REWARDS_REINVEST_NETWORK_DELEGATE Type = 0x54 //Evidence ALLEGATION Type = 0x61 ALLEGATION_VOTE Type = 0x62 RELEASE Type = 0x63 //ons related transaction DOMAIN_CREATE Type = 0x21 DOMAIN_UPDATE Type = 0x22 DOMAIN_SELL Type = 0x23 DOMAIN_PURCHASE Type = 0x24 DOMAIN_SEND Type = 0x25 DOMAIN_DELETE_SUB Type = 0x26 DOMAIN_RENEW Type = 0x27 BTC_LOCK Type = 0x81 BTC_ADD_SIGNATURE Type = 0x82 BTC_BROADCAST_SUCCESS Type = 0x83 BTC_REPORT_FINALITY_MINT Type = 0x84 BTC_EXT_MINT Type = 0x85 BTC_REDEEM Type = 0x86 BTC_FAILED_BROADCAST_RESET Type = 0x87 //Ethereum Actions ETH_LOCK Type = 0x91 ETH_REPORT_FINALITY_MINT Type = 0x92 ETH_REDEEM Type = 0x93 ERC20_LOCK Type = 0x94 ERC20_REDEEM Type = 0x95 //Governance Action PROPOSAL_CREATE Type = 0x30 PROPOSAL_CANCEL Type = 0x31 PROPOSAL_FUND Type = 0x32 PROPOSAL_VOTE Type = 0x33 PROPOSAL_FINALIZE Type = 0x34 EXPIRE_VOTES Type = 0x35 PROPOSAL_WITHDRAW_FUNDS Type = 0x36 //Rewards WITHDRAW_REWARD Type = 0x41 //Smart Contract SC_EXECUTE Type = 0x71 //EOF here Only used as a marker to mark the end of Type list //So that the query for Types can return all Types dynamically //, when there is a change made in Type list //This value should be manually set as the largest among the list EOF Type = 0xFF )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem
|
Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem Package for transactions related to Etheruem |