Documentation ¶
Index ¶
- type BlocksMissed
- type SfcConstants
- type Store
- func (s *Store) AddDirtyOriginationScore(stakerID idx.StakerID, v *big.Int)
- func (s *Store) AddDirtyValidationScore(stakerID idx.StakerID, v *big.Int)
- func (s *Store) AddPoiFee(poiPeriod uint64, diff *big.Int)
- func (s *Store) ApplyGenesis(net *lachesis.Config) (evmBlock *evmcore.EvmBlock, err error)
- func (s *Store) Commit() error
- func (s *Store) DelActiveOriginationScore(stakerID idx.StakerID)
- func (s *Store) DelActiveValidationScore(stakerID idx.StakerID)
- func (s *Store) DelAllActiveOriginationScores()
- func (s *Store) DelAllActiveValidationScores()
- func (s *Store) DelAllWeightedDelegationsFee()
- func (s *Store) DelDelegationClaimedRewards(id sfctype.DelegationID)
- func (s *Store) DelDirtyOriginationScore(stakerID idx.StakerID)
- func (s *Store) DelDirtyValidationScore(stakerID idx.StakerID)
- func (s *Store) DelGasPowerRefunds(epoch idx.Epoch)
- func (s *Store) DelSfcDelegation(id sfctype.DelegationID)
- func (s *Store) DelSfcStaker(stakerID idx.StakerID)
- func (s *Store) DelStakerClaimedRewards(stakerID idx.StakerID)
- func (s *Store) DelStakerDelegationsClaimedRewards(stakerID idx.StakerID)
- func (s *Store) DelStakerPOI(stakerID idx.StakerID)
- func (s *Store) DelWeightedDelegationsFee(stakerID idx.StakerID)
- func (s *Store) EvmLogs() *topicsdb.Index
- func (s *Store) EvmTable() ethdb.Database
- func (s *Store) ForEachSfcDelegation(do func(sfctype.SfcDelegationAndID))
- func (s *Store) ForEachSfcStaker(do func(sfctype.SfcStakerAndID))
- func (s *Store) GetActiveOriginationScore(stakerID idx.StakerID) *big.Int
- func (s *Store) GetActiveValidationScore(stakerID idx.StakerID) *big.Int
- func (s *Store) GetAddressFee(addr common.Address, poiPeriod uint64) *big.Int
- func (s *Store) GetAddressLastTxTime(addr common.Address) inter.Timestamp
- func (s *Store) GetAddressPOI(address common.Address) *big.Int
- func (s *Store) GetBlocksMissed(stakerID idx.StakerID) BlocksMissed
- func (s *Store) GetDelegationClaimedRewards(id sfctype.DelegationID) *big.Int
- func (s *Store) GetDirtyOriginationScore(stakerID idx.StakerID) *big.Int
- func (s *Store) GetDirtyValidationScore(stakerID idx.StakerID) *big.Int
- func (s *Store) GetEpochValidators(epoch idx.Epoch) []sfctype.SfcStakerAndID
- func (s *Store) GetGasPowerRefund(epoch idx.Epoch, stakerID idx.StakerID) uint64
- func (s *Store) GetGasPowerRefunds(epoch idx.Epoch) map[idx.StakerID]uint64
- func (s *Store) GetPoiFee(poiPeriod uint64) *big.Int
- func (s *Store) GetReceipts(n idx.Block) types.Receipts
- func (s *Store) GetSfcConstants(epoch idx.Epoch) SfcConstants
- func (s *Store) GetSfcDelegation(id sfctype.DelegationID) *sfctype.SfcDelegation
- func (s *Store) GetSfcDelegationsByAddr(addr common.Address, limit int) []sfctype.SfcDelegationAndID
- func (s *Store) GetSfcStaker(stakerID idx.StakerID) *sfctype.SfcStaker
- func (s *Store) GetSfcStakers() []sfctype.SfcStakerAndID
- func (s *Store) GetStakerClaimedRewards(stakerID idx.StakerID) *big.Int
- func (s *Store) GetStakerDelegationsClaimedRewards(stakerID idx.StakerID) *big.Int
- func (s *Store) GetStakerPOI(stakerID idx.StakerID) *big.Int
- func (s *Store) GetTotalSupply() *big.Int
- func (s *Store) GetWeightedDelegationsFee(stakerID idx.StakerID) *big.Int
- func (s *Store) HasEpochValidator(epoch idx.Epoch, stakerID idx.StakerID) bool
- func (s *Store) HasSfcConstants(epoch idx.Epoch) bool
- func (s *Store) HasSfcStaker(stakerID idx.StakerID) bool
- func (s *Store) IncBlocksMissed(stakerID idx.StakerID, periodDiff inter.Timestamp)
- func (s *Store) IncDelegationClaimedRewards(id sfctype.DelegationID, diff *big.Int)
- func (s *Store) IncGasPowerRefund(epoch idx.Epoch, stakerID idx.StakerID, diff uint64)
- func (s *Store) IncStakerClaimedRewards(stakerID idx.StakerID, diff *big.Int)
- func (s *Store) IncStakerDelegationsClaimedRewards(stakerID idx.StakerID, diff *big.Int)
- func (s *Store) IndexLogs(recs ...*types.Log)
- func (s *Store) MigrateAdjustableMinGasPrice() error
- func (s *Store) MigrateAdjustableOfflinePeriod() error
- func (s *Store) MigrateEraseGenesisField() error
- func (s *Store) MigrateMultiDelegations() error
- func (s *Store) MoveDirtyOriginationScoresToActive()
- func (s *Store) MoveDirtyValidationScoresToActive()
- func (s *Store) ResetBlocksMissed(stakerID idx.StakerID)
- func (s *Store) SetAddressFee(addr common.Address, poiPeriod uint64, val *big.Int)
- func (s *Store) SetAddressLastTxTime(addr common.Address, t inter.Timestamp)
- func (s *Store) SetAddressPOI(address common.Address, poi *big.Int)
- func (s *Store) SetDelegationClaimedRewards(id sfctype.DelegationID, amount *big.Int)
- func (s *Store) SetEpochValidators(epoch idx.Epoch, vv []sfctype.SfcStakerAndID)
- func (s *Store) SetGasPowerRefund(epoch idx.Epoch, stakerID idx.StakerID, refund uint64)
- func (s *Store) SetPoiFee(poiPeriod uint64, val *big.Int)
- func (s *Store) SetReceipts(n idx.Block, receipts types.Receipts)
- func (s *Store) SetSfcConstants(epoch idx.Epoch, constants SfcConstants)
- func (s *Store) SetSfcDelegation(id sfctype.DelegationID, v *sfctype.SfcDelegation)
- func (s *Store) SetSfcStaker(stakerID idx.StakerID, v *sfctype.SfcStaker)
- func (s *Store) SetStakerClaimedRewards(stakerID idx.StakerID, amount *big.Int)
- func (s *Store) SetStakerDelegationsClaimedRewards(stakerID idx.StakerID, amount *big.Int)
- func (s *Store) SetStakerPOI(stakerID idx.StakerID, poi *big.Int)
- func (s *Store) SetTotalSupply(amount *big.Int)
- func (s *Store) SetWeightedDelegationsFee(stakerID idx.StakerID, val *big.Int)
- func (s *Store) StateDB(from common.Hash) (*state.StateDB, error)
- type StoreConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlocksMissed ¶
BlocksMissed is information about missed blocks from a staker
type SfcConstants ¶
type SfcConstants struct { ShortGasPowerAllocPerSec uint64 LongGasPowerAllocPerSec uint64 BaseRewardPerSec *big.Int OfflinePenaltyThreshold BlocksMissed MinGasPrice *big.Int }
SfcConstants are constants which may be changed by SFC contract
type Store ¶
Store is a node persistent storage working over physical key-value database.
func NewStore ¶
func NewStore(mainDb kvdb.KeyValueStore, cfg StoreConfig) *Store
NewStore creates store over key-value db.
func (*Store) AddDirtyOriginationScore ¶
AddDirtyOriginationScore add gas value for active validation score
func (*Store) AddDirtyValidationScore ¶
AddDirtyValidationScore add gas value for active validation score
func (*Store) ApplyGenesis ¶
ApplyGenesis writes initial state.
func (*Store) DelActiveOriginationScore ¶
DelActiveOriginationScore deletes record about active origination score of a staker
func (*Store) DelActiveValidationScore ¶
DelActiveValidationScore deletes record about active validation score of a staker
func (*Store) DelAllActiveOriginationScores ¶
func (s *Store) DelAllActiveOriginationScores()
DelAllActiveOriginationScores deletes all the record about dirty origination scores of stakers
func (*Store) DelAllActiveValidationScores ¶
func (s *Store) DelAllActiveValidationScores()
DelAllActiveValidationScores deletes all the record about dirty validation scores of stakers
func (*Store) DelAllWeightedDelegationsFee ¶
func (s *Store) DelAllWeightedDelegationsFee()
DelAllWeightedDelegationsFee deletes all the records about gas used by delegations of all stakers
func (*Store) DelDelegationClaimedRewards ¶
func (s *Store) DelDelegationClaimedRewards(id sfctype.DelegationID)
DelDelegationClaimedRewards deletes record about sum of claimed rewards in past
func (*Store) DelDirtyOriginationScore ¶
DelDirtyOriginationScore deletes record about dirty origination score of a staker
func (*Store) DelDirtyValidationScore ¶
DelDirtyValidationScore deletes record about dirty validation score of a staker
func (*Store) DelGasPowerRefunds ¶
DelGasPowerRefunds erases all record on epoch
func (*Store) DelSfcDelegation ¶
func (s *Store) DelSfcDelegation(id sfctype.DelegationID)
DelSfcDelegation deletes SfcDelegation
func (*Store) DelSfcStaker ¶
DelSfcStaker deletes SfcStaker
func (*Store) DelStakerClaimedRewards ¶
DelStakerClaimedRewards deletes record about sum of claimed rewards in past
func (*Store) DelStakerDelegationsClaimedRewards ¶
DelStakerDelegationsClaimedRewards deletes record about sum of claimed rewards in past
func (*Store) DelStakerPOI ¶
DelStakerPOI deletes record about staker's PoI
func (*Store) DelWeightedDelegationsFee ¶
DelWeightedDelegationsFee deletes record about gas used by delegations of a staker
func (*Store) ForEachSfcDelegation ¶
func (s *Store) ForEachSfcDelegation(do func(sfctype.SfcDelegationAndID))
ForEachSfcDelegation iterates all stored SfcDelegations
func (*Store) ForEachSfcStaker ¶
func (s *Store) ForEachSfcStaker(do func(sfctype.SfcStakerAndID))
ForEachSfcStaker iterates all stored SfcStakers
func (*Store) GetActiveOriginationScore ¶
GetActiveOriginationScore return gas value for active validator score
func (*Store) GetActiveValidationScore ¶
GetActiveValidationScore return gas value for active validator score
func (*Store) GetAddressFee ¶
GetAddressFee get gas used by address
func (*Store) GetAddressLastTxTime ¶
GetAddressLastTxTime get last time for last tx from this address
func (*Store) GetAddressPOI ¶
GetAddressPOI get POI value for user address
func (*Store) GetBlocksMissed ¶
func (s *Store) GetBlocksMissed(stakerID idx.StakerID) BlocksMissed
GetBlocksMissed return blocks missed num for validator
func (*Store) GetDelegationClaimedRewards ¶
func (s *Store) GetDelegationClaimedRewards(id sfctype.DelegationID) *big.Int
GetDelegationClaimedRewards returns sum of claimed rewards in past, by this delegation
func (*Store) GetDirtyOriginationScore ¶
GetDirtyOriginationScore return gas value for active validator score
func (*Store) GetDirtyValidationScore ¶
GetDirtyValidationScore return gas value for active validator score
func (*Store) GetEpochValidators ¶
func (s *Store) GetEpochValidators(epoch idx.Epoch) []sfctype.SfcStakerAndID
GetEpochValidators returns all stored EpochValidators on the epoch
func (*Store) GetGasPowerRefund ¶
GetGasPowerRefund returns stored amount of gas power to refund
func (*Store) GetGasPowerRefunds ¶
GetGasPowerRefunds returns all stored amount of gas power to refund
func (*Store) GetReceipts ¶
GetReceipts returns stored transaction receipts.
func (*Store) GetSfcConstants ¶
func (s *Store) GetSfcConstants(epoch idx.Epoch) SfcConstants
GetSfcConstants returns stored SfcConstants
func (*Store) GetSfcDelegation ¶
func (s *Store) GetSfcDelegation(id sfctype.DelegationID) *sfctype.SfcDelegation
GetSfcDelegation returns stored SfcDelegation
func (*Store) GetSfcDelegationsByAddr ¶
func (s *Store) GetSfcDelegationsByAddr(addr common.Address, limit int) []sfctype.SfcDelegationAndID
GetSfcDelegationsByAddr returns a lsit of delegations by address
func (*Store) GetSfcStaker ¶
GetSfcStaker returns stored SfcStaker
func (*Store) GetSfcStakers ¶
func (s *Store) GetSfcStakers() []sfctype.SfcStakerAndID
GetSfcStakers returns all stored SfcStakers
func (*Store) GetStakerClaimedRewards ¶
GetStakerClaimedRewards returns sum of claimed rewards in past, by this staker
func (*Store) GetStakerDelegationsClaimedRewards ¶
GetStakerDelegationsClaimedRewards returns sum of claimed rewards in past, by this delegations of this staker
func (*Store) GetStakerPOI ¶
GetStakerPOI get POI value for staker
func (*Store) GetTotalSupply ¶
GetTotalSupply returns total supply
func (*Store) GetWeightedDelegationsFee ¶
GetWeightedDelegationsFee get gas used by delegations of a staker
func (*Store) HasEpochValidator ¶
HasEpochValidator returns true if validator exists
func (*Store) HasSfcConstants ¶
HasSfcConstants returns true if SFC constants are stored
func (*Store) HasSfcStaker ¶
HasSfcStaker returns true if staker exists
func (*Store) IncBlocksMissed ¶
IncBlocksMissed add count of missed blocks for validator
func (*Store) IncDelegationClaimedRewards ¶
func (s *Store) IncDelegationClaimedRewards(id sfctype.DelegationID, diff *big.Int)
IncDelegationClaimedRewards increments sum of claimed rewards in past
func (*Store) IncGasPowerRefund ¶
IncGasPowerRefund increments amount of gas power to refund
func (*Store) IncStakerClaimedRewards ¶
IncStakerClaimedRewards increments sum of claimed rewards in past
func (*Store) IncStakerDelegationsClaimedRewards ¶
IncStakerDelegationsClaimedRewards increments sum of claimed rewards in past
func (*Store) MigrateAdjustableMinGasPrice ¶
func (*Store) MigrateAdjustableOfflinePeriod ¶
func (*Store) MigrateEraseGenesisField ¶
func (*Store) MigrateMultiDelegations ¶
func (*Store) MoveDirtyOriginationScoresToActive ¶
func (s *Store) MoveDirtyOriginationScoresToActive()
MoveDirtyOriginationScoresToActive moves all the dirty records to active
func (*Store) MoveDirtyValidationScoresToActive ¶
func (s *Store) MoveDirtyValidationScoresToActive()
MoveDirtyValidationScoresToActive moves all the dirty records to active
func (*Store) ResetBlocksMissed ¶
ResetBlocksMissed set to 0 missed blocks for validator
func (*Store) SetAddressFee ¶
SetAddressFee save gas used by address
func (*Store) SetAddressLastTxTime ¶
SetAddressLastTxTime save last time for tx from this address
func (*Store) SetAddressPOI ¶
SetAddressPOI save POI value for a user address
func (*Store) SetDelegationClaimedRewards ¶
func (s *Store) SetDelegationClaimedRewards(id sfctype.DelegationID, amount *big.Int)
SetDelegationClaimedRewards sets sum of claimed rewards in past
func (*Store) SetEpochValidators ¶
func (s *Store) SetEpochValidators(epoch idx.Epoch, vv []sfctype.SfcStakerAndID)
SetEpochValidator stores EpochValidator
func (*Store) SetGasPowerRefund ¶
SetGasPowerRefund stores amount of gas power to refund
func (*Store) SetReceipts ¶
SetReceipts stores transaction receipts.
func (*Store) SetSfcConstants ¶
func (s *Store) SetSfcConstants(epoch idx.Epoch, constants SfcConstants)
SetSfcConstants stores SfcConstants
func (*Store) SetSfcDelegation ¶
func (s *Store) SetSfcDelegation(id sfctype.DelegationID, v *sfctype.SfcDelegation)
SetSfcDelegation stores SfcDelegation
func (*Store) SetSfcStaker ¶
SetSfcStaker stores SfcStaker
func (*Store) SetStakerClaimedRewards ¶
SetStakerClaimedRewards sets sum of claimed rewards in past
func (*Store) SetStakerDelegationsClaimedRewards ¶
SetStakerDelegationsClaimedRewards sets sum of claimed rewards in past
func (*Store) SetStakerPOI ¶
SetStakerPOI save POI value for staker
func (*Store) SetTotalSupply ¶
SetTotalSupply stores total supply
func (*Store) SetWeightedDelegationsFee ¶
SetWeightedDelegationsFee stores gas used by delegations of a staker
type StoreConfig ¶
type StoreConfig struct { // Cache size for Receipts. ReceiptsCacheSize int // Cache size for Stakers. StakersCacheSize int // Cache size for Delegations. DelegationsCacheSize int }
StoreConfig is a config for store db.