Documentation ¶
Index ¶
- Variables
- func AccountTotalsMaxSize() (s int)
- func AccumulateDeltas(base map[basics.Address]basics.AccountData, deltas AccountDeltas) map[basics.Address]basics.AccountData
- func AlgoCountMaxSize() (s int)
- func AssignAccountData(a *basics.AccountData, acct AccountData)
- func AssignAccountResourceToAccountData(cindex basics.CreatableIndex, resource AccountResource, ad *basics.AccountData) (assigned bool)
- func MakeLabel(l CatchpointLabelMaker) string
- func OnlineRoundParamsDataMaxSize() (s int)
- func ParseCatchpointLabel(label string) (round basics.Round, hash crypto.Digest, err error)
- func StateProofVerificationContextMaxSize() (s int)
- type AccountApp
- type AccountAsset
- type AccountBaseData
- type AccountData
- func (u AccountData) AvailableBalance(proto *config.ConsensusParams) basics.MicroAlgos
- func (u *AccountData) ClearOnlineState()
- func (u AccountData) IsZero() bool
- func (u AccountData) LastSeen() basics.Round
- func (u AccountData) MinBalance(proto *config.ConsensusParams) basics.MicroAlgos
- func (u AccountData) Money(proto config.ConsensusParams, rewardsLevel uint64) (money basics.MicroAlgos, rewards basics.MicroAlgos)
- func (u *AccountData) NormalizedOnlineBalance(genesisProto config.ConsensusParams) uint64
- func (u AccountData) OnlineAccountData(proto config.ConsensusParams, rewardsLevel uint64) basics.OnlineAccountData
- func (u *AccountData) Suspend()
- func (u AccountData) Suspended() bool
- func (u AccountData) WithUpdatedRewards(proto config.ConsensusParams, rewardsLevel uint64) AccountData
- type AccountDeltas
- func (ad AccountDeltas) ApplyToBasicsAccountData(addr basics.Address, prev basics.AccountData) (result basics.AccountData)
- func (ad *AccountDeltas) Dehydrate()
- func (ad *AccountDeltas) GetAllAppResources() []AppResourceRecord
- func (ad *AccountDeltas) GetAllAssetResources() []AssetResourceRecord
- func (ad AccountDeltas) GetAppLocalState(addr basics.Address, aidx basics.AppIndex) (AppLocalStateDelta, bool)
- func (ad AccountDeltas) GetAppParams(addr basics.Address, aidx basics.AppIndex) (AppParamsDelta, bool)
- func (ad AccountDeltas) GetAssetHolding(addr basics.Address, aidx basics.AssetIndex) (AssetHoldingDelta, bool)
- func (ad AccountDeltas) GetAssetParams(addr basics.Address, aidx basics.AssetIndex) (AssetParamsDelta, bool)
- func (ad AccountDeltas) GetBasicsAccountData(addr basics.Address) (basics.AccountData, bool)
- func (ad *AccountDeltas) GetByIdx(i int) (basics.Address, AccountData)
- func (ad AccountDeltas) GetData(addr basics.Address) (AccountData, bool)
- func (ad AccountDeltas) GetResource(addr basics.Address, aidx basics.CreatableIndex, ctype basics.CreatableType) (ret AccountResource, ok bool)
- func (ad *AccountDeltas) Hydrate()
- func (ad *AccountDeltas) Len() int
- func (ad *AccountDeltas) MergeAccounts(other AccountDeltas)
- func (ad AccountDeltas) ModifiedAccounts() []basics.Address
- func (ad AccountDeltas) ToModifiedCreatables(seen map[basics.CreatableIndex]struct{}) map[basics.CreatableIndex]ModifiedCreatable
- func (ad *AccountDeltas) Upsert(addr basics.Address, data AccountData)
- func (ad *AccountDeltas) UpsertAppResource(addr basics.Address, aidx basics.AppIndex, params AppParamsDelta, ...)
- func (ad *AccountDeltas) UpsertAssetResource(addr basics.Address, aidx basics.AssetIndex, params AssetParamsDelta, ...)
- type AccountResource
- type AccountTotals
- func (at *AccountTotals) AddAccount(proto config.ConsensusParams, data AccountData, ot *basics.OverflowTracker)
- func (at *AccountTotals) All() basics.MicroAlgos
- func (at *AccountTotals) ApplyRewards(rewardsLevel uint64, ot *basics.OverflowTracker)
- func (_ *AccountTotals) CanMarshalMsg(z interface{}) bool
- func (_ *AccountTotals) CanUnmarshalMsg(z interface{}) bool
- func (at *AccountTotals) DelAccount(proto config.ConsensusParams, data AccountData, ot *basics.OverflowTracker)
- func (z *AccountTotals) MarshalMsg(b []byte) (o []byte)
- func (z *AccountTotals) MsgIsZero() bool
- func (z *AccountTotals) Msgsize() (s int)
- func (at *AccountTotals) Participating() basics.MicroAlgos
- func (at *AccountTotals) RewardUnits() uint64
- func (z *AccountTotals) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *AccountTotals) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type AlgoCount
- func (_ *AlgoCount) CanMarshalMsg(z interface{}) bool
- func (_ *AlgoCount) CanUnmarshalMsg(z interface{}) bool
- func (z *AlgoCount) MarshalMsg(b []byte) (o []byte)
- func (z *AlgoCount) MsgIsZero() bool
- func (z *AlgoCount) Msgsize() (s int)
- func (z *AlgoCount) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *AlgoCount) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type AppLocalStateDelta
- type AppParamsDelta
- type AppResource
- type AppResourceRecord
- type AssetHoldingDelta
- type AssetParamsDelta
- type AssetResource
- type AssetResourceRecord
- type AssetResourceWithIDs
- type BalanceRecord
- type BlockInLedgerError
- type BlockListener
- type CatchpointLabelMaker
- type CatchpointLabelMakerCurrent
- type CatchpointLabelMakerV6
- type CatchpointLabelMakerV7
- type ErrNoEntry
- type ErrNonSequentialBlockEval
- type IncludedTransactions
- type InitState
- type KvValueDelta
- type LeaseInLedgerError
- type LedgerForSPBuilder
- type ModifiedCreatable
- type OnlineAccount
- type OnlineAccountsFetcher
- type OnlineRoundParamsData
- func (_ *OnlineRoundParamsData) CanMarshalMsg(z interface{}) bool
- func (_ *OnlineRoundParamsData) CanUnmarshalMsg(z interface{}) bool
- func (z *OnlineRoundParamsData) MarshalMsg(b []byte) (o []byte)
- func (z *OnlineRoundParamsData) MsgIsZero() bool
- func (z *OnlineRoundParamsData) Msgsize() (s int)
- func (z *OnlineRoundParamsData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *OnlineRoundParamsData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type StateDelta
- func (sd *StateDelta) AddCreatable(idx basics.CreatableIndex, creatable ModifiedCreatable)
- func (sd *StateDelta) AddKvMod(key string, delta KvValueDelta)
- func (sd *StateDelta) AddTxLease(txLease Txlease, expired basics.Round)
- func (sd *StateDelta) Dehydrate()
- func (sd *StateDelta) Hydrate()
- func (sd *StateDelta) OptimizeAllocatedMemory(maxBalLookback uint64)
- func (sd *StateDelta) PopulateStateDelta(hdr *bookkeeping.BlockHeader, prevTimestamp int64, hint int, ...)
- func (sd *StateDelta) Reset()
- type StateProofVerificationContext
- func (_ *StateProofVerificationContext) CanMarshalMsg(z interface{}) bool
- func (_ *StateProofVerificationContext) CanUnmarshalMsg(z interface{}) bool
- func (z *StateProofVerificationContext) MarshalMsg(b []byte) (o []byte)
- func (z *StateProofVerificationContext) MsgIsZero() bool
- func (z *StateProofVerificationContext) Msgsize() (s int)
- func (z *StateProofVerificationContext) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *StateProofVerificationContext) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type TransactionInLedgerError
- type TxGroupMalformedError
- type TxGroupMalformedErrorReasonCode
- type Txlease
- type TxnNotWellFormedError
- type UnfinishedBlock
- func (ub UnfinishedBlock) ContainsAddress(addr basics.Address) bool
- func (ub UnfinishedBlock) FinishBlock(s committee.Seed, proposer basics.Address, eligible bool) bookkeeping.Block
- func (ub UnfinishedBlock) Round() basics.Round
- func (ub UnfinishedBlock) UnfinishedBlock() bookkeeping.Block
- func (ub UnfinishedBlock) UnfinishedDeltas() StateDelta
- type ValidatedBlock
- type VotersCommitListener
- type VotersForRound
Constants ¶
This section is empty.
Variables ¶
var ErrCatchpointParsingFailed = errors.New("catchpoint parsing failed")
ErrCatchpointParsingFailed is used when we attempt to parse and catchpoint label and failing doing so.
var ErrNoSpace = errors.New("block does not have space for transaction")
ErrNoSpace indicates insufficient space for transaction in block
Functions ¶
func AccountTotalsMaxSize ¶
func AccountTotalsMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func AccumulateDeltas ¶
func AccumulateDeltas(base map[basics.Address]basics.AccountData, deltas AccountDeltas) map[basics.Address]basics.AccountData
AccumulateDeltas adds delta into base accounts map in-place
func AlgoCountMaxSize ¶
func AlgoCountMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func AssignAccountData ¶
func AssignAccountData(a *basics.AccountData, acct AccountData)
AssignAccountData assigns the contents of AccountData to the fields in basics.AccountData, but does not touch the AppParams, AppLocalState, AssetHolding, or AssetParams data.
func AssignAccountResourceToAccountData ¶
func AssignAccountResourceToAccountData(cindex basics.CreatableIndex, resource AccountResource, ad *basics.AccountData) (assigned bool)
AssignAccountResourceToAccountData assigns the Asset/App params/holdings contained in the AccountResource to the given basics.AccountData, creating maps if necessary. Returns true if the AccountResource contained a new or updated resource, and false if the AccountResource contained no changes (indicating the resource was deleted).
func MakeLabel ¶
func MakeLabel(l CatchpointLabelMaker) string
MakeLabel returns the user-facing representation of this catchpoint label. ( i.e. the "label" )
func OnlineRoundParamsDataMaxSize ¶
func OnlineRoundParamsDataMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func ParseCatchpointLabel ¶
ParseCatchpointLabel parse the given label and breaks it into the round and hash components. In case of a parsing failure, the returned err is non-nil.
func StateProofVerificationContextMaxSize ¶
func StateProofVerificationContextMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
Types ¶
type AccountApp ¶
AccountApp is used as a map key.
type AccountAsset ¶
type AccountAsset struct { Address basics.Address Asset basics.AssetIndex }
AccountAsset is used as a map key.
type AccountBaseData ¶
type AccountBaseData struct { Status basics.Status MicroAlgos basics.MicroAlgos RewardsBase uint64 RewardedMicroAlgos basics.MicroAlgos AuthAddr basics.Address IncentiveEligible bool TotalAppSchema basics.StateSchema // Totals across created globals, and opted in locals. TotalExtraAppPages uint32 // Total number of extra pages across all created apps TotalAppParams uint64 // Total number of apps this account has created TotalAppLocalStates uint64 // Total number of apps this account is opted into. TotalAssetParams uint64 // Total number of assets created by this account TotalAssets uint64 // Total of asset creations and optins (i.e. number of holdings) TotalBoxes uint64 // Total number of boxes associated to this account TotalBoxBytes uint64 // Total bytes for this account's boxes. keys _and_ values count LastProposed basics.Round // The last round that this account proposed the winning block. LastHeartbeat basics.Round // The last round that this account sent a heartbeat to show it was online. }
AccountBaseData contains base account info like balance, status and total number of resources
type AccountData ¶
type AccountData struct { AccountBaseData basics.VotingData }
AccountData provides users of the Balances interface per-account data (like basics.AccountData) but without any maps containing AppParams, AppLocalState, AssetHolding, or AssetParams. This ensures that transaction evaluation must retrieve and mutate account, asset, and application data separately, to better support on-disk and in-memory schemas that do not store them together.
func ToAccountData ¶
func ToAccountData(acct basics.AccountData) AccountData
ToAccountData returns ledgercore.AccountData from basics.AccountData
func (AccountData) AvailableBalance ¶
func (u AccountData) AvailableBalance(proto *config.ConsensusParams) basics.MicroAlgos
AvailableBalance returns the amount of MicroAlgos that are available for spending without fully closing the account.
func (*AccountData) ClearOnlineState ¶
func (u *AccountData) ClearOnlineState()
ClearOnlineState resets the account's fields to indicate that the account is an offline account
func (AccountData) IsZero ¶
func (u AccountData) IsZero() bool
IsZero checks if an AccountData value is the same as its zero value.
func (AccountData) LastSeen ¶
func (u AccountData) LastSeen() basics.Round
LastSeen returns the last round that the account was seen online
func (AccountData) MinBalance ¶
func (u AccountData) MinBalance(proto *config.ConsensusParams) basics.MicroAlgos
MinBalance computes the minimum balance requirements for an account based on some consensus parameters. MinBalance should correspond roughly to how much storage the account is allowed to store on disk.
func (AccountData) Money ¶
func (u AccountData) Money(proto config.ConsensusParams, rewardsLevel uint64) (money basics.MicroAlgos, rewards basics.MicroAlgos)
Money is similar to basics account data Money function
func (*AccountData) NormalizedOnlineBalance ¶
func (u *AccountData) NormalizedOnlineBalance(genesisProto config.ConsensusParams) uint64
NormalizedOnlineBalance wraps basics.NormalizedOnlineAccountBalance
func (AccountData) OnlineAccountData ¶
func (u AccountData) OnlineAccountData(proto config.ConsensusParams, rewardsLevel uint64) basics.OnlineAccountData
OnlineAccountData calculates the online account data given an AccountData, by adding the rewards.
func (*AccountData) Suspend ¶
func (u *AccountData) Suspend()
Suspend sets the status to Offline, but does _not_ clear voting keys, so that a heartbeat can bring the account back Online
func (AccountData) Suspended ¶
func (u AccountData) Suspended() bool
Suspended returns true if the account is suspended (offline with keys)
func (AccountData) WithUpdatedRewards ¶
func (u AccountData) WithUpdatedRewards(proto config.ConsensusParams, rewardsLevel uint64) AccountData
WithUpdatedRewards calls basics account data WithUpdatedRewards
type AccountDeltas ¶
type AccountDeltas struct { // Actual data. If an account is deleted, `Accts` contains the BalanceRecord // with an empty `AccountData` and a populated `Addr`. Accts []BalanceRecord // AppResources deltas. If app params or local state is deleted, there is a nil value in AppResources.Params or AppResources.State and Deleted flag set AppResources []AppResourceRecord AssetResources []AssetResourceRecord // contains filtered or unexported fields }
AccountDeltas stores ordered accounts and allows fast lookup by address One key design aspect here was to ensure that we're able to access the written deltas in a deterministic order, while maintaining O(1) lookup. In order to do that, each of the arrays here is constructed as a pair of (slice, map). The map would point the address/address+creatable id onto the index of the element within the slice. If adding fields make sure to add them to the .reset() method to avoid dirty state
func MakeAccountDeltas ¶
func MakeAccountDeltas(hint int) AccountDeltas
MakeAccountDeltas creates account delta if adding new fields make sure to add them to the .reset() and .isEmpty() methods
func (AccountDeltas) ApplyToBasicsAccountData ¶
func (ad AccountDeltas) ApplyToBasicsAccountData(addr basics.Address, prev basics.AccountData) (result basics.AccountData)
ApplyToBasicsAccountData applies partial delta from "ad" to a full account data "prev" and returns a deep copy
func (*AccountDeltas) Dehydrate ¶
func (ad *AccountDeltas) Dehydrate()
Dehydrate normalizes the fields of this AccountDeltas, and clears any redundant internal caching. This is useful for comparing AccountDeltas objects for equality.
func (*AccountDeltas) GetAllAppResources ¶
func (ad *AccountDeltas) GetAllAppResources() []AppResourceRecord
GetAllAppResources returns all AppResourceRecords
func (*AccountDeltas) GetAllAssetResources ¶
func (ad *AccountDeltas) GetAllAssetResources() []AssetResourceRecord
GetAllAssetResources returns all AssetResourceRecords
func (AccountDeltas) GetAppLocalState ¶
func (ad AccountDeltas) GetAppLocalState(addr basics.Address, aidx basics.AppIndex) (AppLocalStateDelta, bool)
GetAppLocalState returns app local state delta value
func (AccountDeltas) GetAppParams ¶
func (ad AccountDeltas) GetAppParams(addr basics.Address, aidx basics.AppIndex) (AppParamsDelta, bool)
GetAppParams returns app params delta value
func (AccountDeltas) GetAssetHolding ¶
func (ad AccountDeltas) GetAssetHolding(addr basics.Address, aidx basics.AssetIndex) (AssetHoldingDelta, bool)
GetAssetHolding returns asset holding delta value
func (AccountDeltas) GetAssetParams ¶
func (ad AccountDeltas) GetAssetParams(addr basics.Address, aidx basics.AssetIndex) (AssetParamsDelta, bool)
GetAssetParams returns asset params delta value
func (AccountDeltas) GetBasicsAccountData ¶
func (ad AccountDeltas) GetBasicsAccountData(addr basics.Address) (basics.AccountData, bool)
GetBasicsAccountData returns basics account data for some specific address Currently is only used in tests
func (*AccountDeltas) GetByIdx ¶
func (ad *AccountDeltas) GetByIdx(i int) (basics.Address, AccountData)
GetByIdx returns address and AccountData It does NOT check boundaries.
func (AccountDeltas) GetData ¶
func (ad AccountDeltas) GetData(addr basics.Address) (AccountData, bool)
GetData lookups AccountData by address
func (AccountDeltas) GetResource ¶
func (ad AccountDeltas) GetResource(addr basics.Address, aidx basics.CreatableIndex, ctype basics.CreatableType) (ret AccountResource, ok bool)
GetResource looks up a pair of app or asset resources, given its index and type.
func (*AccountDeltas) Hydrate ¶
func (ad *AccountDeltas) Hydrate()
Hydrate reverses the effects of Dehydrate, restoring internal data.
func (*AccountDeltas) Len ¶
func (ad *AccountDeltas) Len() int
Len returns number of stored accounts
func (*AccountDeltas) MergeAccounts ¶
func (ad *AccountDeltas) MergeAccounts(other AccountDeltas)
MergeAccounts applies other accounts into this StateDelta accounts
func (AccountDeltas) ModifiedAccounts ¶
func (ad AccountDeltas) ModifiedAccounts() []basics.Address
ModifiedAccounts returns list of addresses of modified accounts
func (AccountDeltas) ToModifiedCreatables ¶
func (ad AccountDeltas) ToModifiedCreatables(seen map[basics.CreatableIndex]struct{}) map[basics.CreatableIndex]ModifiedCreatable
ToModifiedCreatables is only used in tests, to create a map of ModifiedCreatable.
func (*AccountDeltas) Upsert ¶
func (ad *AccountDeltas) Upsert(addr basics.Address, data AccountData)
Upsert adds ledgercore.AccountData into deltas
func (*AccountDeltas) UpsertAppResource ¶
func (ad *AccountDeltas) UpsertAppResource(addr basics.Address, aidx basics.AppIndex, params AppParamsDelta, state AppLocalStateDelta)
UpsertAppResource adds AppParams and AppLocalState delta
func (*AccountDeltas) UpsertAssetResource ¶
func (ad *AccountDeltas) UpsertAssetResource(addr basics.Address, aidx basics.AssetIndex, params AssetParamsDelta, holding AssetHoldingDelta)
UpsertAssetResource adds AssetParams and AssetHolding delta
type AccountResource ¶
type AccountResource struct { AssetParams *basics.AssetParams AssetHolding *basics.AssetHolding AppLocalState *basics.AppLocalState AppParams *basics.AppParams }
AccountResource used to retrieve a generic resource information from the data tier
type AccountTotals ¶
type AccountTotals struct { Online AlgoCount `codec:"online"` Offline AlgoCount `codec:"offline"` NotParticipating AlgoCount `codec:"notpart"` // Total number of algos received per reward unit since genesis RewardsLevel uint64 `codec:"rwdlvl"` // contains filtered or unexported fields }
AccountTotals represents the totals of algos in the system grouped by different account status values.
func (*AccountTotals) AddAccount ¶
func (at *AccountTotals) AddAccount(proto config.ConsensusParams, data AccountData, ot *basics.OverflowTracker)
AddAccount adds an account algos from the total money
func (*AccountTotals) All ¶
func (at *AccountTotals) All() basics.MicroAlgos
All returns the sum of algos held under all different status values.
func (*AccountTotals) ApplyRewards ¶
func (at *AccountTotals) ApplyRewards(rewardsLevel uint64, ot *basics.OverflowTracker)
ApplyRewards adds the reward to the account totals based on the new rewards level
func (*AccountTotals) CanMarshalMsg ¶
func (_ *AccountTotals) CanMarshalMsg(z interface{}) bool
func (*AccountTotals) CanUnmarshalMsg ¶
func (_ *AccountTotals) CanUnmarshalMsg(z interface{}) bool
func (*AccountTotals) DelAccount ¶
func (at *AccountTotals) DelAccount(proto config.ConsensusParams, data AccountData, ot *basics.OverflowTracker)
DelAccount removes an account algos from the total money
func (*AccountTotals) MarshalMsg ¶
func (z *AccountTotals) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*AccountTotals) MsgIsZero ¶
func (z *AccountTotals) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*AccountTotals) Msgsize ¶
func (z *AccountTotals) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AccountTotals) Participating ¶
func (at *AccountTotals) Participating() basics.MicroAlgos
Participating returns the sum of algos held under “participating” account status values (Online and Offline). It excludes MicroAlgos held by NotParticipating accounts.
func (*AccountTotals) RewardUnits ¶
func (at *AccountTotals) RewardUnits() uint64
RewardUnits returns the sum of reward units held under “participating” account status values (Online and Offline). It excludes units held by NotParticipating accounts.
func (*AccountTotals) UnmarshalMsg ¶
func (z *AccountTotals) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*AccountTotals) UnmarshalMsgWithState ¶
func (z *AccountTotals) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AlgoCount ¶
type AlgoCount struct { // Sum of algos of all accounts in this class. Money basics.MicroAlgos `codec:"mon"` // Total number of whole reward units in accounts. RewardUnits uint64 `codec:"rwd"` // contains filtered or unexported fields }
AlgoCount represents a total of algos of a certain class of accounts (split up by their Status value).
func (*AlgoCount) CanMarshalMsg ¶
func (*AlgoCount) CanUnmarshalMsg ¶
func (*AlgoCount) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*AlgoCount) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AlgoCount) UnmarshalMsgWithState ¶
UnmarshalMsg implements msgp.Unmarshaler
type AppLocalStateDelta ¶
type AppLocalStateDelta struct { LocalState *basics.AppLocalState Deleted bool }
AppLocalStateDelta tracks a changed AppLocalState, and whether it was deleted
type AppParamsDelta ¶
AppParamsDelta tracks a changed AppParams, and whether it was deleted
type AppResource ¶
type AppResource struct { AppLocalState *basics.AppLocalState AppParams *basics.AppParams }
AppResource used to retrieve a generic app resource information from the data tier
type AppResourceRecord ¶
type AppResourceRecord struct { Aidx basics.AppIndex Addr basics.Address Params AppParamsDelta State AppLocalStateDelta }
AppResourceRecord represents AppParams and AppLocalState in deltas
type AssetHoldingDelta ¶
type AssetHoldingDelta struct { Holding *basics.AssetHolding Deleted bool }
AssetHoldingDelta records a changed AssetHolding, and whether it was deleted
type AssetParamsDelta ¶
type AssetParamsDelta struct { Params *basics.AssetParams Deleted bool }
AssetParamsDelta tracks a changed AssetParams, and whether it was deleted
type AssetResource ¶
type AssetResource struct { AssetParams *basics.AssetParams AssetHolding *basics.AssetHolding }
AssetResource used to retrieve a generic asset resource information from the data tier
type AssetResourceRecord ¶
type AssetResourceRecord struct { Aidx basics.AssetIndex Addr basics.Address Params AssetParamsDelta Holding AssetHoldingDelta }
AssetResourceRecord represents AssetParams and AssetHolding in deltas
type AssetResourceWithIDs ¶
type AssetResourceWithIDs struct { AssetResource AssetID basics.AssetIndex Creator basics.Address }
AssetResourceWithIDs is used to retrieve a asset resource information from the data tier, inclusive of the asset ID and creator address
type BalanceRecord ¶
type BalanceRecord struct { Addr basics.Address AccountData }
BalanceRecord is similar to basics.BalanceRecord but with decoupled base and voting data
type BlockInLedgerError ¶
BlockInLedgerError is returned when a block cannot be added because it has already been done
func (BlockInLedgerError) Error ¶
func (bile BlockInLedgerError) Error() string
Error satisfies builtin interface `error`
type BlockListener ¶
type BlockListener interface {
OnNewBlock(block bookkeeping.Block, delta StateDelta)
}
BlockListener represents an object that needs to get notified on new blocks.
type CatchpointLabelMaker ¶
type CatchpointLabelMaker interface {
// contains filtered or unexported methods
}
CatchpointLabelMaker is used for abstract the creation of different catchpoints versions. Different catchpoint version might hash different fields.
type CatchpointLabelMakerCurrent ¶
type CatchpointLabelMakerCurrent struct {
// contains filtered or unexported fields
}
CatchpointLabelMakerCurrent represents a single catchpoint maker, matching catchpoints of version V7 and above.
func MakeCatchpointLabelMakerCurrent ¶
func MakeCatchpointLabelMakerCurrent(ledgerRound basics.Round, ledgerRoundBlockHash *crypto.Digest, balancesMerkleRoot *crypto.Digest, totals AccountTotals, spVerificationContextHash, onlineAccountsHash, onlineRoundParamsHash *crypto.Digest) *CatchpointLabelMakerCurrent
MakeCatchpointLabelMakerCurrent creates a catchpoint label given the catchpoint label parameters.
type CatchpointLabelMakerV6 ¶
type CatchpointLabelMakerV6 struct {
// contains filtered or unexported fields
}
CatchpointLabelMakerV6 represent a single catchpoint label maker, matching catchpoints of version V6 and below.
func MakeCatchpointLabelMakerV6 ¶
func MakeCatchpointLabelMakerV6(ledgerRound basics.Round, ledgerRoundBlockHash *crypto.Digest, balancesMerkleRoot *crypto.Digest, totals AccountTotals) *CatchpointLabelMakerV6
MakeCatchpointLabelMakerV6 creates a V6 catchpoint label given the catchpoint label parameters.
type CatchpointLabelMakerV7 ¶
type CatchpointLabelMakerV7 struct {
// contains filtered or unexported fields
}
CatchpointLabelMakerV7 represents a single catchpoint maker, matching catchpoints of version V7 and above.
func MakeCatchpointLabelMakerV7 ¶
func MakeCatchpointLabelMakerV7(ledgerRound basics.Round, ledgerRoundBlockHash *crypto.Digest, balancesMerkleRoot *crypto.Digest, totals AccountTotals, spVerificationContextHash *crypto.Digest) *CatchpointLabelMakerV7
MakeCatchpointLabelMakerV7 creates a catchpoint label given the catchpoint label parameters.
type ErrNoEntry ¶
ErrNoEntry is used to indicate that a block is not present in the ledger.
func (ErrNoEntry) Error ¶
func (err ErrNoEntry) Error() string
Error satisfies builtin interface `error`
type ErrNonSequentialBlockEval ¶
type ErrNonSequentialBlockEval struct { EvaluatorRound basics.Round // EvaluatorRound is the round the evaluator was created for LatestRound basics.Round // LatestRound is the latest round available on disk }
ErrNonSequentialBlockEval provides feedback when the evaluator cannot be created for stale/future rounds.
func (ErrNonSequentialBlockEval) Error ¶
func (err ErrNonSequentialBlockEval) Error() string
Error satisfies builtin interface `error`
type IncludedTransactions ¶
type IncludedTransactions struct { LastValid basics.Round Intra uint64 // the index of the transaction in the block }
IncludedTransactions defines the transactions included in a block, their index and last valid round.
type InitState ¶
type InitState struct { Block bookkeeping.Block Accounts map[basics.Address]basics.AccountData GenesisHash crypto.Digest }
InitState structure defines blockchain init params
type KvValueDelta ¶
type KvValueDelta struct { // Data stores the most recent value (nil == deleted) Data []byte // OldData stores the previous vlaue (nil == didn't exist) OldData []byte }
A KvValueDelta shows how the Data associated with a key in the kvstore has changed. However, OldData is elided during evaluation, and only filled in at the conclusion of a block during the called to roundCowState.deltas()
type LeaseInLedgerError ¶
type LeaseInLedgerError struct { InBlockEvaluator bool // contains filtered or unexported fields }
LeaseInLedgerError is returned when a transaction cannot be added because it has a lease that already being used in the relevant rounds
func MakeLeaseInLedgerError ¶
func MakeLeaseInLedgerError(txid transactions.Txid, lease Txlease, inBlockEvaluator bool) *LeaseInLedgerError
MakeLeaseInLedgerError builds a LeaseInLedgerError object
func (*LeaseInLedgerError) Error ¶
func (lile *LeaseInLedgerError) Error() string
Error implements the error interface for the LeaseInLedgerError stuct
type LedgerForSPBuilder ¶
type LedgerForSPBuilder interface { VotersForStateProof(rnd basics.Round) (*VotersForRound, error) BlockHdr(basics.Round) (bookkeeping.BlockHeader, error) }
LedgerForSPBuilder captures the functionality needed for the creation of the cryptographic state proof builder.
type ModifiedCreatable ¶
type ModifiedCreatable struct { // Type of the creatable: app or asset Ctype basics.CreatableType // Created if true, deleted if false Created bool // creator of the app/asset Creator basics.Address // Keeps track of how many times this app/asset appears in // accountUpdates.creatableDeltas Ndeltas int }
ModifiedCreatable defines the changes to a single single creatable state
type OnlineAccount ¶
type OnlineAccount struct { // These are a subset of the fields from the corresponding AccountData. Address basics.Address MicroAlgos basics.MicroAlgos RewardsBase uint64 NormalizedOnlineBalance uint64 VoteFirstValid basics.Round VoteLastValid basics.Round StateProofID merklesignature.Commitment }
An OnlineAccount corresponds to an account whose AccountData.Status is Online. This is used for a Merkle tree commitment of online accounts, which is subsequently used to validate participants for a state proof.
type OnlineAccountsFetcher ¶
type OnlineAccountsFetcher interface { // TopOnlineAccounts returns the top n online accounts, sorted by their normalized // balance and address, whose voting keys are valid in voteRnd. See the // normalization description in AccountData.NormalizedOnlineBalance(). TopOnlineAccounts(rnd basics.Round, voteRnd basics.Round, n uint64, params *config.ConsensusParams, rewardsLevel uint64) (topOnlineAccounts []*OnlineAccount, totalOnlineStake basics.MicroAlgos, err error) }
OnlineAccountsFetcher captures the functionality of querying online accounts status
type OnlineRoundParamsData ¶
type OnlineRoundParamsData struct { OnlineSupply uint64 `codec:"online"` RewardsLevel uint64 `codec:"rwdlvl"` CurrentProtocol protocol.ConsensusVersion `codec:"proto"` // contains filtered or unexported fields }
OnlineRoundParamsData keeps track of parameters needed for agreement from maxBalLookback ago
func (*OnlineRoundParamsData) CanMarshalMsg ¶
func (_ *OnlineRoundParamsData) CanMarshalMsg(z interface{}) bool
func (*OnlineRoundParamsData) CanUnmarshalMsg ¶
func (_ *OnlineRoundParamsData) CanUnmarshalMsg(z interface{}) bool
func (*OnlineRoundParamsData) MarshalMsg ¶
func (z *OnlineRoundParamsData) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*OnlineRoundParamsData) MsgIsZero ¶
func (z *OnlineRoundParamsData) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*OnlineRoundParamsData) Msgsize ¶
func (z *OnlineRoundParamsData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*OnlineRoundParamsData) UnmarshalMsg ¶
func (z *OnlineRoundParamsData) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*OnlineRoundParamsData) UnmarshalMsgWithState ¶
func (z *OnlineRoundParamsData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type StateDelta ¶
type StateDelta struct { // modified new accounts Accts AccountDeltas // modified kv pairs (nil == delete) // not preallocated use .AddKvMod to insert instead of direct assignment KvMods map[string]KvValueDelta // new Txids for the txtail and TxnCounter, mapped to txn.LastValid Txids map[transactions.Txid]IncludedTransactions // new txleases for the txtail mapped to expiration // not pre-allocated so use .AddTxLease to insert instead of direct assignment Txleases map[Txlease]basics.Round // new creatables creator lookup table // not pre-allocated so use .AddCreatable to insert instead of direct assignment Creatables map[basics.CreatableIndex]ModifiedCreatable // new block header; read-only Hdr *bookkeeping.BlockHeader // StateProofNext represents modification on StateProofNextRound field in the block header. If the block contains // a valid state proof transaction, this field will contain the next round for state proof. // otherwise it will be set to 0. StateProofNext basics.Round // previous block timestamp PrevTimestamp int64 // The account totals reflecting the changes in this StateDelta object. Totals AccountTotals // contains filtered or unexported fields }
StateDelta describes the delta between a given round to the previous round If adding a new field not explicitly allocated by PopulateStateDelta, make sure to reset it in .ReuseStateDelta to avoid dirty memory errors. If adding fields make sure to add them to the .Reset() method to avoid dirty state
func MakeStateDelta ¶
func MakeStateDelta(hdr *bookkeeping.BlockHeader, prevTimestamp int64, hint int, stateProofNext basics.Round) (sd StateDelta)
MakeStateDelta creates a new instance of StateDelta hint is amount of transactions for evaluation, 2 * hint is for sender and receiver balance records. This does not play well for AssetConfig and ApplicationCall transactions on scale
func (*StateDelta) AddCreatable ¶
func (sd *StateDelta) AddCreatable(idx basics.CreatableIndex, creatable ModifiedCreatable)
AddCreatable adds a new Creatable to the StateDelta
func (*StateDelta) AddKvMod ¶
func (sd *StateDelta) AddKvMod(key string, delta KvValueDelta)
AddKvMod adds a new KvMod to the StateDelta
func (*StateDelta) AddTxLease ¶
func (sd *StateDelta) AddTxLease(txLease Txlease, expired basics.Round)
AddTxLease adds a new TxLease to the StateDelta
func (*StateDelta) Dehydrate ¶
func (sd *StateDelta) Dehydrate()
Dehydrate normalized the fields of this StateDelta, and clears any redundant internal caching. This is useful for comparing StateDelta objects for equality.
NOTE: initialHint is lost in dehydration. All other fields can be restored by calling Hydrate()
func (*StateDelta) Hydrate ¶
func (sd *StateDelta) Hydrate()
Hydrate reverses the effects of Dehydrate, restoring internal data.
func (*StateDelta) OptimizeAllocatedMemory ¶
func (sd *StateDelta) OptimizeAllocatedMemory(maxBalLookback uint64)
OptimizeAllocatedMemory by reallocating maps to needed capacity For each data structure, reallocate if it would save us at least 50MB aggregate If provided maxBalLookback or maxTxnLife are zero, dependent optimizations will not occur.
func (*StateDelta) PopulateStateDelta ¶
func (sd *StateDelta) PopulateStateDelta(hdr *bookkeeping.BlockHeader, prevTimestamp int64, hint int, stateProofNext basics.Round)
PopulateStateDelta populates an existing StateDelta struct. Used as a helper for MakeStateDelta as well as for re-using already allocated structs from sync.Pool
func (*StateDelta) Reset ¶
func (sd *StateDelta) Reset()
Reset resets the StateDelta for re-use with sync.Pool
type StateProofVerificationContext ¶
type StateProofVerificationContext struct { // LastAttestedRound is the last attested round of the state proof verified using this data. LastAttestedRound basics.Round `codec:"spround"` // VotersCommitment is the vector commitment root of the top N accounts to sign the next state proof. VotersCommitment crypto.GenericDigest `codec:"vc"` // OnlineTotalWeight is the total amount of stake attesting to the next state proof. OnlineTotalWeight basics.MicroAlgos `codec:"pw"` // Version is the protocol version that would be used to verify the state proof Version protocol.ConsensusVersion `codec:"v"` // contains filtered or unexported fields }
StateProofVerificationContext represents the context provided by the ledger to verify a state proof transaction.
func MakeStateProofVerificationContext ¶
func MakeStateProofVerificationContext(votersHdr *bookkeeping.BlockHeader, lastAttested basics.Round) *StateProofVerificationContext
MakeStateProofVerificationContext produces a new StateProofVerificationContext instance from a block header and last attested round
func (*StateProofVerificationContext) CanMarshalMsg ¶
func (_ *StateProofVerificationContext) CanMarshalMsg(z interface{}) bool
func (*StateProofVerificationContext) CanUnmarshalMsg ¶
func (_ *StateProofVerificationContext) CanUnmarshalMsg(z interface{}) bool
func (*StateProofVerificationContext) MarshalMsg ¶
func (z *StateProofVerificationContext) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*StateProofVerificationContext) MsgIsZero ¶
func (z *StateProofVerificationContext) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*StateProofVerificationContext) Msgsize ¶
func (z *StateProofVerificationContext) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*StateProofVerificationContext) UnmarshalMsg ¶
func (z *StateProofVerificationContext) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*StateProofVerificationContext) UnmarshalMsgWithState ¶
func (z *StateProofVerificationContext) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type TransactionInLedgerError ¶
type TransactionInLedgerError struct { Txid transactions.Txid InBlockEvaluator bool }
TransactionInLedgerError is returned when a transaction cannot be added because it has already been committed, either to the blockchain's ledger or to the history of changes tracked by a BlockEvaluator.
func (TransactionInLedgerError) Error ¶
func (tile TransactionInLedgerError) Error() string
Error satisfies builtin interface `error`
type TxGroupMalformedError ¶
type TxGroupMalformedError struct { Msg string Reason TxGroupMalformedErrorReasonCode }
TxGroupMalformedError indicates txgroup has group ID problems or too large
func (*TxGroupMalformedError) Error ¶
func (e *TxGroupMalformedError) Error() string
type TxGroupMalformedErrorReasonCode ¶
type TxGroupMalformedErrorReasonCode int
TxGroupMalformedErrorReasonCode is a reason code for TxGroupMalformed
const ( // TxGroupMalformedErrorReasonGeneric is a generic (not specific) reason code TxGroupMalformedErrorReasonGeneric TxGroupMalformedErrorReasonCode = iota // TxGroupMalformedErrorReasonExceedMaxSize indicates too large txgroup TxGroupMalformedErrorReasonExceedMaxSize // TxGroupMalformedErrorReasonInconsistentGroupID indicates different group IDs in a txgroup TxGroupMalformedErrorReasonInconsistentGroupID // TxGroupMalformedErrorReasonEmptyGroupID is for empty group ID but multiple transactions in a txgroup TxGroupMalformedErrorReasonEmptyGroupID // TxGroupMalformedErrorReasonIncompleteGroup indicates expected group ID does not match to provided TxGroupMalformedErrorReasonIncompleteGroup )
type Txlease ¶
A Txlease is a transaction (sender, lease) pair which uniquely specifies a transaction lease.
type TxnNotWellFormedError ¶
type TxnNotWellFormedError string
TxnNotWellFormedError indicates a transaction was not well-formed when evaluated by the BlockEvaluator
func (*TxnNotWellFormedError) Error ¶
func (err *TxnNotWellFormedError) Error() string
type UnfinishedBlock ¶
type UnfinishedBlock struct {
// contains filtered or unexported fields
}
UnfinishedBlock represents a block that has been generated, but is not yet ready for proposing until FinishBlock is called.
func MakeUnfinishedBlock ¶
func MakeUnfinishedBlock(blk bookkeeping.Block, deltas StateDelta, finalAccounts map[basics.Address]AccountData) UnfinishedBlock
MakeUnfinishedBlock creates an unfinished block.
func (UnfinishedBlock) ContainsAddress ¶
func (ub UnfinishedBlock) ContainsAddress(addr basics.Address) bool
ContainsAddress returns true if the balance data about the given address is present in the unfinished block.
func (UnfinishedBlock) FinishBlock ¶
func (ub UnfinishedBlock) FinishBlock(s committee.Seed, proposer basics.Address, eligible bool) bookkeeping.Block
FinishBlock completes the block and returns a proposable block.
func (UnfinishedBlock) Round ¶
func (ub UnfinishedBlock) Round() basics.Round
Round returns the round of the block.
func (UnfinishedBlock) UnfinishedBlock ¶
func (ub UnfinishedBlock) UnfinishedBlock() bookkeeping.Block
UnfinishedBlock returns the underlying Block. It should only be used for statistics and testing purposes, as the block is not yet finished and ready for proposing.
func (UnfinishedBlock) UnfinishedDeltas ¶
func (ub UnfinishedBlock) UnfinishedDeltas() StateDelta
UnfinishedDeltas returns the unfinished deltas. It should only be used for statistics and testing purposes, as the block is not yet finished and ready for proposing.
type ValidatedBlock ¶
type ValidatedBlock struct {
// contains filtered or unexported fields
}
ValidatedBlock represents the result of a block validation. It can be used to efficiently add the block to the ledger, without repeating the work of applying the block's changes to the ledger state.
func MakeValidatedBlock ¶
func MakeValidatedBlock(blk bookkeeping.Block, delta StateDelta) ValidatedBlock
MakeValidatedBlock creates a validated block.
func (ValidatedBlock) Block ¶
func (vb ValidatedBlock) Block() bookkeeping.Block
Block returns the underlying Block for a ValidatedBlock.
func (ValidatedBlock) Delta ¶
func (vb ValidatedBlock) Delta() StateDelta
Delta returns the underlying Delta for a ValidatedBlock.
type VotersCommitListener ¶
type VotersCommitListener interface { // OnPrepareVoterCommit gives the listener the opportunity to backup VotersForRound data related to rounds (oldBase, newBase] before it is being removed. // The implementation should log any errors that might occur. OnPrepareVoterCommit(oldBase basics.Round, newBase basics.Round, voters LedgerForSPBuilder) }
VotersCommitListener represents an object that needs to get notified on commit stages in the voters tracker.
type VotersForRound ¶
type VotersForRound struct { // Proto is the ConsensusParams for the round whose balances are reflected // in participants. Proto config.ConsensusParams // Participants is the array of top StateProofTopVoters online accounts // in this round, sorted by normalized balance (to make sure heavyweight // accounts are biased to the front). Participants basics.ParticipantsArray // AddrToPos specifies the position of a given account address (if present) // in the Participants array. This allows adding a vote from a given account // to the certificate builder. AddrToPos map[basics.Address]uint64 // Tree is a constructed Merkle tree of the Participants array. Tree *merklearray.Tree // TotalWeight is the sum of the weights from the Participants array. TotalWeight basics.MicroAlgos // contains filtered or unexported fields }
VotersForRound tracks the top online voting accounts as of a particular round, along with a Merkle tree commitment to those voting accounts.
func MakeVotersForRound ¶
func MakeVotersForRound() *VotersForRound
MakeVotersForRound create a new VotersForRound object and initialize it's cond.
func (*VotersForRound) BroadcastError ¶
func (tr *VotersForRound) BroadcastError(err error)
BroadcastError broadcasts the error
func (*VotersForRound) Completed ¶
func (tr *VotersForRound) Completed() (bool, error)
Completed returns true if the tree has finished being constructed. If there was an error constructing the tree, the error is also returned.
func (*VotersForRound) LoadTree ¶
func (tr *VotersForRound) LoadTree(onlineAccountsFetcher OnlineAccountsFetcher, hdr bookkeeping.BlockHeader) error
LoadTree loads the participation tree and other required fields, using the provided OnlineAccountsFetcher.
func (*VotersForRound) Wait ¶
func (tr *VotersForRound) Wait() error
Wait waits for the tree to get constructed.