Skip to content

feat: add Rosen Bridge FIRO ↔ rsFIRO swaps - #1445

Closed
reubenyap wants to merge 26 commits into
cypherstack:stagingfrom
reubenyap:codex/rosen-firo-swap
Closed

reubenyap wants to merge 26 commits into
cypherstack:stagingfrom
reubenyap:codex/rosen-firo-swap

Conversation

@reubenyap

@reubenyap reubenyap commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Adds Rosen Bridge to the existing Swap flow for native FIRO ↔ rsFIRO on Ethereum mainnet. Users can create, fund, refresh, and resume swaps through the existing mobile/desktop confirmation screens and trade history.

Includes the rsFIRO and Campfire commits from #1444. Campfire can add FIRO, ETH, rsFIRO, USDC, and USDT wallets. The bridge and Add wallet share one rsFIRO contract definition.

Implementation

  • Reuses Exchange, trade persistence, wallet signing/broadcast, FIRO coin selection, and ERC-20 transaction history. Uses existing coinlib address/hex helpers and web3dart ABI encoding.
  • FIRO funding uses transparent funds with the required OP_RETURN; rsFIRO funding appends Rosen metadata to the ERC-20 transfer and pays gas in ETH. Signed transaction contents, mainnet, balances, fees, and nonce are checked before broadcast.
  • Changed bridge fees require a refreshed quote and another confirmation. Concurrent funding and stale trade updates cannot erase a recorded deposit.
  • Desktop wallet selection retains the selected wallet ID. Token registration preserves existing contract records.
  • Runs the complete Flutter test suite with coverage enabled and existing prebuild stubs. Tests use package imports across the lib/ boundary to prevent duplicate library identities that trigger the Dart coverage collector crash. No test assertions, discovery rules, or coverage exclusions were changed; test execution is capped at 20 minutes and the job at 30 minutes.
  • Updates the Codecov action to support tokenless public-fork uploads and report upload failures as CI failures.

Protocol configuration and pinned upstream references are documented in docs/rosen_bridge.md.

Validation

  • Full Linux CI passed on the final commit: 361 tests passed with coverage enabled, with 5 existing native-library skips. Codecov verified its uploader signature and accepted the report from this fork PR. The complete coverage-enabled suite also passed on both preceding revisions of the CI fix.
  • Passed 16 focused Flutter tests on macOS using the configured application dependencies: fee boundaries, protocol metadata, signed FIRO and ERC-20 transactions, Hive trade refresh/persistence, and Campfire token filtering.
  • Targeted analysis found no compile errors; existing warnings/lints remain.
  • Dart 3.12.2 formatting and git diff --check pass.

The full local macOS run with coverage completed without process crashes (361 passed, 4 skipped); its existing PIN test expects zero biometric calls on Linux and fails that assertion on macOS. No test assertions were changed for this CI fix.

This remains a draft until the application flows and live transfers in both directions are validated; no funds were sent during testing.

Archive empty wallet test shells without changing their contents. Their unused mock imports pull native wallet dependencies into coverage collection despite executing no assertions, triggering Linux test-process crashes. Keep all active tests and coverage enabled, add expanded logs, and bound the test step to 20 minutes and the job to 30 minutes.
Coverage collection also crashes active test processes and reproduces with serial execution. Restore all original test files and run every test without coverage instrumentation. Suspend the corresponding upload until getSourceReport can collect coverage reliably; retain bounded execution and expanded test logs.
Use canonical package URIs in the FIRO and Rosen tests. Relative imports across lib can give the same library both file and package identities in Flutter's shared incremental compiler, leaving orphan scripts that crash getSourceReport during coverage collection (dart-lang/sdk#49968). Restore coverage collection and upload while retaining the CI timeouts and all existing tests.
@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 34.32116% with 953 lines in your changes missing coverage. Please review.
✅ Project coverage is 5.43%. Comparing base (d14ad05) to head (0718d2f).
⚠️ Report is 1 commits behind head on staging.

Files with missing lines Patch % Lines
lib/services/exchange/rosen/rosen_funding.dart 21.47% 128 Missing ⚠️
...desktop_exchange/exchange_steps/step_scaffold.dart 0.00% 112 Missing ⚠️
...exchange_view/exchange_step_views/step_3_view.dart 0.00% 83 Missing ⚠️
...b/pages/exchange_view/confirm_change_now_send.dart 0.00% 77 Missing ⚠️
lib/pages/exchange_view/send_from_view.dart 0.00% 65 Missing ⚠️
..._wallet_views/add_wallet_view/add_wallet_view.dart 0.00% 60 Missing ⚠️
...exchange_view/exchange_step_views/step_4_view.dart 0.00% 46 Missing ⚠️
..._views/add_token_view/edit_wallet_tokens_view.dart 0.00% 45 Missing ⚠️
.../exchange_view/choose_address_from_stack_view.dart 0.00% 41 Missing ⚠️
...ange/exchange_steps/subwidgets/desktop_step_4.dart 0.00% 41 Missing ⚠️
... and 18 more
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #1445      +/-   ##
===========================================
+ Coverage     4.80%    5.43%   +0.63%     
===========================================
  Files         1110     1117       +7     
  Lines       111087   112079     +992     
===========================================
+ Hits          5333     6091     +758     
- Misses      105754   105988     +234     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@julian-CStack

Copy link
Copy Markdown
Collaborator

this needs to be redone as it was based on a bad base. See close reason for #1444

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.

2 participants