Gate messages to epoch once the epoch is sealed - #513
Conversation
… 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.
| } | ||
|
|
||
| return err | ||
| if block.SealingBlockInfo() != nil && block.SealingBlockInfo().PrevSealingBlockHash != [32]byte{} { |
There was a problem hiding this comment.
we have the method onEpochChange in instance.go, can't we just define the variable there?
|
|
||
| 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 { |
There was a problem hiding this comment.
why ==? What if it's a replication request for a previous epoch? Shouldn't we serve it as well?
There was a problem hiding this comment.
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
| return nil | ||
| } | ||
|
|
||
| switch { |
There was a problem hiding this comment.
why do we have auxiliary info disseminated separately from the approval?
There was a problem hiding this comment.
not sure i understand. We handle auxiliary info differently than approvals because one comes after the other. They also have different message structures
10be7d2 to
d99a5c6
Compare
No description provided.