You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in #410 the dynamic-vat-creation code needs to evaluate the new vat's code string in an environment that allows it to call require() with the usual three suspects: Nat, harden, and evaluate. To build the require endowment, this function (kernel.js kernelRequire(), roughly around line 530) needs to import those three values into its own environment.
As we discussed during the review of #410, we should do this with import statements rather than require calls. We can get away with require for now, because we feed all the kernel code through rollup and then evaluate it with a require endowment. But that will probably change soon, either when we run under XS, or when we move to the upcoming new SES API, both of which are entirely focussed on modules.
My comments from the review were:
I'm not sure we should do this now, but in a future cleanup I'm wondering if we should add a import evaluate from '@agoric/evaluate'; import Nat from '@agoric/nat'; at the top of this file, and remove the require() calls from this function (so return harden and Nat and evaluate). Then in createVatDynamically we could just call evaluate.evaluateProgram(buildFnSrc, req) instead of using the generated require() function to extract the evaluator.
The text was updated successfully, but these errors were encountered:
in #410 the dynamic-vat-creation code needs to evaluate the new vat's code string in an environment that allows it to call
require()
with the usual three suspects: Nat, harden, and evaluate. To build therequire
endowment, this function (kernel.jskernelRequire()
, roughly around line 530) needs to import those three values into its own environment.As we discussed during the review of #410, we should do this with
import
statements rather thanrequire
calls. We can get away withrequire
for now, because we feed all the kernel code throughrollup
and then evaluate it with arequire
endowment. But that will probably change soon, either when we run under XS, or when we move to the upcoming new SES API, both of which are entirely focussed on modules.My comments from the review were:
I'm not sure we should do this now, but in a future cleanup I'm wondering if we should add a
import evaluate from '@agoric/evaluate'; import Nat from '@agoric/nat';
at the top of this file, and remove therequire()
calls from this function (so returnharden
andNat
andevaluate
). Then increateVatDynamically
we could just callevaluate.evaluateProgram(buildFnSrc, req)
instead of using the generatedrequire()
function to extract the evaluator.The text was updated successfully, but these errors were encountered: