endo
endo copied to clipboard
Consider adding function/method guards
As observed in https://github.com/endojs/endo/pull/1282#discussion_r970038535 and https://github.com/endojs/endo/pull/1282#discussion_r970074074 , there is a need to construct wrappers that make assertions about and/or mutate output from another function. It can be done manually like fn = (baseFn => arg => { const result = baseFn(arg); typeof result === 'string' && result.startsWith('#') || assert.fail(…); return harden(result); })(fn), but we might also consider generalizing and pulling in "patterns" functionality from @agoric/store.
@gibson042 , this would now be about exos for far functions, yes?
Possibly, although it seems better to keep argument/return shape checking independent of exportability.