Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
dbc4949
fix react bug nullish check
binarybaron Nov 4, 2025
f46f4ee
add tx_refund_amnesty
binarybaron Nov 4, 2025
95b9e32
move TxPartialRefund to partial_refund.rs and TxFullRefund to full_re…
Einliterflasche Dec 1, 2025
2d8f843
remove unnecessary functions on BobRefundType
Einliterflasche Dec 2, 2025
6cdf507
move run_swap_setup of alice into seperate function
Einliterflasche Dec 2, 2025
208f485
change tx_refund_encsig to tx_partial_refund_encsig in Message3
Einliterflasche Dec 2, 2025
9e4cfff
add amnesty_amount and tx_partial_refund_fee to swap_setup
Einliterflasche Dec 2, 2025
1842cac
add tx_partial_refund_fee to NewSwap
Einliterflasche Dec 2, 2025
f5b7984
fix compilation errors in bitcoin wallet tests
Einliterflasche Dec 2, 2025
ea5bcf3
bob: estimate partial refund fee
Einliterflasche Dec 2, 2025
46cd40c
allow Alice to send full refund encisg and amnesty sig during swap se…
Einliterflasche Dec 2, 2025
0a42da8
add tx_partial_refund_fee and btc_amnesty_amoutn to all Alice states
Einliterflasche Dec 2, 2025
a596087
rename tx_refund_encsig to tx_full_refund_encsig while keeping db bac…
Einliterflasche Dec 2, 2025
0d5be57
add tx_refund_amnesty_fee to swap setup messages and alice/bob states
Einliterflasche Dec 2, 2025
bcdbec7
add tx_refund_amnesty_fee to Bob State1, verify partial_refund and re…
Einliterflasche Dec 2, 2025
80bdcd4
remove unnecessary serde(with = bitcoin::amount::serde::as_sats) as i…
Einliterflasche Dec 3, 2025
2bc6b83
add tx_partial_refund_fee and tx_refund_amnesty_fee to all bob and al…
Einliterflasche Dec 3, 2025
4f73fba
fix merge conflict
Einliterflasche Dec 3, 2025
e809b42
add PartiallyRefunded, AmnestyPublished, AmnestyConfirmed states for Bob
Einliterflasche Dec 3, 2025
9851f35
add Bob::BtcPartialRefundPublished state
Einliterflasche Dec 3, 2025
2b6b05b
add new states to match arms
Einliterflasche Dec 3, 2025
b70275d
fix compilation errors in tests
Einliterflasche Dec 3, 2025
c6e1385
add btc_amnesty_amount (optional) to all Bob states
Einliterflasche Dec 6, 2025
2b6e81a
add construct_tx_partial_refund and signed_partial_refund_transaction…
Einliterflasche Dec 6, 2025
55f413f
alice: actually send TxPartialRefund encsig
Einliterflasche Dec 6, 2025
c3c000c
add ensure_broadcasted function to BitcoinWallet trait
Einliterflasche Dec 8, 2025
1f83ff7
bob state machine: publish best bitcoin refund transaction depending …
Einliterflasche Dec 8, 2025
e0341e9
inline publish_best_btc_refund_tx
Einliterflasche Dec 8, 2025
651a5fa
rename BobRefundType to RefundSignatures
Einliterflasche Dec 8, 2025
4542b6d
fix btc_amnesty_amount type
Einliterflasche Dec 8, 2025
2fef464
bob: refactor btc refund publish logic
Einliterflasche Dec 8, 2025
56d4fb3
add PartialRefund and Amnesty events to SwapProgressEvent
Einliterflasche Dec 8, 2025
2a6c01f
bob: handle BtcPartialRefundPublished
Einliterflasche Dec 8, 2025
3018dde
bob: publish TxRefundAmnesty if we have the key or wait for Alice to …
Einliterflasche Dec 8, 2025
23391f8
bob: handle BtcAmnestyPublished and BtcAmestyConfirmed
Einliterflasche Dec 8, 2025
0bcfd23
Merge branch 'hardfork/v4' into protocol/partial-refund
Einliterflasche Dec 9, 2025
cc7b64e
asb: add refund_policy to Config, apply it in event loop
Einliterflasche Dec 10, 2025
cf5fce9
update tests to have refund policy
Einliterflasche Dec 10, 2025
fe94416
alice: actually use btc_amnesty_amount in run_swap_setup
Einliterflasche Dec 10, 2025
3863fc1
tracing: force ansi output for terminal layer. if anything breaks wit…
Einliterflasche Dec 10, 2025
ceac03a
remove yarn@4 from package.json as package manager
Einliterflasche Dec 10, 2025
53f9aaf
remove unnecessary env var from just asb-testnet command
Einliterflasche Dec 10, 2025
cb9bec0
state-machine(alice): make btc_amnesty_amount optional
Einliterflasche Dec 10, 2025
3a7035b
gui: show bitcoin amnesty in SwapSetupInflight page
Einliterflasche Dec 10, 2025
da31dcc
state-machine(alice): wait for either TxFullRefund or TxPartialRefund
Einliterflasche Dec 10, 2025
478b950
implement BitcoinWallet::ensure_broadcasted
Einliterflasche Dec 11, 2025
aadffaa
state-machine(alice): add BtcPartiallyRefunded and XmrRefundable states
Einliterflasche Dec 11, 2025
de92047
add justfile aliases for gui linting
Einliterflasche Dec 11, 2025
dd433d4
state-machine(alice): add XmrRefundable state
Einliterflasche Dec 11, 2025
fdaa70d
tiny gui fixes
Einliterflasche Dec 11, 2025
1f913b2
gui: update types to reflect new states
Einliterflasche Dec 11, 2025
a621ccf
bob: send sig for TxRefundAmnesty, alice: publish it
Einliterflasche Dec 12, 2025
0780e53
alice: extract monero private key from partial_refund also
Einliterflasche Dec 12, 2025
87b3e96
switch all uses of BitcoinWallet::broadcast to BitcoinWallet::ensure_…
Einliterflasche Dec 12, 2025
db83f79
add remaining_refund_timelock
Einliterflasche Dec 16, 2025
0d2cfe6
add RemainingRefundTimelock to ExpiredTimelocks
Einliterflasche Dec 17, 2025
9de25bc
fix warnings
Einliterflasche Dec 17, 2025
8c97291
add TxRefundBurn (see comment on #675 for explanation)
Einliterflasche Dec 17, 2025
95f86a0
add TxFinalAmnesty
Einliterflasche Dec 17, 2025
d393056
state-machine(bob): add new states (WaitingForRemainingRefundTimelock…
Einliterflasche Dec 17, 2025
310acc1
swap-setup: exchange signatures and fees for TxRefundBurn and TxFinal…
Einliterflasche Dec 17, 2025
7afbde5
state-machine(bob): add tx_final_amnesty_fee and tx_refund_burn_fee t…
Einliterflasche Dec 17, 2025
37c6635
swap-setup/state-machine(bob): make alice's sig on TxRefundAmnesty no…
Einliterflasche Dec 17, 2025
2e6175f
fix tests: pass remaining_refund_timelock
Einliterflasche Dec 17, 2025
31a6267
Merge branch 'hardfork/v4' into protocol/partial-refund
Einliterflasche Dec 17, 2025
06478eb
alice: sent encsig for TxFullRefund during swap setup when btc_amnest…
Einliterflasche Dec 17, 2025
6cfe009
bob: make fee fiels in state puiblic
Einliterflasche Dec 17, 2025
0276e8c
tests: add integration test for partial refund + amnesty
Einliterflasche Dec 17, 2025
92c7ee3
alice: don't try to publish TxRefundAmnesty
Einliterflasche Dec 17, 2025
840d029
add new integration test to ci
Einliterflasche Dec 17, 2025
a91ac5f
fmt
Einliterflasche Dec 18, 2025
15ed690
controller: output table when running get-swaps
Einliterflasche Dec 18, 2025
8a4ac95
controller: display more information about swaps
Einliterflasche Dec 18, 2025
db2343f
swap-setup(alice+bob): only construct TxRefundAmnesty/TxRefundBurn/Tx…
Einliterflasche Dec 19, 2025
5c2261d
just command for listing docker tests
Einliterflasche Dec 19, 2025
cdd260e
store should_publish_tx_refund_burn in alice states
Einliterflasche Dec 26, 2025
a7e6d97
alice: add states BtcRefundBurn{Published, Confirmed} and BtcFinalAmn…
Einliterflasche Dec 27, 2025
88e1bfe
add new tests to ci.yml
Einliterflasche Dec 27, 2025
b369687
add new integration tests for burn scenarios, add BurnRefund command …
Einliterflasche Dec 27, 2025
a78f3df
unify ai agent instructions
Einliterflasche Dec 27, 2025
813d641
swap-controller: add set-burn-on-refund <swap-id> <true/false>
Einliterflasche Dec 27, 2025
79da674
add docker test instructions to AGENTS.md
Einliterflasche Dec 28, 2025
d51518d
asb: add final amnesty command to asb cli and controller + integratio…
Einliterflasche Dec 28, 2025
5f7276a
add basic gui components for new states
Einliterflasche Jan 5, 2026
fb838c7
add placeholder components for partial refund path
Einliterflasche Jan 6, 2026
908db14
add mock swap states with stepping controls in dev mode
Einliterflasche Jan 6, 2026
efb6db0
improve components for the partial refund path
Einliterflasche Jan 6, 2026
2bf3d51
add RefundPolicyWire (same as RefundPolicy for now) to quote, bump pr…
Einliterflasche Jan 12, 2026
6565569
gui: extend mocking system, make it possible to view SwapSetupInfligh…
Einliterflasche Jan 12, 2026
3e65462
wait for tx refund confirmation in refund command
Einliterflasche Jan 12, 2026
4f9895f
gui: small react refactors
Einliterflasche Jan 12, 2026
6773237
undo debugging code
Einliterflasche Jan 19, 2026
3d22a04
extract earnest deposit chip into component
Einliterflasche Jan 19, 2026
b9b8e98
gui: update lanugage in partial refund components
Einliterflasche Jan 19, 2026
14fe0f9
gui: simplify language in PartialRefund TxClaim page
Einliterflasche Jan 19, 2026
ccf4ca7
bob: emit new tauri event when waiting for timelock on the remaining …
Einliterflasche Jan 20, 2026
b8a7437
fix compilation errors
Einliterflasche Jan 20, 2026
19b86b7
gui: add new page when waiting for timelock on remaining refund to ex…
Einliterflasche Jan 20, 2026
de69009
gui: add WaitingForEarnestDeposit page to mock paths
Einliterflasche Jan 21, 2026
343adf8
Merge branch 'hardfork/v4' into protocol/partial-refund
Einliterflasche Jan 25, 2026
4593761
fix compilation warnings
Einliterflasche Jan 25, 2026
4fd84d2
move to yarn@4 again
Einliterflasche Jan 26, 2026
ae09bb1
state-machine(alice+bob): rename states to match new transaction names
Einliterflasche Jan 26, 2026
c956efb
bitcoin(transaction): rename partial refund TXs
Einliterflasche Jan 26, 2026
97dbf4c
asb(config)+protocol(quote): anti_spam_deposit_ratio instead of taker…
Einliterflasche Jan 26, 2026
f9d6749
update terminology accross state machines, commands, etc
Einliterflasche Feb 2, 2026
97a332d
try to fix stackoverflow when selecting offer
Einliterflasche Feb 4, 2026
deeb8ff
fix: electrum pool bug preventing btc tx publishing
Einliterflasche Feb 6, 2026
7fa10dc
update transaction weights, field names in mockSwapEvents
Einliterflasche Feb 6, 2026
0cc15ad
alice: sanity check for anti spam deposit ratio
Einliterflasche Feb 6, 2026
f7ced4e
alice+bob: add sanity checks for amnesty amount
Einliterflasche Feb 6, 2026
492fb46
swap: delete unit tests regarding buy-xmr (which was removed)
Einliterflasche Feb 6, 2026
db2858f
add some code style guidelines to CONTRIBUTING.md
Einliterflasche Feb 6, 2026
2a9fa9a
fix typo - actually enable deny(unconditioned_recursion)
Einliterflasche Feb 6, 2026
53675cb
update unit tests
Einliterflasche Feb 6, 2026
8a72769
ci: fix typo -> build and unit tests run again
Einliterflasche Feb 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ linker = "arm-linux-gnueabihf-gcc"
[target.'cfg(all(windows, target_env = "msvc"))']
rustflags = ["-C", "link-arg=/STACK:8388608"]

[target.'cfg(macos)']
rustflags = ["-C", "link-arg=-Wl,stack_size,41943040"]

# For the GNU/MinGW tool-chain
[target.'cfg(all(windows, target_env = "gnu"))']
linker = "x86_64-w64-mingw32-g++" # Use g++ driver so -lstdc++ gets pulled in automatically
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ jobs:
- target: x86_64-pc-windows-gnu
os: ubuntu-22.04

runs-on: ${{ matrix.host }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' || !github.event.pull_request.draft
steps:
- uses: actions/checkout@v4
- name: Setup build environment (cli tools, dependencies)
uses: ./.github/actions/setup-build-environment
with:
host: ${{ matrix.host }}
host: ${{ matrix.os }}
target: ${{ matrix.target }}

- name: Build binary
Expand All @@ -117,21 +117,21 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-15]
runs-on: ${{ matrix.host }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' || !github.event.pull_request.draft
steps:
- uses: actions/checkout@v4
- name: Setup build environment (cli tools, dependencies)
uses: ./.github/actions/setup-build-environment
with:
host: ${{ matrix.host }}
host: ${{ matrix.os }}

- name: Run monero-harness tests
if: matrix.host == 'ubuntu-22.04'
if: matrix.os == 'ubuntu-22.04'
run: cargo test --package monero-harness --all-features

- name: Run library tests for swap
run: cargo test --package swap --lib
- name: Run library tests
run: cargo test --lib

docker_tests:
strategy:
Expand Down Expand Up @@ -182,6 +182,12 @@ jobs:
test_name: alice_broken_wallet_rpc_after_started_btc_early_refund
- package: swap
test_name: happy_path_alice_does_not_send_transfer_proof
- package: swap
test_name: partial_refund_bob_claims_amnesty
- package: swap
test_name: partial_refund_alice_burns
- package: swap
test_name: partial_refund_alice_grants_final_amnesty
- package: monero-tests
test_name: reserve_proof
- package: monero-tests
Expand Down
2 changes: 2 additions & 0 deletions .helix/ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
src-tauri/gen/
monero-sys/monero/
monero-sys/monero-depends/

46 changes: 0 additions & 46 deletions AGENT.md

This file was deleted.

1 change: 1 addition & 0 deletions AGENT.md
50 changes: 50 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
- Read CONTRIBUTING.md and the code style guidelines!
- When asked about libp2p, check if a rust-libp2p folder exists which contains the cloned rust libp2p codebase. Read through to figure out what the best response it. If its a question about best practice when implementing protocols read @rust-libp2p/protocols/ specificially.
- Never do `cargo clean`. Building `monero-sys` takes ages, and cleaning the build cache will cause a full rebuilt (horrible).
`cargo clean` has never fixed a build problem.
- Before suggesting a change, always give at least a short (1 sentence) summary of which function you are editing and why.
- When being asked to add something, check whether there is a similar thing already implemented, the architecture of which you can follow.
For example, when asked to add a new Tauri command, check out how other tauri commands are implemented and what conventions they follow.
-

- Think about seperation of concerns. This has many facets. But the most ofen there are questions like:
"Which part of the code should decide how to handle this situation". In the context of an error, the solution is:
- Never use fallback values. They lead to
- swallowed errors
- breaking invariances
- breaking other implicit assumptions
- destroy any meaning the value might have had.
Instead, if an error/invlaid state is encountered, the error should be propagated.
This is most often correctly done by using anyhow's "Context" and the question mark operator`.context("Failed to <foo>")?`.
- Keep error handling simple: it is basically never wrong to just propagate the error using `?` and maybe add some basic context.

Other facetts of seperation of concern include:
- should this function need to have access to this <implementation detail>?
- should this function decide a parameter itself or just take an argument?

We follow the principle of LEAST SURPRISE. Take a step back, and come back with a fresh view. Then ask yourself: "would I expect this function to do <X>?".
If not, then don't do it.

- coding style tips:
- keep the code succint. Prefer `if let` and `let ... else` to `match` whenever possible.
- avoid nesting if possible.
- prefer early returns to nesting.

- Docker tests: We have an extended test suite that simulates a whole blockchain environment for the purpose of testing swaps end to end.
The docker tests are located in `swap/tests` and can be executed using `just docker_test <name>`. Get a list of all docker tests by `just list-docker-tests`.
- If you changed something could possibly affect the success of a swap, make sure to run the integration tests that could possibly be affected.
Be very liberal with assuming what might be affected.
- If not explicitly instructed yet, ask the user whether you should add {unit, integration} tests if you just added / changed some behaviour/code
- The docker tests are long (multiple minutes) and produce tens of thousands of log messages.
Don't try to read all of that output, it will fill you context up before finishing
the initialization.
Instead, spawn them as a background-task (each as it's own).
Then you can simply check in on the current status by checking it's output every minute or so.
If you are claude, use claude codes native background task system and read from the `/tmp/claude/tasks/foo/output.tmp` pipe file, or whatever the path is.
If you are not claude, then do the thing that best accomplishises this.

- Before claiming you finished, make sure everything compiles (`cargo c --all-features`).
Also all tests (`cargo c --tests`) and all targets (`cargo c --all-targets`) must compile.



1 change: 0 additions & 1 deletion CLAUDE.md

This file was deleted.

1 change: 1 addition & 0 deletions CLAUDE.md
33 changes: 25 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,38 @@ Thank you for wanting to contribute to this project!

There are a couple of things we are going to look out for in PRs and knowing them upfront is going to reduce the number of times we will be going back and forth, making things more efficient.

0. **Read and comply with our [AI Policy](AI_POLICY.md)**
1. We have CI checks in place that validate formatting and code style.
Make sure `dprint check` and `cargo clippy` both finish without any warnings or errors.
If you don't already have it installed, you can obtain in [various ways](https://dprint.dev/install/).
2. Run the test suite with [cargo-nextest](https://nexte.st/docs/running/).
Install it using `cargo install cargo-nextest` and execute `cargo nextest run`.
3. All text document (`CHANGELOG.md`, `README.md`, etc) should follow the [semantic linebreaks](https://sembr.org/) specification.
4. We strive for atomic commits with good commit messages.
Make sure the branch is building with `--all-features` and `--all-targets` without errors
and all tests are passed.
2. All text document (`CHANGELOG.md`, `README.md`, etc) should follow the [semantic linebreaks](https://sembr.org/) specification.
3. We strive for atomic commits with good commit messages.
As an inspiration, read [this](https://chris.beams.io/posts/git-commit/) blogpost.
An atomic commit is a cohesive diff with formatting checks, linter and build passing.
Ideally, all tests are passing as well but we acknowledge that this is not always possible depending on the change you are making.
5. If you are making any user visible changes, include a changelog entry.
4. If you are making any user visible changes, include a changelog entry.

## Contributing issues

When contributing a feature request, please focus on your _problem_ as much as possible.
It is okay to include ideas on how the feature should be implemented but they should be 2nd nature of your request.

For more loosely-defined problems and ideas, consider starting a [discussion](https://github.com/comit-network/xmr-btc-swap/discussions/new) instead of opening an issue.
## Code style

### General

- File structure
- The content of each file should be ordered in terms of importance / level of abstraction
- Public `struct`s, `enum`s and important constants should be at the top
- `impl` blocks should be below the type declarations
- Both the type declaration part and the implementation part of the file should be internally ordered by level of abstraction/ importance
- For example, `fn main` should always be at least at the top of the implementation
- Prefer early returns over nested `if`/`match` statements
- Don't use fallback values or silent failures

### Rust

- Use `cargo fmt` for formatting
- Make use of the powerful `if let` and `let ... else` pattern to enable early returns
- Make use of anyhows `.context` method and the `?` operator for concise error reporting

Loading
Loading