Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Epoch initial height #93

Merged
merged 3 commits into from
Sep 27, 2024
Merged

fix: Epoch initial height #93

merged 3 commits into from
Sep 27, 2024

Conversation

gitferry
Copy link
Member

When we initialize epoch, we should also initialize epoch 1. Otherwise, epoch 0 will be accessed

@gitferry gitferry requested a review from a team as a code owner September 26, 2024 07:53
@gitferry gitferry requested review from KonradStaniec, Lazar955, SebastianElvis and RafilxTenfen and removed request for a team September 26, 2024 07:53
Copy link
Member

@Lazar955 Lazar955 left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines 43 to 44
firstEpoch := types.NewEpoch(1, epochInterval, 1, &header.Time)
k.setEpochInfo(ctx, 1, &firstEpoch)
Copy link
Member

Choose a reason for hiding this comment

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

What's the problem that this tries to address? Upon BeginBlock of block 1 the epoch 1 metadata will be generated, so it seems not necessary to initialise it upon InitGenesis (block 0)

Copy link
Member Author

Choose a reason for hiding this comment

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

I also found it might not be necessary. So maybe the point of this pr is to fix the interval of epoch 0?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, so how about we keep L40-41 and remove L42-44?

Comment on lines 43 to 44
firstEpoch := types.NewEpoch(1, epochInterval, 1, &header.Time)
k.setEpochInfo(ctx, 1, &firstEpoch)
Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, so how about we keep L40-41 and remove L42-44?

@gitferry gitferry merged commit 22f9283 into main Sep 27, 2024
19 checks passed
gitferry added a commit that referenced this pull request Sep 27, 2024
When we initialize epoch, we should also initialize epoch 1. Otherwise,
epoch 0 will be accessed
@maurolacy maurolacy deleted the fix/epoch-initial-height branch September 27, 2024 10:55
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.

3 participants