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

Allow exporting transcript from SwingSet into log format #7

Open
danfinlay opened this issue Apr 5, 2021 · 0 comments
Open

Allow exporting transcript from SwingSet into log format #7

danfinlay opened this issue Apr 5, 2021 · 0 comments

Comments

@danfinlay
Copy link
Collaborator

From our earlier versions (ses-shim, xsnap, pre-swingset), we have a lot format we can use to run a series of transactions into the machine.

However, we've now lost the ability to easily transport our state via logs, which would give us a convenient way to "merge state" (replay transactions from two machines) to get a cheap (albeit "unfairly ordered") new machine state. I think this'll be useful in development, when we might hand off who's running the server.

Some notes from Brian Warner, who seems to be the expert on the topic of exporting data from the SwingSet db:


heya.. not easy but not hard. The way that involves the least agoric-sdk code is to use the node-lmdb package. The DB has string keys, and ${vatID}.t.${n} is the n'th transcript entry for a given vat. ${vatID}.t.nextID is one larger than the last entry.
there are keys like vat.name.${vatID} to tell you the names of static vats, given their ID, which can help get oriented. The on-chain swingset has maybe 15 static vats. Start with bootstrap, that one is pretty much guaranteed to exist.
Each transcript entry is a JSON-parsable string. There's a single "delivery object" that describes the message sent into the vat (a message send, or a promise resolution notification). And there's an array of syscalls made by the vat during that turn, each with a description of the syscall (message send, promise resolution, device invocation, secondary storage get/set/delete), and the return value if any.
look in agoric-sdk/packages/SwingSet/src/kernel/state/kernelKeeper.js for a big comment near the top that describes the DB schema
the transcript is managed by src/kernel/vatManager/transcript.js and several functions in src/kernel/state/vatKeeper.js

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

No branches or pull requests

1 participant