state

package
v1.0.44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const HashLength = 32

HashLength defines how many bytes are used in a hash

Variables

View Source
var ErrAccNotFound = errors.New("account was not found")

ErrAccNotFound signals that account was not found in state trie

View Source
var ErrBech32ConvertError = errors.New("can't convert bech32 string")

ErrBech32ConvertError signals that conversion the 5bit alphabet to 8bit failed

View Source
var ErrBech32WrongAddr = errors.New("wrong bech32 string")

ErrBech32WrongAddr signals that the string provided might not be in bech32 format

View Source
var ErrEmptyAddress = errors.New("empty Address")

ErrEmptyAddress defines the error when trying to work with an empty address

View Source
var ErrNegativeValue = errors.New("negative values are not permited")

ErrNegativeValue signals that an operation has been attempted with a negative value

View Source
var ErrNilAccountFactory = errors.New("account factory is nil")

ErrNilAccountFactory signals that a nil account factory was provided

View Source
var ErrNilAccountHandler = errors.New("account wrapper is nil")

ErrNilAccountHandler signals that a nil account wrapper was provided

View Source
var ErrNilAccountTracker = errors.New("nil account tracker provided")

ErrNilAccountTracker signals that a nil account tracker has been provided

View Source
var ErrNilAccountsAdapter = errors.New("nil AccountsAdapter")

ErrNilAccountsAdapter defines the error when trying to revert on nil accounts

View Source
var ErrNilAddressContainer = errors.New("nil AddressContainer")

ErrNilAddressContainer defines the error when trying to work with a nil address

View Source
var ErrNilAddressConverter = errors.New("nil address converter")

ErrNilAddressConverter signals that a nil address converter has been provided

View Source
var ErrNilBLSPublicKey = errors.New("bls public key is nil")

ErrNilBLSPublicKey signals that the provided BLS public key is nil

View Source
var ErrNilCode = errors.New("nil smart contract code")

ErrNilCode signals that a nil code was provided

View Source
var ErrNilHasher = errors.New("nil hasher")

ErrNilHasher signals that an operation has been attempted to or with a nil hasher implementation

View Source
var ErrNilMarshalizer = errors.New("nil marshalizer")

ErrNilMarshalizer signals that an operation has been attempted to or with a nil marshalizer implementation

View Source
var ErrNilOrEmptyKey = errors.New("key is empty or nil")

ErrNilOrEmptyKey signals that key empty key was provided

View Source
var ErrNilPubKeysBytes = errors.New("nil public key bytes")

ErrNilPubKeysBytes signals that an operation has been attempted to or with a nil public key slice

View Source
var ErrNilSchnorrPublicKey = errors.New("schnorr public key is nil")

ErrNilSchnorrPublicKey signals that the provided schnorr public is nil

View Source
var ErrNilShardCoordinator = errors.New("shard coordinator is nil")

ErrNilShardCoordinator signals that nil shard coordinator was provided

View Source
var ErrNilStake = errors.New("stake is nil")

ErrNilStake signals that the provided stake is nil

View Source
var ErrNilTrackableDataTrie = errors.New("nil trackable data trie")

ErrNilTrackableDataTrie signals that a nil trackable data trie has been provided

View Source
var ErrNilTrie = errors.New("trie is nil")

ErrNilTrie signals that a trie is nil and no operation can be made

View Source
var ErrNilUpdater = errors.New("updater is nil")

ErrNilUpdater signals that a nil updater has been provided

View Source
var ErrNilValue = errors.New("nil value")

ErrNilValue signals that an operation has been attempted to or with a nil value

View Source
var ErrUnknownAccountType = errors.New("account type is unknown")

ErrUnknownAccountType signals that the provided account type is unknown

View Source
var ErrUnknownShardId = errors.New("shard id is not valid")

ErrUnknownShardId signals that shard id is not valid

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals that a wrong type assertion occurred

Functions

func NewAddress

func NewAddress(adr []byte) *address

NewAddress creates a new Address with the same byte slice as the parameter received

Types

type Account added in v1.0.3

type Account struct {
	Nonce    uint64
	Balance  *big.Int
	CodeHash []byte
	RootHash []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

func (a *Account) DataTrie() data.Trie

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

func (a *Account) GetCode() []byte

GetCode gets the actual code that needs to be run in the VM

func (*Account) GetCodeHash added in v1.0.3

func (a *Account) GetCodeHash() []byte

GetCodeHash returns the code hash associated with this account

func (*Account) GetNonce added in v1.0.3

func (a *Account) GetNonce() uint64

GetNonce gets the nonce of the account

func (*Account) GetRootHash added in v1.0.3

func (a *Account) GetRootHash() []byte

GetRootHash returns the root hash associated with this account

func (*Account) IsInterfaceNil added in v1.0.3

func (a *Account) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Account) SetBalanceWithJournal added in v1.0.3

func (a *Account) SetBalanceWithJournal(balance *big.Int) error

SetBalanceWithJournal sets the account's balance, saving the old balance before changing

func (*Account) SetCode added in v1.0.3

func (a *Account) SetCode(code []byte)

SetCode sets the actual code that needs to be run in the VM

func (*Account) SetCodeHash added in v1.0.3

func (a *Account) SetCodeHash(codeHash []byte)

SetCodeHash sets the code hash associated with the account

func (*Account) SetCodeHashWithJournal added in v1.0.3

func (a *Account) SetCodeHashWithJournal(codeHash []byte) error

SetCodeHashWithJournal sets the account's code hash, saving the old code hash before changing

func (*Account) SetDataTrie added in v1.0.3

func (a *Account) SetDataTrie(trie data.Trie)

SetDataTrie sets the trie that holds the current account's data

func (*Account) SetNonce added in v1.0.3

func (a *Account) SetNonce(nonce uint64)

SetNonce saves the nonce to the account

func (*Account) SetNonceWithJournal added in v1.0.3

func (a *Account) SetNonceWithJournal(nonce uint64) error

SetNonceWithJournal sets the account's nonce, saving the old nonce before changing

func (*Account) SetRootHash added in v1.0.3

func (a *Account) SetRootHash(roothash []byte)

SetRootHash sets the root hash associated with the account

func (*Account) SetRootHashWithJournal added in v1.0.3

func (a *Account) SetRootHashWithJournal(rootHash []byte) error

SetRootHashWithJournal sets the account's root hash, saving the old root hash before changing

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)
	SetRootHashWithJournal([]byte) error
	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
	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) 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) 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) 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

type AddressContainer

type AddressContainer interface {
	Bytes() []byte
	IsInterfaceNil() bool
}

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 BaseJournalEntryData added in v1.0.3

type BaseJournalEntryData struct {
	// contains filtered or unexported fields
}

BaseJournalEntryData is used to mark an account's data change

func NewBaseJournalEntryData added in v1.0.3

func NewBaseJournalEntryData(account AccountHandler, trie data.Trie) (*BaseJournalEntryData, error)

NewBaseJournalEntryData outputs a new BaseJournalEntry implementation used to keep track of data change. The revert will practically empty the dirty data map

func (*BaseJournalEntryData) IsInterfaceNil added in v1.0.16

func (bjed *BaseJournalEntryData) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BaseJournalEntryData) Revert added in v1.0.3

func (bjed *BaseJournalEntryData) Revert() (AccountHandler, error)

Revert will empty the dirtyData map from AccountState

func (*BaseJournalEntryData) Trie added in v1.0.3

func (bjed *BaseJournalEntryData) Trie() data.Trie

Trie returns the referenced PatriciaMerkelTree for committing the changes

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 BaseJournalEntryRootHash added in v1.0.3

type BaseJournalEntryRootHash struct {
	// contains filtered or unexported fields
}

BaseJournalEntryRootHash creates an account's root hash change

func NewBaseJournalEntryRootHash added in v1.0.3

func NewBaseJournalEntryRootHash(account AccountHandler, oldRootHash []byte, oldTrie data.Trie) (*BaseJournalEntryRootHash, error)

NewBaseJournalEntryRootHash outputs a new BaseJournalEntry used to save and revert an account's root hash change

func (*BaseJournalEntryRootHash) IsInterfaceNil added in v1.0.16

func (bjer *BaseJournalEntryRootHash) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BaseJournalEntryRootHash) Revert added in v1.0.3

func (bjer *BaseJournalEntryRootHash) 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

type ErrorWrongSize struct {
	Exp int
	Got int
}

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 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
	// 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 (a *MetaAccount) AddressContainer() AddressContainer

AddressContainer returns the address associated with the account

func (*MetaAccount) DataTrie added in v1.0.3

func (a *MetaAccount) DataTrie() data.Trie

DataTrie returns the trie that holds the current account's data

func (*MetaAccount) DataTrieTracker added in v1.0.3

func (a *MetaAccount) DataTrieTracker() DataTrieTracker

DataTrieTracker returns the trie wrapper used in managing the SC data

func (*MetaAccount) GetCode added in v1.0.3

func (a *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 (a *MetaAccount) GetCodeHash() []byte

GetCodeHash returns the code hash associated with this account

func (*MetaAccount) GetNonce added in v1.0.3

func (a *MetaAccount) GetNonce() uint64

GetNonce gets the nonce of the account

func (*MetaAccount) GetRootHash added in v1.0.3

func (a *MetaAccount) GetRootHash() []byte

GetRootHash returns the root hash associated with this account

func (*MetaAccount) IsInterfaceNil added in v1.0.3

func (a *MetaAccount) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MetaAccount) SetCode added in v1.0.3

func (a *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 (a *MetaAccount) SetCodeHash(roothash []byte)

SetCodeHash sets the code hash associated with the account

func (*MetaAccount) SetCodeHashWithJournal added in v1.0.3

func (a *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 (a *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 (a *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 (a *MetaAccount) SetNonce(nonce uint64)

SetNonce saves the nonce to the account

func (*MetaAccount) SetNonceWithJournal added in v1.0.3

func (a *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 (a *MetaAccount) SetRootHash(roothash []byte)

SetRootHash sets the root hash associated with the account

func (*MetaAccount) SetRootHashWithJournal added in v1.0.3

func (a *MetaAccount) SetRootHashWithJournal(rootHash []byte) error

SetRootHashWithJournal sets the account's root hash, saving the old root hash before changing

func (*MetaAccount) SetRoundWithJournal added in v1.0.3

func (a *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 (a *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 (a *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 (jen *MetaJournalEntryMiniBlocksData) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MetaJournalEntryMiniBlocksData) Revert added in v1.0.3

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 (jen *MetaJournalEntryRound) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MetaJournalEntryRound) Revert added in v1.0.3

func (jen *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 (jen *MetaJournalEntryShardRootHash) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MetaJournalEntryShardRootHash) Revert added in v1.0.3

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 (jen *MetaJournalEntryTxCount) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MetaJournalEntryTxCount) Revert added in v1.0.3

func (jen *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
	Address          []byte
	Stake            *big.Int

	JailTime      TimePeriod
	PastJailTimes []TimePeriod

	CurrentShardId    uint32
	NextShardId       uint32
	NodeInWaitingList bool
	UnStakedNonce     uint64

	ValidatorSuccessRate SignRate
	LeaderSuccessRate    SignRate

	CodeHash []byte

	Rating   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 (a *PeerAccount) AddressContainer() AddressContainer

AddressContainer returns the address associated with the account

func (*PeerAccount) DataTrie added in v1.0.20

func (a *PeerAccount) DataTrie() data.Trie

DataTrie returns the trie that holds the current account's data

func (*PeerAccount) DataTrieTracker added in v1.0.20

func (a *PeerAccount) DataTrieTracker() DataTrieTracker

DataTrieTracker returns the trie wrapper used in managing the SC data

func (*PeerAccount) DecreaseLeaderSuccessRateWithJournal added in v1.0.20

func (a *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 (a *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 (a *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 (a *PeerAccount) GetCodeHash() []byte

GetCodeHash returns the code hash associated with this account

func (*PeerAccount) GetNonce added in v1.0.20

func (a *PeerAccount) GetNonce() uint64

GetNonce gets the nonce of the account

func (*PeerAccount) GetRootHash added in v1.0.20

func (a *PeerAccount) GetRootHash() []byte

GetRootHash returns the root hash associated with this account

func (*PeerAccount) IncreaseLeaderSuccessRateWithJournal added in v1.0.20

func (a *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 (a *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 (a *PeerAccount) IsInterfaceNil() bool

IsInterfaceNil return if there is no value under the interface

func (*PeerAccount) SetAddressWithJournal added in v1.0.20

func (a *PeerAccount) SetAddressWithJournal(address []byte) error

SetAddressWithJournal sets the account's address, saving the old address before changing

func (*PeerAccount) SetBLSPublicKeyWithJournal added in v1.0.20

func (a *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 (a *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 (a *PeerAccount) SetCodeHash(codeHash []byte)

SetCodeHash sets the code hash associated with the account

func (*PeerAccount) SetCodeHashWithJournal added in v1.0.20

func (a *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 (a *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 (a *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 (a *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 (a *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 (a *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 (a *PeerAccount) SetNonce(nonce uint64)

SetNonce saves the nonce to the account

func (*PeerAccount) SetNonceWithJournal added in v1.0.20

func (a *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 (a *PeerAccount) SetRatingWithJournal(rating uint32) error

SetRatingWithJournal sets the account's rating id, saving the old state before changing

func (*PeerAccount) SetRootHash added in v1.0.20

func (a *PeerAccount) SetRootHash(roothash []byte)

SetRootHash sets the root hash associated with the account

func (*PeerAccount) SetRootHashWithJournal added in v1.0.20

func (a *PeerAccount) SetRootHashWithJournal(rootHash []byte) error

SetRootHashWithJournal sets the account's root hash, saving the old root hash before changing

func (*PeerAccount) SetSchnorrPublicKeyWithJournal added in v1.0.20

func (a *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 (a *PeerAccount) SetStakeWithJournal(stake *big.Int) error

SetStakeWithJournal sets the account's stake, saving the old stake before changing

func (*PeerAccount) SetUnStakedNonceWithJournal added in v1.0.39

func (a *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
}

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

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

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

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

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

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

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 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)

PeerJournalEntryUnStakedNonce outputs a new PeerJournalEntryCurrentShardId 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

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

Revert applies undo operation

type SignRate

type SignRate struct {
	NrSuccess uint32
	NrFailure uint32
}

SignRate is used to keep the number of success and failed signings

type TimePeriod

type TimePeriod struct {
	StartTime TimeStamp
	EndTime   TimeStamp
}

TimePeriod holds start and end time

type TimeStamp

type TimeStamp struct {
	Epoch uint64
	Round uint64
}

TimeStamp is a moment defined by epoch and round

type TrackableDataTrie

type TrackableDataTrie struct {
	// contains filtered or unexported fields
}

TrackableDataTrie wraps a PatriciaMerkelTrie adding modifying data capabilities

func NewTrackableDataTrie

func NewTrackableDataTrie(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 Updater

type Updater interface {
	Update(key, value []byte) error
	IsInterfaceNil() bool
}

Updater set a new value for a key, implemented by trie

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL