Skip to content

Conversation

@Einliterflasche
Copy link

@Einliterflasche Einliterflasche commented Sep 11, 2025

This PR adds the functionality for manual cooperative redeem between maker and taker:

  • add the cooperative-redeem --swap-id <swap-id> command to asb-controller
  • add a check to make sure Bob gets the correct cooperative redeem key
  • deduplicate redeem logic: go to state Bob::BtcRedeemed when Bob gets the correct key
  • add functionality to GUI
  • add integration tests for manual cooperative redeem via rpc server
  • add simple test to make sure Bob actually fails when receiving the wrong key from Alice
  • test it manually

Note

Implements manual cooperative redeem after punish across core, RPC/CLI, and GUI, with key validation, DB migration, and tests.

  • Core/Protocol:
    • Add manual cooperative redeem path; validate s_a against S_a_monero and transition to Bob::BtcRedeemed upon success.
    • Extend Bob states (State4/State6) to carry S_a_monero; add PrivateViewKey::from_spend_key.
    • Improve redeem flow (unlock wait warns but proceeds) and rendezvous logging; minor fixes.
  • RPC/Controller:
    • ASB RPC: new cooperative_redeem_info(swap_id) endpoint; server returns s_a, lock_tx_id, lock_tx_key when safe.
    • Controller CLI: new cooperative-redeem-key --swap-id command.
    • Tauri backend: new manual_cooperative_redeem command and request types; wire through context.
  • GUI:
    • Add manual cooperative redeem modal on punished screen; resume with pasted key/tx info.
    • Seed phrase modal refactor (fetch on open), minor UI tweaks.
  • Database:
    • Migration to populate S_a_monero for Bob states to enable validation.
  • Tests/CI:
    • Add integration tests: manual_cooperative_redeem and malicious key rejection; include in CI matrix.
  • Deps/Build:
    • Add monero-oxide, swap-serde usage; minor logging/utility changes; justfile targets updated.

Written by Cursor Bugbot for commit fa23dfa. This will update automatically on new commits. Configure here.

@Einliterflasche Einliterflasche changed the title feat: manual cooperative redeem feat: Manual Cooperative Redeem Sep 11, 2025
Copy link

@binarybaron binarybaron left a comment

Choose a reason for hiding this comment

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

some comments

@binarybaron
Copy link

@Einliterflasche You can test this on our testnet VPS. Just change the docker-compose.yml to build from this branch.

@Einliterflasche
Copy link
Author

bugbot run

@cursor
Copy link

cursor bot commented Oct 14, 2025

Skipping Bugbot: Bugbot is disabled for this repository

@binarybaron
Copy link

bugbot run

- package: swap
test_name: manual_cooperative_redeem
- package: swap
test_name: manual_cooperative_redeem_malicious_key.rs
Copy link

Choose a reason for hiding this comment

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

Bug: Test Name Incorrectly Includes File Extension

The test_name manual_cooperative_redeem_malicious_key.rs in the CI workflow incorrectly includes the .rs file extension. Test names typically reference the test function, not the filename, and this inconsistency may prevent the CI from running the test.

Fix in Cursor Fix in Web

)
.into_json_rpc_error();
}

Copy link

Choose a reason for hiding this comment

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

Bug: Error Handling Flaw in Cooperative Redeem

In cooperative_redeem_info, an error is created when bob_was_punished is false, but it's not returned. This allows execution to continue, potentially leading to an insecure key revelation or an incorrect successful response.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants