Skip to content

Comments

fix: wait for valid blockhash#992

Open
Dodecahedr0x wants to merge 1 commit intomasterfrom
dode/crank-reset
Open

fix: wait for valid blockhash#992
Dodecahedr0x wants to merge 1 commit intomasterfrom
dode/crank-reset

Conversation

@Dodecahedr0x
Copy link
Contributor

@Dodecahedr0x Dodecahedr0x commented Feb 22, 2026

Summary

  • Fix an issue where tasks rescheduled after a restart fail because the blockhash is not yet valid

Compatibility

  • No breaking changes
  • Config change (describe):
  • Migration needed (describe):

Testing

  • tests (or explain)

Summary by CodeRabbit

  • New Features

    • Enhanced ledger recovery process now better synchronizes scheduled task execution during restart procedures.
  • Bug Fixes

    • Improved task scheduler rescheduling logic with refined timing calculations for more robust execution.
  • Tests

    • Added integration test for validating crank operation persistence across ledger restarts.

@github-actions
Copy link

Manual Deploy Available

You can trigger a manual deploy of this PR branch to testnet:

Deploy to Testnet 🚀

Alternative: Comment /deploy on this PR to trigger deployment directly.

⚠️ Note: Manual deploy requires authorization. Only authorized users can trigger deployments.

Comment updated automatically when the PR is synchronized.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

The changes introduce a slot_interval duration parameter to the TaskSchedulerService, which is now passed from the validator API layer. This replaces the previous task rescheduling timeout calculation with a more deterministic approach based on 2x the slot interval. The TaskSchedulerConfig reset behavior is made conditional on the ledger reset parameter. A new integration test module is added to verify crank persistence across validator restarts by testing write and read operations on the ledger.

Suggested reviewers

  • thlorenz
  • taco-paco
  • GabrielePicco
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dode/crank-reset

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test-integration/test-ledger-restore/tests/16_cranks_persists.rs`:
- Around line 43-44: Remove the dead commented-out lines in the test (the two
commented lines containing "Wait for account to be delegated" and
"expect!(ctx.wait_for_delta_slot_ephem(10), validator);") so the test file
16_cranks_persists.rs contains no leftover commented code; simply delete those
comment lines (references: ctx.wait_for_delta_slot_ephem and the surrounding
test block) to clean up the file.

Comment on lines +43 to +44
// Wait for account to be delegated
// expect!(ctx.wait_for_delta_slot_ephem(10), validator);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove commented-out dead code.

🧹 Proposed cleanup
-    // expect!(ctx.wait_for_delta_slot_ephem(10), validator);
-
     // Schedule a task
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Wait for account to be delegated
// expect!(ctx.wait_for_delta_slot_ephem(10), validator);
// Wait for account to be delegated
// Schedule a task
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test-integration/test-ledger-restore/tests/16_cranks_persists.rs` around
lines 43 - 44, Remove the dead commented-out lines in the test (the two
commented lines containing "Wait for account to be delegated" and
"expect!(ctx.wait_for_delta_slot_ephem(10), validator);") so the test file
16_cranks_persists.rs contains no leftover commented code; simply delete those
comment lines (references: ctx.wait_for_delta_slot_ephem and the surrounding
test block) to clean up the file.

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.

1 participant