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

Add richer data to the progress messages #761

Merged
merged 8 commits into from
Dec 2, 2022

Conversation

TheCharlatan
Copy link
Member

@TheCharlatan TheCharlatan commented Nov 8, 2022

There are now three possible progress messages that a swap can issue. I message is just a string containing information. A transition goes from an old state to a new state. A state update updates the current state. Farcasterd only keeps the latest state update around, any previous state updates are discarded.

The progress now serves additional information about the confirmation status of various transactions during a swap. Additionally, it provides the block height of a running swap daemon.

I can be pretty flexible with the provided information here, so please let me know what additions / changes / re-designs you want.

Sample Output:

> swap1-cli progress 0xaf373e2400556909ab5b90959242979ac6bb05e0c48888d24533095fc7ead6ab                          

progress:
  - message: Proposing to take swap 0xbad3…3565 to Maker remote peer
  - transition:
      old_state: StartA
      new_state: CommitA
  - transition:
      old_state: CommitA
      new_state: RevealA
  - transition:
      old_state: RevealA
      new_state:
        RefundSigA:
          arb_block_height: 2405384
          acc_block_height: 1219189
          arb_locked: false
          acc_locked: false
          buy_published: false
          cancel_seen: false
          refund_seen: false
          overfunded: false
          arb_lock_confirmations: ~
          acc_lock_confirmations: ~
          blocks_until_cancel_possible: ~
          cancel_confirmations: ~
          blocks_until_punish_possible: ~
          blocks_until_safe_buy: ~
  - StateUpdate:
      RefundSigA:
        arb_block_height: 2405386
        acc_block_height: 1219192
        arb_locked: true
        acc_locked: true
        buy_published: true
        cancel_seen: false
        refund_seen: false
        overfunded: false
        arb_lock_confirmations: 2
        acc_lock_confirmations: 1
        blocks_until_cancel_possible: 2
        cancel_confirmations: ~
        blocks_until_punish_possible: ~
        blocks_until_safe_buy: 0
  - transition:
      old_state:
        RefundSigA:
          arb_block_height: 2405386
          acc_block_height: 1219192
          arb_locked: true
          acc_locked: true
          buy_published: true
          cancel_seen: false
          refund_seen: false
          overfunded: false
          arb_lock_confirmations: 2
          acc_lock_confirmations: 1
          blocks_until_cancel_possible: 2
          cancel_confirmations: ~
          blocks_until_punish_possible: ~
          blocks_until_safe_buy: 0
      new_state:
        FinishA: SuccessSwap

@TheCharlatan TheCharlatan force-pushed the dynamicProgress branch 6 times, most recently from 619defd to b027341 Compare November 8, 2022 22:40
@TheCharlatan TheCharlatan marked this pull request as ready for review November 8, 2022 22:40
@TheCharlatan TheCharlatan force-pushed the dynamicProgress branch 2 times, most recently from 9ca9674 to 908da54 Compare November 9, 2022 08:17
@TheCharlatan TheCharlatan added the enhancement New feature or request label Nov 9, 2022
@TheCharlatan TheCharlatan linked an issue Nov 9, 2022 that may be closed by this pull request
Copy link
Member

@h4sh3d h4sh3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could also rename the state names in this PR, either find better names or just more verbose than A B...

src/bus/info.rs Show resolved Hide resolved
src/swapd/swap_state.rs Outdated Show resolved Hide resolved
src/swapd/temporal_safety.rs Show resolved Hide resolved
Copy link
Member

@h4sh3d h4sh3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second round of review, ACK

@h4sh3d h4sh3d merged commit 0101eae into farcaster-project:main Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants