-
Notifications
You must be signed in to change notification settings - Fork 71
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
Compartment transforms can't seem to add endowments #248
Comments
@michaelfig see if you can think of a reason why transforms are failing here.. nothing's jumped out at me. BTW when I run
I'm grateful that In case it helps anybody, I used |
I'm adding this to the zoe-alpha project because it's a blocker for the Agoric/agoric-sdk#477 new-ses work. |
@erights any ideas? |
Actually, this only blocks kernel-on-new-ses if swingset actually uses transforms to add endowments. @michaelfig I was assuming the metering/injection code used that feature (to add an endowment with the actual meter object to be decremented). If we're not using that (or if it's a SES1 thing only), then we can reduce the priority of this. |
For (more-)secure metering, we actually need to put something in the global lexical scope (like SES1 endowments did), not on the I know JF was talking about supporting the global lexical scope, but even if that exists, I'm certain that the transforms mechanism does not allow using it yet. |
Since I'm familiar with the SES1 per-evaluation endowments mechanism, I could add such a thing to the SES-shim. However, it would be peculiar to the shim. We've already covered with Moddable that the XS SES machine will not support such a mechanism. Therefore we are also unlikely to propose such a mechanism. Are the per-compartments endowments problematic because they are per-compartment, or because they're on the global object? If the only problem is the latter, then we could get per-compartment global lexical endowments using the "optimizer" mechanism in the 8 magic lines. This also fits better with what Moddable can smoothly implement (attn @phoddie @patrick-soquet ). The shim would only support I suspect tc39 would also be more tolerant to see a per-compartment global lexical environment added to the proposal, as a construction option, than to see one added as a per-evaluation option. |
The latter. As long as the meter endowment is at least a const binding, it can only be referenced directly by name in an evaluation. That makes it possible for a transform to ensure that the evaluated pre-transformed code doesn't reference it. |
The failure I'm seeing in
import-bundle (in https://github.com/Agoric/agoric-sdk/pull/762) seems to stem from
Compartment` transforms not working the way I think they're supposed to. The minimal test case is:I'll add a branch with this appended to
test/compartment.test.js
for convenience.What I'm seeing is that the
c.evaluate
fails withReferenceError: added is not defined
. When I read throughcompartment-shim.js
, I thought each transform accepted a{ src, endowments }
object and returned a new one of the same shape, so mytransform()
ought to leave anadded
endowment that should show up by the timef4
is evaluated.I also tried providing the transforms as an option to
c.evaluate(src, { transforms })
, but that didn't work either.The text was updated successfully, but these errors were encountered: