Documentation ¶
Index ¶
- Constants
- Variables
- func IsCeremonyCandidate(identity Identity) bool
- func ReadTreeFrom(pdb dbm.DB, height uint64, root common.Hash, from io.Reader) error
- func WriteTreeTo(sourceDb dbm.DB, height uint64, to io.Writer) (rootHash common.Hash, err error)
- type Account
- type ApprovedIdentity
- type BitArray
- func (bA *BitArray) Bytes() []byte
- func (bA *BitArray) GetIndex(i int) bool
- func (bA *BitArray) MarshalJSON() ([]byte, error)
- func (bA *BitArray) SetIndex(i int, v bool) bool
- func (bA *BitArray) Size() uint
- func (bA *BitArray) String() string
- func (bA *BitArray) StringIndented(indent string) string
- func (bA *BitArray) UnmarshalJSON(bz []byte) error
- type ContractData
- type Delegation
- type DelegationSwitch
- type Global
- type Identity
- type IdentityFlip
- type IdentityState
- type IdentityStateDB
- func (s *IdentityStateDB) Add(identity common.Address)
- func (s *IdentityStateDB) AddDiff(height uint64, diff *IdentityStateDiff)
- func (s *IdentityStateDB) Clear()
- func (s *IdentityStateDB) Commit(deleteEmptyObjects bool) (root []byte, version int64, diff *IdentityStateDiff, err error)
- func (s *IdentityStateDB) CommitSnapshot(height uint64) (dropDb dbm.DB)
- func (s *IdentityStateDB) CommitTree(newVersion int64) (root []byte, version int64, err error)
- func (s *IdentityStateDB) CreatePreliminaryCopy(height uint64) (*IdentityStateDB, error)
- func (s *IdentityStateDB) Delegatee(addr common.Address) *common.Address
- func (s *IdentityStateDB) DropPreliminary()
- func (s *IdentityStateDB) ForCheck(height uint64) (*IdentityStateDB, error)
- func (s *IdentityStateDB) ForCheckWithOverwrite(height uint64) (*IdentityStateDB, error)
- func (s *IdentityStateDB) GetOrNewIdentityObject(addr common.Address) *stateApprovedIdentity
- func (s *IdentityStateDB) HasVersion(height uint64) bool
- func (s *IdentityStateDB) IsApproved(addr common.Address) bool
- func (s *IdentityStateDB) IsOnline(addr common.Address) bool
- func (s *IdentityStateDB) IterateIdentities(fn func(key []byte, value []byte) bool) bool
- func (s *IdentityStateDB) Load(height uint64) error
- func (s *IdentityStateDB) LoadPreliminary(height uint64) (*IdentityStateDB, error)
- func (s *IdentityStateDB) MarkStateIdentityObjectDirty(addr common.Address)
- func (s *IdentityStateDB) Precommit(deleteEmptyObjects bool) *IdentityStateDiff
- func (s *IdentityStateDB) Readonly(height uint64) (*IdentityStateDB, error)
- func (s *IdentityStateDB) RecoverSnapshot(height uint64, treeRoot common.Hash, from io.Reader) error
- func (s *IdentityStateDB) Remove(identity common.Address)
- func (s *IdentityStateDB) RemoveDelegatee(addr common.Address)
- func (s *IdentityStateDB) Reset()
- func (s *IdentityStateDB) ResetTo(height uint64) error
- func (s *IdentityStateDB) Root() common.Hash
- func (s *IdentityStateDB) SaveForcedVersion(height uint64) error
- func (s *IdentityStateDB) SetDelegatee(addr common.Address, delegatee common.Address)
- func (s *IdentityStateDB) SetOnline(addr common.Address, online bool)
- func (s *IdentityStateDB) SetPredefinedIdentities(state *models.ProtoPredefinedState)
- func (s *IdentityStateDB) SwitchToPreliminary(height uint64) (batch dbm.Batch, dropDb dbm.DB, err error)
- func (s *IdentityStateDB) Version() uint64
- type IdentityStateDiff
- func (diff *IdentityStateDiff) Empty() bool
- func (diff *IdentityStateDiff) FromBytes(data []byte) error
- func (diff *IdentityStateDiff) FromProto(protoDiff *models.ProtoIdentityStateDiff) *IdentityStateDiff
- func (diff *IdentityStateDiff) ToBytes() ([]byte, error)
- func (diff *IdentityStateDiff) ToProto() *models.ProtoIdentityStateDiff
- type IdentityStateDiffValue
- type IdentityStatusSwitch
- type ImmutableTree
- func (t *ImmutableTree) AvailableVersions() []int
- func (t *ImmutableTree) DeleteVersion(version int64) error
- func (t *ImmutableTree) ExistVersion(version int64) bool
- func (t *ImmutableTree) Get(key []byte) (index int64, value []byte)
- func (t *ImmutableTree) GetImmutable() *ImmutableTree
- func (t *ImmutableTree) Hash() common.Hash
- func (t *ImmutableTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *ImmutableTree) IterateRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *ImmutableTree) IterateRangeInclusive(start, end []byte, ascending bool, ...) (stopped bool)
- func (t *ImmutableTree) Load() (int64, error)
- func (t *ImmutableTree) LoadVersion(targetVersion int64) (int64, error)
- func (t *ImmutableTree) LoadVersionForOverwriting(targetVersion int64) (int64, error)
- func (t *ImmutableTree) Remove(key []byte) ([]byte, bool)
- func (t *ImmutableTree) Rollback()
- func (t *ImmutableTree) SaveVersion() ([]byte, int64, error)
- func (t *ImmutableTree) SaveVersionAt(version int64) ([]byte, int64, error)
- func (t *ImmutableTree) Set(key, value []byte) bool
- func (t *ImmutableTree) SetVirtualVersion(version int64)
- func (t *ImmutableTree) ValidateTree() bool
- func (t *ImmutableTree) Version() int64
- func (t *ImmutableTree) WorkingHash() common.Hash
- type MutableTree
- func (t *MutableTree) AvailableVersions() []int
- func (t *MutableTree) DeleteVersion(version int64) error
- func (t *MutableTree) ExistVersion(version int64) bool
- func (t *MutableTree) Get(key []byte) (index int64, value []byte)
- func (t *MutableTree) GetImmutable() *ImmutableTree
- func (t *MutableTree) Hash() common.Hash
- func (t *MutableTree) LazyLoad(version int64) (int64, error)
- func (t *MutableTree) Load() (int64, error)
- func (t *MutableTree) LoadVersion(targetVersion int64) (int64, error)
- func (t *MutableTree) LoadVersionForOverwriting(targetVersion int64) (int64, error)
- func (t *MutableTree) Remove(key []byte) ([]byte, bool)
- func (t *MutableTree) Rollback()
- func (t *MutableTree) SaveVersion() ([]byte, int64, error)
- func (t *MutableTree) SaveVersionAt(version int64) ([]byte, int64, error)
- func (t *MutableTree) Set(key, value []byte) bool
- func (t *MutableTree) SetVirtualVersion(version int64)
- func (t *MutableTree) ValidateTree() bool
- func (t *MutableTree) Version() int64
- func (t *MutableTree) WorkingHash() common.Hash
- type NonceCache
- func (ns *NonceCache) Clear()
- func (ns *NonceCache) GetNonce(addr common.Address, epoch uint16) uint32
- func (ns *NonceCache) Lock()
- func (ns *NonceCache) ReloadFallback(sdb *StateDB) error
- func (ns *NonceCache) SetNonce(addr common.Address, txEpoch uint16, nonce uint32)
- func (ns *NonceCache) UnLock()
- func (ns *NonceCache) UnsafeSetNonce(addr common.Address, txEpoch uint16, nonce uint32)
- type SnapshotManager
- func (m *SnapshotManager) AddInvalidManifest(cid []byte)
- func (m *SnapshotManager) AddTimeoutManifest(cid []byte)
- func (m *SnapshotManager) DownloadSnapshot(snapshot *snapshot.Manifest) (filePath string, err error)
- func (m *SnapshotManager) IsInvalidManifest(cid []byte) bool
- func (m *SnapshotManager) StartSync()
- func (m *SnapshotManager) StopSync()
- type StateDB
- func (s *StateDB) AccountExists(address common.Address) bool
- func (s *StateDB) AddBalance(addr common.Address, amount *big.Int)
- func (s *StateDB) AddBlockBit(empty bool)
- func (s *StateDB) AddFlip(addr common.Address, cid []byte, pair uint8)
- func (s *StateDB) AddInvite(address common.Address, amount uint8)
- func (s *StateDB) AddInvitee(address, inviteeAddress common.Address, txHash common.Hash)
- func (s *StateDB) AddNewScore(address common.Address, score byte)
- func (s *StateDB) AddStake(address common.Address, intStake *big.Int)
- func (s *StateDB) BlocksCntWithoutCeremonialTxs() byte
- func (s *StateDB) Clear()
- func (s *StateDB) ClearAccount(addr common.Address)
- func (s *StateDB) ClearDelegations()
- func (s *StateDB) ClearFlips(addr common.Address)
- func (s *StateDB) ClearPenalty(address common.Address)
- func (s *StateDB) ClearStatusSwitchAddresses()
- func (s *StateDB) CollectKilledDelegators() []common.Address
- func (s *StateDB) Commit(deleteEmptyObjects bool) (root []byte, version int64, err error)
- func (s *StateDB) CommitSnapshot(height uint64, batch dbm.Batch) (dropDb dbm.DB)
- func (s *StateDB) CommitTree(newVersion int64) (root []byte, version int64, err error)
- func (s *StateDB) Delegatee(addr common.Address) *common.Address
- func (s *StateDB) DelegationEpoch(addr common.Address) uint16
- func (s *StateDB) DelegationSwitch(sender common.Address) *Delegation
- func (s *StateDB) Delegations() []*Delegation
- func (s *StateDB) DeleteFlip(addr common.Address, cid []byte)
- func (s *StateDB) DeployContract(addr common.Address, codeHash common.Hash, stake *big.Int)
- func (s *StateDB) DropContract(addr common.Address)
- func (s *StateDB) DropSnapshot(manifest *snapshot.Manifest)
- func (s *StateDB) EmptyBlocksCount() int
- func (s *StateDB) Epoch() uint16
- func (s *StateDB) EpochBlock() uint64
- func (s *StateDB) FeePerGas() *big.Int
- func (s *StateDB) FlipWordsSeed() types.Seed
- func (s *StateDB) ForCheck(height uint64) (*StateDB, error)
- func (s *StateDB) ForCheckWithOverwrite(height uint64) (*StateDB, error)
- func (s *StateDB) GeneticCode(address common.Address) (generation uint32, code []byte)
- func (s *StateDB) GetBalance(addr common.Address) *big.Int
- func (s *StateDB) GetCodeHash(addr common.Address) *common.Hash
- func (s *StateDB) GetContractStake(addr common.Address) *big.Int
- func (s *StateDB) GetContractValue(addr common.Address, key []byte) []byte
- func (s *StateDB) GetEpoch(addr common.Address) uint16
- func (s *StateDB) GetIdentity(addr common.Address) Identity
- func (s *StateDB) GetIdentityState(addr common.Address) IdentityState
- func (s *StateDB) GetInvitees(address common.Address) []TxAddr
- func (s *StateDB) GetInviter(address common.Address) *TxAddr
- func (s *StateDB) GetInvites(addr common.Address) uint8
- func (s *StateDB) GetMadeFlips(addr common.Address) uint8
- func (s *StateDB) GetNonce(addr common.Address) uint32
- func (s *StateDB) GetOrNewAccountObject(addr common.Address) *stateAccount
- func (s *StateDB) GetOrNewDelegationSwitchObject() *stateDelegationSwitch
- func (s *StateDB) GetOrNewGlobalObject() *stateGlobal
- func (s *StateDB) GetOrNewIdentityObject(addr common.Address) *stateIdentity
- func (s *StateDB) GetOrNewStatusSwitchObject() *stateStatusSwitch
- func (s *StateDB) GetPenalty(address common.Address) *big.Int
- func (s *StateDB) GetProfileHash(addr common.Address) []byte
- func (s *StateDB) GetQualifiedFlipsCount(addr common.Address) uint32
- func (s *StateDB) GetRequiredFlips(addr common.Address) uint8
- func (s *StateDB) GetScores(addr common.Address) []byte
- func (s *StateDB) GetShortFlipPoints(addr common.Address) float32
- func (s *StateDB) GetStakeBalance(addr common.Address) *big.Int
- func (s *StateDB) GodAddress() common.Address
- func (s *StateDB) GodAddressInvites() uint16
- func (s *StateDB) HasStatusSwitchAddresses(addr common.Address) bool
- func (s *StateDB) HasValidationTx(addr common.Address, txType types.TxType) bool
- func (s *StateDB) IncBlocksCntWithoutCeremonialTxs()
- func (s *StateDB) IncEpoch()
- func (s *StateDB) IterateAccounts(fn func(key []byte, value []byte) bool) bool
- func (s *StateDB) IterateContractStore(addr common.Address, minKey []byte, maxKey []byte, ...)
- func (s *StateDB) IterateContractValues(f func(key []byte, value []byte) bool)
- func (s *StateDB) IterateIdentities(fn func(key []byte, value []byte) bool) bool
- func (s *StateDB) IterateOverAccounts(callback func(addr common.Address, account Account))
- func (s *StateDB) IterateOverIdentities(callback func(addr common.Address, identity Identity))
- func (s *StateDB) LastSnapshot() uint64
- func (s *StateDB) Load(height uint64) error
- func (s *StateDB) MarkStateAccountObjectDirty(addr common.Address)
- func (s *StateDB) MarkStateDelegationSwitchObjectDirty()
- func (s *StateDB) MarkStateGlobalObjectDirty()
- func (s *StateDB) MarkStateIdentityObjectDirty(addr common.Address)
- func (s *StateDB) MarkStateStatusSwitchObjectDirty()
- func (s *StateDB) NextValidationTime() time.Time
- func (s *StateDB) Precommit(deleteEmptyObjects bool)
- func (s *StateDB) Readonly(height int64) (*StateDB, error)
- func (s *StateDB) RecoverSnapshot(height uint64, treeRoot common.Hash, from io.Reader) error
- func (s *StateDB) RemoveContractValue(addr common.Address, key []byte)
- func (s *StateDB) RemoveDelegatee(addr common.Address)
- func (s *StateDB) RemoveInvitee(address, inviteeAddress common.Address)
- func (s *StateDB) Reset()
- func (s *StateDB) ResetBlocksCntWithoutCeremonialTxs()
- func (s *StateDB) ResetInviter(address common.Address)
- func (s *StateDB) ResetTo(height uint64) error
- func (s *StateDB) ResetValidationTxBits(addr common.Address)
- func (s *StateDB) Root() common.Hash
- func (s *StateDB) SaveForcedVersion(height uint64) (root []byte, version int64, err error)
- func (s *StateDB) SetBalance(addr common.Address, amount *big.Int)
- func (s *StateDB) SetBirthday(address common.Address, birthday uint16)
- func (s *StateDB) SetContractStake(addr common.Address, stake *big.Int)
- func (s *StateDB) SetContractValue(addr common.Address, key []byte, value []byte)
- func (s *StateDB) SetDelegatee(addr common.Address, delegatee common.Address)
- func (s *StateDB) SetDelegationEpoch(addr common.Address, epoch uint16)
- func (s *StateDB) SetDelegationNonce(addr common.Address, nonce uint32)
- func (s *StateDB) SetEpoch(addr common.Address, epoch uint16)
- func (s *StateDB) SetEpochBlock(height uint64)
- func (s *StateDB) SetFeePerGas(fee *big.Int)
- func (s *StateDB) SetFlipWordsSeed(seed types.Seed)
- func (s *StateDB) SetGeneticCode(address common.Address, generation uint32, code []byte)
- func (s *StateDB) SetGlobalEpoch(epoch uint16)
- func (s *StateDB) SetGodAddress(godAddress common.Address)
- func (s *StateDB) SetGodAddressInvites(count uint16)
- func (s *StateDB) SetInviter(address, inviterAddress common.Address, txHash common.Hash)
- func (s *StateDB) SetInvites(address common.Address, amount uint8)
- func (s *StateDB) SetLastSnapshot(height uint64)
- func (s *StateDB) SetNextValidationTime(t time.Time)
- func (s *StateDB) SetNonce(addr common.Address, nonce uint32)
- func (s *StateDB) SetPenalty(address common.Address, penalty *big.Int)
- func (s *StateDB) SetPredefinedAccounts(state *models.ProtoPredefinedState)
- func (s *StateDB) SetPredefinedContractValues(state *models.ProtoPredefinedState)
- func (s *StateDB) SetPredefinedGlobal(state *models.ProtoPredefinedState)
- func (s *StateDB) SetPredefinedIdentities(state *models.ProtoPredefinedState)
- func (s *StateDB) SetPredefinedStatusSwitch(state *models.ProtoPredefinedState)
- func (s *StateDB) SetProfileHash(addr common.Address, hash []byte)
- func (s *StateDB) SetPubKey(address common.Address, pubKey []byte)
- func (s *StateDB) SetRequiredFlips(addr common.Address, amount uint8)
- func (s *StateDB) SetState(address common.Address, state IdentityState)
- func (s *StateDB) SetValidationPeriod(period ValidationPeriod)
- func (s *StateDB) SetValidationStatus(addr common.Address, status ValidationStatusFlag)
- func (s *StateDB) SetValidationTxBit(addr common.Address, txType types.TxType)
- func (s *StateDB) SetVrfProposerThreshold(value float64)
- func (s *StateDB) StatusSwitchAddresses() []common.Address
- func (s *StateDB) SubBalance(addr common.Address, amount *big.Int)
- func (s *StateDB) SubGodAddressInvite()
- func (s *StateDB) SubInvite(address common.Address, amount uint8)
- func (s *StateDB) SubPenalty(address common.Address, penalty *big.Int)
- func (s *StateDB) SubStake(addr common.Address, amount *big.Int)
- func (s *StateDB) ToggleDelegationAddress(sender common.Address, delegatee common.Address)
- func (s *StateDB) ToggleStatusSwitchAddress(sender common.Address)
- func (s *StateDB) ValidationPeriod() ValidationPeriod
- func (s *StateDB) Version() int64
- func (s *StateDB) VrfProposerThreshold() float64
- func (s *StateDB) WriteSnapshot(height uint64, to io.Writer) (root common.Hash, err error)
- type Tree
- type TxAddr
- type ValidationPeriod
- type ValidationStatusFlag
Constants ¶
const ( Undefined IdentityState = 0 Invite IdentityState = 1 Candidate IdentityState = 2 Verified IdentityState = 3 Suspended IdentityState = 4 Killed IdentityState = 5 Zombie IdentityState = 6 Newbie IdentityState = 7 Human IdentityState = 8 MaxInvitesAmount = math.MaxUint8 EmptyBlocksBitsSize = 25 AdditionalVerifiedFlips = 1 AdditionalHumanFlips = 2 // Minimal number of blocks in after long period which should be without ceremonial txs AfterLongRequiredBlocks = 5 )
const ( MaxSavedStatesCount = 100 GeneticCodeSize = 12 )
const (
SnapshotBlockSize = 10000
)
const (
SnapshotsFolder = "/snapshots"
)
Variables ¶
var ( StateDbKeys = &stateDbKeys{} IdentityStateDbKeys = &identityStateDbPrefix{} )
var ( InvalidManifestPrefix = []byte("im") MaxManifestTimeouts = byte(5) )
Functions ¶
func IsCeremonyCandidate ¶
func ReadTreeFrom ¶ added in v0.23.0
Types ¶
type Account ¶
type Account struct { Nonce uint32 Epoch uint16 Balance *big.Int Contract *ContractData }
Account is the Idena consensus representation of accounts. These objects are stored in the main account trie.
type ApprovedIdentity ¶
func (*ApprovedIdentity) FromBytes ¶ added in v0.21.0
func (s *ApprovedIdentity) FromBytes(data []byte) error
func (*ApprovedIdentity) ToBytes ¶ added in v0.21.0
func (s *ApprovedIdentity) ToBytes() ([]byte, error)
type BitArray ¶
type BitArray struct { Bits uint `json:"bits"` // NOTE: persisted via reflect, must be exported Elems []uint64 `json:"elems"` // NOTE: persisted via reflect, must be exported // contains filtered or unexported fields }
BitArray is a thread-safe implementation of a bit array.
func NewBitArray ¶
NewBitArray returns a new bit array. It returns nil if the number of bits is zero.
func (*BitArray) GetIndex ¶
GetIndex returns the bit at index i within the bit array. The behavior is undefined if i >= bA.Bits
func (*BitArray) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface by marshaling bit array using a custom format: a string of '-' or 'x' where 'x' denotes the 1 bit.
func (*BitArray) SetIndex ¶
SetIndex sets the bit at index i within the bit array. The behavior is undefined if i >= bA.Bits
func (*BitArray) String ¶
String returns a string representation of BitArray: BA{<bit-string>}, where <bit-string> is a sequence of 'x' (1) and '_' (0). The <bit-string> includes spaces and newlines to help people. For a simple sequence of 'x' and '_' characters with no spaces or newlines, see the MarshalJSON() method. Example: "BA{_x_}" or "nil-BitArray" for nil.
func (*BitArray) StringIndented ¶
StringIndented returns the same thing as String(), but applies the indent at every 10th bit, and twice at every 50th bit.
func (*BitArray) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface by unmarshaling a custom JSON description.
type ContractData ¶ added in v0.22.0
type Delegation ¶ added in v0.25.0
type DelegationSwitch ¶ added in v0.25.0
type DelegationSwitch struct {
Delegations []*Delegation
}
func (*DelegationSwitch) FromBytes ¶ added in v0.25.0
func (s *DelegationSwitch) FromBytes(data []byte) error
func (*DelegationSwitch) ToBytes ¶ added in v0.25.0
func (s *DelegationSwitch) ToBytes() ([]byte, error)
type Global ¶
type Global struct { Epoch uint16 NextValidationTime int64 ValidationPeriod ValidationPeriod GodAddress common.Address WordsSeed types.Seed LastSnapshot uint64 EpochBlock uint64 FeePerGas *big.Int VrfProposerThreshold uint64 EmptyBlocksBits *big.Int GodAddressInvites uint16 BlocksCntWithoutCeremonialTxs byte }
type Identity ¶
type Identity struct { ProfileHash []byte Stake *big.Int Invites uint8 Birthday uint16 State IdentityState QualifiedFlips uint32 // should use GetShortFlipPoints instead of reading directly ShortFlipPoints uint32 PubKey []byte RequiredFlips uint8 Flips []IdentityFlip Generation uint32 Code []byte Invitees []TxAddr Inviter *TxAddr Penalty *big.Int ValidationTxsBits byte LastValidationStatus ValidationStatusFlag Scores []byte Delegatee *common.Address DelegationNonce uint32 DelegationEpoch uint16 }
func (*Identity) GetMaximumAvailableFlips ¶
func (*Identity) GetShortFlipPoints ¶
func (*Identity) GetTotalWordPairsCount ¶
func (*Identity) HasDoneAllRequiredFlips ¶
type IdentityFlip ¶
type IdentityState ¶
type IdentityState uint8
func (IdentityState) NewbieOrBetter ¶
func (s IdentityState) NewbieOrBetter() bool
func (IdentityState) VerifiedOrBetter ¶
func (s IdentityState) VerifiedOrBetter() bool
type IdentityStateDB ¶
type IdentityStateDB struct {
// contains filtered or unexported fields
}
func NewLazyIdentityState ¶
func NewLazyIdentityState(db dbm.DB) (*IdentityStateDB, error)
func (*IdentityStateDB) Add ¶
func (s *IdentityStateDB) Add(identity common.Address)
func (*IdentityStateDB) AddDiff ¶
func (s *IdentityStateDB) AddDiff(height uint64, diff *IdentityStateDiff)
func (*IdentityStateDB) Clear ¶
func (s *IdentityStateDB) Clear()
func (*IdentityStateDB) Commit ¶
func (s *IdentityStateDB) Commit(deleteEmptyObjects bool) (root []byte, version int64, diff *IdentityStateDiff, err error)
Commit writes the state to the underlying in-memory trie database.
func (*IdentityStateDB) CommitSnapshot ¶ added in v0.23.0
func (s *IdentityStateDB) CommitSnapshot(height uint64) (dropDb dbm.DB)
func (*IdentityStateDB) CommitTree ¶
func (s *IdentityStateDB) CommitTree(newVersion int64) (root []byte, version int64, err error)
func (*IdentityStateDB) CreatePreliminaryCopy ¶
func (s *IdentityStateDB) CreatePreliminaryCopy(height uint64) (*IdentityStateDB, error)
func (*IdentityStateDB) Delegatee ¶ added in v0.25.0
func (s *IdentityStateDB) Delegatee(addr common.Address) *common.Address
func (*IdentityStateDB) DropPreliminary ¶
func (s *IdentityStateDB) DropPreliminary()
func (*IdentityStateDB) ForCheck ¶
func (s *IdentityStateDB) ForCheck(height uint64) (*IdentityStateDB, error)
func (*IdentityStateDB) ForCheckWithOverwrite ¶ added in v0.19.3
func (s *IdentityStateDB) ForCheckWithOverwrite(height uint64) (*IdentityStateDB, error)
func (*IdentityStateDB) GetOrNewIdentityObject ¶
func (s *IdentityStateDB) GetOrNewIdentityObject(addr common.Address) *stateApprovedIdentity
Retrieve a state object or create a new state object if nil
func (*IdentityStateDB) HasVersion ¶
func (s *IdentityStateDB) HasVersion(height uint64) bool
func (*IdentityStateDB) IsApproved ¶
func (s *IdentityStateDB) IsApproved(addr common.Address) bool
func (*IdentityStateDB) IterateIdentities ¶
func (s *IdentityStateDB) IterateIdentities(fn func(key []byte, value []byte) bool) bool
func (*IdentityStateDB) Load ¶
func (s *IdentityStateDB) Load(height uint64) error
func (*IdentityStateDB) LoadPreliminary ¶
func (s *IdentityStateDB) LoadPreliminary(height uint64) (*IdentityStateDB, error)
func (*IdentityStateDB) MarkStateIdentityObjectDirty ¶
func (s *IdentityStateDB) MarkStateIdentityObjectDirty(addr common.Address)
MarkStateAccountObjectDirty adds the specified object to the dirty map to avoid costly state object cache iteration to find a handful of modified ones.
func (*IdentityStateDB) Precommit ¶
func (s *IdentityStateDB) Precommit(deleteEmptyObjects bool) *IdentityStateDiff
func (*IdentityStateDB) Readonly ¶
func (s *IdentityStateDB) Readonly(height uint64) (*IdentityStateDB, error)
func (*IdentityStateDB) RecoverSnapshot ¶ added in v0.23.0
func (*IdentityStateDB) Remove ¶
func (s *IdentityStateDB) Remove(identity common.Address)
func (*IdentityStateDB) RemoveDelegatee ¶ added in v0.25.0
func (s *IdentityStateDB) RemoveDelegatee(addr common.Address)
func (*IdentityStateDB) Reset ¶
func (s *IdentityStateDB) Reset()
func (*IdentityStateDB) ResetTo ¶
func (s *IdentityStateDB) ResetTo(height uint64) error
func (*IdentityStateDB) Root ¶
func (s *IdentityStateDB) Root() common.Hash
func (*IdentityStateDB) SaveForcedVersion ¶
func (s *IdentityStateDB) SaveForcedVersion(height uint64) error
func (*IdentityStateDB) SetDelegatee ¶ added in v0.25.0
func (s *IdentityStateDB) SetDelegatee(addr common.Address, delegatee common.Address)
func (*IdentityStateDB) SetOnline ¶
func (s *IdentityStateDB) SetOnline(addr common.Address, online bool)
func (*IdentityStateDB) SetPredefinedIdentities ¶
func (s *IdentityStateDB) SetPredefinedIdentities(state *models.ProtoPredefinedState)
func (*IdentityStateDB) SwitchToPreliminary ¶
func (*IdentityStateDB) Version ¶
func (s *IdentityStateDB) Version() uint64
type IdentityStateDiff ¶
type IdentityStateDiff struct {
Values []*IdentityStateDiffValue
}
func (*IdentityStateDiff) Empty ¶
func (diff *IdentityStateDiff) Empty() bool
func (*IdentityStateDiff) FromBytes ¶ added in v0.21.0
func (diff *IdentityStateDiff) FromBytes(data []byte) error
func (*IdentityStateDiff) FromProto ¶ added in v0.21.0
func (diff *IdentityStateDiff) FromProto(protoDiff *models.ProtoIdentityStateDiff) *IdentityStateDiff
func (*IdentityStateDiff) ToBytes ¶ added in v0.21.0
func (diff *IdentityStateDiff) ToBytes() ([]byte, error)
func (*IdentityStateDiff) ToProto ¶ added in v0.21.0
func (diff *IdentityStateDiff) ToProto() *models.ProtoIdentityStateDiff
type IdentityStateDiffValue ¶
type IdentityStatusSwitch ¶
func (*IdentityStatusSwitch) FromBytes ¶ added in v0.21.0
func (s *IdentityStatusSwitch) FromBytes(data []byte) error
func (*IdentityStatusSwitch) ToBytes ¶ added in v0.21.0
func (s *IdentityStatusSwitch) ToBytes() ([]byte, error)
type ImmutableTree ¶
type ImmutableTree struct {
// contains filtered or unexported fields
}
func (*ImmutableTree) AvailableVersions ¶
func (t *ImmutableTree) AvailableVersions() []int
func (*ImmutableTree) DeleteVersion ¶
func (t *ImmutableTree) DeleteVersion(version int64) error
func (*ImmutableTree) ExistVersion ¶
func (t *ImmutableTree) ExistVersion(version int64) bool
func (*ImmutableTree) GetImmutable ¶
func (t *ImmutableTree) GetImmutable() *ImmutableTree
func (*ImmutableTree) Hash ¶
func (t *ImmutableTree) Hash() common.Hash
func (*ImmutableTree) Iterate ¶
func (t *ImmutableTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
Iterate iterates over all keys of the tree, in order.
func (*ImmutableTree) IterateRange ¶
func (t *ImmutableTree) IterateRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) (stopped bool)
IterateRange makes a callback for all nodes with key between start and end non-inclusive. If either are nil, then it is open on that side (nil, nil is the same as Iterate)
func (*ImmutableTree) IterateRangeInclusive ¶
func (t *ImmutableTree) IterateRangeInclusive(start, end []byte, ascending bool, fn func(key, value []byte, version int64) bool) (stopped bool)
IterateRangeInclusive makes a callback for all nodes with key between start and end inclusive. If either are nil, then it is open on that side (nil, nil is the same as Iterate)
func (*ImmutableTree) Load ¶
func (t *ImmutableTree) Load() (int64, error)
func (*ImmutableTree) LoadVersion ¶
func (t *ImmutableTree) LoadVersion(targetVersion int64) (int64, error)
func (*ImmutableTree) LoadVersionForOverwriting ¶
func (t *ImmutableTree) LoadVersionForOverwriting(targetVersion int64) (int64, error)
func (*ImmutableTree) Rollback ¶
func (t *ImmutableTree) Rollback()
func (*ImmutableTree) SaveVersion ¶
func (t *ImmutableTree) SaveVersion() ([]byte, int64, error)
func (*ImmutableTree) SaveVersionAt ¶
func (t *ImmutableTree) SaveVersionAt(version int64) ([]byte, int64, error)
func (*ImmutableTree) Set ¶
func (t *ImmutableTree) Set(key, value []byte) bool
func (*ImmutableTree) SetVirtualVersion ¶
func (t *ImmutableTree) SetVirtualVersion(version int64)
func (*ImmutableTree) ValidateTree ¶
func (t *ImmutableTree) ValidateTree() bool
func (*ImmutableTree) Version ¶
func (t *ImmutableTree) Version() int64
func (*ImmutableTree) WorkingHash ¶
func (t *ImmutableTree) WorkingHash() common.Hash
type MutableTree ¶
type MutableTree struct {
// contains filtered or unexported fields
}
func NewMutableTree ¶
func NewMutableTree(db dbm.DB) *MutableTree
func (*MutableTree) AvailableVersions ¶
func (t *MutableTree) AvailableVersions() []int
func (*MutableTree) DeleteVersion ¶
func (t *MutableTree) DeleteVersion(version int64) error
func (*MutableTree) ExistVersion ¶
func (t *MutableTree) ExistVersion(version int64) bool
func (*MutableTree) GetImmutable ¶
func (t *MutableTree) GetImmutable() *ImmutableTree
func (*MutableTree) Hash ¶
func (t *MutableTree) Hash() common.Hash
func (*MutableTree) LazyLoad ¶ added in v0.19.3
func (t *MutableTree) LazyLoad(version int64) (int64, error)
func (*MutableTree) Load ¶
func (t *MutableTree) Load() (int64, error)
func (*MutableTree) LoadVersion ¶
func (t *MutableTree) LoadVersion(targetVersion int64) (int64, error)
func (*MutableTree) LoadVersionForOverwriting ¶
func (t *MutableTree) LoadVersionForOverwriting(targetVersion int64) (int64, error)
func (*MutableTree) Rollback ¶
func (t *MutableTree) Rollback()
func (*MutableTree) SaveVersion ¶
func (t *MutableTree) SaveVersion() ([]byte, int64, error)
func (*MutableTree) SaveVersionAt ¶
func (t *MutableTree) SaveVersionAt(version int64) ([]byte, int64, error)
func (*MutableTree) Set ¶
func (t *MutableTree) Set(key, value []byte) bool
func (*MutableTree) SetVirtualVersion ¶
func (t *MutableTree) SetVirtualVersion(version int64)
func (*MutableTree) ValidateTree ¶
func (t *MutableTree) ValidateTree() bool
func (*MutableTree) Version ¶
func (t *MutableTree) Version() int64
func (*MutableTree) WorkingHash ¶
func (t *MutableTree) WorkingHash() common.Hash
type NonceCache ¶
type NonceCache struct {
// contains filtered or unexported fields
}
func NewNonceCache ¶
func NewNonceCache(sdb *StateDB) (*NonceCache, error)
func (*NonceCache) Clear ¶ added in v0.19.3
func (ns *NonceCache) Clear()
func (*NonceCache) GetNonce ¶
func (ns *NonceCache) GetNonce(addr common.Address, epoch uint16) uint32
GetNonce returns the canonical nonce for the managed or unmanaged account. Because GetNonce mutates the DB, we must take a write lock.
func (*NonceCache) Lock ¶ added in v0.19.3
func (ns *NonceCache) Lock()
func (*NonceCache) ReloadFallback ¶ added in v0.19.3
func (ns *NonceCache) ReloadFallback(sdb *StateDB) error
func (*NonceCache) SetNonce ¶
func (ns *NonceCache) SetNonce(addr common.Address, txEpoch uint16, nonce uint32)
SetNonce sets the new canonical nonce for the managed state
func (*NonceCache) UnLock ¶ added in v0.19.3
func (ns *NonceCache) UnLock()
func (*NonceCache) UnsafeSetNonce ¶ added in v0.19.3
func (ns *NonceCache) UnsafeSetNonce(addr common.Address, txEpoch uint16, nonce uint32)
type SnapshotManager ¶
type SnapshotManager struct {
// contains filtered or unexported fields
}
func NewSnapshotManager ¶
func (*SnapshotManager) AddInvalidManifest ¶
func (m *SnapshotManager) AddInvalidManifest(cid []byte)
func (*SnapshotManager) AddTimeoutManifest ¶
func (m *SnapshotManager) AddTimeoutManifest(cid []byte)
func (*SnapshotManager) DownloadSnapshot ¶
func (m *SnapshotManager) DownloadSnapshot(snapshot *snapshot.Manifest) (filePath string, err error)
func (*SnapshotManager) IsInvalidManifest ¶
func (m *SnapshotManager) IsInvalidManifest(cid []byte) bool
func (*SnapshotManager) StartSync ¶
func (m *SnapshotManager) StartSync()
func (*SnapshotManager) StopSync ¶
func (m *SnapshotManager) StopSync()
type StateDB ¶
type StateDB struct {
// contains filtered or unexported fields
}
func (*StateDB) AddBalance ¶
AddBalance adds amount to the account associated with addr
func (*StateDB) AddBlockBit ¶
func (*StateDB) AddInvitee ¶
func (*StateDB) AddNewScore ¶ added in v0.22.0
func (*StateDB) BlocksCntWithoutCeremonialTxs ¶ added in v0.21.0
func (*StateDB) ClearAccount ¶ added in v0.20.0
func (*StateDB) ClearDelegations ¶ added in v0.25.0
func (s *StateDB) ClearDelegations()
func (*StateDB) ClearFlips ¶
func (*StateDB) ClearPenalty ¶
func (*StateDB) ClearStatusSwitchAddresses ¶
func (s *StateDB) ClearStatusSwitchAddresses()
func (*StateDB) CollectKilledDelegators ¶ added in v0.25.0
func (*StateDB) CommitSnapshot ¶
func (*StateDB) CommitTree ¶
func (*StateDB) DelegationEpoch ¶ added in v0.25.0
func (*StateDB) DelegationSwitch ¶ added in v0.25.0
func (s *StateDB) DelegationSwitch(sender common.Address) *Delegation
func (*StateDB) Delegations ¶ added in v0.25.0
func (s *StateDB) Delegations() []*Delegation
func (*StateDB) DeployContract ¶ added in v0.22.0
func (*StateDB) DropContract ¶ added in v0.22.0
func (*StateDB) DropSnapshot ¶
func (*StateDB) EmptyBlocksCount ¶
func (*StateDB) EpochBlock ¶
func (*StateDB) FlipWordsSeed ¶
func (*StateDB) ForCheckWithOverwrite ¶ added in v0.19.3
func (*StateDB) GeneticCode ¶
func (*StateDB) GetBalance ¶
Retrieve the balance from the given address or 0 if object not found
func (*StateDB) GetCodeHash ¶ added in v0.22.0
func (*StateDB) GetContractStake ¶ added in v0.22.0
func (*StateDB) GetContractValue ¶ added in v0.22.0
func (*StateDB) GetIdentityState ¶
func (s *StateDB) GetIdentityState(addr common.Address) IdentityState
func (*StateDB) GetOrNewAccountObject ¶
Retrieve a state object or create a new state object if nil
func (*StateDB) GetOrNewDelegationSwitchObject ¶ added in v0.25.0
func (s *StateDB) GetOrNewDelegationSwitchObject() *stateDelegationSwitch
func (*StateDB) GetOrNewGlobalObject ¶
func (s *StateDB) GetOrNewGlobalObject() *stateGlobal
Retrieve a state object or create a new state object if nil
func (*StateDB) GetOrNewIdentityObject ¶
Retrieve a state object or create a new state object if nil
func (*StateDB) GetOrNewStatusSwitchObject ¶
func (s *StateDB) GetOrNewStatusSwitchObject() *stateStatusSwitch
func (*StateDB) GetQualifiedFlipsCount ¶
func (*StateDB) GetShortFlipPoints ¶
func (*StateDB) GodAddress ¶
func (*StateDB) GodAddressInvites ¶
func (*StateDB) HasStatusSwitchAddresses ¶
func (*StateDB) HasValidationTx ¶
func (*StateDB) IncBlocksCntWithoutCeremonialTxs ¶ added in v0.21.0
func (s *StateDB) IncBlocksCntWithoutCeremonialTxs()
func (*StateDB) IterateAccounts ¶
func (*StateDB) IterateContractStore ¶ added in v0.22.0
func (*StateDB) IterateContractValues ¶ added in v0.22.0
Iterate over all stored contract data
func (*StateDB) IterateIdentities ¶
func (*StateDB) IterateOverAccounts ¶ added in v0.20.0
func (*StateDB) IterateOverIdentities ¶
func (*StateDB) LastSnapshot ¶
func (*StateDB) MarkStateAccountObjectDirty ¶
MarkStateAccountObjectDirty adds the specified object to the dirty map to avoid costly state object cache iteration to find a handful of modified ones.
func (*StateDB) MarkStateDelegationSwitchObjectDirty ¶ added in v0.25.0
func (s *StateDB) MarkStateDelegationSwitchObjectDirty()
func (*StateDB) MarkStateGlobalObjectDirty ¶
func (s *StateDB) MarkStateGlobalObjectDirty()
MarkStateAccountObjectDirty adds the specified object to the dirty map to avoid costly state object cache iteration to find a handful of modified ones.
func (*StateDB) MarkStateIdentityObjectDirty ¶
MarkStateAccountObjectDirty adds the specified object to the dirty map to avoid costly state object cache iteration to find a handful of modified ones.
func (*StateDB) MarkStateStatusSwitchObjectDirty ¶
func (s *StateDB) MarkStateStatusSwitchObjectDirty()
func (*StateDB) NextValidationTime ¶
func (*StateDB) RecoverSnapshot ¶
func (*StateDB) RemoveContractValue ¶ added in v0.22.0
func (*StateDB) RemoveDelegatee ¶ added in v0.25.0
func (*StateDB) RemoveInvitee ¶
func (*StateDB) ResetBlocksCntWithoutCeremonialTxs ¶ added in v0.21.0
func (s *StateDB) ResetBlocksCntWithoutCeremonialTxs()
func (*StateDB) ResetInviter ¶
func (*StateDB) ResetValidationTxBits ¶
func (*StateDB) SaveForcedVersion ¶
func (*StateDB) SetBirthday ¶
func (*StateDB) SetContractStake ¶ added in v0.22.0
func (*StateDB) SetContractValue ¶ added in v0.22.0
func (*StateDB) SetDelegatee ¶ added in v0.25.0
func (*StateDB) SetDelegationEpoch ¶ added in v0.25.0
func (*StateDB) SetDelegationNonce ¶ added in v0.25.0
func (*StateDB) SetEpochBlock ¶
func (*StateDB) SetFeePerGas ¶ added in v0.22.0
func (*StateDB) SetFlipWordsSeed ¶
func (*StateDB) SetGeneticCode ¶
func (*StateDB) SetGlobalEpoch ¶
func (*StateDB) SetGodAddress ¶
func (*StateDB) SetGodAddressInvites ¶
func (*StateDB) SetInviter ¶
func (*StateDB) SetLastSnapshot ¶
func (*StateDB) SetNextValidationTime ¶
func (*StateDB) SetPredefinedAccounts ¶
func (s *StateDB) SetPredefinedAccounts(state *models.ProtoPredefinedState)
func (*StateDB) SetPredefinedContractValues ¶ added in v0.22.0
func (s *StateDB) SetPredefinedContractValues(state *models.ProtoPredefinedState)
func (*StateDB) SetPredefinedGlobal ¶
func (s *StateDB) SetPredefinedGlobal(state *models.ProtoPredefinedState)
func (*StateDB) SetPredefinedIdentities ¶
func (s *StateDB) SetPredefinedIdentities(state *models.ProtoPredefinedState)
func (*StateDB) SetPredefinedStatusSwitch ¶
func (s *StateDB) SetPredefinedStatusSwitch(state *models.ProtoPredefinedState)
func (*StateDB) SetRequiredFlips ¶
func (*StateDB) SetValidationPeriod ¶
func (s *StateDB) SetValidationPeriod(period ValidationPeriod)
func (*StateDB) SetValidationStatus ¶
func (s *StateDB) SetValidationStatus(addr common.Address, status ValidationStatusFlag)
func (*StateDB) SetValidationTxBit ¶
func (*StateDB) SetVrfProposerThreshold ¶
func (*StateDB) StatusSwitchAddresses ¶
func (*StateDB) SubBalance ¶
SubBalance subtracts amount from the account associated with addr
func (*StateDB) SubGodAddressInvite ¶
func (s *StateDB) SubGodAddressInvite()
func (*StateDB) ToggleDelegationAddress ¶ added in v0.25.0
func (*StateDB) ToggleStatusSwitchAddress ¶
func (*StateDB) ValidationPeriod ¶
func (s *StateDB) ValidationPeriod() ValidationPeriod
func (*StateDB) VrfProposerThreshold ¶
type Tree ¶
type Tree interface { Get(key []byte) (index int64, value []byte) Set(key, value []byte) bool Remove(key []byte) ([]byte, bool) LoadVersion(targetVersion int64) (int64, error) Load() (int64, error) SaveVersion() ([]byte, int64, error) DeleteVersion(version int64) error GetImmutable() *ImmutableTree Version() int64 Hash() common.Hash WorkingHash() common.Hash ExistVersion(version int64) bool LoadVersionForOverwriting(targetVersion int64) (int64, error) Rollback() AvailableVersions() []int SaveVersionAt(version int64) ([]byte, int64, error) SetVirtualVersion(version int64) ValidateTree() bool }
type ValidationPeriod ¶
type ValidationPeriod uint32
const ( NonePeriod ValidationPeriod = 0 FlipLotteryPeriod ValidationPeriod = 1 ShortSessionPeriod ValidationPeriod = 2 LongSessionPeriod ValidationPeriod = 3 AfterLongSessionPeriod ValidationPeriod = 4 )
type ValidationStatusFlag ¶
type ValidationStatusFlag uint16
const ( AtLeastOneFlipReported ValidationStatusFlag = 1 << iota AtLeastOneFlipNotQualified AllFlipsNotQualified )
func (ValidationStatusFlag) HasFlag ¶
func (f ValidationStatusFlag) HasFlag(flag ValidationStatusFlag) bool