Documentation ¶
Index ¶
- Variables
- func NewContext(origin common.Address, gasLimit uint64, gasPrice *big.Int) vm.Context
- type DatabaseDeleter
- type DatabasePutter
- type DatabaseReader
- type State
- func (s *State) ApplyTransaction(txBytes []byte, txIndex int, blockHash common.Hash) error
- func (s *State) Call(callMsg ethTypes.Message) ([]byte, error)
- func (s *State) CheckAuthorised(addr common.Address) (bool, error)
- func (s *State) CheckTx(tx *ethTypes.Transaction) error
- func (s *State) Commit() (common.Hash, error)
- func (s *State) CreateGenesisAccounts() error
- func (s *State) Empty(addr common.Address) bool
- func (s *State) GetAuthorisingAbi() string
- func (s *State) GetAuthorisingAccount() string
- func (s *State) GetBalance(addr common.Address) *big.Int
- func (s *State) GetCode(addr common.Address) []byte
- func (s *State) GetGasLimit() uint64
- func (s *State) GetGenesis() (bcommon.Genesis, error)
- func (s *State) GetNonce(addr common.Address) uint64
- func (s *State) GetPoolNonce(addr common.Address) uint64
- func (s *State) GetReceipt(txHash common.Hash) (*ethTypes.Receipt, error)
- func (s *State) GetTransaction(hash common.Hash) (*ethTypes.Transaction, error)
- func (s *State) InitState() error
- type TxPool
- type WriteAheadState
Constants ¶
This section is empty.
Variables ¶
var ( // POAABI defines the ABI of the POA smart-contract as needed by a consensus // module to check if an address is authorized POAABI abi.ABI POAABISTRING string // POAADDR is the address of the POA smart-contract. POAADDR eth_common.Address )
var ( //CustomChainConfig accounts for the fact that Shuffle doesn't really have //a concetp of Chain, or Blocks (being consensus-agnostic). The EVM is //tightly coupled with this ChainConfig object (cf interpreter.go), so this //is a workaround that treats all blocks the same. CustomChainConfig = params.ChainConfig{ ChainID: big.NewInt(1), ConstantinopleBlock: big.NewInt(0), } )
var (
MIPMapLevels = []uint64{1000000, 500000, 100000, 50000, 1000}
)
Functions ¶
Types ¶
type DatabaseDeleter ¶
DatabaseDeleter wraps the Delete method of a backing data store.
type DatabasePutter ¶
DatabasePutter wraps the Put method of a backing data store.
type DatabaseReader ¶
DatabaseReader wraps the Get method of a backing data store.
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) ApplyTransaction ¶
ApplyTransaction decodes a transaction and applies it to the WAS. It is meant to be called by the consensus system to apply transactions sequentially.
func (*State) Call ¶
Call executes a readonly transaction on the statedb. It is called by the service handlers
func (*State) CheckAuthorised ¶
CheckAuthorised queries the POA smart-contract to check if the address is authorised
func (*State) CheckTx ¶
func (s *State) CheckTx(tx *ethTypes.Transaction) error
CheckTx attempt to apply a transaction to the TxPool's statedb. It is called by the Service handlers to check if a transaction is valid before submitting it to the consensus system. This also updates the sender's Nonce in the TxPool's statedb.
func (*State) Commit ¶
Commit persists all pending state changes (in the WAS) to the DB, and resets the WAS and TxPool
func (*State) CreateGenesisAccounts ¶
CreateGenesisAccounts reads the genesis.json file and creates the regular pre-funded accounts, as well as the POA smart-contract account.
func (*State) GetAuthorisingAbi ¶
GetAuthorisingAbi returns the abi of the smart contract which handles the list of authorized peers
func (*State) GetAuthorisingAccount ¶
GetAuthorisingAccount returns the address of the smart contract which handles the list of authorized peers
func (*State) GetBalance ¶
GetBalance returns an account's balance from the main ethState
func (*State) GetGasLimit ¶
GetGasLimit returns the gas limit set between commit calls
func (*State) GetGenesis ¶
GetGenesis reads and unmarshals the genesis.json file
func (*State) GetPoolNonce ¶
GetPoolNonce returns an account's nonce from the txpool's ethState
func (*State) GetReceipt ¶
GetReceipt fetches transaction receipts by transaction hash directly from the DB
func (*State) GetTransaction ¶
GetTransaction fetches transactions by hash directly from the DB.
type WriteAheadState ¶
type WriteAheadState struct {
// contains filtered or unexported fields
}
WriteAheadState is a wrapper around a DB and StateDB object that applies transactions to the StateDB and only commits them to the DB upon Commit. It also handles persisting transactions, logs, and receipts to the DB. NOT THREAD SAFE
func NewWriteAheadState ¶
func (*WriteAheadState) ApplyTransaction ¶
func (was *WriteAheadState) ApplyTransaction(tx ethTypes.Transaction, txIndex int, blockHash common.Hash) error