Skip to content

Gate messages to epoch once the epoch is sealed - #513

Draft
samliok wants to merge 6 commits into
transition-listenerfrom
epoch-sealed-gate
Draft

Gate messages to epoch once the epoch is sealed#513
samliok wants to merge 6 commits into
transition-listenerfrom
epoch-sealed-gate

Conversation

@samliok

@samliok samliok commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

… VM, rework epoch transitions

Extract LastBlock and epoch/validator-set derivation into util.go with tests.
Split ParseBlock into a BlockDeserializer interface and move ICM epoch
computation to a Config field. Replace EpochAwareStorage with InstanceStorage,
which skips Telocks by block type and exposes an onIndex hook. Signal epoch
changes via EpochConfig.OnSealingBlockIndex for validators and
nonvalidator.Config.TransitionToValidator for non-validators instead of the
storage wrapper. Rework processEpochChange to honor Stop for validators and
notifyEpochChange to keep only the newest pending change.
Add Message.AuxiliaryInfo and Message.EpochTransitionApproval along with the
common.AuxiliaryInfo type. Blocks now carry an AuxiliaryInfoBatch with one
entry per contributing node instead of a single locally generated entry. The
builder collects legal entries from a new auxInfoStore mempool populated by
HandleAuxiliaryInfo, and SignApproval is exported so callers can sign and
broadcast their own approvals. GetAuxiliaryHistory exposes the aux history
traversal used to decide whether to generate info or approve.

Note: this changes the wire format of the metadata aux info field, and the
candidate digest for an empty aux history is now the zero digest instead of
sha256(nil).
Construct an epochTransitionListener in NewInstance and hook its onIndex into
both the validator and non-validator storage paths, so indexing a transition
block generates and broadcasts auxiliary info, or signs and broadcasts an
epoch transition approval once the history is sufficient. Route incoming
AuxiliaryInfo and EpochTransitionApproval messages into the MSM.
@samliok
samliok changed the base branch from main to transition-listener August 14, 2026 16:43
Comment thread adapters.go
}

return err
if block.SealingBlockInfo() != nil && block.SealingBlockInfo().PrevSealingBlockHash != [32]byte{} {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have the method onEpochChange in instance.go, can't we just define the variable there?

Comment thread instance.go

func (i *Instance) handleValidatorMessage(msg *common.Message, from common.NodeID) error {
// we only want to process replication requests if the epoch is sealed
if i.cs.lastSealedEpoch == i.e.Metadata().Epoch {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ==? What if it's a replication request for a previous epoch? Shouldn't we serve it as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not checking the epoch noted in the message, its strictly checking the epoch instance's metadata. So the contents of the replication request have no bearing on this check

Comment thread instance.go
Comment thread instance.go
return nil
}

switch {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have auxiliary info disseminated separately from the approval?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure i understand. We handle auxiliary info differently than approvals because one comes after the other. They also have different message structures

@samliok
samliok marked this pull request as draft August 17, 2026 21:43
@samliok
samliok force-pushed the transition-listener branch 6 times, most recently from 10be7d2 to d99a5c6 Compare August 21, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants