Documentation
¶
Index ¶
- Variables
- func CreateBloom(receipts EvmReceipts) *types.Bloom
- func NewEvmLogs() *evmLogs
- func NewMessage(tx *pb.EthTransaction) etherTypes.Message
- type AccessList
- type AccessTuple
- type Account
- func (o *Account) AddBalance(amount *big.Int)
- func (o *Account) AddState(key []byte, value []byte)
- func (o *Account) Code() []byte
- func (o *Account) CodeHash() []byte
- func (o *Account) GetBalance() *big.Int
- func (o *Account) GetCommittedState(key []byte) []byte
- func (o *Account) GetNonce() uint64
- func (o *Account) GetState(key []byte) (bool, []byte)
- func (o *Account) Query(prefix string) (bool, [][]byte)
- func (o *Account) SetBalance(balance *big.Int)
- func (o *Account) SetCodeAndHash(code []byte)
- func (o *Account) SetNonce(nonce uint64)
- func (o *Account) SetState(key []byte, value []byte)
- func (o *Account) SubBalance(amount *big.Int)
- type AccountCache
- type BlockData
- type BlockJournal
- type BlockchainLedger
- type ChainLedger
- func (l *ChainLedger) AccountCache() *AccountCache
- func (l *ChainLedger) AddAddressToAccessList(addr types.Address)
- func (l *ChainLedger) AddAddressToEVMAccessList(addr common.Address)
- func (l *ChainLedger) AddBalance(addr *types.Address, value *big.Int)
- func (l *ChainLedger) AddEVMBalance(addr common.Address, amount *big.Int)
- func (l *ChainLedger) AddEVMLog(log *etherTypes.Log)
- func (l *ChainLedger) AddEVMPreimage(hash common.Hash, data []byte)
- func (l *ChainLedger) AddEVMRefund(gas uint64)
- func (l *ChainLedger) AddEvent(event *pb.Event)
- func (l *ChainLedger) AddLog(log *pb.EvmLog)
- func (l *ChainLedger) AddPreimage(hash types.Hash, preimage []byte)
- func (l *ChainLedger) AddRefund(gas uint64)
- func (l *ChainLedger) AddSlotToAccessList(addr types.Address, slot types.Hash)
- func (l *ChainLedger) AddSlotToEVMAccessList(addr common.Address, slot common.Hash)
- func (l *ChainLedger) AddState(addr *types.Address, key []byte, v []byte)
- func (l *ChainLedger) AddressInAccessList(addr types.Address) bool
- func (l *ChainLedger) AddressInEVMAccessList(addr common.Address) bool
- func (l *ChainLedger) Clear()
- func (l *ChainLedger) ClearChangerAndRefund()
- func (l *ChainLedger) Close()
- func (l *ChainLedger) Commit(height uint64, accounts map[string]*Account, blockJournal *BlockJournal) error
- func (l *ChainLedger) CreateEVMAccount(addr common.Address)
- func (l *ChainLedger) Empty(addr *types.Address) bool
- func (l *ChainLedger) EmptyEVM(addr common.Address) bool
- func (l *ChainLedger) Events(txHash string) []*pb.Event
- func (l *ChainLedger) Exist(addr *types.Address) bool
- func (l *ChainLedger) ExistEVM(addr common.Address) bool
- func (l *ChainLedger) FlushDirtyDataAndComputeJournal() (map[string]*Account, *BlockJournal)
- func (l *ChainLedger) GetAccount(address *types.Address) *Account
- func (l *ChainLedger) GetBalance(addr *types.Address) *big.Int
- func (l *ChainLedger) GetBlock(height uint64) (*pb.Block, error)
- func (l *ChainLedger) GetBlockByHash(hash *types.Hash) (*pb.Block, error)
- func (l *ChainLedger) GetBlockEVMHash(height uint64) common.Hash
- func (l *ChainLedger) GetBlockHash(height uint64) *types.Hash
- func (l *ChainLedger) GetBlockSign(height uint64) ([]byte, error)
- func (l *ChainLedger) GetChainMeta() *pb.ChainMeta
- func (l *ChainLedger) GetCode(addr *types.Address) []byte
- func (l *ChainLedger) GetCodeHash(addr *types.Address) *types.Hash
- func (l *ChainLedger) GetCodeSize(addr *types.Address) int
- func (l *ChainLedger) GetCommittedState(addr *types.Address, key []byte) []byte
- func (l *ChainLedger) GetEVMBalance(addr common.Address) *big.Int
- func (l *ChainLedger) GetEVMCode(addr common.Address) []byte
- func (l *ChainLedger) GetEVMCodeHash(addr common.Address) common.Hash
- func (l *ChainLedger) GetEVMCodeSize(addr common.Address) int
- func (l *ChainLedger) GetEVMCommittedState(addr common.Address, hash common.Hash) common.Hash
- func (l *ChainLedger) GetEVMNonce(addr common.Address) uint64
- func (l *ChainLedger) GetEVMRefund() uint64
- func (l *ChainLedger) GetEVMState(addr common.Address, hash common.Hash) common.Hash
- func (l *ChainLedger) GetInterchainMeta(height uint64) (*pb.InterchainMeta, error)
- func (l *ChainLedger) GetLogs(hash types.Hash) []*pb.EvmLog
- func (l *ChainLedger) GetNonce(addr *types.Address) uint64
- func (l *ChainLedger) GetOrCreateAccount(addr *types.Address) *Account
- func (l *ChainLedger) GetReceipt(hash *types.Hash) (*pb.Receipt, error)
- func (l *ChainLedger) GetRefund() uint64
- func (l *ChainLedger) GetState(addr *types.Address, key []byte) (bool, []byte)
- func (l *ChainLedger) GetTransaction(hash *types.Hash) (pb.Transaction, error)
- func (l *ChainLedger) GetTransactionCount(height uint64) (uint64, error)
- func (l *ChainLedger) GetTransactionMeta(hash *types.Hash) (*pb.TransactionMeta, error)
- func (l *ChainLedger) HasSuiside(addr *types.Address) bool
- func (l *ChainLedger) HasSuisideEVM(addr common.Address) bool
- func (l *ChainLedger) Logs() []*pb.EvmLog
- func (l *ChainLedger) PersistBlockData(blockData *BlockData)
- func (l *ChainLedger) PersistExecutionResult(block *pb.Block, receipts []*pb.Receipt, interchainMeta *pb.InterchainMeta) error
- func (l *ChainLedger) PrepareAccessList(sender types.Address, dst *types.Address, precompiles []types.Address, ...)
- func (l *ChainLedger) PrepareBlock(hash *types.Hash)
- func (l *ChainLedger) PrepareEVM(hash common.Hash, index int)
- func (l *ChainLedger) PrepareEVMAccessList(sender common.Address, dest *common.Address, preEVMcompiles []common.Address, ...)
- func (l *ChainLedger) PutBlock(height uint64, block *pb.Block) error
- func (l *ChainLedger) QueryByPrefix(addr *types.Address, prefix string) (bool, [][]byte)
- func (l *ChainLedger) RemoveJournalsBeforeBlock(height uint64) error
- func (l *ChainLedger) RevertToSnapshot(revid int)
- func (l *ChainLedger) Rollback(height uint64) error
- func (l *ChainLedger) SetBalance(addr *types.Address, value *big.Int)
- func (l *ChainLedger) SetCode(addr *types.Address, code []byte)
- func (l *ChainLedger) SetEVMCode(addr common.Address, code []byte)
- func (l *ChainLedger) SetEVMNonce(addr common.Address, nonce uint64)
- func (l *ChainLedger) SetEVMState(addr common.Address, key, value common.Hash)
- func (l *ChainLedger) SetNonce(addr *types.Address, nonce uint64)
- func (l *ChainLedger) SetState(addr *types.Address, key []byte, v []byte)
- func (l *ChainLedger) SlotInAccessList(addr types.Address, slot types.Hash) (bool, bool)
- func (l *ChainLedger) SlotInEVMAceessList(addr common.Address, slot common.Hash) (bool, bool)
- func (l *ChainLedger) Snapshot() int
- func (l *ChainLedger) StateDB() vm.StateDB
- func (l *ChainLedger) SubBalance(addr *types.Address, value *big.Int)
- func (l *ChainLedger) SubEVMBalance(addr common.Address, amount *big.Int)
- func (l *ChainLedger) SubEVMRefund(gas uint64)
- func (l *ChainLedger) SubRefund(gas uint64)
- func (l *ChainLedger) Suiside(addr *types.Address) bool
- func (l *ChainLedger) SuisideEVM(addr common.Address) bool
- func (l *ChainLedger) UpdateChainMeta(meta *pb.ChainMeta)
- func (l *ChainLedger) Version() uint64
- type EvmReceipts
- type Ledger
- type StateAccessor
Constants ¶
This section is empty.
Variables ¶
var ( ErrorRollbackToHigherNumber = fmt.Errorf("rollback to higher blockchain height") ErrorRollbackWithoutJournal = fmt.Errorf("rollback to blockchain height without journal") ErrorRollbackTooMuch = fmt.Errorf("rollback too much block") ErrorRemoveJournalOutOfRange = fmt.Errorf("remove journal out of range") )
var ( PersistBlockDuration = prometheus.NewHistogram(prometheus.HistogramOpts{ Namespace: "bitxhub", Subsystem: "ledger", Name: "persist_block_duration_second", Help: "The total latency of block persist", Buckets: prometheus.ExponentialBuckets(0.001, 2, 10), }) )
Functions ¶
func CreateBloom ¶ added in v1.8.0
func CreateBloom(receipts EvmReceipts) *types.Bloom
func NewEvmLogs ¶ added in v1.8.0
func NewEvmLogs() *evmLogs
func NewMessage ¶ added in v1.8.0
func NewMessage(tx *pb.EthTransaction) etherTypes.Message
Types ¶
type AccessList ¶ added in v1.8.0
type AccessList []AccessTuple
func (AccessList) StorageKeys ¶ added in v1.8.0
func (al AccessList) StorageKeys() int
type AccessTuple ¶ added in v1.8.0
type Account ¶
func (*Account) AddBalance ¶ added in v1.8.0
func (*Account) GetBalance ¶
GetBalance Get the balance from the account
func (*Account) GetCommittedState ¶ added in v1.8.0
func (*Account) SetBalance ¶
SetBalance Set the balance to the account
func (*Account) SetCodeAndHash ¶
SetCodeAndHash Set the contract code and hash
func (*Account) SubBalance ¶ added in v1.8.0
type AccountCache ¶
type AccountCache struct {
// contains filtered or unexported fields
}
func NewAccountCache ¶
func NewAccountCache() (*AccountCache, error)
type BlockJournal ¶
type BlockchainLedger ¶
type BlockchainLedger interface {
// PutBlock put block into store
PutBlock(height uint64, block *pb.Block) error
// GetBlock get block with height
GetBlock(height uint64) (*pb.Block, error)
// GetBlockSign get the signature of block
GetBlockSign(height uint64) ([]byte, error)
// GetBlockByHash get the block using block hash
GetBlockByHash(hash *types.Hash) (*pb.Block, error)
// GetTransaction get the transaction using transaction hash
GetTransaction(hash *types.Hash) (pb.Transaction, error)
// GetTransactionMeta get the transaction meta data
GetTransactionMeta(hash *types.Hash) (*pb.TransactionMeta, error)
// GetReceipt get the transaction receipt
GetReceipt(hash *types.Hash) (*pb.Receipt, error)
// GetInterchainMeta get interchain meta data
GetInterchainMeta(height uint64) (*pb.InterchainMeta, error)
// PersistExecutionResult persist the execution result
PersistExecutionResult(block *pb.Block, receipts []*pb.Receipt, meta *pb.InterchainMeta) error
// GetChainMeta get chain meta data
GetChainMeta() *pb.ChainMeta
// UpdateChainMeta update the chain meta data
UpdateChainMeta(*pb.ChainMeta)
// GetTxCountInBlock get the transaction count in a block
GetTransactionCount(height uint64) (uint64, error)
}
BlockchainLedger handles block, transaction and receipt data.
type ChainLedger ¶
type ChainLedger struct {
// contains filtered or unexported fields
}
func New ¶
func New(repo *repo.Repo, blockchainStore storage.Storage, ldb storage.Storage, bf *blockfile.BlockFile, accountCache *AccountCache, logger logrus.FieldLogger) (*ChainLedger, error)
New create a new ledger instance
func (*ChainLedger) AccountCache ¶ added in v1.0.1
func (l *ChainLedger) AccountCache() *AccountCache
func (*ChainLedger) AddAddressToAccessList ¶ added in v1.8.0
func (l *ChainLedger) AddAddressToAccessList(addr types.Address)
func (*ChainLedger) AddAddressToEVMAccessList ¶ added in v1.8.0
func (l *ChainLedger) AddAddressToEVMAccessList(addr common.Address)
func (*ChainLedger) AddBalance ¶ added in v1.8.0
func (l *ChainLedger) AddBalance(addr *types.Address, value *big.Int)
func (*ChainLedger) AddEVMBalance ¶ added in v1.8.0
func (l *ChainLedger) AddEVMBalance(addr common.Address, amount *big.Int)
func (*ChainLedger) AddEVMLog ¶ added in v1.8.0
func (l *ChainLedger) AddEVMLog(log *etherTypes.Log)
func (*ChainLedger) AddEVMPreimage ¶ added in v1.8.0
func (l *ChainLedger) AddEVMPreimage(hash common.Hash, data []byte)
func (*ChainLedger) AddEVMRefund ¶ added in v1.8.0
func (l *ChainLedger) AddEVMRefund(gas uint64)
func (*ChainLedger) AddEvent ¶
func (l *ChainLedger) AddEvent(event *pb.Event)
AddEvent add ledger event
func (*ChainLedger) AddLog ¶ added in v1.8.0
func (l *ChainLedger) AddLog(log *pb.EvmLog)
func (*ChainLedger) AddPreimage ¶ added in v1.8.0
func (l *ChainLedger) AddPreimage(hash types.Hash, preimage []byte)
func (*ChainLedger) AddRefund ¶ added in v1.8.0
func (l *ChainLedger) AddRefund(gas uint64)
func (*ChainLedger) AddSlotToAccessList ¶ added in v1.8.0
func (l *ChainLedger) AddSlotToAccessList(addr types.Address, slot types.Hash)
func (*ChainLedger) AddSlotToEVMAccessList ¶ added in v1.8.0
func (l *ChainLedger) AddSlotToEVMAccessList(addr common.Address, slot common.Hash)
func (*ChainLedger) AddState ¶ added in v1.0.1
func (l *ChainLedger) AddState(addr *types.Address, key []byte, v []byte)
AddState add account state value using account Address and key
func (*ChainLedger) AddressInAccessList ¶ added in v1.8.0
func (l *ChainLedger) AddressInAccessList(addr types.Address) bool
func (*ChainLedger) AddressInEVMAccessList ¶ added in v1.8.0
func (l *ChainLedger) AddressInEVMAccessList(addr common.Address) bool
func (*ChainLedger) Clear ¶
func (l *ChainLedger) Clear()
func (*ChainLedger) ClearChangerAndRefund ¶ added in v1.8.0
func (l *ChainLedger) ClearChangerAndRefund()
func (*ChainLedger) Commit ¶
func (l *ChainLedger) Commit(height uint64, accounts map[string]*Account, blockJournal *BlockJournal) error
Commit commit the state
func (*ChainLedger) CreateEVMAccount ¶ added in v1.8.0
func (l *ChainLedger) CreateEVMAccount(addr common.Address)
func (*ChainLedger) EmptyEVM ¶ added in v1.8.0
func (l *ChainLedger) EmptyEVM(addr common.Address) bool
func (*ChainLedger) Events ¶
func (l *ChainLedger) Events(txHash string) []*pb.Event
Events return ledger events
func (*ChainLedger) ExistEVM ¶ added in v1.8.0
func (l *ChainLedger) ExistEVM(addr common.Address) bool
func (*ChainLedger) FlushDirtyDataAndComputeJournal ¶
func (l *ChainLedger) FlushDirtyDataAndComputeJournal() (map[string]*Account, *BlockJournal)
FlushDirtyDataAndComputeJournal gets dirty accounts and computes block journal
func (*ChainLedger) GetAccount ¶
func (l *ChainLedger) GetAccount(address *types.Address) *Account
GetAccount get account info using account Address, if not found, create a new account
func (*ChainLedger) GetBalance ¶
func (l *ChainLedger) GetBalance(addr *types.Address) *big.Int
GetBalanec get account balance using account Address
func (*ChainLedger) GetBlock ¶
func (l *ChainLedger) GetBlock(height uint64) (*pb.Block, error)
GetBlock get block with height
func (*ChainLedger) GetBlockByHash ¶
GetBlockByHash get the block using block hash
func (*ChainLedger) GetBlockEVMHash ¶ added in v1.8.0
func (l *ChainLedger) GetBlockEVMHash(height uint64) common.Hash
func (*ChainLedger) GetBlockHash ¶ added in v1.8.0
func (l *ChainLedger) GetBlockHash(height uint64) *types.Hash
func (*ChainLedger) GetBlockSign ¶
func (l *ChainLedger) GetBlockSign(height uint64) ([]byte, error)
GetBlockSign get the signature of block
func (*ChainLedger) GetChainMeta ¶
func (l *ChainLedger) GetChainMeta() *pb.ChainMeta
GetChainMeta get chain meta data
func (*ChainLedger) GetCode ¶
func (l *ChainLedger) GetCode(addr *types.Address) []byte
GetCode get contract code
func (*ChainLedger) GetCodeHash ¶ added in v1.8.0
func (l *ChainLedger) GetCodeHash(addr *types.Address) *types.Hash
func (*ChainLedger) GetCodeSize ¶ added in v1.8.0
func (l *ChainLedger) GetCodeSize(addr *types.Address) int
func (*ChainLedger) GetCommittedState ¶ added in v1.8.0
func (l *ChainLedger) GetCommittedState(addr *types.Address, key []byte) []byte
func (*ChainLedger) GetEVMBalance ¶ added in v1.8.0
func (l *ChainLedger) GetEVMBalance(addr common.Address) *big.Int
func (*ChainLedger) GetEVMCode ¶ added in v1.8.0
func (l *ChainLedger) GetEVMCode(addr common.Address) []byte
func (*ChainLedger) GetEVMCodeHash ¶ added in v1.8.0
func (l *ChainLedger) GetEVMCodeHash(addr common.Address) common.Hash
func (*ChainLedger) GetEVMCodeSize ¶ added in v1.8.0
func (l *ChainLedger) GetEVMCodeSize(addr common.Address) int
func (*ChainLedger) GetEVMCommittedState ¶ added in v1.8.0
func (*ChainLedger) GetEVMNonce ¶ added in v1.8.0
func (l *ChainLedger) GetEVMNonce(addr common.Address) uint64
func (*ChainLedger) GetEVMRefund ¶ added in v1.8.0
func (l *ChainLedger) GetEVMRefund() uint64
func (*ChainLedger) GetEVMState ¶ added in v1.8.0
func (*ChainLedger) GetInterchainMeta ¶
func (l *ChainLedger) GetInterchainMeta(height uint64) (*pb.InterchainMeta, error)
func (*ChainLedger) GetLogs ¶ added in v1.8.0
func (l *ChainLedger) GetLogs(hash types.Hash) []*pb.EvmLog
func (*ChainLedger) GetNonce ¶
func (l *ChainLedger) GetNonce(addr *types.Address) uint64
GetNonce get account nonce
func (*ChainLedger) GetOrCreateAccount ¶
func (l *ChainLedger) GetOrCreateAccount(addr *types.Address) *Account
GetOrCreateAccount get the account, if not exist, create a new account
func (*ChainLedger) GetReceipt ¶
GetReceipt get the transaction receipt
func (*ChainLedger) GetRefund ¶ added in v1.8.0
func (l *ChainLedger) GetRefund() uint64
func (*ChainLedger) GetTransaction ¶
func (l *ChainLedger) GetTransaction(hash *types.Hash) (pb.Transaction, error)
GetTransaction get the transaction using transaction hash
func (*ChainLedger) GetTransactionCount ¶ added in v1.0.1
func (l *ChainLedger) GetTransactionCount(height uint64) (uint64, error)
func (*ChainLedger) GetTransactionMeta ¶
func (l *ChainLedger) GetTransactionMeta(hash *types.Hash) (*pb.TransactionMeta, error)
GetTransactionMeta get the transaction meta data
func (*ChainLedger) HasSuiside ¶ added in v1.8.0
func (l *ChainLedger) HasSuiside(addr *types.Address) bool
func (*ChainLedger) HasSuisideEVM ¶ added in v1.8.0
func (l *ChainLedger) HasSuisideEVM(addr common.Address) bool
func (*ChainLedger) Logs ¶ added in v1.8.0
func (l *ChainLedger) Logs() []*pb.EvmLog
func (*ChainLedger) PersistBlockData ¶
func (l *ChainLedger) PersistBlockData(blockData *BlockData)
PersistBlockData persists block data
func (*ChainLedger) PersistExecutionResult ¶
func (l *ChainLedger) PersistExecutionResult(block *pb.Block, receipts []*pb.Receipt, interchainMeta *pb.InterchainMeta) error
PersistExecutionResult persist the execution result
func (*ChainLedger) PrepareAccessList ¶ added in v1.8.0
func (l *ChainLedger) PrepareAccessList(sender types.Address, dst *types.Address, precompiles []types.Address, list AccessList)
func (*ChainLedger) PrepareBlock ¶ added in v1.8.0
func (l *ChainLedger) PrepareBlock(hash *types.Hash)
func (*ChainLedger) PrepareEVM ¶ added in v1.8.0
func (l *ChainLedger) PrepareEVM(hash common.Hash, index int)
func (*ChainLedger) PrepareEVMAccessList ¶ added in v1.8.0
func (l *ChainLedger) PrepareEVMAccessList(sender common.Address, dest *common.Address, preEVMcompiles []common.Address, txEVMAccesses etherTypes.AccessList)
func (*ChainLedger) PutBlock ¶
func (l *ChainLedger) PutBlock(height uint64, block *pb.Block) error
PutBlock put block into store
func (*ChainLedger) QueryByPrefix ¶
QueryByPrefix query value using key
func (*ChainLedger) RemoveJournalsBeforeBlock ¶
func (l *ChainLedger) RemoveJournalsBeforeBlock(height uint64) error
RemoveJournalsBeforeBlock removes ledger journals whose block number < height
func (*ChainLedger) RevertToSnapshot ¶ added in v1.8.0
func (l *ChainLedger) RevertToSnapshot(revid int)
func (*ChainLedger) Rollback ¶
func (l *ChainLedger) Rollback(height uint64) error
Rollback rollback ledger to history version
func (*ChainLedger) SetBalance ¶
func (l *ChainLedger) SetBalance(addr *types.Address, value *big.Int)
SetBalance set account balance
func (*ChainLedger) SetCode ¶
func (l *ChainLedger) SetCode(addr *types.Address, code []byte)
SetCode set contract code
func (*ChainLedger) SetEVMCode ¶ added in v1.8.0
func (l *ChainLedger) SetEVMCode(addr common.Address, code []byte)
func (*ChainLedger) SetEVMNonce ¶ added in v1.8.0
func (l *ChainLedger) SetEVMNonce(addr common.Address, nonce uint64)
func (*ChainLedger) SetEVMState ¶ added in v1.8.0
func (l *ChainLedger) SetEVMState(addr common.Address, key, value common.Hash)
func (*ChainLedger) SetNonce ¶
func (l *ChainLedger) SetNonce(addr *types.Address, nonce uint64)
SetNonce set account nonce
func (*ChainLedger) SetState ¶
func (l *ChainLedger) SetState(addr *types.Address, key []byte, v []byte)
SetState set account state value using account Address and key
func (*ChainLedger) SlotInAccessList ¶ added in v1.8.0
func (*ChainLedger) SlotInEVMAceessList ¶ added in v1.8.0
func (*ChainLedger) Snapshot ¶ added in v1.8.0
func (l *ChainLedger) Snapshot() int
func (*ChainLedger) StateDB ¶ added in v1.8.0
func (l *ChainLedger) StateDB() vm.StateDB
func (*ChainLedger) SubBalance ¶ added in v1.8.0
func (l *ChainLedger) SubBalance(addr *types.Address, value *big.Int)
func (*ChainLedger) SubEVMBalance ¶ added in v1.8.0
func (l *ChainLedger) SubEVMBalance(addr common.Address, amount *big.Int)
func (*ChainLedger) SubEVMRefund ¶ added in v1.8.0
func (l *ChainLedger) SubEVMRefund(gas uint64)
func (*ChainLedger) SubRefund ¶ added in v1.8.0
func (l *ChainLedger) SubRefund(gas uint64)
func (*ChainLedger) Suiside ¶ added in v1.8.0
func (l *ChainLedger) Suiside(addr *types.Address) bool
func (*ChainLedger) SuisideEVM ¶ added in v1.8.0
func (l *ChainLedger) SuisideEVM(addr common.Address) bool
func (*ChainLedger) UpdateChainMeta ¶
func (l *ChainLedger) UpdateChainMeta(meta *pb.ChainMeta)
UpdateChainMeta update the chain meta data
func (*ChainLedger) Version ¶
func (l *ChainLedger) Version() uint64
Version returns the current version
type EvmReceipts ¶ added in v1.8.0
type Ledger ¶
type Ledger interface {
BlockchainLedger
StateAccessor
vm.StateDB
StateDB() vm.StateDB
AccountCache() *AccountCache
// PersistBlockData
PersistBlockData(blockData *BlockData)
// AddEvent
AddEvent(*pb.Event)
// Events
Events(txHash string) []*pb.Event
// Rollback
Rollback(height uint64) error
// RemoveJournalsBeforeBlock
RemoveJournalsBeforeBlock(height uint64) error
PrepareBlock(*types.Hash)
ClearChangerAndRefund()
// Close release resource
Close()
}
type StateAccessor ¶
type StateAccessor interface {
// GetOrCreateAccount
GetOrCreateAccount(*types.Address) *Account
// GetAccount
GetAccount(*types.Address) *Account
// 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]*Account, blockJournal *BlockJournal) error
// FlushDirtyDataAndComputeJournal flushes the dirty data and computes block journal
FlushDirtyDataAndComputeJournal() (map[string]*Account, *BlockJournal)
// Version
Version() uint64
GetLogs(types.Hash) []*pb.EvmLog
// Clear
Clear()
}
StateAccessor manipulates the state data