Repository navigation
Conversation
get_bitcoin_address returned whatever address the BitSafe API sent. A compromised API or a hijacked API domain could hand out an address that the attestors do not control. The lib now derives the address from the attestor group key that it pins per network, the same way the attestors do, and fails when the API returns a different one. It still asks the API, so a new attestor key after a DKG causes an error instead of a deposit to an old-key address. Closes #10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
cbtc::mint::get_bitcoin_addressnow checks the address that the BitSafe API returns. The lib derives the address itself from public inputs and fails when the two differ.get_deposit_account_statusgets the same check, because it callsget_bitcoin_address.Closes #10. Part of the plan in DLC-link/dlc-attestor-stack#835.
Why
Before this change, the lib returned whatever address the API sent. TLS does not help when the API itself is compromised, or when someone hijacks the
bitsafe.financedomain and gets a valid certificate. A merchant would then fund an address that the attestors do not control. That BTC cannot be recovered.How it works
src/tokens/cbtc/deposit_address.rsmirrorsgenerate_taproot_output_infoin the attestor (attestor/src/attestor/cbtc_bitcoin.rs). The internal key is the BIP-341 unspendable point with chain code SHA-256(id), derived atm/0/0. The one script leaf is<group key> OP_CHECKSIG. The output is P2TR./cbtc/v1/address-calculation-data. An operator can compare the pinned value with that endpoint by eye.Key decisions
bitcoin0.29. The test vectors come from the live attestors, so any drift fails a test.bitcoin0.32. It is rust-bitcoin, the standard maintained crate for this work, and it bringssecp256k1. This lib'sdeny.tomlchecks advisories only. The crate's CC0 license needs no change.derivestays private. A public version would let callers skip the API check.How tested
changeid on each network), a swapped address, and the right account on the wrong network.pinned_keys_match_the_live_attestors, checks the pinned xpub and all 901 published addresses on devnet, testnet and mainnet. It passes. Run it before a release and after any DKG:cargo test --lib -- --ignored pinned_keys_match_the_live_attestors./cbtc/v1/bitcoin-address/{id}by hand on each network. The returned addresses match the local derivation.cargo fmt --check,cargo clippy --all-targetsandcargo testpass. cargo-deny runs in CI.Author: Claude Code (Claude Opus 5.5), working for Jesse.
🤖 Generated with Claude Code