Repository navigation
refactor(abstract-utxo): offline vault applies the descriptor policy spend rules - #10000
Draft
OttoAllmendinger wants to merge 2 commits into
Conversation
Contributor
OttoAllmendinger
force-pushed
the
otto/SI-1971-offlinevault-policy-validate-spend
branch
from
October 19, 2026 08:25
91008c4 to
fd1b93d
Compare
…spend rules The offline vault half-sign step called assertPox5SpendPolicy directly while the hot descriptor wallet applies the spend rules through the descriptor policy (validateSpend). Build the offline vault descriptor policy in one place and have getHalfSignedPsbt call policy.validateSpend, so both paths share one entry point and the offline vault no longer names PoX-5 in its sign step. No behavior change. Refs: SI-1971
Follow-ups from the review of the early-exit policy: - require exactly one PSBT_IN_SHA256 record on the early-exit input, not just exactly one that matches the descriptor commitment, so an unrelated extra record is refused too - drop the redundant descriptor-match check in the early-exit branch (classifyPox5Spend has already done it) and make the branch switch exhaustive instead of having an unreachable default - document that classifyPox5Spend treats any PSBT_IN_SHA256 record as an early exit on purpose, so a stray record in a late exit fails closed, and that the shared assertPox5EarlyExitSpend only checks the descriptor match and not nLockTime or the preimage Refs: SI-1971
OttoAllmendinger
force-pushed
the
otto/SI-1971-offlinevault-policy-validate-spend
branch
from
October 19, 2026 08:26
fd1b93d to
f67a332
Compare
OttoAllmendinger
added this pull request to stack #9993
October 19, 2026 08:34
Contributor
|
|
This branch has not been deployed
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.
Description
Stacked on #9991 (base: its branch; retarget to
masteronce #9987 and #9991 have merged). Two commits:1.
refactor(abstract-utxo): offline vault applies the descriptor policy spend rules(no behavior change)#9991 made hot descriptor wallets check PoX-5 spends through
DescriptorValidationPolicy.validateSpend. The offline vault still calledassertPox5SpendPolicydirectly in its half-sign step. Both paths now use the same entry point: the offline vault's descriptor policy is built in one function (getDescriptorPolicy) andgetHalfSignedPsbtcallspolicy.validateSpend?.(psbt, descriptorMap). The offline vault sign step no longer names PoX-5.2.
refactor(abstract-utxo): tighten the PoX-5 early-exit policy(follow-ups from the review of #9987, #9987 (review))PSBT_IN_SHA256record on the lockup input, so an extra unrelated record is refused (before,getPox5PrincipalPreimageignored non-matching records, so two records with one matching passed). The commitment check still applies to that one record.classifyPox5Spendtreats anyPSBT_IN_SHA256record as an early exit, so a stray record fails closed in the early-exit checks (for a late exit it hits the nLockTime 0 requirement). Classifying on "matches the descriptor commitment" would let a late exit carry an unrelated record through to signing.assertPox5EarlyExitSpendonly checks the descriptor match: documented on the shared function, pointing at the policy that adds the nLockTime and preimage checks.getMatchedTransactionInputand unreachabledefault:: removed the repeated descriptor-match check in the early-exit branch (classification has already done it), and the branch switch is exhaustive (never) instead of having an unreachable default.The "live-tested" gate in the review stays as is: it needs the OVC beta bump, fixtures and
sign-exportcoverage (offline-vault-console#1315), and real early-exit exports depend on SI-2002.Issue Number
Refs: SI-1971
Type of change
How Has This Been Tested?
npx mocha --recursive test/unit/transaction test/unit/signTransaction.ts test/unit/offlineVault(450 passing). New tests: an early exit with a second, unrelatedPSBT_IN_SHA256record is rejected, and a late exit carrying a strayPSBT_IN_SHA256record is rejected. With thevalidateSpendcall removed fromgetHalfSignedPsbt, 14 of the offline vault PoX-5 tests fail.modules/utxo-descriptorsunit tests still pass (53); the only change there is a doc comment.