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

Use native and/or fake harden for performance #7438

Merged
merged 4 commits into from
Apr 21, 2023
Merged

Conversation

michaelfig
Copy link
Member

@michaelfig michaelfig commented Apr 17, 2023

closes: #7275, closes: #7367
refs: agoric-labs/xsnap-pub#37 agoric-labs/moddable#8 endojs/endo#1556

Description

Optimise the on-chain use of harden

Please note the Git hash updates in this PR, and see that the submodule diffs below are as expected.

Security Considerations

Some softer interface boundaries within the SwingSet kernel (running in Node.js) since harden is faked there for performance. We consider this to be an acceptable risk, because the kernel is carefully written, and does not evaluate any externally-supplied code except within a vat worker (which still uses the full, safe harden implementation).

Scaling Considerations

Reduces runtime costs of harden() under xsnap-worker and within the SwingSet kernel launched by agd start.

Documentation Considerations

Testing Considerations

@michaelfig michaelfig self-assigned this Apr 17, 2023
@michaelfig michaelfig added the xsnap the XS execution tool label Apr 17, 2023
@mhofman
Copy link
Member

mhofman commented Apr 19, 2023

I'll waive the requirement to bump the meter version given we will soon update XS versions anyway.

@michaelfig michaelfig force-pushed the mfig-native-harden branch 6 times, most recently from 3f42157 to 2012ec8 Compare April 20, 2023 19:43
@michaelfig michaelfig changed the title feat(xsnap): use native harden Use native and fake harden for performance Apr 21, 2023
@michaelfig michaelfig changed the title Use native and fake harden for performance Use native or fake harden for performance Apr 21, 2023
@michaelfig michaelfig changed the base branch from master to mfig-endo-2023-04-20 April 21, 2023 01:24
@michaelfig michaelfig marked this pull request as ready for review April 21, 2023 01:50
@michaelfig michaelfig requested review from warner and mhofman April 21, 2023 01:50
@michaelfig michaelfig force-pushed the mfig-endo-2023-04-20 branch from b67b0e5 to b43439c Compare April 21, 2023 01:57
@michaelfig michaelfig mentioned this pull request Apr 21, 2023
Base automatically changed from mfig-endo-2023-04-20 to master April 21, 2023 02:40
@michaelfig michaelfig changed the title Use native or fake harden for performance Use native and/or fake harden for performance Apr 21, 2023
Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swingset needs to continue to work with normal safe harden as well, for general correctness and sanity. Can we have a way to run the Swingset tests with safe harden too? Should this happen in CI?

@michaelfig michaelfig added the cosmic-swingset package: cosmic-swingset label Apr 21, 2023
@michaelfig
Copy link
Member Author

Swingset needs to continue to work with normal safe harden as well, for general correctness and sanity. Can we have a way to run the Swingset tests with safe harden too? Should this happen in CI?

The only change to use unsafe harden is in the entry points in the cosmic-swingset package (the code used when running agd). Everywhere else, including all CI, normal safe harden is used.

Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, clean change!

rawSaveSeconds: 0,
uncompressedSize: 801387,
uncompressedSize: 724579,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive how we reduced the heap snapshot size!

Copy link
Member Author

@michaelfig michaelfig Apr 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, removing the WeakSet of hardened values is probably what caused this shrinkage.

@michaelfig michaelfig added the automerge:no-update (expert!) Automatically merge without updates label Apr 21, 2023
Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, looks good, awesome that this works!

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Full speed ahead!

@mergify mergify bot merged commit 78e204a into master Apr 21, 2023
@mergify mergify bot deleted the mfig-native-harden branch April 21, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:no-update (expert!) Automatically merge without updates cosmic-swingset package: cosmic-swingset xsnap the XS execution tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use fake harden() in chain's kernel process Adopt XS native harden for vats
4 participants