Skip to content

feat(store): allow rollback past included height for sync node + improve rollback cmd#2699

Merged
julienrbrt merged 4 commits intomainfrom
julien/rollback-imprv
Sep 24, 2025
Merged

feat(store): allow rollback past included height for sync node + improve rollback cmd#2699
julienrbrt merged 4 commits intomainfrom
julien/rollback-imprv

Conversation

@julienrbrt
Copy link
Member

rollback cmd

Overview

@julienrbrt julienrbrt changed the title feat(store): allow rollback past included height for sync node + improve feat(store): allow rollback past included height for sync node + improve rollback cmd Sep 24, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 24, 2025

The latest Buf updates on your PR. Results from workflow CI and Release / buf-check (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedSep 24, 2025, 12:34 PM

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @julienrbrt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the node rollback mechanism, introducing greater flexibility for sync nodes while maintaining strict data integrity for aggregator nodes. The primary purpose is to enable sync nodes to recover from potential synchronization issues by allowing them to rollback past the Data Availability (DA) included height, a capability previously restricted. This change enhances the robustness and operational control over node states, ensuring that different node types can manage their historical data appropriately without compromising the network's finalized state.

Highlights

  • Enhanced Rollback Command: The rollback command now includes new flags: --sync-node to specify if the node is a sync node, and --skip-p2p-stores to optionally bypass the rollback of P2P related stores (like goheaderstore).
  • Differentiated Rollback Logic: The core Rollback function in the store package has been updated to differentiate its behavior based on whether the node is an 'aggregator' or a 'sync node'. This is controlled by a new aggregator boolean parameter.
  • Sync Node Rollback Flexibility: Sync nodes are now permitted to rollback to a height that is lower than the previously recorded Data Availability (DA) included height. When this occurs, the DA included height metadata is updated to reflect the new rollback height.
  • Aggregator Node Safeguard: Aggregator nodes retain the critical restriction: they cannot rollback to a height below the DA included height, ensuring data finality and integrity for the network's primary data source.
  • Improved Test Coverage: New test cases have been added to specifically validate the behavior of sync nodes rolling back past the DA included height, ensuring the new logic functions as intended.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the rollback command by adding flags for sync nodes and skipping P2P stores, and it modifies the store's Rollback logic to allow sync nodes to roll back past the DA included height. The changes are logical and well-tested. My review focuses on improving code maintainability by addressing duplication in both the command implementation and test files, fixing a critical atomicity issue in the store's rollback logic, and correcting some typos and inaccuracies in comments.


cmd.Flags().Uint64Var(&height, "height", 0, "rollback to a specific height")
cmd.Flags().BoolVar(&syncNode, "sync-node", false, "sync node (no aggregator)")
cmd.Flags().BoolVar(&skipP2PStores, "skip-p2p-stores", false, "skip rollback p2p2 stores (goheaderstore)")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's a typo in the flag description. "p2p2" should be "p2p".

Suggested change
cmd.Flags().BoolVar(&skipP2PStores, "skip-p2p-stores", false, "skip rollback p2p2 stores (goheaderstore)")
cmd.Flags().BoolVar(&skipP2PStores, "skip-p2p-stores", false, "skip rollback p2p stores (goheaderstore)")

err := store.SetMetadata(ctx, DAIncludedHeightKey, heightBytes)
require.NoError(err)

// Rollback to height below DA included height should fail
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This comment is incorrect. The rollback is expected to succeed, not fail.

Suggested change
// Rollback to height below DA included height should fail
// Rollback to height below DA included height should succeed

@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.14%. Comparing base (fc65124) to head (64ff783).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/store/store.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2699      +/-   ##
==========================================
- Coverage   66.14%   66.14%   -0.01%     
==========================================
  Files          77       77              
  Lines        7849     7856       +7     
==========================================
+ Hits         5192     5196       +4     
- Misses       2174     2176       +2     
- Partials      483      484       +1     
Flag Coverage Δ
combined 66.14% <70.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@julienrbrt julienrbrt added this pull request to the merge queue Sep 24, 2025
github-merge-queue bot pushed a commit that referenced this pull request Sep 24, 2025
…ove rollback cmd (#2699)

rollback cmd

<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.

NOTE: PR titles should follow semantic commits:
https://www.conventionalcommits.org/en/v1.0.0/
-->

## Overview

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 

Ex: Closes #<issue number>
-->
Merged via the queue into main with commit 686f465 Sep 24, 2025
28 of 30 checks passed
@julienrbrt julienrbrt deleted the julien/rollback-imprv branch September 24, 2025 13:39
@github-project-automation github-project-automation bot moved this to Done in Evolve Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants