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

avoid round trip in smart wallet vstorage / storageNode writes #10307

Open
1 task
dckc opened this issue Oct 22, 2024 · 1 comment
Open
1 task

avoid round trip in smart wallet vstorage / storageNode writes #10307

dckc opened this issue Oct 22, 2024 · 1 comment
Labels
enhancement New feature or request needs-design performance Performance related issues wallet

Comments

@dckc
Copy link
Member

dckc commented Oct 22, 2024

What is the Problem Being Solved?

While looking at performance of a PSM trade (#6039), we noticed two round trips in each wallet state update - one for serialize and one for setValue:

image

I re-discovered this pattern in

Description of the Design

Have the board marshaller return JSON.stringify(capData) rather than capData. Then the smart wallet can do

  const stringValueP = E(boardMarshaller).serializeAndStringify(objectGraph);
  await E(storageNode).setValue(stringValueP);

and stringValueP can be forwarded to the bridge vat without a round trip back thru the smart wallet.

There's a proof of concept in...

Security Considerations

Scaling Considerations

fewer round trips should scale better

Test Plan

  • how to verify in a test that we avoided the round trip??

Upgrade Considerations

This would be deployed in an upgrade of walletFactory.

It would be nice to update any other clients that exhibit this pattern, but this issue is scoped to the smart wallet, which is where we see the problem happen most often.

@dckc dckc added enhancement New feature or request wallet performance Performance related issues labels Oct 22, 2024
@gibson042
Copy link
Member

We could also enhance the StorageNode API to perform serialization locally:

  const capDataP = E(boardMarshaller).toCapData(objectGraph);
  await E(storageNode).serializeAndSetValue(capDataP);

(which would likely have smaller overall message size by avoiding the double encoding necessary to send an already serialized representation, but may be more difficult to effect because it would require upgrading the bridge vat)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-design performance Performance related issues wallet
Projects
None yet
Development

No branches or pull requests

2 participants