Documentation ¶
Index ¶
- type ImmutableState
- func (s *ImmutableState) ConsensusParameters(ctx context.Context) (*roothash.ConsensusParameters, error)
- func (s *ImmutableState) EvidenceHashExists(ctx context.Context, runtimeID common.Namespace, round uint64, hash hash.Hash) (bool, error)
- func (s *ImmutableState) IORoot(ctx context.Context, id common.Namespace) (hash.Hash, error)
- func (s *ImmutableState) IncomingMessageQueue(ctx context.Context, runtimeID common.Namespace, offset uint64, limit uint32) ([]*message.IncomingMessage, error)
- func (s *ImmutableState) IncomingMessageQueueMeta(ctx context.Context, runtimeID common.Namespace) (*message.IncomingMessageQueueMeta, error)
- func (s *ImmutableState) LastRoundResults(ctx context.Context, id common.Namespace) (*roothash.RoundResults, error)
- func (s *ImmutableState) PastRoundRoots(ctx context.Context, runtimeID common.Namespace) (map[uint64]roothash.RoundRoots, error)
- func (s *ImmutableState) PastRoundRootsCount(ctx context.Context, runtimeID common.Namespace) uint64
- func (s *ImmutableState) RoundRoots(ctx context.Context, runtimeID common.Namespace, round uint64) (*roothash.RoundRoots, error)
- func (s *ImmutableState) RuntimeState(ctx context.Context, id common.Namespace) (*roothash.RuntimeState, error)
- func (s *ImmutableState) Runtimes(ctx context.Context) ([]*roothash.RuntimeState, error)
- func (s *ImmutableState) RuntimesWithRoundTimeouts(ctx context.Context, height int64) ([]common.Namespace, error)
- func (s *ImmutableState) RuntimesWithRoundTimeoutsAny(ctx context.Context) ([]common.Namespace, []int64, error)
- func (s *ImmutableState) StateRoot(ctx context.Context, id common.Namespace) (hash.Hash, error)
- type MutableState
- func (s *MutableState) ClearRoundTimeout(ctx context.Context, runtimeID common.Namespace, height int64) error
- func (s *MutableState) RemoveExpiredEvidence(ctx context.Context, runtimeID common.Namespace, minRound uint64) error
- func (s *MutableState) RemoveIncomingMessageFromQueue(ctx context.Context, runtimeID common.Namespace, id uint64) error
- func (s *MutableState) ScheduleRoundTimeout(ctx context.Context, runtimeID common.Namespace, height int64) error
- func (s *MutableState) SetConsensusParameters(ctx context.Context, params *roothash.ConsensusParameters) error
- func (s *MutableState) SetEvidenceHash(ctx context.Context, runtimeID common.Namespace, round uint64, hash hash.Hash) error
- func (s *MutableState) SetIncomingMessageInQueue(ctx context.Context, runtimeID common.Namespace, msg *message.IncomingMessage) error
- func (s *MutableState) SetIncomingMessageQueueMeta(ctx context.Context, runtimeID common.Namespace, ...) error
- func (s *MutableState) SetLastRoundResults(ctx context.Context, runtimeID common.Namespace, ...) error
- func (s *MutableState) SetRuntimeState(ctx context.Context, state *roothash.RuntimeState) error
- func (s *MutableState) ShrinkPastRoots(ctx context.Context, max uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImmutableState ¶
type ImmutableState struct {
// contains filtered or unexported fields
}
ImmutableState is the immutable roothash state wrapper.
func NewImmutableState ¶
func NewImmutableState(ctx context.Context, state api.ApplicationQueryState, version int64) (*ImmutableState, error)
func (*ImmutableState) ConsensusParameters ¶
func (s *ImmutableState) ConsensusParameters(ctx context.Context) (*roothash.ConsensusParameters, error)
ConsensusParameters returns the roothash consensus parameters.
func (*ImmutableState) EvidenceHashExists ¶
func (s *ImmutableState) EvidenceHashExists(ctx context.Context, runtimeID common.Namespace, round uint64, hash hash.Hash) (bool, error)
EvidenceHashExists returns true if the evidence hash for the runtime exists.
func (*ImmutableState) IncomingMessageQueue ¶
func (s *ImmutableState) IncomingMessageQueue(ctx context.Context, runtimeID common.Namespace, offset uint64, limit uint32) ([]*message.IncomingMessage, error)
IncomingMessageQueue returns a list of queued messages, starting with the passed offset.
func (*ImmutableState) IncomingMessageQueueMeta ¶
func (s *ImmutableState) IncomingMessageQueueMeta(ctx context.Context, runtimeID common.Namespace) (*message.IncomingMessageQueueMeta, error)
IncomingMessageQueueMeta returns the incoming message queue metadata for the given runtime.
func (*ImmutableState) LastRoundResults ¶
func (s *ImmutableState) LastRoundResults(ctx context.Context, id common.Namespace) (*roothash.RoundResults, error)
LastRoundResults returns the last normal round results for a specific runtime.
func (*ImmutableState) PastRoundRoots ¶
func (s *ImmutableState) PastRoundRoots(ctx context.Context, runtimeID common.Namespace) (map[uint64]roothash.RoundRoots, error)
PastRoundRoots returns the state and I/O roots stored for the given runtime ID.
The number of rounds returned is less than or equal to MaxPastRootsStored, as defined in the roothash consensus parameters. Keys of the returned map hold the round numbers and the values hold the two roots for each round.
func (*ImmutableState) PastRoundRootsCount ¶
func (s *ImmutableState) PastRoundRootsCount(ctx context.Context, runtimeID common.Namespace) uint64
PastRoundRootsCount returns the number of past state and I/O roots in storage for the given runtime ID.
This is more efficient than calling len(PastRoundRoots(runtimeID)), as it avoids deserialization.
func (*ImmutableState) RoundRoots ¶
func (s *ImmutableState) RoundRoots(ctx context.Context, runtimeID common.Namespace, round uint64) (*roothash.RoundRoots, error)
RoundRoots returns the state and I/O roots for the given runtime ID and round.
If no roots are present for the given runtime and round, nil is returned.
func (*ImmutableState) RuntimeState ¶
func (s *ImmutableState) RuntimeState(ctx context.Context, id common.Namespace) (*roothash.RuntimeState, error)
RuntimeState returns the roothash runtime state for a specific runtime.
func (*ImmutableState) Runtimes ¶
func (s *ImmutableState) Runtimes(ctx context.Context) ([]*roothash.RuntimeState, error)
Runtimes returns the list of all roothash runtime states.
func (*ImmutableState) RuntimesWithRoundTimeouts ¶
func (s *ImmutableState) RuntimesWithRoundTimeouts(ctx context.Context, height int64) ([]common.Namespace, error)
RuntimesWithRoundTimeouts returns the runtimes that have round timeouts scheduled at the given height.
func (*ImmutableState) RuntimesWithRoundTimeoutsAny ¶
func (s *ImmutableState) RuntimesWithRoundTimeoutsAny(ctx context.Context) ([]common.Namespace, []int64, error)
RuntimesWithRoundTimeoutsAny returns the runtimes that have round timeouts scheduled at any height.
type MutableState ¶
type MutableState struct { *ImmutableState // contains filtered or unexported fields }
MutableState is the mutable roothash state wrapper.
func NewMutableState ¶
func NewMutableState(tree mkvs.KeyValueTree) *MutableState
func (*MutableState) ClearRoundTimeout ¶
func (s *MutableState) ClearRoundTimeout(ctx context.Context, runtimeID common.Namespace, height int64) error
ClearRoundTimeout clears a previously scheduled round timeout at a given height.
func (*MutableState) RemoveExpiredEvidence ¶
func (s *MutableState) RemoveExpiredEvidence(ctx context.Context, runtimeID common.Namespace, minRound uint64) error
RemoveExpiredEvidence removes expired evidence.
func (*MutableState) RemoveIncomingMessageFromQueue ¶
func (s *MutableState) RemoveIncomingMessageFromQueue(ctx context.Context, runtimeID common.Namespace, id uint64) error
RemoveIncomingMessageFromQueue removes an entry from the incoming message queue.
func (*MutableState) ScheduleRoundTimeout ¶
func (s *MutableState) ScheduleRoundTimeout(ctx context.Context, runtimeID common.Namespace, height int64) error
ScheduleRoundTimeout schedules a new runtime round timeout at a given height.
func (*MutableState) SetConsensusParameters ¶
func (s *MutableState) SetConsensusParameters(ctx context.Context, params *roothash.ConsensusParameters) error
SetConsensusParameters sets roothash consensus parameters.
NOTE: This method must only be called from InitChain/EndBlock contexts.
func (*MutableState) SetEvidenceHash ¶
func (s *MutableState) SetEvidenceHash(ctx context.Context, runtimeID common.Namespace, round uint64, hash hash.Hash) error
SetEvidenceHash sets the provided evidence hash.
func (*MutableState) SetIncomingMessageInQueue ¶
func (s *MutableState) SetIncomingMessageInQueue(ctx context.Context, runtimeID common.Namespace, msg *message.IncomingMessage) error
SetIncomingMessageInQueue sets an entry in the incoming message queue.
func (*MutableState) SetIncomingMessageQueueMeta ¶
func (s *MutableState) SetIncomingMessageQueueMeta(ctx context.Context, runtimeID common.Namespace, meta *message.IncomingMessageQueueMeta) error
SetIncomingMessageQueueMeta sets the incoming message queue metadata.
func (*MutableState) SetLastRoundResults ¶
func (s *MutableState) SetLastRoundResults(ctx context.Context, runtimeID common.Namespace, results *roothash.RoundResults) error
SetLastRoundResults sets a runtime's last normal round results.
func (*MutableState) SetRuntimeState ¶
func (s *MutableState) SetRuntimeState(ctx context.Context, state *roothash.RuntimeState) error
SetRuntimeState sets a runtime's roothash state.
func (*MutableState) ShrinkPastRoots ¶
func (s *MutableState) ShrinkPastRoots(ctx context.Context, max uint64) error
ShrinkPastRoots deletes extra past stored roots for all runtimes that have over the given number of stored roots.
This is used when reducing the MaxPastRootsStored consensus parameter in changeParameters() in go/consensus/cometbft/apps/roothash/messages.go.