Documentation ¶
Index ¶
- Constants
- func NewProvider(opts ...options.Option[Manager]) module.Provider[*engine.Engine, notarization.Notarization]
- func WithMinCommittableSlotAge(age slot.Index) options.Option[Manager]
- type Attestations
- func (a *Attestations) Add(attestation *notarization.Attestation) (added bool, err error)
- func (a *Attestations) Commit(index slot.Index) (...)
- func (a *Attestations) Delete(attestation *notarization.Attestation) (deleted bool, err error)
- func (a *Attestations) Export(writer io.WriteSeeker, targetSlot slot.Index) (err error)
- func (a *Attestations) Get(index slot.Index) (...)
- func (a *Attestations) Import(reader io.ReadSeeker) (err error)
- func (a *Attestations) Weight(index slot.Index) (weight int64, err error)
- type Manager
- func (m *Manager) Attestations() notarization.Attestations
- func (m *Manager) Events() *notarization.Events
- func (m *Manager) Export(writer io.WriteSeeker, targetSlot slot.Index) (err error)
- func (m *Manager) Import(reader io.ReadSeeker) (err error)
- func (m *Manager) IsFullyCommitted() bool
- func (m *Manager) MinCommittableSlotAge() slot.Index
- func (m *Manager) NotarizeAcceptedBlock(block *models.Block) (err error)
- func (m *Manager) NotarizeOrphanedBlock(block *models.Block) (err error)
- func (m *Manager) PerformLocked(perform func(m notarization.Notarization))
- func (m *Manager) TryCommitUntil(acceptanceTime time.Time)
- type SlotMutations
- func (m *SlotMutations) AddAcceptedBlock(block *models.Block) (err error)
- func (m *SlotMutations) AddAcceptedTransaction(metadata *mempool.TransactionMetadata) (err error)
- func (m *SlotMutations) Evict(index slot.Index) (acceptedBlocks *ads.Set[models.BlockID, *models.BlockID], ...)
- func (m *SlotMutations) RemoveAcceptedBlock(block *models.Block) (err error)
- func (m *SlotMutations) RemoveAcceptedTransaction(metadata *mempool.TransactionMetadata) (err error)
- func (m *SlotMutations) Reset(index slot.Index)
- func (m *SlotMutations) UpdateTransactionInclusion(txID utxo.TransactionID, oldSlot, newSlot slot.Index) (err error)
- type TestFramework
- func (t *TestFramework) AddAcceptedBlock(alias string) (err error)
- func (t *TestFramework) AddAcceptedTransaction(alias string) (err error)
- func (t *TestFramework) AssertCommit(index slot.Index, expectedBlocks []string, expectedTransactions []string, ...)
- func (t *TestFramework) Block(alias string) (block *models.Block)
- func (t *TestFramework) CreateBlock(alias string, index slot.Index, blockOpts ...options.Option[models.Block]) (block *models.Block)
- func (t *TestFramework) CreateIssuer(alias string, issuerWeight ...int64) (issuer ed25519.PublicKey)
- func (t *TestFramework) CreateTransaction(alias string, index slot.Index) (metadata *mempool.TransactionMetadata)
- func (t *TestFramework) Issuer(alias string) (issuer ed25519.PublicKey)
- func (t *TestFramework) RemoveAcceptedBlock(alias string) (err error)
- func (t *TestFramework) RemoveAcceptedTransaction(alias string) (err error)
- func (t *TestFramework) Transaction(alias string) *mempool.TransactionMetadata
- func (t *TestFramework) UpdateTransactionInclusion(alias string, oldSlot, newSlot slot.Index) (err error)
Constants ¶
const ( PrefixAttestations byte = iota PrefixAttestationsLastCommittedSlot PrefixAttestationsWeight )
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶
func NewProvider(opts ...options.Option[Manager]) module.Provider[*engine.Engine, notarization.Notarization]
Types ¶
type Attestations ¶
type Attestations struct { traits.Committable module.Module // contains filtered or unexported fields }
func NewAttestations ¶
func NewAttestations(persistentStorage func(optRealm ...byte) kvstore.KVStore, bucketedStorage func(index slot.Index) kvstore.KVStore, weightsProviderFunc func() *sybilprotection.Weights, slotTimeProviderFunc func() *slot.TimeProvider) *Attestations
func (*Attestations) Add ¶
func (a *Attestations) Add(attestation *notarization.Attestation) (added bool, err error)
func (*Attestations) Commit ¶
func (a *Attestations) Commit(index slot.Index) (attestations *ads.Map[identity.ID, notarization.Attestation, *identity.ID, *notarization.Attestation], weight int64, err error)
func (*Attestations) Delete ¶
func (a *Attestations) Delete(attestation *notarization.Attestation) (deleted bool, err error)
func (*Attestations) Export ¶
func (a *Attestations) Export(writer io.WriteSeeker, targetSlot slot.Index) (err error)
func (*Attestations) Get ¶
func (a *Attestations) Get(index slot.Index) (attestations *ads.Map[identity.ID, notarization.Attestation, *identity.ID, *notarization.Attestation], err error)
func (*Attestations) Import ¶
func (a *Attestations) Import(reader io.ReadSeeker) (err error)
type Manager ¶
Manager is the component that manages the slot commitments.
func (*Manager) Attestations ¶
func (m *Manager) Attestations() notarization.Attestations
func (*Manager) Events ¶
func (m *Manager) Events() *notarization.Events
func (*Manager) IsFullyCommitted ¶
IsFullyCommitted returns if the Manager finished committing all pending slots up to the current acceptance time.
func (*Manager) MinCommittableSlotAge ¶
MinCommittableSlotAge returns the minimum age of a slot to be committable.
func (*Manager) NotarizeAcceptedBlock ¶
func (*Manager) NotarizeOrphanedBlock ¶
func (*Manager) PerformLocked ¶
func (m *Manager) PerformLocked(perform func(m notarization.Notarization))
func (*Manager) TryCommitUntil ¶
TryCommitUntil tries to create slot commitments until the new provided acceptance time.
type SlotMutations ¶
type SlotMutations struct { AcceptedBlockRemoved *event.Event1[models.BlockID] // contains filtered or unexported fields }
SlotMutations is an in-memory data structure that enables the collection of mutations for uncommitted slots.
func NewSlotMutations ¶
func NewSlotMutations(weights *sybilprotection.Weights, lastCommittedSlot slot.Index) (newMutationFactory *SlotMutations)
NewSlotMutations creates a new SlotMutations instance.
func (*SlotMutations) AddAcceptedBlock ¶
func (m *SlotMutations) AddAcceptedBlock(block *models.Block) (err error)
AddAcceptedBlock adds the given block to the set of accepted blocks.
func (*SlotMutations) AddAcceptedTransaction ¶
func (m *SlotMutations) AddAcceptedTransaction(metadata *mempool.TransactionMetadata) (err error)
AddAcceptedTransaction adds the given transaction to the set of accepted transactions.
func (*SlotMutations) Evict ¶
func (m *SlotMutations) Evict(index slot.Index) (acceptedBlocks *ads.Set[models.BlockID, *models.BlockID], acceptedTransactions *ads.Set[utxo.TransactionID, *utxo.TransactionID], err error)
Evict evicts the given slot and returns the corresponding mutation sets.
func (*SlotMutations) RemoveAcceptedBlock ¶
func (m *SlotMutations) RemoveAcceptedBlock(block *models.Block) (err error)
RemoveAcceptedBlock removes the given block from the set of accepted blocks.
func (*SlotMutations) RemoveAcceptedTransaction ¶
func (m *SlotMutations) RemoveAcceptedTransaction(metadata *mempool.TransactionMetadata) (err error)
RemoveAcceptedTransaction removes the given transaction from the set of accepted transactions.
func (*SlotMutations) Reset ¶
func (m *SlotMutations) Reset(index slot.Index)
func (*SlotMutations) UpdateTransactionInclusion ¶
func (m *SlotMutations) UpdateTransactionInclusion(txID utxo.TransactionID, oldSlot, newSlot slot.Index) (err error)
UpdateTransactionInclusion moves a transaction from a later slot to the given slot.
type TestFramework ¶
type TestFramework struct { MutationFactory *SlotMutations syncutils.RWMutexFake // contains filtered or unexported fields }
func NewTestFramework ¶
func NewTestFramework(test *testing.T, slotTimeProvider *slot.TimeProvider) *TestFramework
func (*TestFramework) AddAcceptedBlock ¶
func (t *TestFramework) AddAcceptedBlock(alias string) (err error)
func (*TestFramework) AddAcceptedTransaction ¶
func (t *TestFramework) AddAcceptedTransaction(alias string) (err error)
func (*TestFramework) AssertCommit ¶
func (*TestFramework) CreateBlock ¶
func (*TestFramework) CreateIssuer ¶
func (t *TestFramework) CreateIssuer(alias string, issuerWeight ...int64) (issuer ed25519.PublicKey)
func (*TestFramework) CreateTransaction ¶
func (t *TestFramework) CreateTransaction(alias string, index slot.Index) (metadata *mempool.TransactionMetadata)
func (*TestFramework) Issuer ¶
func (t *TestFramework) Issuer(alias string) (issuer ed25519.PublicKey)
func (*TestFramework) RemoveAcceptedBlock ¶
func (t *TestFramework) RemoveAcceptedBlock(alias string) (err error)
func (*TestFramework) RemoveAcceptedTransaction ¶
func (t *TestFramework) RemoveAcceptedTransaction(alias string) (err error)
func (*TestFramework) Transaction ¶
func (t *TestFramework) Transaction(alias string) *mempool.TransactionMetadata
func (*TestFramework) UpdateTransactionInclusion ¶
func (t *TestFramework) UpdateTransactionInclusion(alias string, oldSlot, newSlot slot.Index) (err error)