TBD54566975 / tbdex

56 stars 26 forks source link

New rules for `Close` messages #257

Closed KendallWeihe closed 8 months ago

KendallWeihe commented 8 months ago

Intentionally creating a bit of a duplicate from https://github.com/TBD54566975/tbdex/issues/242 with the hope of focusing aim and consolidating consensus requirements

  1. Close messages are valid after any message type
  2. Close message introduces a new optional property success of type boolean

The logic of Close.success is as such:

if Close.success == null then that means Close was sent prior-to the Order execution
else if Close.success == true then Close was sent after a successful Order execution
else if Close.success == false then Close was sent after a failed Order execution

Close after Order

Close messages may be sent by Alice to the PFI during an actively executing order (AKA a state after, but not necessarily immediately after, an Order but prior to a Close where the Close.success is true), but that doesn't necessarily guarantee a successful canceled execution.

In the event Alice sends a Close message during an actively executing order:

if Close.success == true then Alice failed to cancel the executing order
else if Close.success == false then Alice successfully cancelled the executing order

  1. We need to update the relevant spec docs here in this repo
  2. We need to trickle through the changes through to various implementations
KendallWeihe commented 8 months ago

@phoebe-lew are we actively labeling these for 1.0? This one doesn't have a label.

Edit: nevermind I see it now, it's a Deadline


Two parts to this:

  1. Ensure the success property is within the Close message
  2. Notify DRI's of the necessary changes for the given implementation (Note: Order messages are valid after any message, see description, so ensure that the various "valid next" calls enable that support)