Skip to content

Remove Epoch From the EpochConfig - #575

Merged
yacovm merged 15 commits into
mainfrom
remove-epoch
Sep 9, 2026
Merged

Remove Epoch From the EpochConfig#575
yacovm merged 15 commits into
mainfrom
remove-epoch

Conversation

@samliok

@samliok samliok commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

this simplifies the instance, and is no longer necessary with the recent addition of block.SealingBlockInfo

Another main benefit is we don't need to artificially set the Epoch value after initializing it. Since the epoch's config already has all the information it needs to know about its own epoch, it should be responsible for setting this value.

We also weren't properly setting the epoch if the only blocks in storage were non-simplex blocks, so this PR adds a fix in setMetadataFromStorage and an instance test

@samliok samliok linked an issue Sep 2, 2026 that may be closed by this pull request
Comment thread simplex/epoch.go Outdated
Comment thread simplex/epoch.go Outdated
}
if finalization.Finalization.Round >= highestRound {
highestRound = finalization.Finalization.Round
// We do not need to check if this finalization is associated for a sealing block, because it is impossible for a finalization

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 do not need to check if this finalization is associated for a sealing block, because it is impossible for a finalization
// for another epoch to exist in our wal, yet the original epoch remains un-sealed.

That's true, but why are we writing this?

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.

i added because at first i thought we needed to also set the epoch here, so i wrote it here since it wasn't initially obvious. Maybe a mythos scan will note this as a bug if not documented in the future

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.

I understand that it might make sense to make this comment in the context of this PR.

However after the PR is merged - I think it'll just be confusing.

There is actually a way for a finalization of a higher epoch be present in our WAL - if we have a sealing block in seq 100 but we don't have a finalization for seq 99, we will write the finalization of the sealing block in the WAL.

I suggest we just remove this text.

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.

sounds good, updated

Comment thread simplex/epoch_test.go
require.NoError(t, conf.Storage.Index(context.Background(), epoch1Block, Finalization{}))
require.Equal(t, uint16(1), epoch1Block.Blacklist().NodeCount,

// The epoch number is the sequence of the last indexed sealing block, so both nodes

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 is this change needed?

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.

because we can no longer artificially set the epoch in the config, so we need to go through with actual messages/storage

@samliok

samliok commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

getting a determinist failure on the instance test, will look closer tomorrow. I think its because im not setting the epoch correctly when we build off a non-simplex block

Comment thread simplex/util_test.go
nodes := []NodeID{{1}, {2}, {3}, {4}}
block := testutil.NewTestBlock(ProtocolMetadata{Seq: 0}, emptyBlacklist)
finalization := Finalization{
Finalization: ToBeSignedFinalization{

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.

i had to update the test finalizations to contain QCs

samliok and others added 4 commits September 8, 2026 15:26
Signed-off-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com>
Comment thread simplex/epoch.go Outdated
@yacovm
yacovm merged commit 60517b5 into main Sep 9, 2026
7 checks passed
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.

Remove the Epoch value from EpochConfig

2 participants