Documentation ¶
Index ¶
- func InnerAccountChanged(account0 *InnerAccount, account1 *InnerAccount) bool
- type AccessList
- func (al *AccessList) AddAddress(address types.Address) bool
- func (al *AccessList) AddSlot(address types.Address, slot types.Hash) (bool, bool)
- func (al *AccessList) Contains(addr types.Address, slot types.Hash) (bool, bool)
- func (al *AccessList) ContainsAddress(addr types.Address) bool
- func (al *AccessList) Copy() *AccessList
- func (al *AccessList) DeleteAddress(address types.Address)
- func (al *AccessList) DeleteSlot(address types.Address, slot types.Hash)
- type AccessTuple
- type AccessTupleList
- type ChainLedger
- type IAccount
- type InnerAccount
- type StateAccessor
- type StateDB
- type StateLedger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InnerAccountChanged ¶
func InnerAccountChanged(account0 *InnerAccount, account1 *InnerAccount) bool
Types ¶
type AccessList ¶
type AccessList struct {
// contains filtered or unexported fields
}
func NewAccessList ¶
func NewAccessList() *AccessList
func (*AccessList) AddAddress ¶
func (al *AccessList) AddAddress(address types.Address) bool
func (*AccessList) ContainsAddress ¶
func (al *AccessList) ContainsAddress(addr types.Address) bool
func (*AccessList) Copy ¶
func (al *AccessList) Copy() *AccessList
func (*AccessList) DeleteAddress ¶
func (al *AccessList) DeleteAddress(address types.Address)
func (*AccessList) DeleteSlot ¶
func (al *AccessList) DeleteSlot(address types.Address, slot types.Hash)
type AccessTuple ¶
type AccessTupleList ¶
type AccessTupleList []AccessTuple
func (AccessTupleList) StorageKeys ¶
func (al AccessTupleList) StorageKeys() int
type ChainLedger ¶
type ChainLedger interface { // GetBlock get block with height GetBlock(height uint64) (*types.Block, error) // GetBlockSign get the signature of block GetBlockSign(height uint64) ([]byte, error) // GetBlockByHash get the block using block hash GetBlockByHash(hash *types.Hash) (*types.Block, error) // GetTransaction get the transaction using transaction hash GetTransaction(hash *types.Hash) (*types.Transaction, error) // GetTransactionMeta get the transaction meta data GetTransactionMeta(hash *types.Hash) (*types.TransactionMeta, error) // GetReceipt get the transaction receipt GetReceipt(hash *types.Hash) (*types.Receipt, error) // PersistExecutionResult persist the execution result PersistExecutionResult(block *types.Block, receipts []*types.Receipt) error // GetChainMeta get chain meta data GetChainMeta() *types.ChainMeta // UpdateChainMeta update the chain meta data UpdateChainMeta(*types.ChainMeta) // LoadChainMeta get chain meta data LoadChainMeta() (*types.ChainMeta, error) // GetTxCountInBlock get the transaction count in a block GetTransactionCount(height uint64) (uint64, error) RollbackBlockChain(height uint64) error GetBlockHash(height uint64) *types.Hash Close() }
BlockchainLedger handles block, transaction and receipt data.
type IAccount ¶
type IAccount interface { GetAddress() *types.Address GetState(key []byte) (bool, []byte) GetCommittedState(key []byte) []byte SetState(key []byte, value []byte) AddState(key []byte, value []byte) SetCodeAndHash(code []byte) Code() []byte CodeHash() []byte SetNonce(nonce uint64) GetNonce() uint64 GetBalance() *big.Int SetBalance(balance *big.Int) SubBalance(amount *big.Int) AddBalance(amount *big.Int) Query(prefix string) (bool, [][]byte) IsEmpty() bool Suicided() bool SetSuicided(bool) }
type InnerAccount ¶
type InnerAccount struct { Nonce uint64 `json:"nonce"` Balance *big.Int `json:"balance"` CodeHash []byte `json:"code_hash"` }
func CopyOrNewIfEmpty ¶
func CopyOrNewIfEmpty(o *InnerAccount) *InnerAccount
func (*InnerAccount) Marshal ¶
func (o *InnerAccount) Marshal() ([]byte, error)
Marshal Marshal the account into byte
func (*InnerAccount) Unmarshal ¶
func (o *InnerAccount) Unmarshal(data []byte) error
Unmarshal Unmarshal the account byte into structure
type StateAccessor ¶
type StateAccessor interface { // GetOrCreateAccount GetOrCreateAccount(*types.Address) IAccount // GetAccount GetAccount(*types.Address) IAccount // GetBalance GetBalance(*types.Address) *big.Int // SetBalance SetBalance(*types.Address, *big.Int) // GetState GetState(*types.Address, []byte) (bool, []byte) // SetState SetState(*types.Address, []byte, []byte) // AddState AddState(*types.Address, []byte, []byte) // SetCode SetCode(*types.Address, []byte) // GetCode GetCode(*types.Address) []byte // SetNonce SetNonce(*types.Address, uint64) // GetNonce GetNonce(*types.Address) uint64 // QueryByPrefix QueryByPrefix(address *types.Address, prefix string) (bool, [][]byte) // Commit commits the state data Commit(height uint64, accounts map[string]IAccount, stateRoot *types.Hash) error // FlushDirtyData flushes the dirty data FlushDirtyData() (map[string]IAccount, *types.Hash) // Set tx context for state db SetTxContext(thash *types.Hash, txIndex int) // Clear Clear() }
StateAccessor manipulates the state data
type StateDB ¶
type StateDB interface { CreateEVMAccount(common.Address) SubEVMBalance(common.Address, *big.Int) AddEVMBalance(common.Address, *big.Int) GetEVMBalance(common.Address) *big.Int GetEVMNonce(common.Address) uint64 SetEVMNonce(common.Address, uint64) GetEVMCodeHash(common.Address) common.Hash GetEVMCode(common.Address) []byte SetEVMCode(common.Address, []byte) GetEVMCodeSize(common.Address) int AddEVMRefund(uint64) SubEVMRefund(uint64) GetEVMRefund() uint64 GetEVMCommittedState(common.Address, common.Hash) common.Hash GetEVMState(common.Address, common.Hash) common.Hash SetEVMState(common.Address, common.Hash, common.Hash) GetEVMTransientState(addr common.Address, key common.Hash) common.Hash SetEVMTransientState(addr common.Address, key, value common.Hash) SuisideEVM(common.Address) bool HasSuisideEVM(common.Address) bool // Exist reports whether the given Account exists in state. // Notably this should also return true for suicided accounts. ExistEVM(common.Address) bool // Empty returns whether the given Account is empty. Empty // is defined according to EIP161 (balance = nonce = code = 0). EmptyEVM(common.Address) bool // PrepareEVMAccessList(sender common.Address, dest *common.Address, precompiles []common.Address, txAccesses types2.AccessList) AddressInEVMAccessList(addr common.Address) bool SlotInEVMAceessList(addr common.Address, slot common.Hash) (addressOk bool, slotOk bool) // AddAddressToAccessList adds the given address to the access list. This operation is safe to perform // even if the feature/fork is not active yet AddAddressToEVMAccessList(addr common.Address) // AddSlotToAccessList adds the given (address,slot) to the access list. This operation is safe to perform // even if the feature/fork is not active yet AddSlotToEVMAccessList(addr common.Address, slot common.Hash) PrepareEVM(rules params.Rules, sender, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types2.AccessList) RevertToSnapshot(int) Snapshot() int AddEVMLog(log *types2.Log) AddEVMPreimage(common.Hash, []byte) }
StateDB is an EVM database for full state querying.
type StateLedger ¶
type StateLedger interface { StateAccessor StateDB // AddEvent AddEvent(*types.Event) // Events Events(txHash string) []*types.Event AddLog(log *types.EvmLog) GetLogs(types.Hash, uint64, *types.Hash) []*types.EvmLog // Rollback RollbackState(height uint64) error PrepareBlock(*types.Hash, uint64) ClearChangerAndRefund() // Close release resource Close() Copy() StateLedger Finalise(bool) // Version Version() uint64 }
Directories ¶
Path | Synopsis |
---|---|
Package mock_ledger is a generated GoMock package.
|
Package mock_ledger is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.