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

Namada rollback #1187

Merged
merged 11 commits into from
Apr 13, 2023
Merged

Namada rollback #1187

merged 11 commits into from
Apr 13, 2023

Conversation

grarco
Copy link
Contributor

@grarco grarco commented Feb 24, 2023

Implements a rollback command for Namada.

The command first calls the rollback command of Tendermint and then proceeds to reverting the state of the application by:

  • Reverting the metadata keys that are not height-prepended with their previous value
  • Reverting the subspace keys to their previous value based on the diff key of the last height (if any)
  • Removing all the keys prepended with the last height

let key = Key::from(metadata_key.to_owned().to_db_key());
let previous_key =
Key::from(format!("pred/{}", metadata_key).to_db_key());
let previous_value = self.read_subspace_val(&previous_key)?.expect(
Copy link
Member

Choose a reason for hiding this comment

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

Does this keep track of whether the key was changed in the last block; ie we need to make certain that we only revert to the pred key if it was actually different on block n-1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I understood these three keys are updated with every block

let tendermint_dir = tendermint_dir.as_ref().to_string_lossy();

// Rollback tendermint state
std::process::Command::new(tendermint_path)
Copy link
Member

Choose a reason for hiding this comment

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

Are there docs we can link to that explain how Tendermint rollback behaves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't able to find proper documentation for this. We could link this file which contains the help message, or simply include it in the help message of the Namada command

Copy link
Member

Choose a reason for hiding this comment

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

let's include the link to the code at least

@grarco grarco requested a review from tzemanovic March 1, 2023 18:36
@grarco grarco marked this pull request as ready for review March 1, 2023 18:36
@grarco grarco changed the title Wip Namada rollback Namada rollback Mar 1, 2023
tzemanovic
tzemanovic previously approved these changes Mar 7, 2023
Copy link
Member

@tzemanovic tzemanovic left a comment

Choose a reason for hiding this comment

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

tested the command, lgtm

tzemanovic added a commit that referenced this pull request Apr 11, 2023
* grarco/rollback:
  changelog: add 1187
  Improves rollback command description
  Parallel rollback
  Improves logging in rollback
  Managing missing keys in rollback
  Fixes `rollback` iterators
  Improves rollback docs
  Adds `rollback` command to cli
  Improves rollback comments
  Rollback deletes height-prepended keys
  Wip Namada rollback
@tzemanovic tzemanovic mentioned this pull request Apr 11, 2023
@juped juped merged commit 1b46fa0 into main Apr 13, 2023
@juped juped deleted the grarco/rollback branch April 13, 2023 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants