Open turadg opened 2 years ago
Looks like a SwingSet feature ask, so adding SwingSet label. FYI @warner
One example was liquidation, but if we this one at a time we don't need it. But we need to investigate if there are any other examples we would cross crank boundaries.
Note: breaking up each item in a different crank involves the kernel and may ultimately become too inefficient, at which point we'll probably need a mechanism sensitive to the remaining meter value akin to requestIdleCallback
's IdleDeadline
, which obviously introduces a risk of code being able to sense how much computation other code in the same vat performs.
As discussed last week:
syscall.send()
using one of your own o+NN
vrefs as a targetE(target).method(args)
was spelled target!method(args)
), I used to joke about target!!method(args)
to mean "send to target
but ensure that it happens in a future crank", which only really does anything different if target
is in your own vatE.sendInNewCrank(target).method(args)
p = vatPowers.yieldCrank()
would be enough: it could use an internal object as the syscall.send
target, and return a promise that fires in a future crankvatPowers
might be overkill, but feels safer than making it ambientvatPowers
, and not ambientvatPowers.getRemainingMeter()
(in absolute computrons, or as percentage of remaining meter)spreadOverCranks(meterThreshold)
that provides an async iterator which cycles as much as possible in the current crank, until the remaining meter drops below the chosen threshold, and then the next cycle doesn't start until a future crankvatPowers.getRemainingMeter()
like a normal syscall
What is the Problem Being Solved?
Some things can't be sync because they'd be too large to process in one crank. A simple async iterator would process each item in a separate turn. We need a batching capability so that an async iterator can synchronously process a batch in one crank.
Description of the Design
TBD
Security Considerations
--
Test Plan
--