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

Forward/Revert blocks to the specified height #68

Merged
merged 7 commits into from
Jun 26, 2023

Conversation

shunsukew
Copy link
Collaborator

@shunsukew shunsukew commented May 22, 2023

Resolve #69

  • forward_blocks_to: Forward blocks to the specified block height.
  • revert_blocks_to: Revert blocks to the specified block height. (Reverting finalized blocks only works when --state-pruning mode is archive)

Examples

curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d   '{                                                                                  feat/forward-revert-blocks ✭
     "jsonrpc":"2.0",
      "id":1,
      "method":"engine_forwardBlocksTo",
      "params": [120, null]
    }'
{"jsonrpc":"2.0","result":null,"id":1}%
curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d   '{                                                                                  feat/forward-revert-blocks ✭
     "jsonrpc":"2.0",
      "id":1,
      "method":"engine_revertBlocksTo",
      "params": [50, null]
    }'
{"jsonrpc":"2.0","result":null,"id":1}% 

@shunsukew shunsukew changed the title forward blocks to the specified height forward/revert blocks to the specified height May 22, 2023
@shunsukew shunsukew changed the title forward/revert blocks to the specified height Forward/Revert blocks to the specified height May 22, 2023

let reverted = self
.backend
.revert(diff, true)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Backend revert method doesn't work when blocks are finalized for some reason, even though it is described that providing true as the second argument can revert finalized blocks (in unsafe way).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@shunsukew shunsukew marked this pull request as ready for review May 24, 2023 04:11
Copy link
Contributor

@PierreOssun PierreOssun left a comment

Choose a reason for hiding this comment

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

LGTM

…forward-revert-blocks

# Conflicts:
#	README.md
#	node/src/rpc.rs
@PierreOssun PierreOssun merged commit a0da157 into main Jun 26, 2023
5 checks passed
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.

Block number manipuration
2 participants