Skip to content

feat(compile): verify the unspendable internal key - #368

Open
vadim-anfv wants to merge 2 commits into
bitcoindevkit:masterfrom
vadim-anfv:feat/nums-verify
Open

vadim-anfv wants to merge 2 commits into
bitcoindevkit:masterfrom
vadim-anfv:feat/nums-verify

Conversation

@vadim-anfv

Copy link
Copy Markdown
Collaborator

Description

Blocked by #347, which rewrites the same compile code path.

Continues #218. compile --type tr returns the r it derived the unspendable internal key from (#225); this adds the check that the pair holds, and extracts the derivation so both halves share it.

The CLI surface is not part of this PR: the options are laid out in #218 (comment), and the logic is the same under all of them. Once we pick one, I'll open a follow-up PR wiring verification into the CLI, with integration tests.

Notes to the reviewers

A concept ACK on the interface is more useful than a line-by-line review right now, since the code gets rebased once #347 lands.

  • compile behaves as before, the existing test_compile_* tests pass untouched
  • #[allow(dead_code)] is there because nothing calls the verification until the command exists, and goes away with it
  • I considered wrapping the key and its r in a type, and left it as plain functions until the command adds more callers

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Move the H + rG derivation out of the compile handler into new module,
so that the verification that pairs with it can share it.
The derivation itself is unchanged.
Check that a tr() descriptor's internal key is the NUMS point tweaked
by a given r, so the r that compile returns can be checked against the
descriptor.

No caller yet: the CLI surface is undecided, hence the dead_code allow.
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.17%. Comparing base (4445a26) to head (0970734).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #368      +/-   ##
==========================================
+ Coverage   58.74%   59.17%   +0.42%     
==========================================
  Files          25       26       +1     
  Lines        4608     4656      +48     
==========================================
+ Hits         2707     2755      +48     
  Misses       1901     1901              
Flag Coverage Δ
rust 59.17% <100.00%> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

This branch has not been deployed

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant