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

API to get summary of swingstore block changes #6562

Closed
mhofman opened this issue Nov 14, 2022 · 2 comments
Closed

API to get summary of swingstore block changes #6562

mhofman opened this issue Nov 14, 2022 · 2 comments
Assignees
Labels
cosmic-swingset package: cosmic-swingset enhancement New feature or request SwingSet package: SwingSet vaults_triage DO NOT USE
Milestone

Comments

@mhofman
Copy link
Member

mhofman commented Nov 14, 2022

What is the Problem Being Solved?

In order to solve state-sync (#3769, #5542), we need to capture the content of changes to swingset state, and save it either to the IAVL tree (#5934), or write it in an external blob (WAL like for a full state dump).

Only the resulting write and deletes are needed, not any intermediate mutations, or any read.

This also need to be cognizant of potential crank rollbacks, so a simply memory based approach like the current crank buffer is probably not appropriate.

This is currently complicated by the fact SwingSet state is split over 3 kind of storage: LMDB for the swing-store, SQLite for the stream-store, and raw files for snapshots of the snap-store.

Description of the Design

Once a single SQLite DB is used for all SwingSet state (as initiated by #6561), the following approach may work:

  • Swingstore create a second memory back SQLite DB for every block
  • Every write and delete is saved into this DB, handling crank rollbacks (which can use regular transactions instead of savepoints)
  • At the end of the block, and dump of this DB is taken (and normalized)
  • The dumb is either send to the cosmos side, or written to disk and hashed as appropriate

The DB / table would likely require 3 column: key, newValue and deleted.

Security Considerations

None I can think of

Test Plan

TBD

@warner
Copy link
Member

warner commented Jan 24, 2023

cc @FUDCo

@warner
Copy link
Member

warner commented Mar 14, 2023

This is really the incremental aspect of #6773, and thus superceded by it.

@warner warner closed this as completed Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmic-swingset package: cosmic-swingset enhancement New feature or request SwingSet package: SwingSet vaults_triage DO NOT USE
Projects
None yet
Development

No branches or pull requests

5 participants