Skip to content

Replay local blocks. #328

Open
Open

Description

@tac0turtle

Summary

Sometimes when I have a snapshot I'd like to replay those blocks against the state machine. This would allow teams that modify events and/or data to not have to replay from genesis.

Problem Definition

Currently to replay a specific block in the past you must either find a snapshot before the height or resync from genesis. There is the potential for comsprund to help with this but it would need modifications in the sdk.

Proposal

If I have a snapshot or db with 1m blocks I'd like the ability to replay the last 500k against the application. This would utilize the replay functionality of a node but instead of the network sending me blocks I would use the local db.

Activity

  1. added a commit that references this issue on Mar 1, 2023
  2. yihuang commented on Mar 14, 2023

    @yihuang
    Contributor

    If you can rollback app state by 500k blocks, it'll replay local blocks automatically on restart?

  3. tac0turtle commented on Mar 15, 2023

    @tac0turtle
    ContributorAuthor

    yea, that is the idea. replay would be very fast and people would be able to reconstruct events without needing to have tx_index.db around. This would save space on snapshots. The only issue is you can only replay from the latest upgrade height

  4. yihuang commented on Mar 15, 2023

    @yihuang
    Contributor

    The only issue is you can only replay from the latest upgrade height

    unless using cosmovisor and update the symbolic link manually I guess.

    And there's a quick way to rollback, which is set the latest version in rootmulti metadata directly, that probably work if replaying don't get a different root-hash.

  5. liamsi commented on Mar 20, 2023

    @liamsi

    The only issue is you can only replay from the latest upgrade height

    unless using cosmovisor and update the symbolic link manually I guess.

    Would it not be possible to just swap out the state-machine/app part depending on block height instead of using cosmovisor and swapping out the whole binary? That would be cleaner in many ways anyways.
    Unless there was a breaking change in cometBFT that would enable replaying from a single binary even if there was an upgrade.

  6. tac0turtle commented on Mar 20, 2023

    @tac0turtle
    ContributorAuthor

    Would it not be possible to just swap out the state-machine/app part depending on block height instead of using cosmovisor and swapping out the whole binary?

    you can but your node needs to have comet and sdk as two separate processes. this is a simple thing to do in the sdk currently

  7. liamsi commented on Mar 20, 2023

    @liamsi

    I think it could even be done in-process. Comet or the SDK just need to know from which height onwards things change in the state machine or in comet itself. Though I guess if the changes were only in the state machine the new code-path could live only in the state machine anyways (with no changes to comet). Things become trickier if there are breaking changes in comet. Let's chat more about this in person.

  8. tac0turtle commented on Mar 20, 2023

    @tac0turtle
    ContributorAuthor

    oh sorry, wasnt thinking in that context, was thinking in todays code path. Agree with you

  9. added
    P:operator-experience
    P:new-use-cases
    on Nov 9, 2023
  10. moved this from Todo to Blocked in CometBFT 2023on Nov 9, 2023
  11. andynog commented on Nov 9, 2023

    @andynog
    Contributor

    Hi @tac0turtle, just catching up on old issues. Sorry this been sitting here for a while. I believe you mentioned in other channels the desire to have this feature. But just reading it through it seems to be more complicated than anticipated and might need coordination between Comet or the SDK and would be interesting to gather more feedback from operators on the benefits of implementing this issue.

    Should we close this issue and open a discussion ?

  12. tac0turtle commented on Nov 10, 2023

    @tac0turtle
    ContributorAuthor

    Should we close this issue and open a discussion ?

    the issue seems fairly well outlined, what do you feel like is missing that a discussion is needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P:new-use-casesP:operator-experiencestate-sync

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions