Documentation ¶
Index ¶
- type BlockInfo
- type BlockState
- type ChainStateDB
- func (sdb *ChainStateDB) Apply(bstate *BlockState) error
- func (sdb *ChainStateDB) Clone() *ChainStateDB
- func (sdb *ChainStateDB) Close() error
- func (sdb *ChainStateDB) GetRoot() []byte
- func (sdb *ChainStateDB) GetStateDB() *StateDB
- func (sdb *ChainStateDB) GetSystemAccountState() (*ContractState, error)
- func (sdb *ChainStateDB) Init(dbType string, dataDir string, bestBlock *types.Block, test bool) error
- func (sdb *ChainStateDB) IsExistState(hash []byte) bool
- func (sdb *ChainStateDB) NewBlockState(root []byte) *BlockState
- func (sdb *ChainStateDB) OpenNewStateDB(root []byte) *StateDB
- func (sdb *ChainStateDB) SetGenesis(genesis *types.Genesis, bpInit func(*StateDB, *types.Genesis) error) error
- func (sdb *ChainStateDB) SetRoot(targetBlockRoot []byte) error
- func (sdb *ChainStateDB) UpdateRoot(bstate *BlockState) error
- type ContractState
- func (st *ContractState) DeleteData(key []byte) error
- func (st *ContractState) GetBalance() *big.Int
- func (st *ContractState) GetCode() ([]byte, error)
- func (st *ContractState) GetData(key []byte) ([]byte, error)
- func (st *ContractState) GetInitialData(key []byte) ([]byte, error)
- func (st *ContractState) GetNonce() uint64
- func (st *ContractState) HasKey(key []byte) bool
- func (st *ContractState) Hash() []byte
- func (st *ContractState) Marshal() ([]byte, error)
- func (st *ContractState) Rollback(revision Snapshot) error
- func (st *ContractState) SetBalance(balance *big.Int)
- func (st *ContractState) SetCode(code []byte) error
- func (st *ContractState) SetData(key, value []byte) error
- func (st *ContractState) SetNonce(nonce uint64)
- func (st *ContractState) Snapshot() Snapshot
- type Snapshot
- type StateDB
- func (states *StateDB) Clone() *StateDB
- func (states *StateDB) Commit() error
- func (states *StateDB) CreateAccountStateV(id []byte) (*V, error)
- func (states *StateDB) GetAccountAndProof(id []byte, root []byte, compressed bool) (*types.AccountProof, error)
- func (states *StateDB) GetAccountState(id types.AccountID) (*types.State, error)
- func (states *StateDB) GetAccountStateV(id []byte) (*V, error)
- func (states *StateDB) GetNameAccountState() (*ContractState, error)
- func (states *StateDB) GetRoot() []byte
- func (states *StateDB) GetState(id types.AccountID) (*types.State, error)
- func (states *StateDB) GetSystemAccountState() (*ContractState, error)
- func (states *StateDB) GetVarAndProof(id []byte, root []byte, compressed bool) (*types.ContractVarProof, error)
- func (states *StateDB) HasMarker(root []byte) bool
- func (states *StateDB) InitAccountStateV(id []byte, old *types.State, new *types.State) *V
- func (states *StateDB) LoadCache(root []byte) error
- func (states *StateDB) OpenContractState(aid types.AccountID, st *types.State) (*ContractState, error)
- func (states *StateDB) OpenContractStateAccount(aid types.AccountID) (*ContractState, error)
- func (states *StateDB) PutState(id types.AccountID, state *types.State) error
- func (states *StateDB) Revert(root types.HashID) error
- func (states *StateDB) Rollback(revision Snapshot) error
- func (states *StateDB) SetRoot(root []byte) error
- func (states *StateDB) Snapshot() Snapshot
- func (states *StateDB) StageContractState(st *ContractState) error
- func (states *StateDB) TrieQuery(id []byte, root []byte, compressed bool) ([]byte, [][]byte, int, bool, []byte, []byte, error)
- func (states *StateDB) Update() error
- type V
- func (v *V) AccountID() types.AccountID
- func (v *V) AddBalance(amount *big.Int)
- func (v *V) Balance() *big.Int
- func (v *V) ID() []byte
- func (v *V) IsCreate() bool
- func (v *V) IsNew() bool
- func (v *V) PutState() error
- func (v *V) RP() uint64
- func (v *V) Reset()
- func (v *V) SetNonce(nonce uint64)
- func (v *V) State() *types.State
- func (v *V) SubBalance(amount *big.Int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockInfo ¶
BlockInfo contains BlockHash and StateRoot
func NewBlockInfo ¶
NewBlockInfo create new blockInfo contains blockNo, blockHash and blockHash of previous block
func (*BlockInfo) GetStateRoot ¶
GetStateRoot return bytes of bi.StateRoot
type BlockState ¶
type BlockState struct { StateDB BpReward []byte //final bp reward, increment when tx executes CodeMap map[types.AccountID][]byte // contains filtered or unexported fields }
BlockState contains BlockInfo and statedb for block
func NewBlockState ¶
func NewBlockState(states *StateDB) *BlockState
NewBlockState create new blockState contains blockInfo, account states and undo states
func (*BlockState) AddReceipt ¶
func (bs *BlockState) AddReceipt(r *types.Receipt) error
func (*BlockState) Receipts ¶
func (bs *BlockState) Receipts() *types.Receipts
type ChainStateDB ¶
ChainStateDB manages statedb and additional informations about blocks like a state root hash
func NewChainStateDB ¶
func NewChainStateDB() *ChainStateDB
NewChainStateDB creates instance of ChainStateDB
func (*ChainStateDB) Apply ¶
func (sdb *ChainStateDB) Apply(bstate *BlockState) error
Apply specific blockstate to statedb of main chain
func (*ChainStateDB) Clone ¶
func (sdb *ChainStateDB) Clone() *ChainStateDB
Init initialize database and load statedb of latest block
func (*ChainStateDB) Close ¶
func (sdb *ChainStateDB) Close() error
Close saves latest block information of the chain
func (*ChainStateDB) GetRoot ¶
func (sdb *ChainStateDB) GetRoot() []byte
GetRoot returns state root hash
func (*ChainStateDB) GetStateDB ¶
func (sdb *ChainStateDB) GetStateDB() *StateDB
GetStateDB returns statedb stores account states
func (*ChainStateDB) GetSystemAccountState ¶ added in v0.9.0
func (sdb *ChainStateDB) GetSystemAccountState() (*ContractState, error)
GetSystemAccountState returns the state of the aergo system account.
func (*ChainStateDB) Init ¶
func (sdb *ChainStateDB) Init(dbType string, dataDir string, bestBlock *types.Block, test bool) error
Init initialize database and load statedb of latest block
func (*ChainStateDB) IsExistState ¶
func (sdb *ChainStateDB) IsExistState(hash []byte) bool
func (*ChainStateDB) NewBlockState ¶
func (sdb *ChainStateDB) NewBlockState(root []byte) *BlockState
func (*ChainStateDB) OpenNewStateDB ¶
func (sdb *ChainStateDB) OpenNewStateDB(root []byte) *StateDB
OpenNewStateDB returns new instance of statedb given state root hash
func (*ChainStateDB) SetGenesis ¶
func (*ChainStateDB) SetRoot ¶ added in v0.9.0
func (sdb *ChainStateDB) SetRoot(targetBlockRoot []byte) error
func (*ChainStateDB) UpdateRoot ¶
func (sdb *ChainStateDB) UpdateRoot(bstate *BlockState) error
type ContractState ¶
func (*ContractState) DeleteData ¶ added in v0.8.2
func (st *ContractState) DeleteData(key []byte) error
DeleteData remove key and value pair from the storage.
func (*ContractState) GetBalance ¶
func (st *ContractState) GetBalance() *big.Int
func (*ContractState) GetCode ¶
func (st *ContractState) GetCode() ([]byte, error)
func (*ContractState) GetData ¶
func (st *ContractState) GetData(key []byte) ([]byte, error)
GetData returns the value corresponding to the key from the buffered storage.
func (*ContractState) GetInitialData ¶ added in v0.9.0
func (st *ContractState) GetInitialData(key []byte) ([]byte, error)
GetInitialData returns the value corresponding to the key from the contract storage.
func (*ContractState) GetNonce ¶
func (st *ContractState) GetNonce() uint64
func (*ContractState) HasKey ¶ added in v0.9.0
func (st *ContractState) HasKey(key []byte) bool
HasKey returns existence of the key
func (*ContractState) Hash ¶ added in v0.8.2
func (st *ContractState) Hash() []byte
Hash implements types.ImplHashBytes
func (*ContractState) Marshal ¶ added in v0.8.1
func (st *ContractState) Marshal() ([]byte, error)
Marshal implements types.ImplMarshal
func (*ContractState) Rollback ¶ added in v0.8.1
func (st *ContractState) Rollback(revision Snapshot) error
Rollback discards changes of storage buffer to revision number
func (*ContractState) SetBalance ¶
func (st *ContractState) SetBalance(balance *big.Int)
func (*ContractState) SetCode ¶
func (st *ContractState) SetCode(code []byte) error
func (*ContractState) SetData ¶
func (st *ContractState) SetData(key, value []byte) error
SetData store key and value pair to the storage.
func (*ContractState) SetNonce ¶
func (st *ContractState) SetNonce(nonce uint64)
func (*ContractState) Snapshot ¶ added in v0.8.1
func (st *ContractState) Snapshot() Snapshot
Snapshot returns revision number of storage buffer
type StateDB ¶
type StateDB struct {
// contains filtered or unexported fields
}
StateDB manages trie of states
func NewStateDB ¶
NewStateDB craete StateDB instance
func (*StateDB) CreateAccountStateV ¶
func (*StateDB) GetAccountAndProof ¶ added in v0.9.0
func (states *StateDB) GetAccountAndProof(id []byte, root []byte, compressed bool) (*types.AccountProof, error)
GetAccountAndProof gets the state and associated proof of an account in the given trie root. If the account doesnt exist, a proof of non existence is returned.
func (*StateDB) GetAccountState ¶
GetAccountState gets state of account id from statedb. empty state is returned when there is no state corresponding to account id.
func (*StateDB) GetNameAccountState ¶ added in v0.9.0
func (states *StateDB) GetNameAccountState() (*ContractState, error)
GetNameAccountState returns the ContractState of the AERGO name account.
func (*StateDB) GetState ¶
GetState gets state of account id from state buffer and trie. nil value is returned when there is no state corresponding to account id.
func (*StateDB) GetSystemAccountState ¶ added in v0.9.0
func (states *StateDB) GetSystemAccountState() (*ContractState, error)
GetSystemAccountState returns the ContractState of the AERGO system account.
func (*StateDB) GetVarAndProof ¶ added in v0.8.1
func (states *StateDB) GetVarAndProof(id []byte, root []byte, compressed bool) (*types.ContractVarProof, error)
GetVarAndProof gets the value of a variable in the given contract trie root.
func (*StateDB) HasMarker ¶ added in v0.9.0
HasMarker represents that the state root is finalized or not.
func (*StateDB) InitAccountStateV ¶ added in v0.9.0
func (*StateDB) LoadCache ¶
LoadCache reads first layer of trie given root hash and also updates root node of trie as a given root hash
func (*StateDB) OpenContractState ¶
func (*StateDB) OpenContractStateAccount ¶
func (states *StateDB) OpenContractStateAccount(aid types.AccountID) (*ContractState, error)
func (*StateDB) StageContractState ¶ added in v0.8.1
func (states *StateDB) StageContractState(st *ContractState) error
type V ¶
type V struct {
// contains filtered or unexported fields
}