Documentation ¶
Index ¶
- Constants
- Variables
- func NewAccountsDbWrapperSync(adapter AccountsAdapter) (*accountsDbWrapperSync, error)
- func NewAddress(adr []byte) *address
- func NewDataTriesHolder() *dataTriesHolder
- type Account
- func (a *Account) AddressContainer() AddressContainer
- func (a *Account) DataTrie() data.Trie
- func (a *Account) DataTrieTracker() DataTrieTracker
- func (a *Account) GetCode() []byte
- func (a *Account) GetCodeHash() []byte
- func (a *Account) GetNonce() uint64
- func (a *Account) GetRootHash() []byte
- func (a *Account) IsInterfaceNil() bool
- func (a *Account) SetBalanceWithJournal(balance *big.Int) error
- func (a *Account) SetCode(code []byte)
- func (a *Account) SetCodeHash(codeHash []byte)
- func (a *Account) SetCodeHashWithJournal(codeHash []byte) error
- func (a *Account) SetDataTrie(trie data.Trie)
- func (a *Account) SetNonce(nonce uint64)
- func (a *Account) SetNonceWithJournal(nonce uint64) error
- func (a *Account) SetRootHash(roothash []byte)
- type AccountFactory
- type AccountHandler
- type AccountTracker
- type AccountsAdapter
- type AccountsDB
- func (adb *AccountsDB) CancelPrune(rootHash []byte)
- func (adb *AccountsDB) ClosePersister() error
- func (adb *AccountsDB) Commit() ([]byte, error)
- func (adb *AccountsDB) GetAccountWithJournal(addressContainer AddressContainer) (AccountHandler, error)
- func (adb *AccountsDB) GetExistingAccount(addressContainer AddressContainer) (AccountHandler, error)
- func (adb *AccountsDB) HasAccount(addressContainer AddressContainer) (bool, error)
- func (adb *AccountsDB) IsInterfaceNil() bool
- func (adb *AccountsDB) IsPruningEnabled() bool
- func (adb *AccountsDB) JournalLen() int
- func (adb *AccountsDB) Journalize(entry JournalEntry)
- func (adb *AccountsDB) PruneTrie(rootHash []byte) error
- func (adb *AccountsDB) PutCode(accountHandler AccountHandler, code []byte) error
- func (adb *AccountsDB) RecreateTrie(rootHash []byte) error
- func (adb *AccountsDB) RemoveAccount(addressContainer AddressContainer) error
- func (adb *AccountsDB) RemoveCode(codeHash []byte) error
- func (adb *AccountsDB) RevertToSnapshot(snapshot int) error
- func (adb *AccountsDB) RootHash() ([]byte, error)
- func (adb *AccountsDB) SaveAccount(accountHandler AccountHandler) error
- func (adb *AccountsDB) SaveDataTrie(accountHandler AccountHandler) error
- func (adb *AccountsDB) SetStateCheckpoint(rootHash []byte)
- func (adb *AccountsDB) SnapshotState(rootHash []byte)
- type AddressContainer
- type AddressConverter
- type BaseJournalEntryCodeHash
- type BaseJournalEntryCreation
- type BaseJournalEntryNonce
- type DataTrieTracker
- type ErrMissingTrie
- type ErrorTrieNotNormalized
- type ErrorWrongSize
- type JournalEntry
- type JournalEntryBalance
- type JournalEntryDataTrieUpdates
- type MetaAccount
- func (ma *MetaAccount) AddressContainer() AddressContainer
- func (ma *MetaAccount) DataTrie() data.Trie
- func (ma *MetaAccount) DataTrieTracker() DataTrieTracker
- func (ma *MetaAccount) GetCode() []byte
- func (ma *MetaAccount) GetCodeHash() []byte
- func (ma *MetaAccount) GetNonce() uint64
- func (ma *MetaAccount) GetRootHash() []byte
- func (ma *MetaAccount) IsInterfaceNil() bool
- func (ma *MetaAccount) SetCode(code []byte)
- func (ma *MetaAccount) SetCodeHash(roothash []byte)
- func (ma *MetaAccount) SetCodeHashWithJournal(codeHash []byte) error
- func (ma *MetaAccount) SetDataTrie(trie data.Trie)
- func (ma *MetaAccount) SetMiniBlocksDataWithJournal(miniBlocksData []*MiniBlockData) error
- func (ma *MetaAccount) SetNonce(nonce uint64)
- func (ma *MetaAccount) SetNonceWithJournal(nonce uint64) error
- func (ma *MetaAccount) SetRootHash(roothash []byte)
- func (ma *MetaAccount) SetRoundWithJournal(round uint64) error
- func (ma *MetaAccount) SetShardRootHashWithJournal(shardRootHash []byte) error
- func (ma *MetaAccount) SetTxCountWithJournal(txCount *big.Int) error
- type MetaJournalEntryMiniBlocksData
- type MetaJournalEntryRound
- type MetaJournalEntryShardRootHash
- type MetaJournalEntryTxCount
- type MiniBlockData
- type PeerAccount
- func (pa *PeerAccount) AddressContainer() AddressContainer
- func (pa *PeerAccount) DataTrie() data.Trie
- func (pa *PeerAccount) DataTrieTracker() DataTrieTracker
- func (pa *PeerAccount) DecreaseLeaderSuccessRateWithJournal() error
- func (pa *PeerAccount) DecreaseValidatorSuccessRateWithJournal() error
- func (pa *PeerAccount) GetCode() []byte
- func (pa *PeerAccount) GetCodeHash() []byte
- func (pa *PeerAccount) GetNonce() uint64
- func (pa *PeerAccount) GetRating() uint32
- func (pa *PeerAccount) GetRootHash() []byte
- func (pa *PeerAccount) GetTempRating() uint32
- func (pa *PeerAccount) IncreaseLeaderSuccessRateWithJournal() error
- func (pa *PeerAccount) IncreaseValidatorSuccessRateWithJournal() error
- func (pa *PeerAccount) IsInterfaceNil() bool
- func (pa *PeerAccount) SetBLSPublicKeyWithJournal(pubKey []byte) error
- func (pa *PeerAccount) SetCode(code []byte)
- func (pa *PeerAccount) SetCodeHash(codeHash []byte)
- func (pa *PeerAccount) SetCodeHashWithJournal(codeHash []byte) error
- func (pa *PeerAccount) SetCurrentShardIdWithJournal(shId uint32) error
- func (pa *PeerAccount) SetDataTrie(trie data.Trie)
- func (pa *PeerAccount) SetJailTimeWithJournal(jailTime TimePeriod) error
- func (pa *PeerAccount) SetNextShardIdWithJournal(shId uint32) error
- func (pa *PeerAccount) SetNodeInWaitingListWithJournal(nodeInWaitingList bool) error
- func (pa *PeerAccount) SetNonce(nonce uint64)
- func (pa *PeerAccount) SetNonceWithJournal(nonce uint64) error
- func (pa *PeerAccount) SetRatingWithJournal(rating uint32) error
- func (pa *PeerAccount) SetRewardAddressWithJournal(address []byte) error
- func (pa *PeerAccount) SetRootHash(roothash []byte)
- func (pa *PeerAccount) SetSchnorrPublicKeyWithJournal(pubKey []byte) error
- func (pa *PeerAccount) SetStakeWithJournal(stake *big.Int) error
- func (pa *PeerAccount) SetTempRatingWithJournal(rating uint32) error
- func (pa *PeerAccount) SetUnStakedNonceWithJournal(nonce uint64) error
- type PeerAccountHandler
- type PeerAccountsDB
- type PeerJournalEntryAddress
- type PeerJournalEntryBLSPublicKey
- type PeerJournalEntryCurrentShardId
- type PeerJournalEntryInWaitingList
- type PeerJournalEntryJailTime
- type PeerJournalEntryLeaderSuccessRate
- type PeerJournalEntryNextShardId
- type PeerJournalEntryRating
- type PeerJournalEntrySchnorrPublicKey
- type PeerJournalEntryStake
- type PeerJournalEntryTempRating
- type PeerJournalEntryUnStakedNonce
- type PeerJournalEntryValidatorSuccessRate
- type SignRate
- type TimePeriod
- type TimeStamp
- type TrackableDataTrie
- func (tdaw *TrackableDataTrie) ClearDataCaches()
- func (tdaw *TrackableDataTrie) DataTrie() data.Trie
- func (tdaw *TrackableDataTrie) DirtyData() map[string][]byte
- func (tdaw *TrackableDataTrie) IsInterfaceNil() bool
- func (tdaw *TrackableDataTrie) OriginalValue(key []byte) []byte
- func (tdaw *TrackableDataTrie) RetrieveValue(key []byte) ([]byte, error)
- func (tdaw *TrackableDataTrie) SaveKeyValue(key []byte, value []byte)
- func (tdaw *TrackableDataTrie) SetDataTrie(tr data.Trie)
- type TriesHolder
- type Updater
- type ValidatorApiResponse
Constants ¶
const HashLength = 32
HashLength defines how many bytes are used in a hash
Variables ¶
var ErrAccNotFound = errors.New("account was not found")
ErrAccNotFound signals that account was not found in state trie
var ErrBech32ConvertError = errors.New("can't convert bech32 string")
ErrBech32ConvertError signals that conversion the 5bit alphabet to 8bit failed
var ErrBech32WrongAddr = errors.New("wrong bech32 string")
ErrBech32WrongAddr signals that the string provided might not be in bech32 format
var ErrEmptyAddress = errors.New("empty Address")
ErrEmptyAddress defines the error when trying to work with an empty address
var ErrNegativeValue = errors.New("negative values are not permited")
ErrNegativeValue signals that an operation has been attempted with a negative value
var ErrNilAccountFactory = errors.New("account factory is nil")
ErrNilAccountFactory signals that a nil account factory was provided
var ErrNilAccountHandler = errors.New("account wrapper is nil")
ErrNilAccountHandler signals that a nil account wrapper was provided
var ErrNilAccountTracker = errors.New("nil account tracker provided")
ErrNilAccountTracker signals that a nil account tracker has been provided
var ErrNilAccountsAdapter = errors.New("nil AccountsAdapter")
ErrNilAccountsAdapter defines the error when trying to revert on nil accounts
var ErrNilAddressContainer = errors.New("nil AddressContainer")
ErrNilAddressContainer defines the error when trying to work with a nil address
var ErrNilBLSPublicKey = errors.New("bls public key is nil")
ErrNilBLSPublicKey signals that the provided BLS public key is nil
var ErrNilCode = errors.New("nil smart contract code")
ErrNilCode signals that a nil code was provided
var ErrNilHasher = errors.New("nil hasher")
ErrNilHasher signals that an operation has been attempted to or with a nil hasher implementation
var ErrNilMarshalizer = errors.New("nil marshalizer")
ErrNilMarshalizer signals that an operation has been attempted to or with a nil marshalizer implementation
var ErrNilOrEmptyDataTrieUpdates = errors.New("no data trie updates")
ErrNilOrEmptyDataTrieUpdates signals that there are no data trie updates
var ErrNilOrEmptyKey = errors.New("key is empty or nil")
ErrNilOrEmptyKey signals that key empty key was provided
var ErrNilPubKeysBytes = errors.New("nil public key bytes")
ErrNilPubKeysBytes signals that an operation has been attempted to or with a nil public key slice
var ErrNilSchnorrPublicKey = errors.New("schnorr public key is nil")
ErrNilSchnorrPublicKey signals that the provided schnorr public is nil
var ErrNilShardCoordinator = errors.New("shard coordinator is nil")
ErrNilShardCoordinator signals that nil shard coordinator was provided
var ErrNilStake = errors.New("stake is nil")
ErrNilStake signals that the provided stake is nil
var ErrNilTrackableDataTrie = errors.New("nil trackable data trie")
ErrNilTrackableDataTrie signals that a nil trackable data trie has been provided
var ErrNilTrie = errors.New("trie is nil")
ErrNilTrie signals that a trie is nil and no operation can be made
var ErrNilUpdater = errors.New("updater is nil")
ErrNilUpdater signals that a nil updater has been provided
var ErrUnknownAccountType = errors.New("account type is unknown")
ErrUnknownAccountType signals that the provided account type is unknown
var ErrUnknownShardId = errors.New("shard id is not valid")
ErrUnknownShardId signals that shard id is not valid
var ErrWrongTypeAssertion = errors.New("wrong type assertion")
ErrWrongTypeAssertion signals that a wrong type assertion occurred
Functions ¶
func NewAccountsDbWrapperSync ¶ added in v1.0.77
func NewAccountsDbWrapperSync(adapter AccountsAdapter) (*accountsDbWrapperSync, error)
NewAccountsDbWrapperSync creates a new account manager used when syncing
func NewAddress ¶
func NewAddress(adr []byte) *address
NewAddress creates a new Address with the same byte slice as the parameter received
func NewDataTriesHolder ¶
func NewDataTriesHolder() *dataTriesHolder
NewDataTriesHolder creates a new instance of dataTriesHolder
Types ¶
type Account ¶ added in v1.0.3
type Account struct { Nonce uint64 Balance *big.Int CodeHash []byte RootHash []byte Address []byte // contains filtered or unexported fields }
Account is the struct used in serialization/deserialization
func NewAccount ¶ added in v1.0.3
func NewAccount(addressContainer AddressContainer, tracker AccountTracker) (*Account, error)
NewAccount creates new simple account wrapper for an AccountContainer (that has just been initialized)
func (*Account) AddressContainer ¶ added in v1.0.3
func (a *Account) AddressContainer() AddressContainer
AddressContainer returns the address associated with the account
func (*Account) DataTrie ¶ added in v1.0.3
DataTrie returns the trie that holds the current account's data
func (*Account) DataTrieTracker ¶ added in v1.0.3
func (a *Account) DataTrieTracker() DataTrieTracker
DataTrieTracker returns the trie wrapper used in managing the SC data
func (*Account) GetCode ¶ added in v1.0.3
GetCode gets the actual code that needs to be run in the VM
func (*Account) GetCodeHash ¶ added in v1.0.3
GetCodeHash returns the code hash associated with this account
func (*Account) GetRootHash ¶ added in v1.0.3
GetRootHash returns the root hash associated with this account
func (*Account) IsInterfaceNil ¶ added in v1.0.3
IsInterfaceNil returns true if there is no value under the interface
func (*Account) SetBalanceWithJournal ¶ added in v1.0.3
SetBalanceWithJournal sets the account's balance, saving the old balance before changing
func (*Account) SetCode ¶ added in v1.0.3
SetCode sets the actual code that needs to be run in the VM
func (*Account) SetCodeHash ¶ added in v1.0.3
SetCodeHash sets the code hash associated with the account
func (*Account) SetCodeHashWithJournal ¶ added in v1.0.3
SetCodeHashWithJournal sets the account's code hash, saving the old code hash before changing
func (*Account) SetDataTrie ¶ added in v1.0.3
SetDataTrie sets the trie that holds the current account's data
func (*Account) SetNonceWithJournal ¶ added in v1.0.3
SetNonceWithJournal sets the account's nonce, saving the old nonce before changing
func (*Account) SetRootHash ¶ added in v1.0.3
SetRootHash sets the root hash associated with the account
type AccountFactory ¶
type AccountFactory interface { CreateAccount(address AddressContainer, tracker AccountTracker) (AccountHandler, error) IsInterfaceNil() bool }
AccountFactory creates an account of different types
type AccountHandler ¶
type AccountHandler interface { AddressContainer() AddressContainer GetCodeHash() []byte SetCodeHash([]byte) SetCodeHashWithJournal([]byte) error GetCode() []byte SetCode(code []byte) SetNonce(nonce uint64) GetNonce() uint64 SetNonceWithJournal(nonce uint64) error GetRootHash() []byte SetRootHash([]byte) DataTrie() data.Trie SetDataTrie(trie data.Trie) DataTrieTracker() DataTrieTracker IsInterfaceNil() bool }
AccountHandler models a state account, which can journalize and revert It knows about code and data, as data structures not hashes
type AccountTracker ¶ added in v1.0.3
type AccountTracker interface { SaveAccount(accountHandler AccountHandler) error Journalize(entry JournalEntry) IsInterfaceNil() bool }
AccountTracker saves an account state and journalizes new entries
type AccountsAdapter ¶
type AccountsAdapter interface { GetAccountWithJournal(addressContainer AddressContainer) (AccountHandler, error) // will create if it not exist GetExistingAccount(addressContainer AddressContainer) (AccountHandler, error) HasAccount(addressContainer AddressContainer) (bool, error) RemoveAccount(addressContainer AddressContainer) error Commit() ([]byte, error) JournalLen() int RevertToSnapshot(snapshot int) error RootHash() ([]byte, error) RecreateTrie(rootHash []byte) error PutCode(accountHandler AccountHandler, code []byte) error RemoveCode(codeHash []byte) error SaveDataTrie(accountHandler AccountHandler) error PruneTrie(rootHash []byte) error CancelPrune(rootHash []byte) SnapshotState(rootHash []byte) SetStateCheckpoint(rootHash []byte) IsPruningEnabled() bool ClosePersister() error IsInterfaceNil() bool }
AccountsAdapter is used for the structure that manages the accounts on top of a trie.PatriciaMerkleTrie implementation
type AccountsDB ¶
type AccountsDB struct {
// contains filtered or unexported fields
}
AccountsDB is the struct used for accessing accounts
func NewAccountsDB ¶
func NewAccountsDB( trie data.Trie, hasher hashing.Hasher, marshalizer marshal.Marshalizer, accountFactory AccountFactory, ) (*AccountsDB, error)
NewAccountsDB creates a new account manager
func (*AccountsDB) CancelPrune ¶
func (adb *AccountsDB) CancelPrune(rootHash []byte)
CancelPrune clears the trie's evictionWaitingList
func (*AccountsDB) ClosePersister ¶ added in v1.0.78
func (adb *AccountsDB) ClosePersister() error
ClosePersister will close trie persister
func (*AccountsDB) Commit ¶
func (adb *AccountsDB) Commit() ([]byte, error)
Commit will persist all data inside the trie
func (*AccountsDB) GetAccountWithJournal ¶ added in v1.0.3
func (adb *AccountsDB) GetAccountWithJournal(addressContainer AddressContainer) (AccountHandler, error)
GetAccountWithJournal fetches the account based on the address. Creates an empty account if the account is missing.
func (*AccountsDB) GetExistingAccount ¶
func (adb *AccountsDB) GetExistingAccount(addressContainer AddressContainer) (AccountHandler, error)
GetExistingAccount returns an existing account if exists or nil if missing
func (*AccountsDB) HasAccount ¶ added in v1.0.3
func (adb *AccountsDB) HasAccount(addressContainer AddressContainer) (bool, error)
HasAccount searches for an account based on the address. Errors if something went wrong and outputs if the account exists or not
func (*AccountsDB) IsInterfaceNil ¶
func (adb *AccountsDB) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*AccountsDB) IsPruningEnabled ¶
func (adb *AccountsDB) IsPruningEnabled() bool
IsPruningEnabled returns true if state pruning is enabled
func (*AccountsDB) JournalLen ¶
func (adb *AccountsDB) JournalLen() int
JournalLen will return the number of entries Concurrent safe.
func (*AccountsDB) Journalize ¶ added in v1.0.3
func (adb *AccountsDB) Journalize(entry JournalEntry)
Journalize adds a new object to entries list. Concurrent safe.
func (*AccountsDB) PruneTrie ¶
func (adb *AccountsDB) PruneTrie(rootHash []byte) error
PruneTrie removes old values from the trie database
func (*AccountsDB) PutCode ¶ added in v1.0.3
func (adb *AccountsDB) PutCode(accountHandler AccountHandler, code []byte) error
PutCode sets the SC plain code in AccountHandler object and trie, code hash in AccountState. Errors if something went wrong
func (*AccountsDB) RecreateTrie ¶
func (adb *AccountsDB) RecreateTrie(rootHash []byte) error
RecreateTrie is used to reload the trie based on an existing rootHash
func (*AccountsDB) RemoveAccount ¶
func (adb *AccountsDB) RemoveAccount(addressContainer AddressContainer) error
RemoveAccount removes the account data from underlying trie. It basically calls Update with empty slice
func (*AccountsDB) RemoveCode ¶ added in v1.0.3
func (adb *AccountsDB) RemoveCode(codeHash []byte) error
RemoveCode deletes the code from the trie. It writes an empty byte slice at codeHash "address"
func (*AccountsDB) RevertToSnapshot ¶
func (adb *AccountsDB) RevertToSnapshot(snapshot int) error
RevertToSnapshot apply Revert method over accounts object and removes entries from the list If snapshot > len(entries) will do nothing, return will be nil 0 index based. Calling this method with negative value will do nothing. Calling with 0 revert everything. Concurrent safe.
func (*AccountsDB) RootHash ¶
func (adb *AccountsDB) RootHash() ([]byte, error)
RootHash returns the main trie's root hash
func (*AccountsDB) SaveAccount ¶
func (adb *AccountsDB) SaveAccount(accountHandler AccountHandler) error
SaveAccount saves the account WITHOUT data trie inside main trie. Errors if something went wrong
func (*AccountsDB) SaveDataTrie ¶ added in v1.0.3
func (adb *AccountsDB) SaveDataTrie(accountHandler AccountHandler) error
SaveDataTrie is used to save the data trie (not committing it) and to recompute the new Root value If data is not dirtied, method will not create its JournalEntries to keep track of data modification
func (*AccountsDB) SetStateCheckpoint ¶
func (adb *AccountsDB) SetStateCheckpoint(rootHash []byte)
SetStateCheckpoint sets a checkpoint for the state trie
func (*AccountsDB) SnapshotState ¶
func (adb *AccountsDB) SnapshotState(rootHash []byte)
SnapshotState triggers the snapshotting process of the state trie
type AddressContainer ¶
AddressContainer models what an Address struct should do
type AddressConverter ¶
type AddressConverter interface { AddressLen() int CreateAddressFromPublicKeyBytes(pubKey []byte) (AddressContainer, error) ConvertToHex(addressContainer AddressContainer) (string, error) CreateAddressFromHex(hexAddress string) (AddressContainer, error) PrepareAddressBytes(addressBytes []byte) ([]byte, error) IsInterfaceNil() bool }
AddressConverter is used to convert to/from AddressContainer
type BaseJournalEntryCodeHash ¶ added in v1.0.3
type BaseJournalEntryCodeHash struct {
// contains filtered or unexported fields
}
BaseJournalEntryCodeHash creates a code hash change in account
func NewBaseJournalEntryCodeHash ¶ added in v1.0.3
func NewBaseJournalEntryCodeHash(account AccountHandler, oldCodeHash []byte) (*BaseJournalEntryCodeHash, error)
NewBaseJournalEntryCodeHash outputs a new BaseJournalEntry implementation used to save and revert a code hash change
func (*BaseJournalEntryCodeHash) IsInterfaceNil ¶ added in v1.0.16
func (bjech *BaseJournalEntryCodeHash) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*BaseJournalEntryCodeHash) Revert ¶ added in v1.0.3
func (bjech *BaseJournalEntryCodeHash) Revert() (AccountHandler, error)
Revert applies undo operation
type BaseJournalEntryCreation ¶ added in v1.0.3
type BaseJournalEntryCreation struct {
// contains filtered or unexported fields
}
BaseJournalEntryCreation creates a new account entry in the state trie through updater it can revert the created changes.
func NewBaseJournalEntryCreation ¶ added in v1.0.3
func NewBaseJournalEntryCreation(key []byte, updater Updater) (*BaseJournalEntryCreation, error)
NewBaseJournalEntryCreation outputs a new BaseJournalEntry implementation used to revert an account creation
func (*BaseJournalEntryCreation) IsInterfaceNil ¶ added in v1.0.16
func (bjec *BaseJournalEntryCreation) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*BaseJournalEntryCreation) Revert ¶ added in v1.0.3
func (bjec *BaseJournalEntryCreation) Revert() (AccountHandler, error)
Revert applies undo operation
type BaseJournalEntryNonce ¶ added in v1.0.11
type BaseJournalEntryNonce struct {
// contains filtered or unexported fields
}
BaseJournalEntryNonce is used to revert a nonce change
func NewBaseJournalEntryNonce ¶ added in v1.0.11
func NewBaseJournalEntryNonce(account AccountHandler, oldNonce uint64) (*BaseJournalEntryNonce, error)
NewBaseJournalEntryNonce outputs a new JournalEntry implementation used to revert a nonce change
func (*BaseJournalEntryNonce) IsInterfaceNil ¶ added in v1.0.16
func (bjen *BaseJournalEntryNonce) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*BaseJournalEntryNonce) Revert ¶ added in v1.0.11
func (bjen *BaseJournalEntryNonce) Revert() (AccountHandler, error)
Revert applies undo operation
type DataTrieTracker ¶
type DataTrieTracker interface { ClearDataCaches() DirtyData() map[string][]byte OriginalValue(key []byte) []byte RetrieveValue(key []byte) ([]byte, error) SaveKeyValue(key []byte, value []byte) SetDataTrie(tr data.Trie) DataTrie() data.Trie IsInterfaceNil() bool }
DataTrieTracker models what how to manipulate data held by a SC account
type ErrMissingTrie ¶
type ErrMissingTrie struct {
// contains filtered or unexported fields
}
ErrMissingTrie is an error-compatible struct holding the root hash of the trie that is missing
func NewErrMissingTrie ¶
func NewErrMissingTrie(rootHash []byte) *ErrMissingTrie
NewErrMissingTrie returns a new instantiated struct
func (*ErrMissingTrie) Error ¶
func (e *ErrMissingTrie) Error() string
Error returns the error as string
type ErrorTrieNotNormalized ¶
type ErrorTrieNotNormalized struct {
// contains filtered or unexported fields
}
ErrorTrieNotNormalized is an error-compatible struct holding the hash length that is not normalized
func NewErrorTrieNotNormalized ¶
func NewErrorTrieNotNormalized(exp int, actual int) *ErrorTrieNotNormalized
NewErrorTrieNotNormalized returns a new instantiated struct
func (*ErrorTrieNotNormalized) Error ¶
func (e *ErrorTrieNotNormalized) Error() string
Error returns the error as string
type ErrorWrongSize ¶
ErrorWrongSize is an error-compatible struct holding 2 values: Expected and Got
func NewErrorWrongSize ¶
func NewErrorWrongSize(exp int, got int) *ErrorWrongSize
NewErrorWrongSize returns a new instantiated struct
func (*ErrorWrongSize) Error ¶
func (e *ErrorWrongSize) Error() string
Error returns the error as string
type JournalEntry ¶
type JournalEntry interface { Revert() (AccountHandler, error) IsInterfaceNil() bool }
JournalEntry will be used to implement different state changes to be able to easily revert them
type JournalEntryBalance ¶ added in v1.0.3
type JournalEntryBalance struct {
// contains filtered or unexported fields
}
JournalEntryBalance is used to revert a balance change
func NewJournalEntryBalance ¶ added in v1.0.3
func NewJournalEntryBalance(account *Account, oldBalance *big.Int) (*JournalEntryBalance, error)
NewJournalEntryBalance outputs a new JournalEntry implementation used to revert a balance change
func (*JournalEntryBalance) IsInterfaceNil ¶ added in v1.0.16
func (jeb *JournalEntryBalance) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*JournalEntryBalance) Revert ¶ added in v1.0.3
func (jeb *JournalEntryBalance) Revert() (AccountHandler, error)
Revert applies undo operation
type JournalEntryDataTrieUpdates ¶ added in v1.0.61
type JournalEntryDataTrieUpdates struct {
// contains filtered or unexported fields
}
JournalEntryDataTrieUpdates stores all the updates done to the account's data trie, so it can be reverted in case of rollback
func NewJournalEntryDataTrieUpdates ¶
func NewJournalEntryDataTrieUpdates(trieUpdates map[string][]byte, account AccountHandler) (*JournalEntryDataTrieUpdates, error)
NewJournalEntryDataTrieUpdates outputs a new JournalEntryDataTrieUpdates implementation used to revert an account's data trie
func (*JournalEntryDataTrieUpdates) IsInterfaceNil ¶ added in v1.0.61
func (jedtu *JournalEntryDataTrieUpdates) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*JournalEntryDataTrieUpdates) Revert ¶ added in v1.0.61
func (jedtu *JournalEntryDataTrieUpdates) Revert() (AccountHandler, error)
Revert applies undo operation
type MetaAccount ¶ added in v1.0.3
type MetaAccount struct { Round uint64 Nonce uint64 TxCount *big.Int CodeHash []byte RootHash []byte MiniBlocks []*MiniBlockData PubKeyLeader []byte ShardRootHash []byte Address []byte // contains filtered or unexported fields }
MetaAccount is the struct used in serialization/deserialization
func NewMetaAccount ¶ added in v1.0.3
func NewMetaAccount(addressContainer AddressContainer, tracker AccountTracker) (*MetaAccount, error)
NewMetaAccount creates new simple meta account for an AccountContainer (that has just been initialized)
func (*MetaAccount) AddressContainer ¶ added in v1.0.3
func (ma *MetaAccount) AddressContainer() AddressContainer
AddressContainer returns the address associated with the account
func (*MetaAccount) DataTrie ¶ added in v1.0.3
func (ma *MetaAccount) DataTrie() data.Trie
DataTrie returns the trie that holds the current account's data
func (*MetaAccount) DataTrieTracker ¶ added in v1.0.3
func (ma *MetaAccount) DataTrieTracker() DataTrieTracker
DataTrieTracker returns the trie wrapper used in managing the SC data
func (*MetaAccount) GetCode ¶ added in v1.0.3
func (ma *MetaAccount) GetCode() []byte
GetCode gets the actual code that needs to be run in the VM
func (*MetaAccount) GetCodeHash ¶ added in v1.0.3
func (ma *MetaAccount) GetCodeHash() []byte
GetCodeHash returns the code hash associated with this account
func (*MetaAccount) GetNonce ¶ added in v1.0.3
func (ma *MetaAccount) GetNonce() uint64
GetNonce gets the nonce of the account
func (*MetaAccount) GetRootHash ¶ added in v1.0.3
func (ma *MetaAccount) GetRootHash() []byte
GetRootHash returns the root hash associated with this account
func (*MetaAccount) IsInterfaceNil ¶ added in v1.0.3
func (ma *MetaAccount) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MetaAccount) SetCode ¶ added in v1.0.3
func (ma *MetaAccount) SetCode(code []byte)
SetCode sets the actual code that needs to be run in the VM
func (*MetaAccount) SetCodeHash ¶ added in v1.0.3
func (ma *MetaAccount) SetCodeHash(roothash []byte)
SetCodeHash sets the code hash associated with the account
func (*MetaAccount) SetCodeHashWithJournal ¶ added in v1.0.3
func (ma *MetaAccount) SetCodeHashWithJournal(codeHash []byte) error
SetCodeHashWithJournal sets the account's code hash, saving the old code hash before changing
func (*MetaAccount) SetDataTrie ¶ added in v1.0.3
func (ma *MetaAccount) SetDataTrie(trie data.Trie)
SetDataTrie sets the trie that holds the current account's data
func (*MetaAccount) SetMiniBlocksDataWithJournal ¶ added in v1.0.3
func (ma *MetaAccount) SetMiniBlocksDataWithJournal(miniBlocksData []*MiniBlockData) error
SetMiniBlocksDataWithJournal sets the current final mini blocks header data, saving the old mini blocks header data before changing
func (*MetaAccount) SetNonce ¶ added in v1.0.3
func (ma *MetaAccount) SetNonce(nonce uint64)
SetNonce saves the nonce to the account
func (*MetaAccount) SetNonceWithJournal ¶ added in v1.0.3
func (ma *MetaAccount) SetNonceWithJournal(nonce uint64) error
SetNonceWithJournal sets the account's nonce, saving the old nonce before changing
func (*MetaAccount) SetRootHash ¶ added in v1.0.3
func (ma *MetaAccount) SetRootHash(roothash []byte)
SetRootHash sets the root hash associated with the account
func (*MetaAccount) SetRoundWithJournal ¶ added in v1.0.3
func (ma *MetaAccount) SetRoundWithJournal(round uint64) error
SetRoundWithJournal sets the account's round, saving the old round before changing
func (*MetaAccount) SetShardRootHashWithJournal ¶ added in v1.0.3
func (ma *MetaAccount) SetShardRootHashWithJournal(shardRootHash []byte) error
SetShardRootHashWithJournal sets the account's root hash, saving the old root hash before changing
func (*MetaAccount) SetTxCountWithJournal ¶ added in v1.0.3
func (ma *MetaAccount) SetTxCountWithJournal(txCount *big.Int) error
SetTxCountWithJournal sets the total tx count for this shard, saving the old txCount before changing
type MetaJournalEntryMiniBlocksData ¶ added in v1.0.3
type MetaJournalEntryMiniBlocksData struct {
// contains filtered or unexported fields
}
MetaJournalEntryMiniBlocksData is used to revert a round change
func NewMetaJournalEntryMiniBlocksData ¶ added in v1.0.3
func NewMetaJournalEntryMiniBlocksData(account *MetaAccount, oldMiniBlocksData []*MiniBlockData) (*MetaJournalEntryMiniBlocksData, error)
NewMetaJournalEntryMiniBlocksData outputs a new JournalEntry implementation used to revert a MiniBlocksData change
func (*MetaJournalEntryMiniBlocksData) IsInterfaceNil ¶ added in v1.0.16
func (mjembd *MetaJournalEntryMiniBlocksData) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MetaJournalEntryMiniBlocksData) Revert ¶ added in v1.0.3
func (mjembd *MetaJournalEntryMiniBlocksData) Revert() (AccountHandler, error)
Revert applies undo operation
type MetaJournalEntryRound ¶ added in v1.0.3
type MetaJournalEntryRound struct {
// contains filtered or unexported fields
}
MetaJournalEntryRound is used to revert a round change
func NewMetaJournalEntryRound ¶ added in v1.0.3
func NewMetaJournalEntryRound(account *MetaAccount, oldRound uint64) (*MetaJournalEntryRound, error)
NewMetaJournalEntryRound outputs a new JournalEntry implementation used to revert a round change
func (*MetaJournalEntryRound) IsInterfaceNil ¶ added in v1.0.16
func (mjer *MetaJournalEntryRound) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MetaJournalEntryRound) Revert ¶ added in v1.0.3
func (mjer *MetaJournalEntryRound) Revert() (AccountHandler, error)
Revert applies undo operation
type MetaJournalEntryShardRootHash ¶ added in v1.0.3
type MetaJournalEntryShardRootHash struct {
// contains filtered or unexported fields
}
MetaJournalEntryShardRootHash is used to revert a round change
func NewMetaJournalEntryShardRootHash ¶ added in v1.0.3
func NewMetaJournalEntryShardRootHash(account *MetaAccount, oldShardRootHash []byte) (*MetaJournalEntryShardRootHash, error)
NewMetaJournalEntryShardRootHash outputs a new JournalEntry implementation used to revert a ShardRootHash change
func (*MetaJournalEntryShardRootHash) IsInterfaceNil ¶ added in v1.0.16
func (mjesrh *MetaJournalEntryShardRootHash) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MetaJournalEntryShardRootHash) Revert ¶ added in v1.0.3
func (mjesrh *MetaJournalEntryShardRootHash) Revert() (AccountHandler, error)
Revert applies undo operation
type MetaJournalEntryTxCount ¶ added in v1.0.3
type MetaJournalEntryTxCount struct {
// contains filtered or unexported fields
}
MetaJournalEntryTxCount is used to revert a round change
func NewMetaJournalEntryTxCount ¶ added in v1.0.3
func NewMetaJournalEntryTxCount(account *MetaAccount, oldTxCount *big.Int) (*MetaJournalEntryTxCount, error)
NewMetaJournalEntryTxCount outputs a new JournalEntry implementation used to revert a TxCount change
func (*MetaJournalEntryTxCount) IsInterfaceNil ¶ added in v1.0.16
func (mjetc *MetaJournalEntryTxCount) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MetaJournalEntryTxCount) Revert ¶ added in v1.0.3
func (mjetc *MetaJournalEntryTxCount) Revert() (AccountHandler, error)
Revert applies undo operation
type MiniBlockData ¶ added in v1.0.3
type MiniBlockData struct { Hash []byte ReceiverShardId uint32 SenderShardId uint32 TxCount uint32 }
MiniBlockData is the data to be saved in shard account for any shard
type PeerAccount ¶ added in v1.0.20
type PeerAccount struct { BLSPublicKey []byte SchnorrPublicKey []byte RewardAddress []byte Stake *big.Int JailTime TimePeriod PastJailTimes []TimePeriod CurrentShardId uint32 NextShardId uint32 NodeInWaitingList bool UnStakedNonce uint64 ValidatorSuccessRate SignRate LeaderSuccessRate SignRate CodeHash []byte Rating uint32 TempRating uint32 RootHash []byte Nonce uint64 // contains filtered or unexported fields }
PeerAccount is the struct used in serialization/deserialization
func NewPeerAccount ¶
func NewPeerAccount( addressContainer AddressContainer, tracker AccountTracker, ) (*PeerAccount, error)
NewPeerAccount creates new simple account wrapper for an PeerAccountContainer (that has just been initialized)
func (*PeerAccount) AddressContainer ¶ added in v1.0.20
func (pa *PeerAccount) AddressContainer() AddressContainer
AddressContainer returns the address associated with the account
func (*PeerAccount) DataTrie ¶ added in v1.0.20
func (pa *PeerAccount) DataTrie() data.Trie
DataTrie returns the trie that holds the current account's data
func (*PeerAccount) DataTrieTracker ¶ added in v1.0.20
func (pa *PeerAccount) DataTrieTracker() DataTrieTracker
DataTrieTracker returns the trie wrapper used in managing the SC data
func (*PeerAccount) DecreaseLeaderSuccessRateWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) DecreaseLeaderSuccessRateWithJournal() error
DecreaseLeaderSuccessRateWithJournal increases the account's number of missing signing, saving the old state before changing
func (*PeerAccount) DecreaseValidatorSuccessRateWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) DecreaseValidatorSuccessRateWithJournal() error
DecreaseValidatorSuccessRateWithJournal increases the account's number of missed signing, saving the old state before changing
func (*PeerAccount) GetCode ¶ added in v1.0.20
func (pa *PeerAccount) GetCode() []byte
GetCode gets the actual code that needs to be run in the VM
func (*PeerAccount) GetCodeHash ¶ added in v1.0.20
func (pa *PeerAccount) GetCodeHash() []byte
GetCodeHash returns the code hash associated with this account
func (*PeerAccount) GetNonce ¶ added in v1.0.20
func (pa *PeerAccount) GetNonce() uint64
GetNonce gets the nonce of the account
func (*PeerAccount) GetRating ¶ added in v1.0.67
func (pa *PeerAccount) GetRating() uint32
GetRating gets the rating
func (*PeerAccount) GetRootHash ¶ added in v1.0.20
func (pa *PeerAccount) GetRootHash() []byte
GetRootHash returns the root hash associated with this account
func (*PeerAccount) GetTempRating ¶ added in v1.0.67
func (pa *PeerAccount) GetTempRating() uint32
GetTempRating gets the rating
func (*PeerAccount) IncreaseLeaderSuccessRateWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) IncreaseLeaderSuccessRateWithJournal() error
IncreaseLeaderSuccessRateWithJournal increases the account's number of successful signing, saving the old state before changing
func (*PeerAccount) IncreaseValidatorSuccessRateWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) IncreaseValidatorSuccessRateWithJournal() error
IncreaseValidatorSuccessRateWithJournal increases the account's number of successful signing, saving the old state before changing
func (*PeerAccount) IsInterfaceNil ¶ added in v1.0.20
func (pa *PeerAccount) IsInterfaceNil() bool
IsInterfaceNil return if there is no value under the interface
func (*PeerAccount) SetBLSPublicKeyWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetBLSPublicKeyWithJournal(pubKey []byte) error
SetBLSPublicKeyWithJournal sets the account's bls public key, saving the old key before changing
func (*PeerAccount) SetCode ¶ added in v1.0.20
func (pa *PeerAccount) SetCode(code []byte)
SetCode sets the actual code that needs to be run in the VM
func (*PeerAccount) SetCodeHash ¶ added in v1.0.20
func (pa *PeerAccount) SetCodeHash(codeHash []byte)
SetCodeHash sets the code hash associated with the account
func (*PeerAccount) SetCodeHashWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetCodeHashWithJournal(codeHash []byte) error
SetCodeHashWithJournal sets the account's code hash, saving the old code hash before changing
func (*PeerAccount) SetCurrentShardIdWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetCurrentShardIdWithJournal(shId uint32) error
SetCurrentShardIdWithJournal sets the account's shard id, saving the old state before changing
func (*PeerAccount) SetDataTrie ¶ added in v1.0.20
func (pa *PeerAccount) SetDataTrie(trie data.Trie)
SetDataTrie sets the trie that holds the current account's data
func (*PeerAccount) SetJailTimeWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetJailTimeWithJournal(jailTime TimePeriod) error
SetJailTimeWithJournal sets the account's jail time, saving the old state before changing
func (*PeerAccount) SetNextShardIdWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetNextShardIdWithJournal(shId uint32) error
SetNextShardIdWithJournal sets the account's shard id, saving the old state before changing
func (*PeerAccount) SetNodeInWaitingListWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetNodeInWaitingListWithJournal(nodeInWaitingList bool) error
SetNodeInWaitingListWithJournal sets the account's nodes status whether in waiting list, saving the old state before
func (*PeerAccount) SetNonce ¶ added in v1.0.20
func (pa *PeerAccount) SetNonce(nonce uint64)
SetNonce saves the nonce to the account
func (*PeerAccount) SetNonceWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetNonceWithJournal(nonce uint64) error
SetNonceWithJournal sets the account's nonce, saving the old nonce before changing
func (*PeerAccount) SetRatingWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetRatingWithJournal(rating uint32) error
SetRatingWithJournal sets the account's rating id, saving the old state before changing
func (*PeerAccount) SetRewardAddressWithJournal ¶ added in v1.0.74
func (pa *PeerAccount) SetRewardAddressWithJournal(address []byte) error
SetRewardAddressWithJournal sets the account's reward address, saving the old address before changing
func (*PeerAccount) SetRootHash ¶ added in v1.0.20
func (pa *PeerAccount) SetRootHash(roothash []byte)
SetRootHash sets the root hash associated with the account
func (*PeerAccount) SetSchnorrPublicKeyWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetSchnorrPublicKeyWithJournal(pubKey []byte) error
SetSchnorrPublicKeyWithJournal sets the account's public key, saving the old key before changing
func (*PeerAccount) SetStakeWithJournal ¶ added in v1.0.20
func (pa *PeerAccount) SetStakeWithJournal(stake *big.Int) error
SetStakeWithJournal sets the account's stake, saving the old stake before changing
func (*PeerAccount) SetTempRatingWithJournal ¶ added in v1.0.67
func (pa *PeerAccount) SetTempRatingWithJournal(rating uint32) error
SetTempRatingWithJournal sets the account's tempRating, saving the old state before changing
func (*PeerAccount) SetUnStakedNonceWithJournal ¶ added in v1.0.39
func (pa *PeerAccount) SetUnStakedNonceWithJournal(nonce uint64) error
SetUnStakedNonceWithJournal sets the account's shard id, saving the old state before changing
type PeerAccountHandler ¶
type PeerAccountHandler interface { AccountHandler IncreaseLeaderSuccessRateWithJournal() error DecreaseLeaderSuccessRateWithJournal() error IncreaseValidatorSuccessRateWithJournal() error DecreaseValidatorSuccessRateWithJournal() error GetRating() uint32 SetRatingWithJournal(uint322 uint32) error GetTempRating() uint32 SetTempRatingWithJournal(uint322 uint32) error }
PeerAccountHandler models a peer state account, which can journalize a normal account's data
with some extra features like signing statistics or rating information
type PeerAccountsDB ¶
type PeerAccountsDB struct {
*AccountsDB
}
PeerAccountsDB will save and synchronize data from peer processor, plus will synchronize with nodesCoordinator
func NewPeerAccountsDB ¶
func NewPeerAccountsDB( trie data.Trie, hasher hashing.Hasher, marshalizer marshal.Marshalizer, accountFactory AccountFactory, ) (*PeerAccountsDB, error)
NewPeerAccountsDB creates a new account manager
type PeerJournalEntryAddress ¶ added in v1.0.20
type PeerJournalEntryAddress struct {
// contains filtered or unexported fields
}
PeerJournalEntryAddress is used to revert a round change
func NewPeerJournalEntryAddress ¶ added in v1.0.20
func NewPeerJournalEntryAddress(account *PeerAccount, oldAddress []byte) (*PeerJournalEntryAddress, error)
NewPeerJournalEntryAddress outputs a new PeerJournalEntry implementation used to revert a round change
func (*PeerJournalEntryAddress) IsInterfaceNil ¶ added in v1.0.20
func (pje *PeerJournalEntryAddress) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryAddress) Revert ¶ added in v1.0.20
func (pje *PeerJournalEntryAddress) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryBLSPublicKey ¶ added in v1.0.20
type PeerJournalEntryBLSPublicKey struct {
// contains filtered or unexported fields
}
PeerJournalEntryBLSPublicKey is used to revert a round change
func NewPeerJournalEntryBLSPublicKey ¶ added in v1.0.20
func NewPeerJournalEntryBLSPublicKey(account *PeerAccount, oldBLSPubKey []byte) (*PeerJournalEntryBLSPublicKey, error)
NewPeerJournalEntryBLSPublicKey outputs a new PeerJournalEntryBLSPublicKey implementation used to revert a round change
func (*PeerJournalEntryBLSPublicKey) IsInterfaceNil ¶ added in v1.0.20
func (pjeb *PeerJournalEntryBLSPublicKey) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryBLSPublicKey) Revert ¶ added in v1.0.20
func (pjeb *PeerJournalEntryBLSPublicKey) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryCurrentShardId ¶ added in v1.0.20
type PeerJournalEntryCurrentShardId struct {
// contains filtered or unexported fields
}
PeerJournalEntryCurrentShardId is used to revert a shardId change
func NewPeerJournalEntryCurrentShardId ¶ added in v1.0.20
func NewPeerJournalEntryCurrentShardId(account *PeerAccount, oldShardId uint32) (*PeerJournalEntryCurrentShardId, error)
NewPeerJournalEntryCurrentShardId outputs a new PeerJournalEntryCurrentShardId implementation used to revert a state change
func (*PeerJournalEntryCurrentShardId) IsInterfaceNil ¶ added in v1.0.20
func (pjec *PeerJournalEntryCurrentShardId) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryCurrentShardId) Revert ¶ added in v1.0.20
func (pjec *PeerJournalEntryCurrentShardId) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryInWaitingList ¶ added in v1.0.20
type PeerJournalEntryInWaitingList struct {
// contains filtered or unexported fields
}
PeerJournalEntryInWaitingList is used to revert a shardId change
func NewPeerJournalEntryInWaitingList ¶ added in v1.0.20
func NewPeerJournalEntryInWaitingList( account *PeerAccount, oldNodeInWaitingList bool, ) (*PeerJournalEntryInWaitingList, error)
NewPeerJournalEntryInWaitingList outputs a new PeerJournalEntryInWaitingList implementation used to revert a state change
func (*PeerJournalEntryInWaitingList) IsInterfaceNil ¶ added in v1.0.20
func (pjew *PeerJournalEntryInWaitingList) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryInWaitingList) Revert ¶ added in v1.0.20
func (pjew *PeerJournalEntryInWaitingList) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryJailTime ¶ added in v1.0.20
type PeerJournalEntryJailTime struct {
// contains filtered or unexported fields
}
PeerJournalEntryJailTime is used to revert a balance change
func NewPeerJournalEntryJailTime ¶ added in v1.0.20
func NewPeerJournalEntryJailTime(account *PeerAccount, oldJailTime TimePeriod) (*PeerJournalEntryJailTime, error)
NewPeerJournalEntryJailTime outputs a new PeerJournalEntryJailTime implementation used to revert a state change
func (*PeerJournalEntryJailTime) IsInterfaceNil ¶ added in v1.0.20
func (pjej *PeerJournalEntryJailTime) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryJailTime) Revert ¶ added in v1.0.20
func (pjej *PeerJournalEntryJailTime) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryLeaderSuccessRate ¶ added in v1.0.20
type PeerJournalEntryLeaderSuccessRate struct {
// contains filtered or unexported fields
}
PeerJournalEntryLeaderSuccessRate is used to revert a success rate change
func NewPeerJournalEntryLeaderSuccessRate ¶ added in v1.0.20
func NewPeerJournalEntryLeaderSuccessRate( account *PeerAccount, oldLeaderSuccessRate SignRate, ) (*PeerJournalEntryLeaderSuccessRate, error)
NewPeerJournalEntryLeaderSuccessRate outputs a new PeerJournalEntryLeaderSuccessRate implementation used to revert a state change
func (*PeerJournalEntryLeaderSuccessRate) IsInterfaceNil ¶ added in v1.0.20
func (pjel *PeerJournalEntryLeaderSuccessRate) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryLeaderSuccessRate) Revert ¶ added in v1.0.20
func (pjel *PeerJournalEntryLeaderSuccessRate) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryNextShardId ¶ added in v1.0.20
type PeerJournalEntryNextShardId struct {
// contains filtered or unexported fields
}
PeerJournalEntryNextShardId is used to revert a shardId change
func NewPeerJournalEntryNextShardId ¶ added in v1.0.20
func NewPeerJournalEntryNextShardId(account *PeerAccount, oldShardId uint32) (*PeerJournalEntryNextShardId, error)
NewPeerJournalEntryNextShardId outputs a new PeerJournalEntryNextShardId implementation used to revert a state change
func (*PeerJournalEntryNextShardId) IsInterfaceNil ¶ added in v1.0.20
func (pjen *PeerJournalEntryNextShardId) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryNextShardId) Revert ¶ added in v1.0.20
func (pjen *PeerJournalEntryNextShardId) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryRating ¶ added in v1.0.20
type PeerJournalEntryRating struct {
// contains filtered or unexported fields
}
PeerJournalEntryRating is used to revert a rating change
func NewPeerJournalEntryRating ¶ added in v1.0.20
func NewPeerJournalEntryRating(account *PeerAccount, oldRating uint32) (*PeerJournalEntryRating, error)
NewPeerJournalEntryRating outputs a new PeerJournalEntryRating implementation used to revert a state change
func (*PeerJournalEntryRating) IsInterfaceNil ¶ added in v1.0.20
func (pjer *PeerJournalEntryRating) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryRating) Revert ¶ added in v1.0.20
func (pjer *PeerJournalEntryRating) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntrySchnorrPublicKey ¶ added in v1.0.20
type PeerJournalEntrySchnorrPublicKey struct {
// contains filtered or unexported fields
}
PeerJournalEntrySchnorrPublicKey is used to revert a round change
func NewPeerJournalEntrySchnorrPublicKey ¶ added in v1.0.20
func NewPeerJournalEntrySchnorrPublicKey( account *PeerAccount, oldSchnorrPubKey []byte, ) (*PeerJournalEntrySchnorrPublicKey, error)
NewPeerJournalEntrySchnorrPublicKey outputs a new PeerJournalEntrySchnorrPublicKey implementation used to revert a round change
func (*PeerJournalEntrySchnorrPublicKey) IsInterfaceNil ¶ added in v1.0.20
func (jens *PeerJournalEntrySchnorrPublicKey) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntrySchnorrPublicKey) Revert ¶ added in v1.0.20
func (jens *PeerJournalEntrySchnorrPublicKey) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryStake ¶ added in v1.0.20
type PeerJournalEntryStake struct {
// contains filtered or unexported fields
}
PeerJournalEntryStake is used to revert a stake change
func NewPeerJournalEntryStake ¶ added in v1.0.20
func NewPeerJournalEntryStake(account *PeerAccount, oldStake *big.Int) (*PeerJournalEntryStake, error)
NewPeerJournalEntryStake outputs a new PeerJournalEntryStake implementation used to revert a stake change
func (*PeerJournalEntryStake) IsInterfaceNil ¶ added in v1.0.20
func (pjes *PeerJournalEntryStake) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryStake) Revert ¶ added in v1.0.20
func (pjes *PeerJournalEntryStake) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryTempRating ¶ added in v1.0.67
type PeerJournalEntryTempRating struct {
// contains filtered or unexported fields
}
PeerJournalEntryTempRating is used to revert a rating change
func NewPeerJournalEntryTempRating ¶ added in v1.0.67
func NewPeerJournalEntryTempRating(account *PeerAccount, oldTempRating uint32) (*PeerJournalEntryTempRating, error)
NewPeerJournalEntryTempRating outputs a new PeerJournalEntryTempRating implementation used to revert a state change
func (*PeerJournalEntryTempRating) IsInterfaceNil ¶ added in v1.0.67
func (pjer *PeerJournalEntryTempRating) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryTempRating) Revert ¶ added in v1.0.67
func (pjer *PeerJournalEntryTempRating) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryUnStakedNonce ¶ added in v1.0.39
type PeerJournalEntryUnStakedNonce struct {
// contains filtered or unexported fields
}
PeerJournalEntryUnStakedNonce is used to revert a unstaked nonce change
func NewPeerJournalEntryUnStakedNonce ¶ added in v1.0.39
func NewPeerJournalEntryUnStakedNonce(account *PeerAccount, oldUnStakedNonce uint64) (*PeerJournalEntryUnStakedNonce, error)
NewPeerJournalEntryUnStakedNonce outputs a new PeerJournalEntryUnStakedNonce implementation used to revert a state change
func (*PeerJournalEntryUnStakedNonce) IsInterfaceNil ¶ added in v1.0.39
func (pjec *PeerJournalEntryUnStakedNonce) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryUnStakedNonce) Revert ¶ added in v1.0.39
func (pjec *PeerJournalEntryUnStakedNonce) Revert() (AccountHandler, error)
Revert applies undo operation
type PeerJournalEntryValidatorSuccessRate ¶ added in v1.0.20
type PeerJournalEntryValidatorSuccessRate struct {
// contains filtered or unexported fields
}
PeerJournalEntryValidatorSuccessRate is used to revert a success rate change
func NewPeerJournalEntryValidatorSuccessRate ¶ added in v1.0.20
func NewPeerJournalEntryValidatorSuccessRate( account *PeerAccount, oldValidatorSuccessRate SignRate, ) (*PeerJournalEntryValidatorSuccessRate, error)
NewPeerJournalEntryValidatorSuccessRate outputs a new PeerJournalEntryValidatorSuccessRate implementation used to revert a state change
func (*PeerJournalEntryValidatorSuccessRate) IsInterfaceNil ¶ added in v1.0.20
func (pjev *PeerJournalEntryValidatorSuccessRate) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*PeerJournalEntryValidatorSuccessRate) Revert ¶ added in v1.0.20
func (pjev *PeerJournalEntryValidatorSuccessRate) Revert() (AccountHandler, error)
Revert applies undo operation
type TimePeriod ¶
TimePeriod holds start and end time
type TrackableDataTrie ¶
type TrackableDataTrie struct {
// contains filtered or unexported fields
}
TrackableDataTrie wraps a PatriciaMerkelTrie adding modifying data capabilities
func NewTrackableDataTrie ¶
func NewTrackableDataTrie(identifier []byte, tr data.Trie) *TrackableDataTrie
NewTrackableDataTrie returns an instance of DataTrieTracker
func (*TrackableDataTrie) ClearDataCaches ¶
func (tdaw *TrackableDataTrie) ClearDataCaches()
ClearDataCaches empties the dirtyData map and original map
func (*TrackableDataTrie) DataTrie ¶
func (tdaw *TrackableDataTrie) DataTrie() data.Trie
DataTrie sets the internal data trie
func (*TrackableDataTrie) DirtyData ¶
func (tdaw *TrackableDataTrie) DirtyData() map[string][]byte
DirtyData returns the map of (key, value) pairs that contain the data needed to be saved in the data trie
func (*TrackableDataTrie) IsInterfaceNil ¶
func (tdaw *TrackableDataTrie) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*TrackableDataTrie) OriginalValue ¶
func (tdaw *TrackableDataTrie) OriginalValue(key []byte) []byte
OriginalValue returns the value for a key stored in originalData map which is acting like a cache
func (*TrackableDataTrie) RetrieveValue ¶
func (tdaw *TrackableDataTrie) RetrieveValue(key []byte) ([]byte, error)
RetrieveValue fetches the value from a particular key searching the account data store The search starts with dirty map, continues with original map and ends with the trie Data must have been retrieved from its trie
func (*TrackableDataTrie) SaveKeyValue ¶
func (tdaw *TrackableDataTrie) SaveKeyValue(key []byte, value []byte)
SaveKeyValue stores in dirtyData the data keys "touched" It does not care if the data is really dirty as calling this check here will be sub-optimal
func (*TrackableDataTrie) SetDataTrie ¶
func (tdaw *TrackableDataTrie) SetDataTrie(tr data.Trie)
SetDataTrie sets the internal data trie
type TriesHolder ¶
type TriesHolder interface { Put([]byte, data.Trie) Get([]byte) data.Trie GetAll() []data.Trie Reset() IsInterfaceNil() bool }
TriesHolder is used to store multiple tries
type ValidatorApiResponse ¶
type ValidatorApiResponse struct { NrLeaderSuccess uint32 `json:"nrLeaderSuccess"` NrLeaderFailure uint32 `json:"nrLeaderFailure"` NrValidatorSuccess uint32 `json:"nrValidatorSuccess"` NrValidatorFailure uint32 `json:"nrValidatorFailure"` }
ValidatorApiResponse represents the data which is fetched from each validator for returning it in API call