Documentation ¶
Index ¶
- func AccountKey(addr common.Address) common.Bytes
- func ChainIDKey() common.Bytes
- func CodeKey(codeHash common.Bytes) common.Bytes
- func GuardianCandidatePoolKey() common.Bytes
- func SplitRuleKey(resourceID string) common.Bytes
- func SplitRuleKeyPrefix() common.Bytes
- func StakeTransactionHeightListKey() common.Bytes
- func StatePruningProgressKey() common.Bytes
- func ValidatorCandidatePoolKey() common.Bytes
- type LedgerState
- func (s *LedgerState) Checked() *StoreView
- func (s *LedgerState) Commit() common.Hash
- func (s *LedgerState) DB() database.Database
- func (s *LedgerState) Delivered() *StoreView
- func (s *LedgerState) Finalize(height uint64, stateRootHash common.Hash) result.Result
- func (s *LedgerState) Finalized() *StoreView
- func (s *LedgerState) GetChainID() string
- func (s *LedgerState) Height() uint64
- func (s *LedgerState) ParentBlock() *core.Block
- func (s *LedgerState) ResetState(block *core.Block) result.Result
- func (s *LedgerState) Screened() *StoreView
- type StoreView
- func (sv *StoreView) AddBalance(addr common.Address, amount *big.Int)
- func (sv *StoreView) AddLog(l *types.Log)
- func (sv *StoreView) AddRefund(gas uint64)
- func (sv *StoreView) AddSlashIntent(slashIntent types.SlashIntent)
- func (sv *StoreView) AddSplitRule(splitRule *types.SplitRule) bool
- func (sv *StoreView) ClearSlashIntents()
- func (sv *StoreView) CoinbaseTransactinProcessed() bool
- func (sv *StoreView) Copy() (*StoreView, error)
- func (sv *StoreView) CreateAccount(addr common.Address)
- func (sv *StoreView) Delete(key common.Bytes)
- func (sv *StoreView) DeleteAccount(addr common.Address)
- func (sv *StoreView) DeleteExpiredSplitRules(currentBlockHeight uint64) bool
- func (sv *StoreView) DeleteSplitRule(resourceID string) bool
- func (sv *StoreView) Empty(addr common.Address) bool
- func (sv *StoreView) Exist(addr common.Address) bool
- func (sv *StoreView) Get(key common.Bytes) common.Bytes
- func (sv *StoreView) GetAccount(addr common.Address) *types.Account
- func (sv *StoreView) GetBalance(addr common.Address) *big.Int
- func (sv *StoreView) GetBlockHeight() uint64
- func (sv *StoreView) GetCode(addr common.Address) []byte
- func (sv *StoreView) GetCodeByHash(codeHash common.Hash) []byte
- func (sv *StoreView) GetCodeHash(addr common.Address) common.Hash
- func (sv *StoreView) GetCodeSize(addr common.Address) int
- func (sv *StoreView) GetCommittedState(addr common.Address, key common.Hash) common.Hash
- func (sv *StoreView) GetDB() database.Database
- func (sv *StoreView) GetDneroBalance(addr common.Address) *big.Int
- func (sv *StoreView) GetDneroStake(addr common.Address) *big.Int
- func (sv *StoreView) GetGuardianCandidatePool() *core.GuardianCandidatePool
- func (sv *StoreView) GetNonce(addr common.Address) uint64
- func (sv *StoreView) GetOrCreateAccount(addr common.Address) *types.Account
- func (sv *StoreView) GetRefund() uint64
- func (sv *StoreView) GetSlashIntents() []types.SlashIntent
- func (sv *StoreView) GetSplitRule(resourceID string) *types.SplitRule
- func (sv *StoreView) GetStakeTransactionHeightList() *types.HeightList
- func (sv *StoreView) GetState(addr common.Address, key common.Hash) common.Hash
- func (sv *StoreView) GetStore() *treestore.TreeStore
- func (sv *StoreView) GetValidatorCandidatePool() *core.ValidatorCandidatePool
- func (sv *StoreView) HasSuicided(addr common.Address) bool
- func (sv *StoreView) Hash() common.Hash
- func (sv *StoreView) Height() uint64
- func (sv *StoreView) IncrementHeight()
- func (sv *StoreView) PopLogs() []*types.Log
- func (sv *StoreView) ProveVCP(vcpKey []byte, vp *core.VCPProof) error
- func (sv *StoreView) Prune() error
- func (sv *StoreView) ResetLogs()
- func (sv *StoreView) ResetRefund()
- func (sv *StoreView) RevertToSnapshot(root common.Hash)
- func (sv *StoreView) Save() common.Hash
- func (sv *StoreView) Set(key common.Bytes, value common.Bytes)
- func (sv *StoreView) SetAccount(addr common.Address, acc *types.Account)
- func (sv *StoreView) SetCode(addr common.Address, code []byte)
- func (sv *StoreView) SetCoinbaseTransactionProcessed(processed bool)
- func (sv *StoreView) SetNonce(addr common.Address, nonce uint64)
- func (sv *StoreView) SetSplitRule(resourceID string, splitRule *types.SplitRule)
- func (sv *StoreView) SetState(addr common.Address, key, val common.Hash)
- func (sv *StoreView) Snapshot() common.Hash
- func (sv *StoreView) SplitRuleExists(resourceID string) bool
- func (sv *StoreView) SubBalance(addr common.Address, amount *big.Int)
- func (sv *StoreView) SubRefund(gas uint64)
- func (sv *StoreView) Suicide(addr common.Address) bool
- func (sv *StoreView) UpdateGuardianCandidatePool(gcp *core.GuardianCandidatePool)
- func (sv *StoreView) UpdateSplitRule(splitRule *types.SplitRule) bool
- func (sv *StoreView) UpdateStakeTransactionHeightList(hl *types.HeightList)
- func (sv *StoreView) UpdateValidatorCandidatePool(vcp *core.ValidatorCandidatePool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountKey ¶
AccountKey constructs the state key for the given address
func GuardianCandidatePoolKey ¶
GuardianCandidatePoolKey returns the state key for the guadian stake holder set
func SplitRuleKey ¶
SplitRuleKey constructs the state key for the given resourceID
func SplitRuleKeyPrefix ¶
SplitRuleKeyPrefix returns the prefix for the split rule key
func StakeTransactionHeightListKey ¶
StakeTransactionHeightListKey returns the state key the heights of blocks that contain stake related transactions (i.e. StakeDeposit, StakeWithdraw, etc)
func StatePruningProgressKey ¶
StatePruningProgressKey returns the key for the state pruning progress
func ValidatorCandidatePoolKey ¶
ValidatorCandidatePoolKey returns the state key for the validator stake holder set
Types ¶
type LedgerState ¶
type LedgerState struct {
// contains filtered or unexported fields
}
func NewLedgerState ¶
func NewLedgerState(chainID string, db database.Database) *LedgerState
NewLedgerState creates a new Leger State with given store. NOTE: before using the LedgerState, we need to call LedgerState.ResetState() to set
the proper height and stateRootHash
func (*LedgerState) Checked ¶
func (s *LedgerState) Checked() *StoreView
Checked creates a fresh clone of delivered view to be used for checking transactions.
func (*LedgerState) Commit ¶
func (s *LedgerState) Commit() common.Hash
Commit stores the current delivered view as committed, starts new delivered/checked state and returns the hash for the commit.
func (*LedgerState) DB ¶
func (s *LedgerState) DB() database.Database
DB returns the database instance of the ledger state
func (*LedgerState) Delivered ¶
func (s *LedgerState) Delivered() *StoreView
Delivered returns a view of current state that contains both committed and delivered transactions.
func (*LedgerState) Finalized ¶
func (s *LedgerState) Finalized() *StoreView
Finalized creates a fresh clone of delivered view to be used for checking transactions.
func (*LedgerState) GetChainID ¶
func (s *LedgerState) GetChainID() string
GetChainID gets chain ID.
func (*LedgerState) Height ¶
func (s *LedgerState) Height() uint64
Height returns the block height corresponding to the ledger state
func (*LedgerState) ParentBlock ¶
func (s *LedgerState) ParentBlock() *core.Block
ParentBlock returns the pointer to the parent block for the current view
func (*LedgerState) ResetState ¶
func (s *LedgerState) ResetState(block *core.Block) result.Result
ResetState resets the height and state root of its storeviews, and clear the in-memory states func (s *LedgerState) ResetState(height uint64, stateRootHash common.Hash) result.Result
func (*LedgerState) Screened ¶
func (s *LedgerState) Screened() *StoreView
Screened creates a fresh clone of delivered view to be used for checking transactions.
type StoreView ¶
type StoreView struct {
// contains filtered or unexported fields
}
func NewStoreView ¶
NewStoreView creates an instance of the StoreView
func (*StoreView) AddBalance ¶
func (*StoreView) AddSlashIntent ¶
func (sv *StoreView) AddSlashIntent(slashIntent types.SlashIntent)
AddSlashIntent adds slashIntent
func (*StoreView) AddSplitRule ¶
AddSplitRule adds a split rule
func (*StoreView) ClearSlashIntents ¶
func (sv *StoreView) ClearSlashIntents()
ClearSlashIntents clears all the slashIntents
func (*StoreView) CoinbaseTransactinProcessed ¶
CoinbaseTransactinProcessed returns whether the coinbase transaction for the current block has been processed
func (*StoreView) CreateAccount ¶
func (*StoreView) DeleteAccount ¶
DeleteAccount deletes an account.
func (*StoreView) DeleteExpiredSplitRules ¶
DeleteExpiredSplitRules deletes a split rule.
func (*StoreView) DeleteSplitRule ¶
DeleteSplitRule deletes a split rule.
func (*StoreView) Empty ¶
Empty returns whether the given account is empty. Empty is defined according to EIP161 (balance = nonce = code = 0).
func (*StoreView) Exist ¶
Exist reports whether the given account exists in state. Notably this should also return true for suicided accounts.
func (*StoreView) GetAccount ¶
GetAccount returns an account.
func (*StoreView) GetBlockHeight ¶ added in v1.0.0
func (*StoreView) GetCommittedState ¶
func (*StoreView) GetDneroBalance ¶
GetDneroBalance returns the DneroWei balance of the given address
func (*StoreView) GetDneroStake ¶
GetDneroStake returns the total amount of DneroWei the address staked to validators and/or guardians
func (*StoreView) GetGuardianCandidatePool ¶
func (sv *StoreView) GetGuardianCandidatePool() *core.GuardianCandidatePool
GetGuradianCandidatePool gets the guardian candidate pool.
func (*StoreView) GetOrCreateAccount ¶
func (*StoreView) GetSlashIntents ¶
func (sv *StoreView) GetSlashIntents() []types.SlashIntent
GetSlashIntents retrieves all the slashIntents
func (*StoreView) GetSplitRule ¶
GetSplitRule gets split rule.
func (*StoreView) GetStakeTransactionHeightList ¶
func (sv *StoreView) GetStakeTransactionHeightList() *types.HeightList
GetStakeTransactionHeightList gets the heights of blocks that contain stake related transactions
func (*StoreView) GetValidatorCandidatePool ¶
func (sv *StoreView) GetValidatorCandidatePool() *core.ValidatorCandidatePool
GetValidatorCandidatePool gets the validator candidate pool.
func (*StoreView) IncrementHeight ¶
func (sv *StoreView) IncrementHeight()
IncrementHeight increments the block height by 1
func (*StoreView) ResetRefund ¶
func (sv *StoreView) ResetRefund()
func (*StoreView) RevertToSnapshot ¶
func (*StoreView) Save ¶
Save saves the StoreView to the persistent storage, and return the root hash
func (*StoreView) SetAccount ¶
SetAccount sets an account.
func (*StoreView) SetCoinbaseTransactionProcessed ¶
SetCoinbaseTransactionProcessed sets whether the coinbase transaction for the current block has been processed
func (*StoreView) SetSplitRule ¶
SetSplitRule sets split rule.
func (*StoreView) SplitRuleExists ¶
SplitRuleExists checks if a split rule associated with the given resourceID already exists
func (*StoreView) SubBalance ¶
func (*StoreView) UpdateGuardianCandidatePool ¶
func (sv *StoreView) UpdateGuardianCandidatePool(gcp *core.GuardianCandidatePool)
UpdateGuardianCandidatePool updates the guardian candidate pool.
func (*StoreView) UpdateSplitRule ¶
UpdateSplitRule updates a split rule
func (*StoreView) UpdateStakeTransactionHeightList ¶
func (sv *StoreView) UpdateStakeTransactionHeightList(hl *types.HeightList)
UpdateStakeTransactionHeightList updates the heights of blocks that contain stake related transactions
func (*StoreView) UpdateValidatorCandidatePool ¶
func (sv *StoreView) UpdateValidatorCandidatePool(vcp *core.ValidatorCandidatePool)
UpdateValidatorCandidatePool updates the validator candidate pool.