Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKnownBlock is returned when a block to import is already known locally. ErrKnownBlock = errors.New("block already known") // ErrGasLimitReached is returned by the gas pool if the amount of gas required // by a transaction is higher than what's left in the block. ErrGasLimitReached = errors.New("gas limit reached") // ErrBlacklistedHash is returned if a block to import is on the blacklist. ErrBlacklistedHash = errors.New("blacklisted hash") // ErrNonceTooHigh is returned if the nonce of a transaction is higher than the // next one expected based on the local chain. ErrNonceTooHigh = errors.New("nonce too high") // ErrNonceTooLow is returned if the nonce of a transaction is lower than the // one present in the local chain. ErrNonceTooLow = errors.New("nonce too low") )
Functions ¶
func ApplyMessage ¶
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 GasPool ¶
type GasPool uint64
GasPool tracks the amount of gas available during execution of the transactions in a block. The zero value is a pool with zero gas available.
type Message ¶
type Message interface { From() common.Address //FromFrontier() (common.Address, error) To() *common.Address GasPrice() *big.Int Gas() uint64 Value() *big.Int Nonce() uint64 CheckNonce() bool Data() []byte }
Message represents a message sent to a contract.
type PendingLogsEvent ¶
PendingLogsEvent is posted pre mining and notifies of pending logs.
type RemovedLogsEvent ¶
RemovedLogsEvent is posted when a reorg happens
type StateTransition ¶
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 ¶
func NewStateTransition(evm *vm.FVM, msg Message, gp *GasPool) *StateTransition
NewStateTransition initialises and returns a new state transition object.
func (*StateTransition) TransitionDb ¶
func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bool, err error)
TransitionDb will transition the state by applying the current message and returning the result including the used gas. It returns an error if failed. An error indicates a consensus issue.