multistate

package
v0.4.3-testnet Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TriePartitionLedgerState = byte(iota)
	TriePartitionAccounts
	TriePartitionChainID
	TriePartitionCommittedTransactionID
)

partitions of the state store on the trie

View Source
const (
	TmpSnapshotFileNamePrefix = "__tmp__"
)

Variables

View Source
var ErrNotFound = errors.New("object not found")

Functions

func AbsoluteStrongFinalityCoverageThreshold

func AbsoluteStrongFinalityCoverageThreshold(supply uint64, numerator, denominator int) uint64

func BalanceOnChainOutput

func BalanceOnChainOutput(rdr StateIndexReader, chainID *ledger.ChainID) uint64

func BalanceOnLock

func BalanceOnLock(rdr StateIndexReader, account ledger.Accountable) (uint64, int)

BalanceOnLock returns balance and number of outputs

func BranchKnowsTransaction

func BranchKnowsTransaction(branchID, txid *ledger.TransactionID, getStore func() common.KVReader) bool

BranchKnowsTransaction returns true if predecessor txid is known in the descendents state

func CommitEmptyRootWithLedgerIdentity

func CommitEmptyRootWithLedgerIdentity(par ledger.IdentityData, store StateStore) (common.VCommitment, error)

CommitEmptyRootWithLedgerIdentity writes ledger identity data as value of the empty key nil. Return root of the empty trie

func FetchEarliestSlot

func FetchEarliestSlot(store common.KVReader) ledger.Slot

FetchEarliestSlot return earliest slot among roots in the multi-state DB. It is set when multi-state DB is initialized and then remains immutable. For genesis database it is 0, For DB created from snapshot it is slot of the snapshot

func FetchLatestBranchTransactionIDs

func FetchLatestBranchTransactionIDs(store StateStoreReader) []ledger.TransactionID

FetchLatestBranchTransactionIDs sorted descending by coverage

func FetchLatestCommittedSlot

func FetchLatestCommittedSlot(store common.KVReader) ledger.Slot

FetchLatestCommittedSlot fetches latest recorded slot

func FetchSnapshotBranchID

func FetchSnapshotBranchID(store common.KVTraversableReader) ledger.TransactionID

func FindLatestHealthySlot

func FindLatestHealthySlot(store StateStoreReader, fraction global.Fraction) (ledger.Slot, bool)

FindLatestHealthySlot finds latest slot, which has at least one branch with coverage > numerator/denominator * 2 * totalSupply Returns false flag if not found

func FirstHealthySlotIsNotBefore

func FirstHealthySlotIsNotBefore(store StateStoreReader, refSlot ledger.Slot, fraction global.Fraction) (ret bool)

FirstHealthySlotIsNotBefore determines if first healthy slot is nor before tha refSlot. Usually refSlot is just few slots back, so the operation does not require each time traversing unbounded number of slots

func InitLedgerFromStore

func InitLedgerFromStore(stateStore StateStore, verbose ...bool)

func InitStateStore

func InitStateStore(par ledger.IdentityData, store StateStore) (ledger.ChainID, common.VCommitment)

InitStateStore initializes origin ledger state in the empty store Writes initial supply and origin stem outputs. Plus writes root record into the DB Returns root commitment to the genesis ledger state and genesis chainID

func IterateBranchChainBack

func IterateBranchChainBack(store StateStoreReader, branch *BranchData, fun func(branchID *ledger.TransactionID, branch *BranchData) bool)

IterateBranchChainBack iterates past chain of the tip branch (including the tip) Stops when current branch have no predecessor

func IterateRootRecords

func IterateRootRecords(store common.Traversable, fun func(branchTxID ledger.TransactionID, rootData RootRecord) bool, optSlot ...ledger.Slot)

IterateRootRecords iterates root records in the store: - if len(optSlot) > 0, it iterates specific slots - if len(optSlot) == 0, it iterates all records in the store

func IterateSlotsBack

func IterateSlotsBack(store StateStoreReader, fun func(slot ledger.Slot, roots []RootRecord) bool)

IterateSlotsBack iterates descending slots from latest committed slot down to the earliest available

func LedgerIdentityBytesFromRoot

func LedgerIdentityBytesFromRoot(store StateStoreReader, root common.VCommitment) []byte

func LedgerIdentityBytesFromStore

func LedgerIdentityBytesFromStore(store StateStore) []byte

func MakeTree

func MakeTree(stateStore StateStore, slots ...int) graph.Graph[string, string]

func PartitionToString

func PartitionToString(p byte) string

func RootHasTransaction

func RootHasTransaction(store common.KVReader, root common.VCommitment, txid *ledger.TransactionID) bool

func SaveBranchTree

func SaveBranchTree(stateStore StateStore, fname string, slotsBack ...int)

func ScanGenesisState

func ScanGenesisState(stateStore StateStore) (*ledger.IdentityData, common.VCommitment, error)

ScanGenesisState TODO more checks

func UpdateTrie

func UpdateTrie(trie *immutable.TrieUpdatable, mut *Mutations) (err error)

func ValidInclusionThresholdFraction

func ValidInclusionThresholdFraction(numerator, denominator int) bool

func WriteEarliestSlotRecord

func WriteEarliestSlotRecord(w common.KVWriter, slot ledger.Slot)

func WriteLatestSlotRecord

func WriteLatestSlotRecord(w common.KVWriter, slot ledger.Slot)

func WriteRootRecord

func WriteRootRecord(w common.KVWriter, branchTxID ledger.TransactionID, rootData RootRecord)

Types

type AccountInfo

type AccountInfo struct {
	LockedAccounts map[string]LockedAccountInfo
	ChainRecords   map[ledger.ChainID]ChainRecordInfo
}

func MustCollectAccountInfo

func MustCollectAccountInfo(store StateStore, root common.VCommitment) *AccountInfo

func (*AccountInfo) Lines

func (a *AccountInfo) Lines(prefix ...string) *lines.Lines

type BranchData

type BranchData struct {
	RootRecord
	Stem            *ledger.OutputWithID
	SequencerOutput *ledger.OutputWithID
}

func CheckTransactionInLRB

func CheckTransactionInLRB(store StateStoreReader, txid ledger.TransactionID, maxDepth int, fraction global.Fraction) (lrb *BranchData, foundAtDepth int)

CheckTransactionInLRB return number of slots behind the LRB which contains txid. The backwards scan is capped by maxDepth parameter. If maxDepth == 0, it means only LRB is checked

func FetchBranchData

func FetchBranchData(store common.KVReader, branchTxID ledger.TransactionID) (BranchData, bool)

FetchBranchData returns branch data by the branch transaction ID

func FetchBranchDataByRoot

func FetchBranchDataByRoot(store common.KVReader, rootData RootRecord) BranchData

FetchBranchDataByRoot returns existing branch data by root record. The root record usually returned by FetchRootRecord

func FetchBranchDataMulti

func FetchBranchDataMulti(store common.KVReader, rootData ...RootRecord) []*BranchData

FetchBranchDataMulti returns branch records for particular root records

func FetchHeaviestBranchChainNSlotsBack

func FetchHeaviestBranchChainNSlotsBack(store StateStoreReader, nBack int) []*BranchData

FetchHeaviestBranchChainNSlotsBack descending by epoch

func FetchLatestBranches

func FetchLatestBranches(store StateStoreReader) []*BranchData

FetchLatestBranches branches of the latest slot sorted by coverage descending

func FindFirstBranch

func FindFirstBranch(store StateStoreReader, filter func(branch *BranchData) bool) *BranchData

func FindLatestReliableBranch

func FindLatestReliableBranch(store StateStoreReader, fraction global.Fraction) *BranchData

FindLatestReliableBranch latest reliable branch (LRB) is the latest branch, which is contained in any tip from the latest healthy branch with ledger coverage bigger than fraction total supply. Reliable branch is the latest global consensus state with big probability Returns nil if not found

func FindLatestReliableBranchAndNSlotsBack

func FindLatestReliableBranchAndNSlotsBack(store StateStoreReader, n int, fraction global.Fraction) (ret *BranchData)

FindLatestReliableBranchAndNSlotsBack finds LRB and iterates n slots back along the main chain from LRB. It is a precaution if LRB will be orphaned later

func FindLatestReliableBranchWithSequencerID

func FindLatestReliableBranchWithSequencerID(store StateStoreReader, seqID ledger.ChainID, fraction global.Fraction) (ret *BranchData)

FindLatestReliableBranchWithSequencerID finds first branch with the given sequencerID in the main LRBID chain

func GetMainChain

func GetMainChain(store StateStoreReader, fraction global.Fraction, max ...int) ([]*BranchData, error)

func (*BranchData) IsHealthy

func (br *BranchData) IsHealthy(fraction global.Fraction) bool

func (*BranchData) JSONAble

func (br *BranchData) JSONAble() *BranchDataJSONAble

func (*BranchData) Lines

func (br *BranchData) Lines(prefix ...string) *lines.Lines

func (*BranchData) LinesVerbose

func (br *BranchData) LinesVerbose(prefix ...string) *lines.Lines

func (*BranchData) TxID

func (br *BranchData) TxID() *ledger.TransactionID

TxID transaction ID of the branch, as taken from the stem output ID

type BranchDataJSONAble

type BranchDataJSONAble struct {
	Root                 RootRecordJSONAble `json:"root"`
	StemOutputIndex      byte               `json:"stem_output_index"`
	SequencerOutputIndex byte               `json:"sequencer_output_index"`
	OnChainAmount        uint64             `json:"on_chain_amount"`
	BranchInflation      uint64             `json:"branch_inflation"`
}

type ChainRecordInfo

type ChainRecordInfo struct {
	Balance uint64
	Output  *ledger.OutputDataWithID
}

type IndexedStateReader

type IndexedStateReader interface {
	StateReader
	StateIndexReader
}

IndexedStateReader state and indexer readers packing together

type LockedAccountInfo

type LockedAccountInfo struct {
	Balance    uint64
	NumOutputs int
}

type Mutations

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

func NewMutations

func NewMutations() *Mutations

func (*Mutations) InsertAddOutputMutation

func (mut *Mutations) InsertAddOutputMutation(id ledger.OutputID, o *ledger.Output)

func (*Mutations) InsertAddTxMutation

func (mut *Mutations) InsertAddTxMutation(id ledger.TransactionID, slot ledger.Slot, lastOutputIndex byte)

func (*Mutations) InsertDelChainMutation

func (mut *Mutations) InsertDelChainMutation(id ledger.ChainID)

func (*Mutations) InsertDelOutputMutation

func (mut *Mutations) InsertDelOutputMutation(id ledger.OutputID)

func (*Mutations) Len

func (mut *Mutations) Len() int

func (*Mutations) Lines

func (mut *Mutations) Lines(prefix ...string) *lines.Lines

func (*Mutations) Sort

func (mut *Mutations) Sort() *Mutations

type Readable

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

Readable is a read-only ledger state, with the particular root It is thread-safe. The state itself is read-only, but trie cache needs write-lock with every call

func MustNewReadable

func MustNewReadable(store common.KVReader, root common.VCommitment, clearCacheAtSize ...int) *Readable

func NewReadable

func NewReadable(store common.KVReader, root common.VCommitment, clearCacheAtSize ...int) (*Readable, error)

NewReadable creates read-only ledger state with the given root

func (*Readable) AccountsByLocks

func (r *Readable) AccountsByLocks() map[string]LockedAccountInfo

func (*Readable) GetStem

func (r *Readable) GetStem() (ledger.Slot, []byte)

func (*Readable) GetUTXO

func (r *Readable) GetUTXO(oid *ledger.OutputID) ([]byte, bool)

func (*Readable) GetUTXOForChainID

func (r *Readable) GetUTXOForChainID(id *ledger.ChainID) (*ledger.OutputDataWithID, error)

func (*Readable) GetUTXOIDsInAccount

func (r *Readable) GetUTXOIDsInAccount(addr ledger.AccountID) ([]ledger.OutputID, error)

func (*Readable) GetUTXOsInAccount

func (r *Readable) GetUTXOsInAccount(addr ledger.AccountID) ([]*ledger.OutputDataWithID, error)

func (*Readable) HasUTXO

func (r *Readable) HasUTXO(oid *ledger.OutputID) bool

func (*Readable) IterateChainTips

func (r *Readable) IterateChainTips(fun func(chainID ledger.ChainID, oid ledger.OutputID) bool) error

func (*Readable) IterateKnownCommittedTransactions

func (r *Readable) IterateKnownCommittedTransactions(fun func(txid *ledger.TransactionID, slot ledger.Slot) bool, txidSlot ...ledger.Slot)

IterateKnownCommittedTransactions iterates transaction IDs in the state. Optionally, iteration is restricted for a slot. In that case first iterates non-sequencer transactions, the sequencer transactions

func (*Readable) IterateUTXOIDsInAccount

func (r *Readable) IterateUTXOIDsInAccount(addr ledger.AccountID, fun func(oid ledger.OutputID) bool) (err error)

func (*Readable) IterateUTXOsInAccount

func (r *Readable) IterateUTXOsInAccount(addr ledger.AccountID, fun func(oid ledger.OutputID, odata []byte) bool) (err error)

func (*Readable) Iterator

func (r *Readable) Iterator(prefix []byte) common.KVIterator

func (*Readable) KnowsCommittedTransaction

func (r *Readable) KnowsCommittedTransaction(txid *ledger.TransactionID) bool

KnowsCommittedTransaction transaction IDs are purged after some time, so the result may be

func (*Readable) MustLedgerIdentityBytes

func (r *Readable) MustLedgerIdentityBytes() []byte

func (*Readable) Root

func (r *Readable) Root() common.VCommitment

type RootRecord

type RootRecord struct {
	Root        common.VCommitment
	SequencerID ledger.ChainID
	// Note: LedgerCoverage, SlotInflation and Supply are deterministic values calculated from the ledger past cone
	// Each node calculates them itself, and they must be equal on each
	LedgerCoverage uint64
	// SlotInflation: total inflation delta from previous root. It is a sum of individual transaction inflation values
	// of the previous slot/past cone. It includes the branch tx inflation itself and does not include inflation of the previous branch
	SlotInflation uint64
	// Supply: total supply at this root (including the branch itself, excluding prev branch).
	// It is the sum of the Supply of the previous branch and SlotInflation of the current
	Supply uint64
	// Number of new transactions in the slot of the branch
	NumTransactions uint32
}

RootRecord is a persistent data stored in the DB partition with each state root It contains deterministic values for that state

func FetchAllRootRecords

func FetchAllRootRecords(store common.Traversable) []RootRecord

FetchAllRootRecords returns all root records in the DB

func FetchAnyLatestRootRecord

func FetchAnyLatestRootRecord(store StateStoreReader) RootRecord

FetchAnyLatestRootRecord return first root record for the latest slot

func FetchLatestRootRecords

func FetchLatestRootRecords(store StateStoreReader) []RootRecord

FetchLatestRootRecords sorted descending by coverage

func FetchRootRecord

func FetchRootRecord(store common.KVReader, branchTxID ledger.TransactionID) (ret RootRecord, found bool)

FetchRootRecord returns root data, stem output index and existence flag Exactly one root record must exist for the branch transaction

func FetchRootRecords

func FetchRootRecords(store common.Traversable, slots ...ledger.Slot) []RootRecord

FetchRootRecords returns root records for particular slots in the DB

func FetchRootRecordsNSlotsBack

func FetchRootRecordsNSlotsBack(store StateStoreReader, nBack int) []RootRecord

FetchRootRecordsNSlotsBack load root records from N lates slots, present in the store

func FindRootsFromLatestHealthySlot

func FindRootsFromLatestHealthySlot(store StateStoreReader, fraction global.Fraction) ([]RootRecord, bool)

FindRootsFromLatestHealthySlot Healthy slot is a slot which contains at least one healthy root. Function returns all roots from the latest healthy slot. Note that in theory latest healthy slot it may not exist at all, i.e. all slot in the DB does not contain any healthy root. Normally it will exist tho, because: - either database contains all branches down to genesis - or it was started from snapshot which (normally) represents a healthy state

func RootRecordFromBytes

func RootRecordFromBytes(data []byte) (RootRecord, error)

func (*RootRecord) Bytes

func (r *RootRecord) Bytes() []byte

func (*RootRecord) IsCoverageAboveThreshold

func (r *RootRecord) IsCoverageAboveThreshold(numerator, denominator int) bool

IsCoverageAboveThreshold the root is dominating if coverage last delta is more than numerator/denominator of the double supply

func (*RootRecord) JSONAble

func (r *RootRecord) JSONAble() *RootRecordJSONAble

func (*RootRecord) Lines

func (r *RootRecord) Lines(prefix ...string) *lines.Lines

func (*RootRecord) LinesVerbose

func (r *RootRecord) LinesVerbose(prefix ...string) *lines.Lines

func (*RootRecord) StringShort

func (r *RootRecord) StringShort() string

type RootRecordJSONAble

type RootRecordJSONAble struct {
	Root           string `json:"root"`
	SequencerID    string `json:"sequencer_id"`
	LedgerCoverage uint64 `json:"ledger_coverage"`
	SlotInflation  uint64 `json:"slot_inflation"`
	Supply         uint64 `json:"supply"`
}

func (*RootRecordJSONAble) Parse

func (r *RootRecordJSONAble) Parse() (*RootRecord, error)

type RootRecordParams

type RootRecordParams struct {
	StemOutputID      ledger.OutputID
	SeqID             ledger.ChainID
	Coverage          uint64
	SlotInflation     uint64
	Supply            uint64
	NumTransactions   uint32
	WriteEarliestSlot bool
}

type SequencerInfo

type SequencerInfo struct {
	BeginBalance      uint64
	EndBalance        uint64
	NumBranches       int
	StemInTheHeaviest ledger.OutputID
}

type SnapshotFileStream

type SnapshotFileStream struct {
	Header     *SnapshotHeader
	LedgerID   *ledger.IdentityData
	BranchID   ledger.TransactionID
	RootRecord RootRecord
	InChan     chan common.KVPairOrError
	Close      func()
}

func OpenSnapshotFileStream

func OpenSnapshotFileStream(fname string) (*SnapshotFileStream, error)

OpenSnapshotFileStream reads first 3 records in the snapshot file and returns channel for remaining key/value pairs

type SnapshotHeader

type SnapshotHeader struct {
	Description string `json:"description"`
	Version     string `json:"version"`
}

type SnapshotStats

type SnapshotStats struct {
	ByPartition      map[byte]int
	DurationTraverse time.Duration
}

func SaveSnapshot

func SaveSnapshot(state StateStoreReader, branch *BranchData, ctx context.Context, dir string, out ...io.Writer) (string, *SnapshotStats, error)

SaveSnapshot writes latest reliable state into snapshot. Returns snapshot file name

func (*SnapshotStats) Lines

func (s *SnapshotStats) Lines(prefix ...string) *lines.Lines

type StateIndexReader

type StateIndexReader interface {
	IterateUTXOIDsInAccount(addr ledger.AccountID, fun func(oid ledger.OutputID) bool) (err error)
	IterateUTXOsInAccount(addr ledger.AccountID, fun func(oid ledger.OutputID, odata []byte) bool) (err error)
	IterateChainTips(fun func(chainID ledger.ChainID, oid ledger.OutputID) bool) error

	GetUTXOIDsInAccount(addr ledger.AccountID) ([]ledger.OutputID, error)
	GetUTXOsInAccount(accountID ledger.AccountID) ([]*ledger.OutputDataWithID, error) // TODO leave Iterate.. only?

	GetUTXOForChainID(id *ledger.ChainID) (*ledger.OutputDataWithID, error)
	Root() common.VCommitment
	MustLedgerIdentityBytes() []byte // either state identity consistent or panic
}

type StateReader

type StateReader interface {
	GetUTXO(id *ledger.OutputID) ([]byte, bool)
	HasUTXO(id *ledger.OutputID) bool
	KnowsCommittedTransaction(txid *ledger.TransactionID) bool // all txids are kept in the state for some time
}

type StateStore

type StateStore interface {
	StateStoreReader
	common.BatchedUpdatable
}

type StateStoreReader

type StateStoreReader interface {
	common.KVReader
	common.Traversable
	IsClosed() bool
}

type SugaredStateReader

type SugaredStateReader struct {
	IndexedStateReader
}

func MustNewSugaredReadableState

func MustNewSugaredReadableState(store common.KVReader, root common.VCommitment, clearCacheAsSize ...int) SugaredStateReader

func NewSugaredReadableState

func NewSugaredReadableState(store common.KVReader, root common.VCommitment, clearCacheAsSize ...int) (SugaredStateReader, error)

func (SugaredStateReader) BalanceOf

func (s SugaredStateReader) BalanceOf(addr ledger.AccountID) uint64

func (SugaredStateReader) BalanceOnChain

func (s SugaredStateReader) BalanceOnChain(chainID *ledger.ChainID) uint64

func (SugaredStateReader) GetAllChains

func (s SugaredStateReader) GetAllChains() (map[ledger.ChainID]ChainRecordInfo, error)

func (SugaredStateReader) GetChainOutput

func (s SugaredStateReader) GetChainOutput(chainID *ledger.ChainID) (*ledger.OutputWithID, error)

func (SugaredStateReader) GetChainTips

GetChainTips return chain output and, if relevant, stem output for the chain ID. The stem output is nil if sequencer output is not in the branch

func (SugaredStateReader) GetOutput

func (s SugaredStateReader) GetOutput(oid *ledger.OutputID) *ledger.Output

func (SugaredStateReader) GetOutputErr

func (s SugaredStateReader) GetOutputErr(oid *ledger.OutputID) (*ledger.Output, error)

func (SugaredStateReader) GetOutputWithID

func (s SugaredStateReader) GetOutputWithID(oid *ledger.OutputID) (*ledger.OutputWithID, error)

func (SugaredStateReader) GetOutputsDelegatedToAccount

func (s SugaredStateReader) GetOutputsDelegatedToAccount(addr ledger.Accountable) ([]*ledger.OutputWithChainID, error)

func (SugaredStateReader) GetOutputsForAccount

func (s SugaredStateReader) GetOutputsForAccount(addr ledger.AccountID) ([]*ledger.OutputWithID, error)

func (SugaredStateReader) GetOutputsLockedInAddressED25519ForAmount

func (s SugaredStateReader) GetOutputsLockedInAddressED25519ForAmount(addr ledger.AddressED25519, targetAmount uint64) ([]*ledger.OutputWithID, uint64)

GetOutputsLockedInAddressED25519ForAmount returns outputs locked in simple address. Skip delegated and other

func (SugaredStateReader) GetStemOutput

func (s SugaredStateReader) GetStemOutput() *ledger.OutputWithID

func (SugaredStateReader) IterateChainsInAccount

func (s SugaredStateReader) IterateChainsInAccount(addr ledger.Accountable, fun func(oid ledger.OutputID, o *ledger.Output, chainID ledger.ChainID) bool) error

func (SugaredStateReader) IterateDelegatedOutputs

func (s SugaredStateReader) IterateDelegatedOutputs(delegationTarget ledger.Accountable, fun func(oid ledger.OutputID, o *ledger.Output, dLock *ledger.DelegationLock) bool)

func (SugaredStateReader) IterateOutputsForAccount

func (s SugaredStateReader) IterateOutputsForAccount(addr ledger.Accountable, fun func(oid ledger.OutputID, o *ledger.Output) bool) (err error)

func (SugaredStateReader) MustGetOutputWithID

func (s SugaredStateReader) MustGetOutputWithID(oid *ledger.OutputID) *ledger.OutputWithID

func (SugaredStateReader) NumOutputs

func (s SugaredStateReader) NumOutputs(addr ledger.AccountID) int

type SummarySupplyAndInflation

type SummarySupplyAndInflation struct {
	NumberOfBranches int
	OldestSlot       ledger.Slot
	LatestSlot       ledger.Slot
	BeginSupply      uint64
	EndSupply        uint64
	TotalInflation   uint64
	InfoPerSeqID     map[ledger.ChainID]SequencerInfo
}

func FetchSummarySupply

func FetchSummarySupply(stateStore StateStore, nBack int) *SummarySupplyAndInflation

func (*SummarySupplyAndInflation) Lines

func (s *SummarySupplyAndInflation) Lines(prefix ...string) *lines.Lines

type Updatable

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

Updatable is an updatable ledger state, with the particular root Suitable for chained updates Not-thread safe, should be used individual instance for each parallel update. DB (store) is updated atomically with all mutations in one DB transaction

func MustNewUpdatable

func MustNewUpdatable(store StateStore, root common.VCommitment) *Updatable

func NewUpdatable

func NewUpdatable(store StateStore, root common.VCommitment) (*Updatable, error)

NewUpdatable creates updatable state with the given root. After updated, the root changes. Suitable for chained updates of the ledger state

func (*Updatable) MustUpdate

func (u *Updatable) MustUpdate(muts *Mutations, par *RootRecordParams)

func (*Updatable) Readable

func (u *Updatable) Readable() *Readable

func (*Updatable) Root

func (u *Updatable) Root() common.VCommitment

func (*Updatable) Update

func (u *Updatable) Update(muts *Mutations, rootRecordParams *RootRecordParams) error

Update updates trie with mutations If par.GenesisStemOutputID != nil, also writes root partition record

Jump to

Keyboard shortcuts

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