-
Notifications
You must be signed in to change notification settings - Fork 229
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
Zoe metering #592
Zoe metering #592
Conversation
9e21736
to
a317880
Compare
Added spawner support while I am at it. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Zoe parts look great to me! I'd love to understand more about how the metering works.
We can talk about it in person this week. 😄 |
Closes #546 |
Notes to self about how this works (gleaned in person with Michael):
Michael assures me that this complexity will go away soon:
There remain a few questions about what the consequences of metering ought to be. When a meter underflows, computation is interrupted (by an exception that cannot be caught by the guest code) and the kernel regains control, knowing that the crank ended because of an underflow. At that point, one option is to terminate the entire vat (the "one false move and you're dead" approach). This is certainly safer in terms of integrity, as there are no invariants that could be violated, but it's the worst in terms of liveness. All subsequent messages are rejected. We'd discard all of the state changes (c-list additions) made by the doomed crank. The only state changes that get committed would be deleting the doomed vat and popping the fatal message off the run-queue. The second option is to treat the message delivery as failed, but allow subsequent messages to be delivered. The vat state observed by the subsequent message is from the middle of the failing crank: everything up until the uncatchable exception is still there. If we shut down and restart the swingset machine, that vat will follow the same path as before, underflow the meter just as before, and will be left in the same middle-of-the-crank state. The main problem with this option is that the vat has no way to run a We're currently implementing the second option. The kernel treats meter underflow the same way it treats any other vat error during message delivery: the result promise (if any) is rejected, and the kernel goes back to the run queue to process the next delivery. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We walked through this in person and it sounds good to land. I'm concerned about the complexity (and particularly the fact that this is pretty opaque and hard to understand without an in-person conversation), but it sounds like this will be improved soon.
@dtribble made some comments that suggested important changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes for rework.
These functions are run at the end of the crank (empty Promise queue).
b5e849b
to
dc5b0fb
Compare
dc5b0fb
to
ac10627
Compare
Implements basic metering for Zoe contracts. Refs #516
Closes #546
This is a temporary measure until dynamic vats are metered and Zoe can spawn vats instead of evaluating all user code in one vat.
@katelynsills please review the Zoe changes.
@warner please review the additional SwingSet changes.