Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
326 stars 206 forks source link

way to express type transformation of callWhen in Exo behavior #7110

Open turadg opened 1 year ago

turadg commented 1 year ago

What is the Problem Being Solved?

The problem is that type defs with callWhen are deceptive. We have several "xxx" to suppress.

Basically https://github.com/Agoric/agoric-sdk/issues/6160#issuecomment-1275389323

This is separated because that issue is about auto-generation from the shapes and this is a precursor: a manual way to express the function signature that is let's the Exo API and the implementation resolve amicably.

Description of the Design

Probably something in the Exo behavior map that finds callWhen in the guard and transforms the API type to be a promise with awaited arguments. Must inspect the arguments to only wrap Awaited on the M.awaited() ones.

Security Considerations

Scaling Considerations

Test Plan

erights commented 1 year ago

But only for the M.awaited arguments, right? Other argument positions should not be transformed.

Oh, also the return result. But the return transformation should be the same as for async functions in general?

turadg commented 1 year ago

But only for the M.awaited arguments, right? Other argument positions should not be transformed.

Good point. I wrote it as if the callWhen would await all its arguments but it only does the M.awaited() ones. I'll update the body.

also the return result. But the return transformation should be the same as for async functions in general?

👍