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

feat(babe, epoch): retrieve first slot number correctly #3841

Merged
merged 50 commits into from
Apr 15, 2024

Conversation

EclesioMeloJunior
Copy link
Member

@EclesioMeloJunior EclesioMeloJunior commented Apr 1, 2024

Changes

  • Introduced retrieveFirstNonOriginBlockSlot that retrieves the block #1 slot number, if there is more than one them select the correct one based on ancestry
  • Changed BABE initialize epoch to check if epoch was skipped
  • Change node initialization createStateService method that now instantiates the genesis runtime and retrieve BabeConfigurations as it is required for the epoch state
  • This PR will make the code extensible for a full node that does not keep the entire chain history

Tests

go test -tags integration github.com/ChainSafe/gossamer

Issues

Primary Reviewer

@kishansagathiya

@EclesioMeloJunior EclesioMeloJunior changed the title feat: handling epoch skipped before initializing epoch feat(babe, epoch): retrieving correctly very first slot number Apr 4, 2024
@EclesioMeloJunior EclesioMeloJunior marked this pull request as ready for review April 4, 2024 22:54
dot/state/epoch.go Show resolved Hide resolved
dot/state/epoch.go Outdated Show resolved Hide resolved
dot/state/epoch.go Outdated Show resolved Hide resolved
dot/state/epoch.go Show resolved Hide resolved
dot/state/epoch.go Show resolved Hide resolved
dot/import.go Outdated Show resolved Hide resolved
dot/import_integration_test.go Outdated Show resolved Hide resolved
dot/state/epoch_test.go Outdated Show resolved Hide resolved
dot/state/epoch_test.go Outdated Show resolved Hide resolved
dot/state/service_integration_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@timwu20 timwu20 left a comment

Choose a reason for hiding this comment

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

Can you look at the deepsource issues and ensure that you haven't introduced anything.

@dimartiro dimartiro added this to the Block production. BABE milestone Apr 12, 2024
dot/state/epoch.go Outdated Show resolved Hide resolved
lib/babe/verify_test.go Show resolved Hide resolved
EclesioMeloJunior and others added 2 commits April 15, 2024 11:20
Co-authored-by: Axay Sagathiya <axaysagathiya@gmail.com>
Copy link
Contributor

@axaysagathiya axaysagathiya left a comment

Choose a reason for hiding this comment

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

Fix the lint problem. Otherwise, LGTM

Copy link
Member

@edwardmack edwardmack left a comment

Choose a reason for hiding this comment

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

Great work.

Copy link
Contributor

@dimartiro dimartiro left a comment

Choose a reason for hiding this comment

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

LGTM did you test it on staging?

@EclesioMeloJunior EclesioMeloJunior merged commit b9168a2 into development Apr 15, 2024
24 checks passed
@EclesioMeloJunior EclesioMeloJunior deleted the eclesio/move-slot-to-header branch April 15, 2024 20:41
timwu20 pushed a commit that referenced this pull request Apr 19, 2024
Co-authored-by: Axay Sagathiya <axaysagathiya@gmail.com>
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.

fix(lib/epoch): use correctly very first slot number
7 participants