Skip to content

refactor(key-wallet): update transaction builder to centralize funding and signing logic#744

Merged
QuantumExplorer merged 1 commit into
v0.42-devfrom
refactor/transaction-builder-signing
May 8, 2026
Merged

refactor(key-wallet): update transaction builder to centralize funding and signing logic#744
QuantumExplorer merged 1 commit into
v0.42-devfrom
refactor/transaction-builder-signing

Conversation

@ZocoLini
Copy link
Copy Markdown
Collaborator

@ZocoLini ZocoLini commented May 8, 2026

Centralizes coin selection, change derivation, BIP-69 sorting, fee accounting and input signing inside TransactionBuilder so per-tx-type helpers (build_and_sign_transaction, build_asset_lock, build_asset_lock_with_signer, …) only set up the builder and post-process wallet state.

Highlights

  • TransactionBuilder owns the build pipeline: set_funding / set_change_address / set_current_height / set_selection_strategy / set_special_payload → build_unsigned() or build_signed(signer, path_resolver).
  • New TransactionSigner trait with default sign_tx flow; blanket impl for Wallet (soft-wallet path) and for S: Signer (external signers). The blind-digest support check lives once, in the blanket impl.
  • AssetLock-specific structural rules (OP_RETURN burn at tx.output[0], version-3 wire, BIP-69 skip, total-output derived from payload credit_outputs) are handled inside assemble_unsigned; helpers no longer mirror credit_outputs as raw outputs.
  • dashcore payload structs (AssetLockPayload, CoinbasePayload, ProviderRegistrationPayload, …) gain CURRENT_VERSION constants and new(...) constructors so callers don't repeat version literals.

Note: The unit-test suite was not rewritten. Tests were only adjusted to match the new API

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack

Warning

Rate limit exceeded

@ZocoLini has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 36 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 67b26b51-3e51-4166-ac14-e26b94933a48

📥 Commits

Reviewing files that changed from the base of the PR and between 49c8c6d and b462fc0.

📒 Files selected for processing (11)
  • dash/src/blockdata/transaction/special_transaction/asset_lock.rs
  • dash/src/blockdata/transaction/special_transaction/coinbase.rs
  • dash/src/blockdata/transaction/special_transaction/provider_registration.rs
  • dash/src/blockdata/transaction/special_transaction/provider_update_registrar.rs
  • dash/src/blockdata/transaction/special_transaction/provider_update_revocation.rs
  • dash/src/blockdata/transaction/special_transaction/provider_update_service.rs
  • key-wallet-ffi/src/transaction.rs
  • key-wallet-manager/src/lib.rs
  • key-wallet/src/wallet/managed_wallet_info/asset_lock_builder.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_builder.rs
  • key-wallet/src/wallet/managed_wallet_info/transaction_building.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/transaction-builder-signing

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label May 8, 2026
@ZocoLini ZocoLini force-pushed the refactor/transaction-builder-signing branch 2 times, most recently from c354380 to 3ee5958 Compare May 8, 2026 17:21
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label May 8, 2026
@ZocoLini ZocoLini force-pushed the refactor/transaction-builder-signing branch from 3ee5958 to c48adc9 Compare May 8, 2026 17:23
@ZocoLini ZocoLini marked this pull request as ready for review May 8, 2026 17:26
@ZocoLini ZocoLini force-pushed the refactor/transaction-builder-signing branch from c48adc9 to 17c711b Compare May 8, 2026 17:27
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 58.88078% with 169 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.74%. Comparing base (49c8c6d) to head (b462fc0).

Files with missing lines Patch % Lines
...ction/special_transaction/provider_registration.rs 0.00% 34 Missing ⚠️
...ion/special_transaction/provider_update_service.rs 0.00% 26 Missing ⚠️
.../wallet/managed_wallet_info/transaction_builder.rs 87.77% 22 Missing ⚠️
...n/special_transaction/provider_update_registrar.rs 0.00% 20 Missing ⚠️
...ckdata/transaction/special_transaction/coinbase.rs 0.00% 18 Missing ⚠️
...wallet/managed_wallet_info/transaction_building.rs 71.92% 16 Missing ⚠️
.../special_transaction/provider_update_revocation.rs 0.00% 14 Missing ⚠️
key-wallet-ffi/src/transaction.rs 0.00% 9 Missing ⚠️
...data/transaction/special_transaction/asset_lock.rs 0.00% 6 Missing ⚠️
key-wallet-manager/src/lib.rs 0.00% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev     #744      +/-   ##
=============================================
+ Coverage      71.31%   71.74%   +0.43%     
=============================================
  Files            321      321              
  Lines          70339    70013     -326     
=============================================
+ Hits           50160    50234      +74     
+ Misses         20179    19779     -400     
Flag Coverage Δ
core 76.30% <0.00%> (-0.39%) ⬇️
ffi 47.38% <0.00%> (+2.40%) ⬆️
rpc 20.00% <ø> (ø)
spv 87.42% <ø> (-0.09%) ⬇️
wallet 70.75% <85.21%> (+0.90%) ⬆️
Files with missing lines Coverage Δ
key-wallet-manager/src/lib.rs 75.00% <0.00%> (-0.26%) ⬇️
...c/wallet/managed_wallet_info/asset_lock_builder.rs 82.77% <95.55%> (+3.15%) ⬆️
...data/transaction/special_transaction/asset_lock.rs 65.11% <0.00%> (-10.56%) ⬇️
key-wallet-ffi/src/transaction.rs 0.00% <0.00%> (ø)
.../special_transaction/provider_update_revocation.rs 46.87% <0.00%> (-13.13%) ⬇️
...wallet/managed_wallet_info/transaction_building.rs 88.59% <71.92%> (+6.25%) ⬆️
...ckdata/transaction/special_transaction/coinbase.rs 85.11% <0.00%> (-10.22%) ⬇️
...n/special_transaction/provider_update_registrar.rs 86.27% <0.00%> (-12.98%) ⬇️
.../wallet/managed_wallet_info/transaction_builder.rs 84.90% <87.77%> (+23.82%) ⬆️
...ion/special_transaction/provider_update_service.rs 81.81% <0.00%> (-6.12%) ⬇️
... and 1 more

... and 21 files with indirect coverage changes

@ZocoLini ZocoLini force-pushed the refactor/transaction-builder-signing branch from 17c711b to b462fc0 Compare May 8, 2026 18:15
@QuantumExplorer QuantumExplorer merged commit 6e48993 into v0.42-dev May 8, 2026
37 checks passed
@QuantumExplorer QuantumExplorer deleted the refactor/transaction-builder-signing branch May 8, 2026 18:24
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