-
Notifications
You must be signed in to change notification settings - Fork 212
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
merkle-subtree-writing objects #4558
Labels
cosmic-swingset
package: cosmic-swingset
enhancement
New feature or request
read-no-tx
topic: reading from the chain without a transaction
SwingSet
package: SwingSet
Milestone
Comments
warner
added
enhancement
New feature or request
SwingSet
package: SwingSet
cosmic-swingset
package: cosmic-swingset
labels
Feb 16, 2022
Moving this to MN-1, since this is key for our off-chain read impl. |
Closed
We're using objects for this, instead of device nodes, to reduce the amount of low-level code that must be written. |
warner
changed the title
merkle-subtree-writing device nodes
merkle-subtree-writing objects
Apr 13, 2022
This was referenced May 4, 2022
This was referenced May 13, 2022
gibson042
added a commit
that referenced
this issue
May 17, 2022
gibson042
added a commit
that referenced
this issue
May 17, 2022
gibson042
added a commit
that referenced
this issue
May 23, 2022
gibson042
added a commit
that referenced
this issue
May 31, 2022
gibson042
added a commit
that referenced
this issue
Jun 3, 2022
mergify bot
added a commit
that referenced
this issue
Jun 4, 2022
* feat(cosmic-swingset): Add chainStorage interface Fixes #4558 * refactor(cosmic-swingset): Move makeChainStorageNode into a vat * chore(cosmic-swingset): Respond to PR feedback * refactor(cosmic-swingset): Move chainStorage logic into a library * chore: Improve child key checks and explanations * test: Add tests for chainStorage * chore: Allow "-" in chain storage key segments * chore: Try to appease TypeScript * chore: Try harder to appease TypeScript * style: Use a better TypeScript-compatible map initialization * refactor: Create Go and JS constants for top-level chain storage paths * refactor: Replace chain storage "key" with "path" * refactor: Move chain-storage-paths.js to avoid a module cycle * chore: Appease eslint * fix: Try adding a delay to fix CI https://github.com/Agoric/agoric-sdk/runs/6728088019?check_suite_focus=true * chore: Include relevant lines from failing CI log * fix(swingset): louder anachrophobio * ci(vats): correct `chainStorage` bundle in decentral configs Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Michael FIG <mfig@agoric.com>
11 tasks
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
read-no-tx
topic: reading from the chain without a transaction
SwingSet
package: SwingSet
(not sure what label to apply here, it overlaps swingset and cosmic-swingset, plus using it for notification purposes touches a bunch of core vats)
What is the Problem Being Solved?
#3756 wants a cheap way for a contract vat to write to some portion of the chain's externally-queriable (and provable) state space. We know we want the Notifier's
updater
API to drive this, and it would be nice to integrate in with thenotifier
half. We know there probably needs to be a device node involved, to execute the write. To make this as cheap as possible, we'd like the device write to happen from the same vat that hosts theupdater
(rather than having a separate "chain state writer service" vat which follows thenotifier
and reacts to updates by invoking the device.In today's meeting, we discussed having a device nodes that represent specific paths within the chain's state vector. One device node might manage
/swingset/state/amm/pool1
. Another might manage the parent node:/swingset/state/amm
. Each node gives the holder four authorities:cosmic-swingset would create the device and give it the ability to write into the state vector (and simultaneously add an Event to the current block, with the same update). Then
bootstrap
would get this device node, and create child nodes to hand off to each vat. The AMM vat would receive/swingset/state/amm
, and could dole out subsets as it sees fit.For efficiency, we might use fewer device nodes and provide an API which allows writes to arbitrary child paths beneath the device node's starting point. Then plain JS wrapper objects within the vat would provide the appropriate division of authority. You'd only make a new device node when sending it to a new vat.
In this approach, the kernel is not deeply involved. The device would probably be defined in
packages/cosmic-swingset/
, and the chain-sidebootstrap
would perform the subdivision. The sim-chain bootstrap would need to create some simulated equivalent.I'll write up an alternate approach in #4559, in which the kernel is deeply aware of this new IO channel, and a device is not used.
cc @gibson042 @michaelfig @dtribble @erights
Description of the Design
getRootPath() -> string
write(path: string, data: string)
delete(path: string)
write(data: string)
delete()
getPath() -> string
getChild(name: string) -> deviceNode
writeSubpath(subpath: string, data: string)
deleteSubpath(subpath: string)
getSubpath(subpath: string) -> string
The device wants to be a "raw device" (#1346), since it will be creating and exporting a lot of device nodes, and
deviceSlots
doesn't handle this very well. We want the device to store thedref
<->subpath
mapping in the vatstore. Usedevices.bundle
as a template.Questions:
delete()
on a node that encapsulates/foo
, does that also delete anything previously written to/foo/bar
and/foo/baz
? Or do we define a tree, but the individual vertices can each either have data or not? I expect the latter./
separator character is forbidden, and only join them into full strings at the last moment. SowriteSubpath
would bewriteSubpath(['bar', 'baz'], data)
instead ofwriteSubpath('bar/baz', data)
.getPath()
might return/swingset/foo/bar/baz
or it might return['swingset', 'foo', 'bar', 'baz']
and leave it to the caller to do the join.Security Considerations
Test Plan
cosmic-swingset
orpackages/vats
The text was updated successfully, but these errors were encountered: