Skip to content

[Feat] Database checkpoints#3671

Merged
vicsn merged 6 commits intoProvableHQ:stagingfrom
ljedrz:feat/db_checkpoints
Jul 11, 2025
Merged

[Feat] Database checkpoints#3671
vicsn merged 6 commits intoProvableHQ:stagingfrom
ljedrz:feat/db_checkpoints

Conversation

@ljedrz
Copy link
Copy Markdown
Collaborator

@ljedrz ljedrz commented Jun 3, 2025

This PR exposes the functionality introduced to snarkVM in ProvableHQ/snarkVM#2742 via the REST API.

Creating a checkpoint at location /home/aleo_ledger_checkpoints/1:

curl -X POST http://localhost:3030/mainnet/db_backup?path=/home/aleo_ledger_checkpoints/1

Rolling back to (or, more precisely, switching to) the aforementioned checkpoint:

snarkos --storage=/home/aleo_ledger_checkpoints/1

Alternatively, the original ledger can be removed, and manually substituted with the checkpoint.

In addition to the root issue:

  • the checkpoint's location can have any name - it only needs to be a non-existent one
  • (almost - depends on the hard link limits of the filesystem) any number of checkpoints can be created locally

Filing as a draft, pending community feedback wrt the scope.

@ljedrz
Copy link
Copy Markdown
Collaborator Author

ljedrz commented Jun 3, 2025

note: the CI issues appear to have been caused by #3630

@vicsn
Copy link
Copy Markdown
Collaborator

vicsn commented Jun 3, 2025

Can you revive and rebase: #3592

Can you write a short manual in the top PR message for how to backup (call endpoint) and recover (???)

@ljedrz ljedrz force-pushed the feat/db_checkpoints branch 2 times, most recently from 012136b to 460b0fa Compare June 6, 2025 10:32
Comment thread .circleci/db_backup_ci.sh Outdated
@ljedrz ljedrz force-pushed the feat/db_checkpoints branch from 460b0fa to ce77cf9 Compare June 9, 2025 11:30
Comment thread .circleci/db_backup_ci.sh Outdated
@vicsn vicsn requested a review from kaimast June 9, 2025 15:58
@vicsn
Copy link
Copy Markdown
Collaborator

vicsn commented Jul 9, 2025

This is ready for rebase and opening

ljedrz added 5 commits July 10, 2025 10:49
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
…elopment

Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
@ljedrz ljedrz force-pushed the feat/db_checkpoints branch from ce77cf9 to 80beb2f Compare July 10, 2025 08:51
@ljedrz
Copy link
Copy Markdown
Collaborator Author

ljedrz commented Jul 10, 2025

I stopped the devnet CI job, as it wasn't stopping on its own; let's see if it was a fluke.

Edit: yep, it was a fluke - there wasn't an issue locally either.

@ljedrz ljedrz marked this pull request as ready for review July 10, 2025 13:35
@ljedrz ljedrz requested a review from vicsn July 10, 2025 13:35
@vicsn
Copy link
Copy Markdown
Collaborator

vicsn commented Jul 10, 2025

I'm wondering if we can get .circleci/db_backup_ci.sh in CI without having to spin up yet another CI job. Could we just run them one after the other? It shouldn't be an issue if state bleeds from one network to the other.

          name: "Run devnet test"
          timeout: 20m  # Allow 20 minutes total
          command: |
            echo "Starting db_backup_ci.sh"
             ./.circleci/db_backup_ci.sh << parameters >>
            echo "Starting devnet_ci.sh"
            ./.circleci/devnet_ci.sh << parameters.validators >> << parameters.clients >> << parameters.network_id >> << parameters.min_height >>

And to be clear, I think we should not migrate to this other script yet, we can evaluate that PR after this is through.

Comment thread .circleci/db_backup_ci.sh
@ljedrz
Copy link
Copy Markdown
Collaborator Author

ljedrz commented Jul 10, 2025

Could we just run them one after the other? It shouldn't be an issue if state bleeds from one network to the other.

Hmm bleeding state would be a problem, as the checkpoint script expects very specific block heights; it should be fine if snarkos clean is run first, though 🤔.

That being said, database checkpoints are quite isolated from the other functionalities, so I wouldn't expect them to be fragile enough to require a test run after every PR.

@vicsn
Copy link
Copy Markdown
Collaborator

vicsn commented Jul 10, 2025

Hmm bleeding state would be a problem, as the checkpoint script expects very specific block heights; it should be fine if snarkos clean is run first, though 🤔.

Well I'm suggesting to run db_backup_ci.sh first before devnet_ci.sh. But doing snarkos clean at the beginning or end is also fine. Up to you.

Signed-off-by: ljedrz <ljedrz@users.noreply.github.com>
@ljedrz
Copy link
Copy Markdown
Collaborator Author

ljedrz commented Jul 11, 2025

Seems to have worked just fine; a tiny modification, too.

@vicsn vicsn merged commit 3d80094 into ProvableHQ:staging Jul 11, 2025
2 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.

2 participants