Skip to content
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

E(zoe).offer(...) should throw if offer handler throws #8939

Open
2 tasks
dckc opened this issue Feb 17, 2024 · 0 comments
Open
2 tasks

E(zoe).offer(...) should throw if offer handler throws #8939

dckc opened this issue Feb 17, 2024 · 0 comments
Labels
devex developer experience enhancement New feature or request needs-design Zoe package: Zoe

Comments

@dckc
Copy link
Member

dckc commented Feb 17, 2024

What is the Problem Being Solved?

You would think that the result of .offer() would be the offer result, but... nope! gotcha!
It's a seat, and if you forget to call E(seat).getOfferResult(), exceptions from the offer handler become unhandled rejections.

@LuqiPan got bit by this just as I did when learning the Zoe API:
Agoric/dapp-agoric-basics#8 (comment)

cc @erights @Chris-Hibbert @ivanlei

Description of the Design

  • TBD

One idea is:

const { seat, result } = E(zoe).offer2(...)`

Replace offer2 with the bikeshed color of your choice.

But maybe an interim path to the target is a helper:

const { seat, result } = offer2(zoe, invitation, ...)

where offer2 is...

const offer2 = (zoe, ...args) => E(zoe).offer(...args)
  .then(seat => E(seat).getOfferResult().then(result => ({ seat, result })));

Security Considerations

Not sure, but my intuition says there's more than just unhandled rejections that can result from forgetting to wait for getOfferResult() to settle.

Scaling Considerations

n/a

Test Plan

  • depends on design

Upgrade Considerations

adding the E(zoe).offer2(...) API would require a zoe upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devex developer experience enhancement New feature or request needs-design Zoe package: Zoe
Projects
None yet
Development

No branches or pull requests

1 participant