Documentation
¶
Index ¶
- Constants
- Variables
- func AddressED25519MatchesPrivateKey(addr AddressED25519, privateKey ed25519.PrivateKey) bool
- func AdjustedAmount(amount uint64, slot uint32) uint64
- func BelongsToAccount(lock Lock, acc Accountable) bool
- func BranchInflationBonus(proof []byte) uint64
- func ChainInflation(amount uint64, inSlot, forSlots uint32) uint64
- func ChainInflationOneSlot(amount uint64, inSlot uint32) uint64
- func ClockTime(t base.LedgerTime) time.Time
- func ConstantsYAMLFromParams(par InitParameters) []byte
- func Coverage(o *Output, oid base.OutputID, txTs base.LedgerTime) (coverage, frozen uint64)
- func DefaultStorageDeposit() uint64
- func EmbedHardcoded(lib *easyfl.Library[*EvalContext]) error
- func EqualAccountables(a1, a2 Accountable) bool
- func EqualConstraints(l1, l2 Constraint) bool
- func GetEmbeddedFunctionResolver(lib *easyfl.Library[*EvalContext]) func(sym string) easyfl.EmbeddedFunction[*EvalContext]
- func HashOutputs(outs ...*Output) [32]byte
- func InitWithTestingLedgerIDData(opts ...ParametersOption) ed25519.PrivateKey
- func LibraryYAMLFromParameters(id InitParameters, compiled bool) []byte
- func MinimumInflatableAmount(slot uint32) uint64
- func MinimumStorageDeposit(o *Output) uint64
- func MustInitSingleton(identityData []byte)
- func NameByPrefix(prefix []byte) (string, bool)
- func NewChainLockUnlockParams(predChainOutputIndex, predChainConstraintIndex byte) []byte
- func NewChainUnlockParams(successorOutputIdx, successorConstraintIndex byte) []byte
- func NewTagAlongLockUnlockParams(predChainOutputIndex, predChainConstraintIndex, unlockMode byte) []byte
- func OriginChainID() base.ChainID
- func OutputFromBytesMain(data []byte) (*Output, Amounts, Lock, error)
- func OutputsWithIDToString(outs ...*OutputWithID) string
- func ParseLibraryFromYAML(yamlData []byte, getResolver ...) (*easyfl.Library[*EvalContext], error)
- func ParseSequencerData(o *Output) (ret seqdata.SequencerData, err error)
- func RandomFromSeed(data []byte, scale uint64) uint64
- func SlotDuration() time.Duration
- func SlotNow() uint32
- func TickDuration() time.Duration
- func TimeFromClockTime(nowis time.Time) base.LedgerTime
- func TimeNow() base.LedgerTime
- func TokenBalanceFromAmountsBytes(data []byte) (int64, error)
- func TooCloseOnTimeAxis(txid1, txid2 base.TransactionID) bool
- func UnixNanoFromLedgerTime(t base.LedgerTime) int64
- func ValidSequencerPace(t1, t2 base.LedgerTime) bool
- func ValidTransactionPace(t1, t2 base.LedgerTime) bool
- type AccountID
- type Accountable
- type AddressED25519
- func AddressED25519FromBytes(data []byte) (AddressED25519, error)
- func AddressED25519FromPrivateKey(privateKey ed25519.PrivateKey) AddressED25519
- func AddressED25519FromPublicKey(pubKey ed25519.PublicKey) AddressED25519
- func AddressED25519FromSource(src string) (AddressED25519, error)
- func AddressED25519Null() AddressED25519
- func AddressED25519Random() AddressED25519
- func AddressesED25519FromPrivateKeys(privateKeys []ed25519.PrivateKey) []AddressED25519
- func (a AddressED25519) AccountID() AccountID
- func (a AddressED25519) Accounts() []Accountable
- func (a AddressED25519) AsLock() Lock
- func (a AddressED25519) Bytes() []byte
- func (a AddressED25519) Clone() AddressED25519
- func (a AddressED25519) Master() Accountable
- func (a AddressED25519) Name() string
- func (a AddressED25519) Short() string
- func (a AddressED25519) Source() string
- func (a AddressED25519) String() string
- type Amounts
- func (a Amounts) AddToVector(vect *[15]int64) (overflow bool)
- func (a Amounts) Amount(i byte) (ret int64)
- func (a Amounts) Bytes() []byte
- func (a Amounts) FrozenCoverageAt(i byte) (ret int64)
- func (a Amounts) FrozenCoverageVector() []int64
- func (a Amounts) InflationAmount() uint64
- func (a Amounts) IsFrozenCoverageZero() bool
- func (a Amounts) Name() string
- func (a Amounts) Source() string
- func (a Amounts) String() string
- func (a Amounts) TokenBalance() uint64
- type ChainConstraint
- type ChainConstraintData
- type ChainLock
- func (cl ChainLock) AccountID() AccountID
- func (cl ChainLock) Accounts() []Accountable
- func (cl ChainLock) AsLock() Lock
- func (cl ChainLock) Bytes() []byte
- func (cl ChainLock) ChainID() base.ChainID
- func (cl ChainLock) Master() Accountable
- func (cl ChainLock) Name() string
- func (cl ChainLock) Source() string
- func (cl ChainLock) String() string
- type CommitToSibling
- type ConditionalLock
- type Constants
- func (c *Constants) AdjustFrozenCoverageVector(targetID base.ChainID, vect []int64, predTs, succTs base.LedgerTime) []int64
- func (c *Constants) CoveredSlotsInCurrentEpoch(targetID base.ChainID, slot uint32) uint32
- func (c *Constants) DiffEpochs(targetID base.ChainID, ts1, ts2 base.LedgerTime) int
- func (c *Constants) EnsurePostBranchConsolidationConstraintTimestamp(ts base.LedgerTime) base.LedgerTime
- func (c *Constants) EpochFromSlotDirect(targetID base.ChainID, slot uint32) (epoch uint32)
- func (c *Constants) EpochFromSlotFromSource(targetID base.ChainID, slot uint32) (epoch uint32)
- func (c *Constants) EpochLimits(targetID base.ChainID, epoch uint32) (firstSlot, lastSlot uint32)
- func (c *Constants) EpochOffsetSlotsDirect(targetID base.ChainID) uint32
- func (c *Constants) EpochOffsetSlotsFromSource(targetID base.ChainID) uint32
- func (c *Constants) FrozenSlotsFromFrozenEpochs(target base.ChainID, txSlot uint32, frozenEpochs byte) uint32
- func (c *Constants) GenesisControlledAddress() AddressED25519
- func (c *Constants) GenesisTime() time.Time
- func (c *Constants) GenesisTimeUnixNano() int64
- func (c *Constants) IsPostBranchConsolidationTimestamp(ts base.LedgerTime) bool
- func (c *Constants) IsPreBranchConsolidationTimestamp(ts base.LedgerTime) bool
- func (c *Constants) LastSlotInEpochDirect(targetID base.ChainID, epoch uint32) (lastSlot uint32)
- func (c *Constants) LastSlotInEpochFromSource(targetID base.ChainID, epoch uint32) (lastSlot uint32)
- func (c *Constants) LedgerTimeFromClockTime(nowis time.Time) base.LedgerTime
- func (c *Constants) Lines(prefix ...string) *lines.Lines
- func (c *Constants) SlotDuration() time.Duration
- func (c *Constants) SlotsPerDay() int
- func (c *Constants) SlotsPerYear() int
- func (c *Constants) String() string
- func (c *Constants) TicksPerYear() int
- func (c *Constants) TimeConstantsToString() string
- func (c *Constants) TimeToTicksSinceGenesis(nowis time.Time) int64
- type Constraint
- type ConstraintParser
- type DeadlineLock
- type DelegateLock
- type DelegateLockState
- type DelegationOutput
- func (o *DelegationOutput) FreezeUntilMax(ts base.LedgerTime) (freezeUntilEpoch uint32)
- func (o *DelegationOutput) FrozenEpochs(txTs base.LedgerTime) (from, to, total uint32)
- func (o *DelegationOutput) FrozenSlots(txTs ...base.LedgerTime) (from, to, total uint32)
- func (o *DelegationOutput) InflationOneSlot() uint64
- func (o *DelegationOutput) IsInFrozenSlot(slot uint32) bool
- func (o *DelegationOutput) IsInSafeRevocationWindow(txSlot uint32) bool
- func (o *DelegationOutput) IsMarkedFrozen() bool
- func (o *DelegationOutput) IsMarkedOnHold() bool
- func (o *DelegationOutput) IsUnlockableByMaster(txSlot uint32) bool
- func (o *DelegationOutput) IsUnlockableByTarget(txSlot uint32) bool
- func (o *DelegationOutput) IsUnlockableByTargetForFreezing(txSlot uint32) bool
- func (o *DelegationOutput) IsUnlockableByTargetWithReason(txSlot uint32) (valid bool, err error)
- func (o *DelegationOutput) LinesDelegationData(prefix ...string) *lines.Lines
- func (o *DelegationOutput) LinesHRFull(prefix ...string) *lines.Lines
- func (o *DelegationOutput) LinesSourceFull(prefix ...string) *lines.Lines
- func (o *DelegationOutput) MakeDelegationFreezeOutput(txTs base.LedgerTime, freezeUntilEpoch uint32, predOutputIndex byte, ...) (ret *Output, err error)
- func (o *DelegationOutput) MakeDelegationRevokeOutput(par MakeDelegationRevokeOutputParams) (*Output, error)
- func (o *DelegationOutput) MakeFrozenCoverageAmountDeltasForRevoking(txTs base.LedgerTime) []int64
- func (o *DelegationOutput) MakeFrozenCoverageAmounts(frozenEpochs byte, tokenBalance uint64) ([]int64, error)
- func (o *DelegationOutput) ProjectedInflation(txTs base.LedgerTime, frozenEpochs byte) uint64
- func (o *DelegationOutput) RequiredMinimumInflationAdvance(txTs base.LedgerTime, freezeUntilEpoch uint32) (uint64, error)
- func (o *DelegationOutput) RequiredMinimumInflationAdvanceByFrozenEpochs(txTs base.LedgerTime, frozenEpochs uint32) (uint64, error)
- func (o *DelegationOutput) RequiredMinimumInflationAdvanceOriginal(txTs base.LedgerTime, frozenEpochs byte) uint64
- func (o *DelegationOutput) RevocationCompensationEstimate(txSlot uint32) uint64
- func (o *DelegationOutput) SafeRevocationWindow() (from, to uint32, applicable bool)
- func (o *DelegationOutput) UnfreezeSlot() uint32
- type EnsureStopDelegation
- type EvalContext
- func (c *EvalContext) EvalPath() []byte
- func (c *EvalContext) SelfIsConsumedOutput() bool
- func (c *EvalContext) SelfIsProducedOutput() bool
- func (c *EvalContext) SelfOutput() *Output
- func (c *EvalContext) SelfOutputBytes() (ret []byte)
- func (c *EvalContext) SelfSiblingBytes(idx byte) (ret []byte)
- func (c *EvalContext) SelfSiblingPath(idx byte) (ret []byte)
- func (c *EvalContext) SetEvalPath(path []byte)
- func (c *EvalContext) TxContext() TxContextAccess
- type GeneralScript
- type Immutable
- type InitParameters
- type Library
- type Lock
- type LockBalance
- type LockParser
- type MakeDelegateInitOutputParams
- type MakeDelegationRevokeOutputParams
- type Output
- func MakeDelegationInitOutput(par MakeDelegateInitOutputParams) *Output
- func NewOutput(buildFun func(o *OutputBuilder)) *Output
- func NewTagAlongOutput(fee uint64, targetChainID base.ChainID, sender AddressED25519) *Output
- func OutputBasic(amount int64, lock Lock) *Output
- func OutputFromBytes(data []byte, validateOpt ...func(*Output) error) (*Output, error)
- func OutputFromHexString(hexStr string, validateOpt ...func(*Output) error) (*Output, error)
- func (o *Output) AccountIDs() []AccountID
- func (o *Output) Amounts() Amounts
- func (o *Output) ChainConstraint() (*ChainConstraint, byte)
- func (o *Output) Clone(buildFun ...func(o *OutputBuilder)) *Output
- func (o *Output) ConstraintAt(idx byte) ([]byte, error)
- func (o *Output) ConstraintsRawBytes() [][]byte
- func (o *Output) DelegationLock() *DelegateLock
- func (o *Output) EnoughAmountForStorageDeposit() error
- func (o *Output) EnsureStopDelegationConstraint() (*EnsureStopDelegation, byte)
- func (o *Output) ForEachConstraint(fun func(idx byte, constr []byte) bool)
- func (o *Output) FrozenCoverage(i byte) int64
- func (o *Output) Hex() string
- func (o *Output) InflatableAmount() uint64
- func (o *Output) Inflation() uint64
- func (o *Output) IsSequencerOutput() bool
- func (o *Output) Lines(prefix ...string) *lines.Lines
- func (o *Output) LinesHR(prefix ...string) *lines.Lines
- func (o *Output) LinesPlainHR() *lines.Lines
- func (o *Output) LinesPlainSource() *lines.Lines
- func (o *Output) LinesSource(prefix ...string) *lines.Lines
- func (o *Output) LinesVerbose(prefix ...string) *lines.Lines
- func (o *Output) Lock() Lock
- func (o *Output) MustConstraintAt(idx byte) []byte
- func (o *Output) MustHaveConstraintAnyOfAt(pos byte, names ...string)
- func (o *Output) MustStemLock() *StemLock
- func (o *Output) MustValidOutput()
- func (o *Output) NumConstraints() int
- func (o *Output) SequencerConstraint() (*SequencerConstraint, byte)
- func (o *Output) SequencerOutputData() (*SequencerOutputData, bool)
- func (o *Output) StemLock() (*StemLock, bool)
- func (o *Output) String() string
- func (o *Output) TagAlongLock() *TagAlongLock
- func (o *Output) TimeLock() (uint32, bool)
- func (o *Output) ToSource(prefix ...string) string
- func (o *Output) ToString(prefix ...string) string
- func (o *Output) TokenBalance() uint64
- type OutputBuilder
- func (o *OutputBuilder) MustPushConstraint(c []byte) byte
- func (o *OutputBuilder) NumConstraints() int
- func (o *OutputBuilder) PutAmounts(amount ...int64)
- func (o *OutputBuilder) PutConstraint(c []byte, idx byte)
- func (o *OutputBuilder) PutLock(lock Lock)
- func (o *OutputBuilder) WithAmounts(amount ...int64) *OutputBuilder
- func (o *OutputBuilder) WithLock(lock Lock) *OutputBuilder
- func (o *OutputBuilder) WithTokenBalance(bal uint64) *OutputBuilder
- type OutputDataWithChainID
- type OutputDataWithID
- type OutputWithChainID
- func AsOutputWithChainID(o *Output, oid base.OutputID) (OutputWithChainID, bool)
- func FilterChainOutputs(outs []*OutputWithID) ([]*OutputWithChainID, error)
- func GenesisOutput(initialSupply uint64, controllerAddress AddressED25519) *OutputWithChainID
- func ParseChainConstraintsFromData(outs []*OutputDataWithID) ([]*OutputWithChainID, error)
- type OutputWithID
- func FilterOutputsSortByAmount(outs []*OutputWithID, filter func(o *Output) bool, desc ...bool) []*OutputWithID
- func GenesisStemOutput() *OutputWithID
- func ParseAndSortOutputData(outs []*OutputDataWithID, filter func(oid *base.OutputID, o *Output) bool, ...) ([]*OutputWithID, error)
- func ParseAndSortOutputDataUpToAmount(outs []*OutputDataWithID, amount uint64, ...) ([]*OutputWithID, uint64, base.LedgerTime, error)
- func ParseOutputDataAndFilter(outs []*OutputDataWithID, filter func(oid *base.OutputID, o *Output) bool) ([]*OutputWithID, error)
- func (o *OutputWithID) AdjustedTokenBalance() uint64
- func (o *OutputWithID) AsChainOutput() (*OutputWithChainID, error)
- func (o *OutputWithID) AsTagAlong() TagAlongOutput
- func (o *OutputWithID) Clone() *OutputWithID
- func (o *OutputWithID) ExtractChainID() (chainID base.ChainID, predecessorConstraintIndex byte, ok bool)
- func (o *OutputWithID) IDShort() string
- func (o *OutputWithID) LinesHR(prefix ...string) *lines.Lines
- func (o *OutputWithID) LinesSource(prefix ...string) *lines.Lines
- func (o *OutputWithID) MustAsChainOutput() *OutputWithChainID
- func (o *OutputWithID) Short() string
- func (o *OutputWithID) Source() string
- func (o *OutputWithID) String() string
- func (o *OutputWithID) Timestamp() base.LedgerTime
- type OutputWithSequencerData
- type ParametersOption
- type SequencerConstraint
- type SequencerOutputData
- type SequencerTransactionData
- type StemLock
- func (st *StemLock) AccountID() AccountID
- func (st *StemLock) Accounts() []Accountable
- func (st *StemLock) AsLock() Lock
- func (st *StemLock) Bytes() []byte
- func (st *StemLock) Master() Accountable
- func (st *StemLock) Name() string
- func (st *StemLock) Source() string
- func (st *StemLock) String() string
- type TagAlongLock
- type TagAlongOutput
- type Timelock
- type TotalAmount
- type TxContextAccess
Constants ¶
const ( AmountIndexTokenBalance = byte(iota) AmountIndexInflation AmountIndexFrozenCoverage )
const ( TrieArity = common.PathArity16 TrieHashSize = trie_blake2b.HashSize256 )
const ( DefaultTickDuration = 80 * time.Millisecond DustPerProxi = 1_000_000 PRXI = DustPerProxi InitialSupplyProxi = 1_000_000_000 DefaultInitialSupply = InitialSupplyProxi * PRXI DefaultTransactionPace = 12 DefaultTransactionPaceSequencer = 2 )
const ( TransactionBranch = byte(iota) ConsumedBranch )
Top level branches
const ( TxInputIDs = byte(iota) TxUnlockData TxOutputs TxSignature TxSequencerAndStemOutputIndices TxTimestamp TxInputCommitment TxEndorsements TxExplicitBaseline TxLocalLibraries TxTreeIndexMax )
Transaction tree
const ( ConstraintIndexAmounts = byte(iota) ConstraintIndexLock ConstraintIndexFirstOptionalConstraint )
Mandatory output block indices
const ( EnsureStopDelegationName = "ensureStopDelegation" EnsureStopDelegationTemplate = EnsureStopDelegationName + "(0x%s)" EnsureStopDelegationTemplateHR = EnsureStopDelegationName + "(%s)" )
const ( BootstrapSequencerName = "boot" // BoostrapSequencerIDHex is a constant BoostrapSequencerIDHex = "8739faa34a6902e49bc16455bbd642fd3c649e8959d97089e43f214ca57ea0e5" )
const ( DelegateLockName = "delegateLock" DelegateLockTemplate = DelegateLockName + "(%s, %s, %s, z16/%d)" DelegateLockTemplateHR = DelegateLockName + "(target=%s, master=%s, maxFreezeEpochs=%d, inflationShare=%d%%%%)" DelegateLockStateName = "delegateLockState" DelegateLockStateTemplate = DelegateLockStateName + "(z32/%d, %d)" DelegateLockStateTemplateHR = DelegateLockStateName + "(frozenUntilEpoch=%d, state=%s)" DelegateLockStateUndef = byte(0) DelegateLockStateFrozen = byte(1) DelegateLockStateOnHold = byte(2) DelegationUnlockedByTarget = byte(0) DelegationUnlockedByMaster = byte(0xff) )
const (
//AddressED25519Name = "addressED25519"
AddressED25519Name = "a"
)
const AmountsConstraintName = "amounts"
const (
ChainConstraintName = "chain"
)
const (
//ChainLockName = "chainLock"
ChainLockName = "c"
)
const (
CommitToSiblingName = "commitToSibling"
)
const ConditionalLockName = "conditionalLock"
const ConsumedOutputsBranch = byte(0)
const (
DeadlineLockName = "deadlineLock"
)
const (
ImmutableName = "immutable"
)
const SeqMilestoneDataFixedIndex = 4
const (
SequencerConstraintName = "sequencer"
)
const (
StemLockName = "stemLock"
)
const (
TagAlongLockName = "tagAlong"
)
const (
TimelockName = "timelock"
)
const (
TotalAmountConstraintName = "total"
)
Variables ¶
var ( PathToConsumedOutputs = tuples.Path(ConsumedBranch, ConsumedOutputsBranch) PathToProducedOutputs = tuples.Path(TransactionBranch, TxOutputs) PathToUnlockParams = tuples.Path(TransactionBranch, TxUnlockData) PathToInputIDs = tuples.Path(TransactionBranch, TxInputIDs) PathToSignature = tuples.Path(TransactionBranch, TxSignature) PathToSequencerAndStemOutputIndices = tuples.Path(TransactionBranch, TxSequencerAndStemOutputIndices) PathToInputCommitment = tuples.Path(TransactionBranch, TxInputCommitment) PathToEndorsements = tuples.Path(TransactionBranch, TxEndorsements) PathToExplicitBaseline = tuples.Path(TransactionBranch, TxExplicitBaseline) PathToLocalLibraries = tuples.Path(TransactionBranch, TxLocalLibraries) PathToTimestamp = tuples.Path(TransactionBranch, TxTimestamp) )
var CommitmentModel = trie_blake2b.New(TrieArity, TrieHashSize)
var FinishChainUnlockParams = []byte{0xff, 0xff}
var NilChainLock = ChainLockFromChainID(base.NilChainID)
var NilTimelock = Timelock(0)
var StemAccountID = AccountID([]byte{0})
Functions ¶
func AddressED25519MatchesPrivateKey ¶
func AddressED25519MatchesPrivateKey(addr AddressED25519, privateKey ed25519.PrivateKey) bool
func AdjustedAmount ¶
AdjustedAmount calculates amount adjusted to the maximum inflation. I.e. adjusted amount A as a result to maximal inflation in 'slot' slots reaches 'amount' If amount == totalSupply, then adjusted amount == initialSupply TODO experimental
- consider name 'real supply/amount/balance'
- consider adjustment of the branch inflation bonus
func BelongsToAccount ¶
func BelongsToAccount(lock Lock, acc Accountable) bool
func BranchInflationBonus ¶
func ChainInflation ¶
func ChainInflationOneSlot ¶
func ConstantsYAMLFromParams ¶
func ConstantsYAMLFromParams(par InitParameters) []byte
func Coverage ¶
Coverage returns for the consumed output in the transaction with specified timestamp - coverage presented by the output, which includes frozen coverage part - frozen part separately
func DefaultStorageDeposit ¶
func DefaultStorageDeposit() uint64
DefaultStorageDeposit not always enough
func EmbedHardcoded ¶
func EmbedHardcoded(lib *easyfl.Library[*EvalContext]) error
EmbedHardcoded upgrades library with hardcoded (embedded) functions of the proxima ledger
func EqualAccountables ¶
func EqualAccountables(a1, a2 Accountable) bool
func EqualConstraints ¶
func EqualConstraints(l1, l2 Constraint) bool
func GetEmbeddedFunctionResolver ¶
func GetEmbeddedFunctionResolver(lib *easyfl.Library[*EvalContext]) func(sym string) easyfl.EmbeddedFunction[*EvalContext]
func HashOutputs ¶
HashOutputs calculates input commitment from outputs: the hash of lazyarray composed of output data
func InitWithTestingLedgerIDData ¶
func InitWithTestingLedgerIDData(opts ...ParametersOption) ed25519.PrivateKey
func LibraryYAMLFromParameters ¶
func LibraryYAMLFromParameters(id InitParameters, compiled bool) []byte
func MinimumInflatableAmount ¶
func MinimumStorageDeposit ¶
func MustInitSingleton ¶
func MustInitSingleton(identityData []byte)
func NameByPrefix ¶
func NewChainUnlockParams ¶
NewChainUnlockParams unlock parameters for the chain constraint. 3 bytes: 0 - successor output index 1 - successor block index 2 - transition mode must be equal to the transition mode in the successor constraint data
func OriginChainID ¶
func OutputsWithIDToString ¶
func OutputsWithIDToString(outs ...*OutputWithID) string
func ParseLibraryFromYAML ¶
func ParseLibraryFromYAML( yamlData []byte, getResolver ...func(lib *easyfl.Library[*EvalContext], ) func(sym string) easyfl.EmbeddedFunction[*EvalContext]) (*easyfl.Library[*EvalContext], error)
func ParseSequencerData ¶
func ParseSequencerData(o *Output) (ret seqdata.SequencerData, err error)
ParseSequencerData expected at index 4
func RandomFromSeed ¶
RandomFromSeed returns a random uin64 number in [0, scale) by scaling the data value as BigInt to the interval [0, scale). The 'scale' value itself is not included It is used to extract a verifiable random uint64 from a ED25519 signature.
func SlotDuration ¶
func TickDuration ¶
func TimeFromClockTime ¶
func TimeFromClockTime(nowis time.Time) base.LedgerTime
func TimeNow ¶
func TimeNow() base.LedgerTime
func TooCloseOnTimeAxis ¶
func TooCloseOnTimeAxis(txid1, txid2 base.TransactionID) bool
func UnixNanoFromLedgerTime ¶
func UnixNanoFromLedgerTime(t base.LedgerTime) int64
func ValidSequencerPace ¶
func ValidSequencerPace(t1, t2 base.LedgerTime) bool
ValidSequencerPace return true if input and target sequencer tx timestamps make a valid pace
func ValidTransactionPace ¶
func ValidTransactionPace(t1, t2 base.LedgerTime) bool
ValidTransactionPace return true if input and target non-sequencer tx timestamps make a valid pace
Types ¶
type Accountable ¶
type Accountable interface {
Constraint
AccountID() AccountID
AsLock() Lock
}
func AccountableFromBytes ¶
func AccountableFromBytes(data []byte) (Accountable, error)
func AccountableFromSource ¶
func AccountableFromSource(src string) (Accountable, error)
func NoDuplicatesAccountables ¶
func NoDuplicatesAccountables(acc []Accountable) []Accountable
type AddressED25519 ¶
type AddressED25519 []byte
func AddressED25519FromBytes ¶
func AddressED25519FromBytes(data []byte) (AddressED25519, error)
func AddressED25519FromPrivateKey ¶
func AddressED25519FromPrivateKey(privateKey ed25519.PrivateKey) AddressED25519
func AddressED25519FromPublicKey ¶
func AddressED25519FromPublicKey(pubKey ed25519.PublicKey) AddressED25519
func AddressED25519FromSource ¶
func AddressED25519FromSource(src string) (AddressED25519, error)
func AddressED25519Null ¶
func AddressED25519Null() AddressED25519
func AddressED25519Random ¶
func AddressED25519Random() AddressED25519
func AddressesED25519FromPrivateKeys ¶
func AddressesED25519FromPrivateKeys(privateKeys []ed25519.PrivateKey) []AddressED25519
func (AddressED25519) AccountID ¶
func (a AddressED25519) AccountID() AccountID
func (AddressED25519) Accounts ¶
func (a AddressED25519) Accounts() []Accountable
func (AddressED25519) AsLock ¶
func (a AddressED25519) AsLock() Lock
func (AddressED25519) Bytes ¶
func (a AddressED25519) Bytes() []byte
func (AddressED25519) Clone ¶
func (a AddressED25519) Clone() AddressED25519
func (AddressED25519) Master ¶
func (a AddressED25519) Master() Accountable
func (AddressED25519) Name ¶
func (a AddressED25519) Name() string
func (AddressED25519) Short ¶
func (a AddressED25519) Short() string
func (AddressED25519) Source ¶
func (a AddressED25519) Source() string
func (AddressED25519) String ¶
func (a AddressED25519) String() string
type Amounts ¶
type Amounts []int64
func AmountsFromBytes ¶
func NewAmounts ¶
func (Amounts) AddToVector ¶
AddToVector adds amounts to vector with safe arithmetics Returns false in case of arithmetic overflow, but does not panic It is up to the caller to process overflow
func (Amounts) FrozenCoverageAt ¶
func (Amounts) FrozenCoverageVector ¶
func (Amounts) InflationAmount ¶
func (Amounts) IsFrozenCoverageZero ¶
func (Amounts) TokenBalance ¶
type ChainConstraint ¶
type ChainConstraint struct {
// ChainID all-0 for origin
ChainID base.ChainID
// Predecessor output index with the same ChainID. Must be 0xFF for the origin
PredecessorInputIndex byte
// Predecessor constraint index. Must be 0xff for the origin
PredecessorConstraintIndex byte
// slot of the origin chain output
OriginSlot uint32
// amount on the chain at the origin
OriginAmount uint64
}
ChainConstraint is a chain constraint
func ChainConstraintFromBytes ¶
func ChainConstraintFromBytes(data []byte) (*ChainConstraint, error)
func NewChainConstraint ¶
func NewChainOrigin ¶
func NewChainOrigin(startSlot uint32, startAmount uint64) *ChainConstraint
func (*ChainConstraint) Bytes ¶
func (cc *ChainConstraint) Bytes() []byte
func (*ChainConstraint) IsOrigin ¶
func (cc *ChainConstraint) IsOrigin() bool
func (*ChainConstraint) Name ¶
func (cc *ChainConstraint) Name() string
func (*ChainConstraint) Source ¶
func (cc *ChainConstraint) Source() string
func (*ChainConstraint) String ¶
func (cc *ChainConstraint) String() string
type ChainConstraintData ¶
type ChainConstraintData struct {
ChainConstraint
ChainConstraintIndex byte
}
func ExtractChainData ¶
func ExtractChainData(o *Output, oid base.OutputID) (chainConstraintData ChainConstraintData, ok bool)
type ChainLock ¶
type ChainLock []byte
func ChainLockFromBytes ¶
func ChainLockFromChainID ¶
func (ChainLock) Accounts ¶
func (cl ChainLock) Accounts() []Accountable
func (ChainLock) Master ¶
func (cl ChainLock) Master() Accountable
type CommitToSibling ¶
func CommitToSiblingFromBytes ¶
func CommitToSiblingFromBytes(data []byte) (*CommitToSibling, error)
func NewCommitToSibling ¶
func NewCommitToSibling(siblingIndex byte, siblingHash []byte) *CommitToSibling
func (*CommitToSibling) Bytes ¶
func (cs *CommitToSibling) Bytes() []byte
func (*CommitToSibling) Name ¶
func (cs *CommitToSibling) Name() string
func (*CommitToSibling) Source ¶
func (cs *CommitToSibling) Source() string
func (*CommitToSibling) String ¶
func (cs *CommitToSibling) String() string
type ConditionalLock ¶
type ConditionalLock struct {
Conditions [4]Constraint
Locks [4]Accountable
}
ConditionalLock enforces condition by selecting first of up to 4 satisfied conditions and evaluating corresponding accountable lock
func ConditionalLockFromBytes ¶
func ConditionalLockFromBytes(data []byte) (*ConditionalLock, error)
func NewConditionalLock ¶
func NewConditionalLock(conds []Constraint, locks []Accountable) (*ConditionalLock, error)
func (*ConditionalLock) Accounts ¶
func (c *ConditionalLock) Accounts() []Accountable
func (*ConditionalLock) Bytes ¶
func (c *ConditionalLock) Bytes() []byte
func (*ConditionalLock) Master ¶
func (c *ConditionalLock) Master() Accountable
func (*ConditionalLock) Name ¶
func (c *ConditionalLock) Name() string
func (*ConditionalLock) Source ¶
func (c *ConditionalLock) Source() string
func (*ConditionalLock) String ¶
func (c *ConditionalLock) String() string
type Constants ¶
type Constants struct {
Hash [32]byte
// arbitrary string up 255 bytes
Description string
// genesis time unix seconds
GenesisTimeUnix uint32
// ED25519 public key of the controller
GenesisControllerPublicKey ed25519.PublicKey
// time tick duration in nanoseconds
TickDuration time.Duration
TicksPerSlot uint64
// initial supply of tokens
InitialSupply uint64
// ----------- begin inflation-related
SlotInflationBase uint64 // inflation of the total initial supply in slot 0
MinimumInflatableAmount0 uint64 // initial supply / slot inflation base
// BranchInflationBonusBase inflation bonus
BranchInflationBonusBase uint64
// ----------- end inflation-related
// number of ticks between non-sequencer transactions
TransactionPace byte
// number of ticks between sequencer transactions
TransactionPaceSequencer byte
// this limits number of sequencers in the network. Reasonable amount would be few hundreds of sequencers
MinimumAmountOnSequencer uint64
// limit maximum number of endorsements. For determinism
MaxNumberOfEndorsements uint64
// PreBranchConsolidationTicks enforces endorsement-only constraint for specified amount of ticks
// before the slot boundary. It means, sequencer transaction can have only one input, its own predecessor
// for any transaction with timestamp ticks > MaxTickValueInSlot - PreBranchConsolidationTicks
// value 0 of PreBranchConsolidationTicks effectively means no constraint
PreBranchConsolidationTicks uint8
PostBranchConsolidationTicks uint8
// -------------- delegation related
// number of slots where target cannot consume delegation output
SafeRevocationSlots uint32
// number of slot in the delegation epoch
DelegationEpochSlots uint32
// maximum number of frozen epochs
MaxFrozenEpochs uint32
// ---------- tag-along related
TagAlongSlots uint32
TagAlongReclaimSlots uint32
}
Constants contains constant values of the ledger
var Const *Constants
func ConstantsFromLibrary ¶
func ConstantsFromLibrary(lib *easyfl.Library[*EvalContext]) *Constants
func (*Constants) AdjustFrozenCoverageVector ¶
func (*Constants) CoveredSlotsInCurrentEpoch ¶
CoveredSlotsInCurrentEpoch returns how many slots are covered in the current epoch defined by txSlot and taking into account the offset calculated from the target
func (*Constants) DiffEpochs ¶
DiffEpochs return ts1 - ts2 in delegation epochs
func (*Constants) EnsurePostBranchConsolidationConstraintTimestamp ¶
func (c *Constants) EnsurePostBranchConsolidationConstraintTimestamp(ts base.LedgerTime) base.LedgerTime
func (*Constants) EpochFromSlotDirect ¶
EpochFromSlotDirect which delegation epoch slot belongs to
func (*Constants) EpochFromSlotFromSource ¶
EpochFromSlotFromSource which delegation epoch slot belongs to
func (*Constants) EpochLimits ¶
func (*Constants) EpochOffsetSlotsDirect ¶
EpochOffsetSlotsDirect returns slot offset unique for the delegation target chain ChainID. Each chain ChainID defines own grid of epochs. It spreads delegation output consumption among sequencers
func (*Constants) EpochOffsetSlotsFromSource ¶
func (*Constants) FrozenSlotsFromFrozenEpochs ¶
func (*Constants) GenesisControlledAddress ¶
func (c *Constants) GenesisControlledAddress() AddressED25519
func (*Constants) GenesisTime ¶
func (*Constants) GenesisTimeUnixNano ¶
func (*Constants) IsPostBranchConsolidationTimestamp ¶
func (c *Constants) IsPostBranchConsolidationTimestamp(ts base.LedgerTime) bool
func (*Constants) IsPreBranchConsolidationTimestamp ¶
func (c *Constants) IsPreBranchConsolidationTimestamp(ts base.LedgerTime) bool
func (*Constants) LastSlotInEpochDirect ¶
func (*Constants) LastSlotInEpochFromSource ¶
func (*Constants) LedgerTimeFromClockTime ¶
func (c *Constants) LedgerTimeFromClockTime(nowis time.Time) base.LedgerTime
func (*Constants) SlotDuration ¶
func (*Constants) SlotsPerDay ¶
func (*Constants) SlotsPerYear ¶
func (*Constants) TicksPerYear ¶
func (*Constants) TimeConstantsToString ¶
type Constraint ¶
type Constraint interface {
Name() string // EasyFL function name in the ledger library
Bytes() []byte // bytecode, compiled from EasyFL source
Source() string // EasyFL source
String() string // human-readable
}
func ConstraintFromBytes ¶
func ConstraintFromBytes(data []byte) (Constraint, error)
type ConstraintParser ¶
type ConstraintParser func([]byte) (Constraint, error)
type DeadlineLock ¶
type DeadlineLock struct {
Deadline uint32
ConstraintMain Accountable
ConstraintExpiry Accountable
}
func DeadlineLockFromBytes ¶
func DeadlineLockFromBytes(data []byte) (*DeadlineLock, error)
func NewDeadlineLock ¶
func NewDeadlineLock(deadline uint32, main, expiry Accountable) *DeadlineLock
func (*DeadlineLock) Accounts ¶
func (dl *DeadlineLock) Accounts() []Accountable
func (*DeadlineLock) Bytes ¶
func (dl *DeadlineLock) Bytes() []byte
func (*DeadlineLock) Master ¶
func (dl *DeadlineLock) Master() Accountable
func (*DeadlineLock) Name ¶
func (dl *DeadlineLock) Name() string
func (*DeadlineLock) Source ¶
func (dl *DeadlineLock) Source() string
func (*DeadlineLock) String ¶
func (dl *DeadlineLock) String() string
type DelegateLock ¶
type DelegateLock struct {
Target ChainLock
MasterLock Accountable
MaxFrozenEpochs byte
}
func Delegate2LockFromBytes ¶
func Delegate2LockFromBytes(data []byte) (*DelegateLock, error)
func NewDelegateLock ¶
func NewDelegateLock(target ChainLock, master Accountable, maxFreezeEpochs byte, requiredInflationShare uint16) *DelegateLock
func (*DelegateLock) Accounts ¶
func (d *DelegateLock) Accounts() []Accountable
func (*DelegateLock) Bytes ¶
func (d *DelegateLock) Bytes() []byte
func (*DelegateLock) Master ¶
func (d *DelegateLock) Master() Accountable
func (*DelegateLock) Name ¶
func (d *DelegateLock) Name() string
func (*DelegateLock) Source ¶
func (d *DelegateLock) Source() string
func (*DelegateLock) String ¶
func (d *DelegateLock) String() string
type DelegateLockState ¶
func DelegateLockStateFromBytes ¶
func DelegateLockStateFromBytes(data []byte) (DelegateLockState, error)
func (DelegateLockState) Bytes ¶
func (d DelegateLockState) Bytes() []byte
func (DelegateLockState) Name ¶
func (d DelegateLockState) Name() string
func (DelegateLockState) Source ¶
func (d DelegateLockState) Source() string
func (DelegateLockState) String ¶
func (d DelegateLockState) String() string
type DelegationOutput ¶
type DelegationOutput struct {
OutputWithChainID
DelegateLock
DelegateLockState
}
func AsDelegationOutput ¶
func AsDelegationOutput(o *Output, oid base.OutputID) (ret DelegationOutput, ok bool)
func DelegationOutputFromOutputWithChainID ¶
func DelegationOutputFromOutputWithChainID(o *OutputWithChainID) (ret DelegationOutput, ok bool)
func (*DelegationOutput) FreezeUntilMax ¶
func (o *DelegationOutput) FreezeUntilMax(ts base.LedgerTime) (freezeUntilEpoch uint32)
func (*DelegationOutput) FrozenEpochs ¶
func (o *DelegationOutput) FrozenEpochs(txTs base.LedgerTime) (from, to, total uint32)
func (*DelegationOutput) FrozenSlots ¶
func (o *DelegationOutput) FrozenSlots(txTs ...base.LedgerTime) (from, to, total uint32)
func (*DelegationOutput) InflationOneSlot ¶
func (o *DelegationOutput) InflationOneSlot() uint64
func (*DelegationOutput) IsInFrozenSlot ¶
func (o *DelegationOutput) IsInFrozenSlot(slot uint32) bool
IsInFrozenSlot true means only target can consume it in the slot
func (*DelegationOutput) IsInSafeRevocationWindow ¶
func (o *DelegationOutput) IsInSafeRevocationWindow(txSlot uint32) bool
func (*DelegationOutput) IsMarkedFrozen ¶
func (o *DelegationOutput) IsMarkedFrozen() bool
func (*DelegationOutput) IsMarkedOnHold ¶
func (o *DelegationOutput) IsMarkedOnHold() bool
func (*DelegationOutput) IsUnlockableByMaster ¶
func (o *DelegationOutput) IsUnlockableByMaster(txSlot uint32) bool
func (*DelegationOutput) IsUnlockableByTarget ¶
func (o *DelegationOutput) IsUnlockableByTarget(txSlot uint32) bool
IsUnlockableByTarget true if it is not revoked and not in the safe revocation window
func (*DelegationOutput) IsUnlockableByTargetForFreezing ¶
func (o *DelegationOutput) IsUnlockableByTargetForFreezing(txSlot uint32) bool
func (*DelegationOutput) IsUnlockableByTargetWithReason ¶
func (o *DelegationOutput) IsUnlockableByTargetWithReason(txSlot uint32) (valid bool, err error)
IsUnlockableByTargetWithReason returns:
- false, <reason> if permanently unclockable,
- true, <reason> if temporarily unlockable
func (*DelegationOutput) LinesDelegationData ¶
func (o *DelegationOutput) LinesDelegationData(prefix ...string) *lines.Lines
func (*DelegationOutput) LinesHRFull ¶
func (o *DelegationOutput) LinesHRFull(prefix ...string) *lines.Lines
func (*DelegationOutput) LinesSourceFull ¶
func (o *DelegationOutput) LinesSourceFull(prefix ...string) *lines.Lines
func (*DelegationOutput) MakeDelegationFreezeOutput ¶
func (o *DelegationOutput) MakeDelegationFreezeOutput(txTs base.LedgerTime, freezeUntilEpoch uint32, predOutputIndex byte, advance uint64, disableConsistencyCheck ...bool) (ret *Output, err error)
MakeDelegationFreezeOutput constructs successor of the delegation output using maximum possible frozen epochs
func (*DelegationOutput) MakeDelegationRevokeOutput ¶
func (o *DelegationOutput) MakeDelegationRevokeOutput(par MakeDelegationRevokeOutputParams) (*Output, error)
MakeDelegationRevokeOutput error means reason why it cannot be constructed in particular situation
func (*DelegationOutput) MakeFrozenCoverageAmountDeltasForRevoking ¶
func (o *DelegationOutput) MakeFrozenCoverageAmountDeltasForRevoking(txTs base.LedgerTime) []int64
func (*DelegationOutput) MakeFrozenCoverageAmounts ¶
func (o *DelegationOutput) MakeFrozenCoverageAmounts(frozenEpochs byte, tokenBalance uint64) ([]int64, error)
func (*DelegationOutput) ProjectedInflation ¶
func (o *DelegationOutput) ProjectedInflation(txTs base.LedgerTime, frozenEpochs byte) uint64
ProjectedInflation max inflation that could be generated on the output for a number of frozen epochs
func (*DelegationOutput) RequiredMinimumInflationAdvance ¶
func (o *DelegationOutput) RequiredMinimumInflationAdvance(txTs base.LedgerTime, freezeUntilEpoch uint32) (uint64, error)
func (*DelegationOutput) RequiredMinimumInflationAdvanceByFrozenEpochs ¶
func (o *DelegationOutput) RequiredMinimumInflationAdvanceByFrozenEpochs(txTs base.LedgerTime, frozenEpochs uint32) (uint64, error)
func (*DelegationOutput) RequiredMinimumInflationAdvanceOriginal ¶
func (o *DelegationOutput) RequiredMinimumInflationAdvanceOriginal(txTs base.LedgerTime, frozenEpochs byte) uint64
RequiredMinimumInflationAdvanceOriginal calculates how big advance requires the delegation output for freezing it, as calculated from immutable MinInflationAdvancePerFullEpoch value on it
func (*DelegationOutput) RevocationCompensationEstimate ¶
func (o *DelegationOutput) RevocationCompensationEstimate(txSlot uint32) uint64
func (*DelegationOutput) SafeRevocationWindow ¶
func (o *DelegationOutput) SafeRevocationWindow() (from, to uint32, applicable bool)
func (*DelegationOutput) UnfreezeSlot ¶
func (o *DelegationOutput) UnfreezeSlot() uint32
type EnsureStopDelegation ¶
func EnsureStopDelegationFromBytes ¶
func EnsureStopDelegationFromBytes(data []byte) (*EnsureStopDelegation, error)
func EnsureStopDelegationFromDelegationID ¶
func EnsureStopDelegationFromDelegationID(chainID base.ChainID) EnsureStopDelegation
func (*EnsureStopDelegation) Bytes ¶
func (d *EnsureStopDelegation) Bytes() []byte
func (*EnsureStopDelegation) Name ¶
func (d *EnsureStopDelegation) Name() string
func (*EnsureStopDelegation) Source ¶
func (d *EnsureStopDelegation) Source() string
func (*EnsureStopDelegation) String ¶
func (d *EnsureStopDelegation) String() string
type EvalContext ¶
type EvalContext struct {
TxContextAccess
// contains filtered or unexported fields
}
EvalContext is the data structure passed to the eval call. It contains: - access interface to the transaction context - path: a path in the validation context of the constraint being validated in the eval call
func NewEvalContext ¶
func NewEvalContext(ctx TxContextAccess) *EvalContext
func (*EvalContext) EvalPath ¶
func (c *EvalContext) EvalPath() []byte
func (*EvalContext) SelfIsConsumedOutput ¶
func (c *EvalContext) SelfIsConsumedOutput() bool
func (*EvalContext) SelfIsProducedOutput ¶
func (c *EvalContext) SelfIsProducedOutput() bool
func (*EvalContext) SelfOutput ¶
func (c *EvalContext) SelfOutput() *Output
func (*EvalContext) SelfOutputBytes ¶
func (c *EvalContext) SelfOutputBytes() (ret []byte)
func (*EvalContext) SelfSiblingBytes ¶
func (c *EvalContext) SelfSiblingBytes(idx byte) (ret []byte)
func (*EvalContext) SelfSiblingPath ¶
func (c *EvalContext) SelfSiblingPath(idx byte) (ret []byte)
func (*EvalContext) SetEvalPath ¶
func (c *EvalContext) SetEvalPath(path []byte)
func (*EvalContext) TxContext ¶
func (c *EvalContext) TxContext() TxContextAccess
type GeneralScript ¶
type GeneralScript []byte
func NewGeneralScript ¶
func NewGeneralScript(data []byte) GeneralScript
func NewGeneralScriptFromSource ¶
func NewGeneralScriptFromSource(src string) (GeneralScript, error)
func (GeneralScript) Bytes ¶
func (u GeneralScript) Bytes() []byte
func (GeneralScript) Name ¶
func (u GeneralScript) Name() string
func (GeneralScript) Source ¶
func (u GeneralScript) Source() string
func (GeneralScript) String ¶
func (u GeneralScript) String() string
type InitParameters ¶
type InitParameters struct {
Description string
GenesisTimeUnix uint32
GenesisControllerPublicKey ed25519.PublicKey
TickDuration time.Duration
TransactionPaceTicks int
TransactionPaceSequencerTicks int
}
InitParameters contains parameters which can modified ledger definitions before making them immutable
func DefaultParameters ¶
func DefaultParameters(privateKey ed25519.PrivateKey, genesisTimeUnix uint32, description ...string) InitParameters
func GetTestingLedgerParams ¶
func GetTestingLedgerParams(seed ...int) (InitParameters, ed25519.PrivateKey)
type Library ¶
type Library struct {
*easyfl.Library[*EvalContext]
// contains filtered or unexported fields
}
func LibraryFromParameters ¶
func LibraryFromParameters(idParams InitParameters, verbose ...bool) *Library
func (*Library) BranchInflationBonusBaseFromSource ¶
func (*Library) ChainInflationOriginal ¶
func (*Library) IdentityData ¶
type Lock ¶
type Lock interface {
Constraint
// Accounts all accounts of the lock
Accounts() []Accountable
// Master is account which is always unlockable. For conditional locks it is usually nil (no master)
Master() Accountable // TODO is it really needed
}
func LockFromBytes ¶
type LockBalance ¶
type LockBalance struct {
// Lock of the output
Lock Lock
// Balance amount of tokens on the output
Balance uint64
// ChainOrigin true if start a chain on this output by adding chain constrain (origin)
// false for simple ED25519 account balance (no chain origin added)
ChainOrigin bool
}
LockBalance is an amount/target pair used in distribution list One LockBalance results in one produced output on the transaction
type LockParser ¶
type Output ¶
func MakeDelegationInitOutput ¶
func MakeDelegationInitOutput(par MakeDelegateInitOutputParams) *Output
func NewOutput ¶
func NewOutput(buildFun func(o *OutputBuilder)) *Output
func NewTagAlongOutput ¶
func NewTagAlongOutput(fee uint64, targetChainID base.ChainID, sender AddressED25519) *Output
func OutputBasic ¶
func OutputFromBytes ¶
func OutputFromHexString ¶
func (*Output) AccountIDs ¶
func (*Output) ChainConstraint ¶
func (o *Output) ChainConstraint() (*ChainConstraint, byte)
ChainConstraint finds and parses chain constraint. Returns its constraintIndex or 0xff if not found
func (*Output) Clone ¶
func (o *Output) Clone(buildFun ...func(o *OutputBuilder)) *Output
Clone clones output and gives a chance to modify it
func (*Output) ConstraintsRawBytes ¶
func (*Output) DelegationLock ¶
func (o *Output) DelegationLock() *DelegateLock
func (*Output) EnoughAmountForStorageDeposit ¶
func (*Output) EnsureStopDelegationConstraint ¶
func (o *Output) EnsureStopDelegationConstraint() (*EnsureStopDelegation, byte)
func (*Output) ForEachConstraint ¶
func (*Output) FrozenCoverage ¶
func (*Output) InflatableAmount ¶
func (*Output) IsSequencerOutput ¶
IsSequencerOutput output contains sequencer constraint
func (*Output) LinesPlainHR ¶
func (*Output) LinesPlainSource ¶
func (*Output) MustConstraintAt ¶
func (*Output) MustHaveConstraintAnyOfAt ¶
func (*Output) MustStemLock ¶
func (*Output) MustValidOutput ¶
func (o *Output) MustValidOutput()
MustValidOutput checks if amount and lock constraints are as expected
func (*Output) NumConstraints ¶
func (*Output) SequencerConstraint ¶
func (o *Output) SequencerConstraint() (*SequencerConstraint, byte)
SequencerConstraint finds and parses chain constraint. Returns its constraintIndex or 0xff if not found
func (*Output) SequencerOutputData ¶
func (o *Output) SequencerOutputData() (*SequencerOutputData, bool)
func (*Output) TagAlongLock ¶
func (o *Output) TagAlongLock() *TagAlongLock
TagAlongLock return tag-along lock if present, otherwise nil
func (*Output) TokenBalance ¶
type OutputBuilder ¶
type OutputBuilder struct {
*tuples.TupleEditable
}
func OutputBuilderFromBytes ¶
func OutputBuilderFromBytes(data []byte) (*OutputBuilder, error)
func (*OutputBuilder) MustPushConstraint ¶
func (o *OutputBuilder) MustPushConstraint(c []byte) byte
MustPushConstraint can only be used inside the edit closure
func (*OutputBuilder) NumConstraints ¶
func (o *OutputBuilder) NumConstraints() int
func (*OutputBuilder) PutAmounts ¶
func (o *OutputBuilder) PutAmounts(amount ...int64)
func (*OutputBuilder) PutConstraint ¶
func (o *OutputBuilder) PutConstraint(c []byte, idx byte)
PutConstraint places bytecode at the specific index
func (*OutputBuilder) PutLock ¶
func (o *OutputBuilder) PutLock(lock Lock)
func (*OutputBuilder) WithAmounts ¶
func (o *OutputBuilder) WithAmounts(amount ...int64) *OutputBuilder
WithAmounts can only be used inside r/o override closure
func (*OutputBuilder) WithLock ¶
func (o *OutputBuilder) WithLock(lock Lock) *OutputBuilder
WithLock can only be used inside r/o override closure
func (*OutputBuilder) WithTokenBalance ¶
func (o *OutputBuilder) WithTokenBalance(bal uint64) *OutputBuilder
type OutputDataWithChainID ¶
type OutputDataWithChainID struct {
OutputDataWithID
ChainID base.ChainID
}
type OutputDataWithID ¶
func (*OutputDataWithID) MustParse ¶
func (o *OutputDataWithID) MustParse() *OutputWithID
func (*OutputDataWithID) Parse ¶
func (o *OutputDataWithID) Parse(validOpt ...func(o *Output) error) (*OutputWithID, error)
func (*OutputDataWithID) ParseAsChainOutput ¶
func (o *OutputDataWithID) ParseAsChainOutput() (*OutputWithChainID, byte, error)
ParseAsChainOutput parses raw output data expecting chain output. Returns parsed output and index of the chain constraint in it
type OutputWithChainID ¶
type OutputWithChainID struct {
OutputWithID
ChainConstraintData
}
func AsOutputWithChainID ¶
func AsOutputWithChainID(o *Output, oid base.OutputID) (OutputWithChainID, bool)
func FilterChainOutputs ¶
func FilterChainOutputs(outs []*OutputWithID) ([]*OutputWithChainID, error)
func GenesisOutput ¶
func GenesisOutput(initialSupply uint64, controllerAddress AddressED25519) *OutputWithChainID
func ParseChainConstraintsFromData ¶
func ParseChainConstraintsFromData(outs []*OutputDataWithID) ([]*OutputWithChainID, error)
func (*OutputWithChainID) AdjustedFrozenCoverage ¶
func (o *OutputWithChainID) AdjustedFrozenCoverage(txTs base.LedgerTime) int64
type OutputWithID ¶
func FilterOutputsSortByAmount ¶
func FilterOutputsSortByAmount(outs []*OutputWithID, filter func(o *Output) bool, desc ...bool) []*OutputWithID
func GenesisStemOutput ¶
func GenesisStemOutput() *OutputWithID
func ParseAndSortOutputData ¶
func ParseAndSortOutputData(outs []*OutputDataWithID, filter func(oid *base.OutputID, o *Output) bool, desc ...bool) ([]*OutputWithID, error)
func ParseAndSortOutputDataUpToAmount ¶
func ParseAndSortOutputDataUpToAmount(outs []*OutputDataWithID, amount uint64, filter func(oid *base.OutputID, o *Output) bool, desc ...bool) ([]*OutputWithID, uint64, base.LedgerTime, error)
func ParseOutputDataAndFilter ¶
func ParseOutputDataAndFilter(outs []*OutputDataWithID, filter func(oid *base.OutputID, o *Output) bool) ([]*OutputWithID, error)
func (*OutputWithID) AdjustedTokenBalance ¶
func (o *OutputWithID) AdjustedTokenBalance() uint64
AdjustedTokenBalance adjusted to inflation
func (*OutputWithID) AsChainOutput ¶
func (o *OutputWithID) AsChainOutput() (*OutputWithChainID, error)
func (*OutputWithID) AsTagAlong ¶
func (o *OutputWithID) AsTagAlong() TagAlongOutput
func (*OutputWithID) Clone ¶
func (o *OutputWithID) Clone() *OutputWithID
func (*OutputWithID) ExtractChainID ¶
func (o *OutputWithID) ExtractChainID() (chainID base.ChainID, predecessorConstraintIndex byte, ok bool)
ExtractChainID return chainID, predecessor constraint index, existence flag
func (*OutputWithID) IDShort ¶
func (o *OutputWithID) IDShort() string
func (*OutputWithID) LinesSource ¶
func (o *OutputWithID) LinesSource(prefix ...string) *lines.Lines
func (*OutputWithID) MustAsChainOutput ¶
func (o *OutputWithID) MustAsChainOutput() *OutputWithChainID
func (*OutputWithID) Short ¶
func (o *OutputWithID) Short() string
func (*OutputWithID) Source ¶
func (o *OutputWithID) Source() string
func (*OutputWithID) String ¶
func (o *OutputWithID) String() string
func (*OutputWithID) Timestamp ¶
func (o *OutputWithID) Timestamp() base.LedgerTime
type OutputWithSequencerData ¶
type OutputWithSequencerData struct {
OutputWithID
SequencerOutputData
}
type ParametersOption ¶
type ParametersOption func(par *InitParameters)
func WithTickDuration ¶
func WithTickDuration(duration time.Duration) ParametersOption
func WithTransactionPace ¶
func WithTransactionPace(transactionPace int) ParametersOption
func WithTransactionPaceSequencer ¶
func WithTransactionPaceSequencer(transactionPace int) ParametersOption
type SequencerConstraint ¶
type SequencerConstraint struct {
// must point to the sibling chain constraint
ChainConstraintIndex byte
}
func NewSequencerConstraint ¶
func NewSequencerConstraint(chainConstraintIndex byte) *SequencerConstraint
func SequencerConstraintFromBytes ¶
func SequencerConstraintFromBytes(data []byte) (*SequencerConstraint, error)
func (*SequencerConstraint) Bytes ¶
func (s *SequencerConstraint) Bytes() []byte
func (*SequencerConstraint) Name ¶
func (s *SequencerConstraint) Name() string
func (*SequencerConstraint) Source ¶
func (s *SequencerConstraint) Source() string
func (*SequencerConstraint) String ¶
func (s *SequencerConstraint) String() string
type SequencerOutputData ¶
type SequencerOutputData struct {
SequencerConstraint *SequencerConstraint
ChainConstraint *ChainConstraint
AmountOnChain uint64
SequencerConstraintIndex byte
SequencerData *seqdata.SequencerData
}
type SequencerTransactionData ¶
type SequencerTransactionData struct {
SequencerOutputData *SequencerOutputData
StemOutputData *StemLock // nil if does not contain stem output
SequencerID base.ChainID // adjusted for chain origin
SequencerOutputIndex byte
StemOutputIndex byte // 0xff if not a branch transaction
}
SequencerTransactionData represents sequencer and stem data on the transaction
func (*SequencerTransactionData) Short ¶
func (m *SequencerTransactionData) Short() string
type StemLock ¶
func StemLockFromBytes ¶
func (*StemLock) Accounts ¶
func (st *StemLock) Accounts() []Accountable
func (*StemLock) Master ¶
func (st *StemLock) Master() Accountable
type TagAlongLock ¶
type TagAlongLock struct {
TargetSequencerID base.ChainID
Sender Accountable
}
func TagAlongLockFromBytes ¶
func TagAlongLockFromBytes(data []byte) (*TagAlongLock, error)
func (*TagAlongLock) Accounts ¶
func (t *TagAlongLock) Accounts() []Accountable
func (*TagAlongLock) AsLock ¶
func (t *TagAlongLock) AsLock() Lock
func (*TagAlongLock) Bytes ¶
func (t *TagAlongLock) Bytes() []byte
func (*TagAlongLock) Master ¶
func (t *TagAlongLock) Master() Accountable
func (*TagAlongLock) Name ¶
func (t *TagAlongLock) Name() string
func (*TagAlongLock) Source ¶
func (t *TagAlongLock) Source() string
func (*TagAlongLock) String ¶
func (t *TagAlongLock) String() string
type TagAlongOutput ¶
type TagAlongOutput struct {
OutputWithID
*TagAlongLock
}
func (*TagAlongOutput) IsTagAlongPurgeSlot ¶
func (o *TagAlongOutput) IsTagAlongPurgeSlot(slot uint32) bool
func (*TagAlongOutput) IsTagAlongReclaimSlot ¶
func (o *TagAlongOutput) IsTagAlongReclaimSlot(slot uint32) bool
func (*TagAlongOutput) IsTagAlongSlot ¶
func (o *TagAlongOutput) IsTagAlongSlot(slot uint32) bool
func (*TagAlongOutput) StatusInSlot ¶
func (o *TagAlongOutput) StatusInSlot(slot uint32) string
type TotalAmount ¶
type TotalAmount uint64
func NewTotalAmount ¶
func NewTotalAmount(a uint64) TotalAmount
func TotalAmountFromBytes ¶
func TotalAmountFromBytes(data []byte) (TotalAmount, error)
func (TotalAmount) Amount ¶
func (a TotalAmount) Amount() uint64
func (TotalAmount) Bytes ¶
func (a TotalAmount) Bytes() []byte
func (TotalAmount) Name ¶
func (a TotalAmount) Name() string
func (TotalAmount) Source ¶
func (a TotalAmount) Source() string
func (TotalAmount) String ¶
func (a TotalAmount) String() string
type TxContextAccess ¶
type TxContextAccess interface {
BytesAtPath([]byte) ([]byte, error)
ConsumedOutput(idx byte) (*Output, error)
ConsumedTotal(i byte) int64
ProducedTotal(i byte) int64
IsBranchTransaction() bool
IsSequencerTransaction() bool
MustSequencerAndStemOutputIndices() (byte, byte)
ProducedOutputWithIDAt(idx byte) (*OutputWithID, error)
Timestamp() base.LedgerTime
MustInputAt(idx byte) base.OutputID
OutputID(idx byte) base.OutputID
SequencerTransactionData() *SequencerTransactionData
SenderAddress() AddressED25519
UnlockParameters(inputIdx, constraintIdx byte) ([]byte, error)
}
EvalContext is the data structure passed to the eval call. It contains: - access interface to the transaction context - path: a path in the validation context of the constraint being validated in the eval call
Source Files
¶
- amounts.go
- amounts_embed.go
- chain.go
- clock_time.go
- commit_sibling.go
- commitment.go
- constants.go
- constraints.go
- def.go
- def_embed.go
- def_general_func.go
- def_helper_func.go
- def_init_params.go
- def_path_constants.go
- ensure.go
- general.go
- genesis.go
- immutable.go
- inflation_fun.go
- lib.go
- lib_singleton.go
- lock_chain.go
- lock_conditional.go
- lock_deadline.go
- lock_delegate.go
- lock_delegate_util.go
- lock_ed25519.go
- lock_stem.go
- lock_tag_along.go
- output.go
- sdeposit.go
- sequencer.go
- timelock.go
- total_amount.go