Documentation ¶
Index ¶
- func AccountKey(addr common.Address) common.Bytes
- func ChainIDKey() common.Bytes
- func CodeKey(codeHash common.Bytes) common.Bytes
- func EliteEdgeNodeKey(addr common.Address) common.Bytes
- func EliteEdgeNodeKeyPrefix() common.Bytes
- func EliteEdgeNodeStakeReturnsKey(height uint64) common.Bytes
- func EliteEdgeNodeStakeReturnsKeyPrefix() common.Bytes
- func EliteEdgeNodesTotalActiveStakeKey() common.Bytes
- func GuardianCandidatePoolKey() common.Bytes
- func SplitRuleKey(resourceID string) common.Bytes
- func SplitRuleKeyPrefix() common.Bytes
- func StakeRewardDistributionRuleSetKey(addr common.Address) common.Bytes
- func StakeRewardDistributionRuleSetKeyPrefix() common.Bytes
- func StakeTransactionHeightListKey() common.Bytes
- func StatePruningProgressKey() common.Bytes
- func ValidatorCandidatePoolKey() common.Bytes
- type EliteEdgeNodePool
- func (eenp *EliteEdgeNodePool) Contains(eenAddr common.Address) bool
- func (eenp *EliteEdgeNodePool) DepositStake(source common.Address, holder common.Address, amount *big.Int, ...) (err error)
- func (eenp *EliteEdgeNodePool) Get(eenAddr common.Address) *core.EliteEdgeNode
- func (eenp *EliteEdgeNodePool) GetAll(withstake bool) []*core.EliteEdgeNode
- func (eenp *EliteEdgeNodePool) GetPubKeys(eenAddrs []common.Address) []*bls.PublicKey
- func (eenp *EliteEdgeNodePool) RandomRewardWeight(block common.Hash, eenAddr common.Address) int
- func (eenp *EliteEdgeNodePool) Remove(een *core.EliteEdgeNode)
- func (eenp *EliteEdgeNodePool) ReturnStake(currentHeight uint64, holder common.Address, returnedStake core.Stake) error
- func (eenp *EliteEdgeNodePool) Upsert(een *core.EliteEdgeNode)
- func (eenp *EliteEdgeNodePool) WithdrawStake(source common.Address, holder common.Address, currentHeight uint64) (*core.Stake, error)
- 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 StakeRewardDistributionRuleSet
- func (srdr *StakeRewardDistributionRuleSet) Get(stakeHolder common.Address) *core.RewardDistribution
- func (srdr *StakeRewardDistributionRuleSet) GetAll() []*core.RewardDistribution
- func (srdr *StakeRewardDistributionRuleSet) Remove(stakeHolder common.Address)
- func (srdr *StakeRewardDistributionRuleSet) Upsert(rd *core.RewardDistribution)
- type StakeWithHolder
- type StoreView
- func (sv *StoreView) AddBalance(addr common.Address, amount *big.Int)
- func (sv *StoreView) AddDneroBalance(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) CreateAccountWithPreviousBalance(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) GetEliteEdgeNodeStakeReturns(height uint64) []StakeWithHolder
- 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) GetTotalEENStake() *big.Int
- 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) RemoveEliteEdgeNodeStakeReturns(height uint64)
- 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) SetEliteEdgeNodeStakeReturns(height uint64, stakeReturns []StakeWithHolder)
- 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) SetTotalEENStake(amount *big.Int)
- 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) SubDneroBalance(addr common.Address, amount *big.Int)
- func (sv *StoreView) SubRefund(gas uint64)
- func (sv *StoreView) Suicide(addr common.Address) bool
- func (sv *StoreView) Traverse(prefix common.Bytes, cb func(k, v common.Bytes) bool) 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)
- type Tagger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountKey ¶
AccountKey constructs the state key for the given address
func EliteEdgeNodeKey ¶
EliteEdgeNodeKey returns the elite edge node key of a given address
func EliteEdgeNodeKeyPrefix ¶
EliteEdgeNodeKeyPrefix returns the prefix of the elite edge node key
func EliteEdgeNodeStakeReturnsKey ¶
EliteEdgeNodeStakeReturnsKey returns the EEN stake return key for the given height
func EliteEdgeNodeStakeReturnsKeyPrefix ¶
EliteEdgeNodeStakeReturnsKeyPrefix returns the prefix of the elite edge node stake return key
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 StakeRewardDistributionRuleSetKey ¶
StakeRewardDistributionRuleSetKey returns the prefix of the stake reward distribution rule
func StakeRewardDistributionRuleSetKeyPrefix ¶
StakeRewardDistributionRuleSetKeyPrefix returns the prefix of the stake reward distribution rule
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 EliteEdgeNodePool ¶
type EliteEdgeNodePool struct {
// contains filtered or unexported fields
}
func NewEliteEdgeNodePool ¶
func NewEliteEdgeNodePool(sv *StoreView, readOnly bool) *EliteEdgeNodePool
NewEliteEdgeNodePool creates a new instance of EliteEdgeNodePool.
func (*EliteEdgeNodePool) Contains ¶
func (eenp *EliteEdgeNodePool) Contains(eenAddr common.Address) bool
Contains checks if given address is in the pool.
func (*EliteEdgeNodePool) DepositStake ¶
func (*EliteEdgeNodePool) Get ¶
func (eenp *EliteEdgeNodePool) Get(eenAddr common.Address) *core.EliteEdgeNode
Get returns the EEN if exists, nil otherwise
func (*EliteEdgeNodePool) GetAll ¶
func (eenp *EliteEdgeNodePool) GetAll(withstake bool) []*core.EliteEdgeNode
func (*EliteEdgeNodePool) GetPubKeys ¶
func (eenp *EliteEdgeNodePool) GetPubKeys(eenAddrs []common.Address) []*bls.PublicKey
GetPubKeys returns BLS pubkeys of given addresses.
func (*EliteEdgeNodePool) RandomRewardWeight ¶
Contains checks if given address is in the pool.
func (*EliteEdgeNodePool) Remove ¶
func (eenp *EliteEdgeNodePool) Remove(een *core.EliteEdgeNode)
Remove deletes the elite edge node from the pool
func (*EliteEdgeNodePool) ReturnStake ¶
func (*EliteEdgeNodePool) Upsert ¶
func (eenp *EliteEdgeNodePool) Upsert(een *core.EliteEdgeNode)
Upsert update or insert an elite edge node
type LedgerState ¶
type LedgerState struct {
// contains filtered or unexported fields
}
func NewLedgerState ¶
func NewLedgerState(chainID string, db database.Database, tagger Tagger) *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 StakeRewardDistributionRuleSet ¶
type StakeRewardDistributionRuleSet struct {
// contains filtered or unexported fields
}
func NewStakeRewardDistributionRuleSet ¶
func NewStakeRewardDistributionRuleSet(sv *StoreView) *StakeRewardDistributionRuleSet
NewStakeRewardDistributionRuleSet creates a new instance of StakeRewardDistributionRuleSet.
func (*StakeRewardDistributionRuleSet) Get ¶
func (srdr *StakeRewardDistributionRuleSet) Get(stakeHolder common.Address) *core.RewardDistribution
Get returns the reward distribution of a stake holder address in the pool. Returns nil if not found.
func (*StakeRewardDistributionRuleSet) GetAll ¶
func (srdr *StakeRewardDistributionRuleSet) GetAll() []*core.RewardDistribution
GetAll returns all the reward distribution rules
func (*StakeRewardDistributionRuleSet) Remove ¶
func (srdr *StakeRewardDistributionRuleSet) Remove(stakeHolder common.Address)
Remove removes an elite edge node from the pool; returns false if guardian is not found.
func (*StakeRewardDistributionRuleSet) Upsert ¶
func (srdr *StakeRewardDistributionRuleSet) Upsert(rd *core.RewardDistribution)
Upsert update or inserts a stake reward distribution to the rule set
type StoreView ¶
type StoreView struct {
// contains filtered or unexported fields
}
func NewStoreView ¶
NewStoreView creates an instance of the StoreView
func (*StoreView) AddBalance ¶
func (*StoreView) AddDneroBalance ¶
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) CreateAccountWithPreviousBalance ¶
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) GetEliteEdgeNodeStakeReturns ¶
func (sv *StoreView) GetEliteEdgeNodeStakeReturns(height uint64) []StakeWithHolder
GetEliteEdgeNodeStakeReturns gets the elite edge node stake returns
func (*StoreView) GetGuardianCandidatePool ¶
func (sv *StoreView) GetGuardianCandidatePool() *core.GuardianCandidatePool
GetGuardianCandidatePool 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) GetTotalEENStake ¶
GetTotalEENStake retrives the total active EEN stakes
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) RemoveEliteEdgeNodeStakeReturns ¶
RemoveEliteEdgeNodeStakeReturns removes the elite edge node stake returns for the given height
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) SetEliteEdgeNodeStakeReturns ¶
func (sv *StoreView) SetEliteEdgeNodeStakeReturns(height uint64, stakeReturns []StakeWithHolder)
GetEliteEdgeNodeStakeReturns saves the elite edge node stake returns for the given height
func (*StoreView) SetSplitRule ¶
SetSplitRule sets split rule.
func (*StoreView) SetTotalEENStake ¶
SetTotalEENStake sets the total active EEN stakes
func (*StoreView) SplitRuleExists ¶
SplitRuleExists checks if a split rule associated with the given resourceID already exists
func (*StoreView) SubBalance ¶
func (*StoreView) SubDneroBalance ¶
func (*StoreView) Traverse ¶
Traverse traverses the trie and calls cb callback func on every key/value pair with key having prefix
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.