feat: compute epoch length from byron genesis#890
feat: compute epoch length from byron genesis#890nicolasLuduena wants to merge 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughThe PR modifies the Byron epoch length calculation in the forks module, replacing a fixed 5-day-based calculation with one derived from the number of slots per k multiplied by the genesis k value. This change affects both the standard and minimal-version code paths. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This pull request updates how Byron epoch length is calculated in the Cardano codebase to use the correct slot-based formula instead of a fixed time-based value. The changes ensure that epoch length is now determined by the number of slots per epoch as specified in the Byron genesis protocol constants, improving accuracy and alignment with the official Cardano node implementation. Source of information for the formula.
Byron epoch length calculation updates:
FIVE_DAYS_IN_SECONDSwith the slot-based constantBYRON_EPOCH_SLOTS_PER_Kincrates/cardano/src/forks.rs, reflecting that Byron epochs last 10k slots per protocol constantkfrom the genesis file.from_byron_genesisandprotocol_constantsfunctions to useBYRON_EPOCH_SLOTS_PER_K * kinstead of dividing by slot duration, ensuring correctness and consistency with Cardano node behavior.Summary by CodeRabbit