model

package
v1.0.0-alpha.25 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const VersionAndHashSize = iotago.VersionLength + iotago.IdentifierLength

Variables

This section is empty.

Functions

func BlockFromBytesFunc

func BlockFromBytesFunc(apiProvider iotago.APIProvider) func(data []byte) (*Block, int, error)

func CommitmentFromBytes

func CommitmentFromBytes(apiProvider iotago.APIProvider) func([]byte) (*Commitment, int, error)

func SignaledBlockFromBytesFunc

func SignaledBlockFromBytesFunc(decodeAPI iotago.API) func([]byte) (*SignaledBlock, int, error)

Types

type AccountDiff

type AccountDiff struct {
	BICChange iotago.BlockIssuanceCredits

	PreviousUpdatedSlot iotago.SlotIndex

	NewExpirySlot      iotago.SlotIndex
	PreviousExpirySlot iotago.SlotIndex

	// OutputID to which the Account has been transitioned to.
	NewOutputID iotago.OutputID

	// OutputID from which the Account has been transitioned from.
	PreviousOutputID iotago.OutputID

	BlockIssuerKeysAdded   iotago.BlockIssuerKeys
	BlockIssuerKeysRemoved iotago.BlockIssuerKeys

	ValidatorStakeChange              int64
	DelegationStakeChange             int64
	StakeEndEpochChange               int64
	FixedCostChange                   int64
	PrevLatestSupportedVersionAndHash VersionAndHash
	NewLatestSupportedVersionAndHash  VersionAndHash
}

AccountDiff represent the storable changes for a single account within a slot.

func AccountDiffFromBytes

func AccountDiffFromBytes(b []byte) (*AccountDiff, int, error)

func AccountDiffFromReader

func AccountDiffFromReader(reader io.ReadSeeker) (*AccountDiff, error)

func NewAccountDiff

func NewAccountDiff() *AccountDiff

NewAccountDiff creates a new AccountDiff instance.

func (*AccountDiff) Bytes

func (d *AccountDiff) Bytes() ([]byte, error)

func (*AccountDiff) Clone

func (d *AccountDiff) Clone() *AccountDiff

func (*AccountDiff) String

func (d *AccountDiff) String() string

type Block

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

func BlockFromBlock

func BlockFromBlock(block *iotago.Block, opts ...serix.Option) (*Block, error)

func BlockFromBlockIdentifierAndBytes

func BlockFromBlockIdentifierAndBytes(blockIdentifier iotago.Identifier, data []byte, apiProvider iotago.APIProvider) (*Block, error)

BlockFromBlockIdentifierAndBytes creates a new Block from the given blockIdentifier and the serialized block data. This is used when receiving blocks from the network where we pre-compute the blockIdentifier for filtering duplicates.

func BlockFromBytes

func BlockFromBytes(data []byte, apiProvider iotago.APIProvider) (*Block, error)

BlockFromBytes creates a new Block from the serialized block data.

func BlockFromIDAndBytes

func BlockFromIDAndBytes(blockID iotago.BlockID, data []byte, api iotago.API) (*Block, error)

BlockFromIDAndBytes creates a new Block from the given blockID and the serialized block data. This is used when loading a block back from storage where we have both the blockID and the bytes available.

func (*Block) BasicBlock

func (blk *Block) BasicBlock() (basicBlock *iotago.BasicBlockBody, isBasicBlock bool)

func (*Block) Bytes

func (blk *Block) Bytes() ([]byte, error)

func (*Block) Data

func (blk *Block) Data() []byte

func (*Block) ID

func (blk *Block) ID() iotago.BlockID

func (*Block) Payload

func (blk *Block) Payload() iotago.Payload

func (*Block) ProtocolBlock

func (blk *Block) ProtocolBlock() *iotago.Block

func (*Block) SignedTransaction

func (blk *Block) SignedTransaction() (tx *iotago.SignedTransaction, isTransaction bool)

func (*Block) SlotCommitmentID

func (blk *Block) SlotCommitmentID() iotago.CommitmentID

func (*Block) String

func (blk *Block) String() string

func (*Block) ValidationBlock

func (blk *Block) ValidationBlock() (validationBlock *iotago.ValidationBlockBody, isValidationBlock bool)

func (*Block) WorkScore

func (blk *Block) WorkScore() iotago.WorkScore

type Commitment

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

func CommitmentFromCommitment

func CommitmentFromCommitment(iotaCommitment *iotago.Commitment, api iotago.API, opts ...serix.Option) (*Commitment, error)

func NewEmptyCommitment

func NewEmptyCommitment(api iotago.API) *Commitment

func (*Commitment) Bytes

func (c *Commitment) Bytes() ([]byte, error)

func (*Commitment) Commitment

func (c *Commitment) Commitment() *iotago.Commitment

func (*Commitment) CumulativeWeight

func (c *Commitment) CumulativeWeight() uint64

func (*Commitment) Data

func (c *Commitment) Data() []byte

func (*Commitment) ID

func (c *Commitment) ID() iotago.CommitmentID

func (*Commitment) PreviousCommitmentID

func (c *Commitment) PreviousCommitmentID() iotago.CommitmentID

func (*Commitment) ReferenceManaCost

func (c *Commitment) ReferenceManaCost() iotago.Mana

func (*Commitment) RootsID

func (c *Commitment) RootsID() iotago.Identifier

func (*Commitment) Slot

func (c *Commitment) Slot() iotago.SlotIndex

func (*Commitment) String

func (c *Commitment) String() string

type EvictionIndex

type EvictionIndex[K iotago.SlotIndex | iotago.EpochIndex] struct {
	// contains filtered or unexported fields
}

func NewEvictionIndex

func NewEvictionIndex[K iotago.SlotIndex | iotago.EpochIndex]() *EvictionIndex[K]

func (*EvictionIndex[K]) Index

func (e *EvictionIndex[K]) Index() (current K, valid bool)

func (*EvictionIndex[K]) IsEvicted

func (e *EvictionIndex[K]) IsEvicted(index K) bool

func (*EvictionIndex[K]) MarkEvicted

func (e *EvictionIndex[K]) MarkEvicted(index K) (previous K, hadPrevious bool)

func (*EvictionIndex[K]) NextIndex

func (e *EvictionIndex[K]) NextIndex() K

func (*EvictionIndex[K]) ShouldEvict

func (e *EvictionIndex[K]) ShouldEvict(newIndex K) bool

type ParentReferences

type ParentReferences map[iotago.ParentsType]iotago.BlockIDs

ParentReferences is a map between parent type and block IDs.

type PoolRewards

type PoolRewards struct {
	// Total stake of the validator including delegations
	PoolStake iotago.BaseToken
	// Rewards normalized by performance factor
	PoolRewards iotago.Mana
	// What the validator charges for its staking duties
	FixedCost iotago.Mana
}

func PoolRewardsFromBytes

func PoolRewardsFromBytes(bytes []byte) (*PoolRewards, int, error)

func PoolRewardsFromReader

func PoolRewardsFromReader(reader io.ReadSeeker) (*PoolRewards, error)

func (*PoolRewards) Bytes

func (p *PoolRewards) Bytes() ([]byte, error)

func (*PoolRewards) String

func (p *PoolRewards) String() string

type PoolsStats

type PoolsStats struct {
	TotalStake          iotago.BaseToken
	TotalValidatorStake iotago.BaseToken
	ProfitMargin        uint64
}

PoolsStats contains stats about the pools from all the validators for an epoch.

func PoolStatsFromReader

func PoolStatsFromReader(reader io.ReadSeeker) (*PoolsStats, error)

func PoolsStatsFromBytes

func PoolsStatsFromBytes(bytes []byte) (*PoolsStats, int, error)

func (*PoolsStats) Bytes

func (p *PoolsStats) Bytes() ([]byte, error)

func (*PoolsStats) String

func (p *PoolsStats) String() string

type PruningIndex

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

func NewPruningIndex

func NewPruningIndex(kv kvstore.KVStore, key kvstore.Realm) *PruningIndex

func (*PruningIndex) Index

func (e *PruningIndex) Index() (currentEpoch iotago.EpochIndex, valid bool)

func (*PruningIndex) MarkEvicted

func (e *PruningIndex) MarkEvicted(epoch iotago.EpochIndex) error

func (*PruningIndex) NextIndex

func (e *PruningIndex) NextIndex() iotago.EpochIndex

func (*PruningIndex) RestoreFromDisk

func (e *PruningIndex) RestoreFromDisk() error

type SignaledBlock

type SignaledBlock struct {
	ID                      iotago.BlockID    `serix:""`
	IssuingTime             time.Time         `serix:""`
	HighestSupportedVersion iotago.Version    `serix:""`
	ProtocolParametersHash  iotago.Identifier `serix:""`
}

func NewSignaledBlock

func NewSignaledBlock(blockID iotago.BlockID, block *iotago.Block, validationBlock *iotago.ValidationBlockBody) *SignaledBlock

func (*SignaledBlock) Bytes

func (s *SignaledBlock) Bytes(apiForSlot iotago.API) ([]byte, error)

func (*SignaledBlock) Compare

func (s *SignaledBlock) Compare(other *SignaledBlock) int

func (*SignaledBlock) String

func (s *SignaledBlock) String() string

type ValidatorPerformance

type ValidatorPerformance struct {
	// works if ValidationBlocksPerSlot is less than 32 because we use it as bit vector
	SlotActivityVector uint32
	// can be uint8 because max count per slot is maximally ValidationBlocksPerSlot + 1
	BlocksIssuedCount              uint8
	HighestSupportedVersionAndHash VersionAndHash
}

func NewValidatorPerformance

func NewValidatorPerformance() *ValidatorPerformance

func ValidatorPerformanceFromBytes

func ValidatorPerformanceFromBytes(bytes []byte) (*ValidatorPerformance, int, error)

func ValidatorPerformanceFromReader

func ValidatorPerformanceFromReader(reader io.ReadSeeker) (*ValidatorPerformance, error)

func (*ValidatorPerformance) Bytes

func (p *ValidatorPerformance) Bytes() ([]byte, error)

func (*ValidatorPerformance) String

func (p *ValidatorPerformance) String() string

type VersionAndHash

type VersionAndHash struct {
	Version iotago.Version    `serix:""`
	Hash    iotago.Identifier `serix:""`
}

func VersionAndHashFromBytes

func VersionAndHashFromBytes(bytes []byte) (VersionAndHash, int, error)

func (VersionAndHash) Bytes

func (v VersionAndHash) Bytes() ([]byte, error)

func (VersionAndHash) String

func (v VersionAndHash) String() string

Jump to

Keyboard shortcuts

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