Skip to content

feat(tbtc): covenant signer final project branch#3882

Draft
mswilkison wants to merge 52 commits intomainfrom
feat/psbt-covenant-final-project-pr
Draft

feat(tbtc): covenant signer final project branch#3882
mswilkison wants to merge 52 commits intomainfrom
feat/psbt-covenant-final-project-pr

Conversation

@mswilkison
Copy link

@mswilkison mswilkison commented Mar 9, 2026

This is the draft final project PR for the keep-core side of the PSBT covenant extension.

It accumulates the keep-core covenant signer work for the current threshold ECDSA signer set before a final merge to main.

Current contents:

  • covenant signer substrate

This PR is intentionally draft and will be updated as the remaining keep-core covenant work lands.

## Summary
- add a new `pkg/covenantsigner` substrate package with durable
submit/poll semantics for covenant signer jobs
- wire an optional `covenantSigner.port` HTTP server into `keep start`
backed by work persistence
- add route-aware request validation, job dedup by `routeRequestId`,
health endpoint, and targeted tests

## Scope
This is the first keep-core covenant signer extension slice only:
- common covenant job domain
- persistent store
- HTTP+JSON signer-provider surface
- request validation and idempotency

It does **not** yet implement the real signer cryptography / artifact
generation path. The default engine accepts jobs and leaves them pending
until the signing internals are plugged in by follow-up work.

## Verification
- `go test ./pkg/covenantsigner`
- `go test ./config ./cmd`
## Summary
- extend the covenant signer request contract with a concrete migration
destination reservation artifact
- validate reservation script hash, migration extraData encoding, and
canonical destination commitment hash inside keep-core
- add fixed-vector and mismatch coverage so later real signing can rely
on a verified destination artifact instead of only an opaque hash

## Why now
The new tBTC covenant migration destination reservation service is
merged on the covenant project branch. The keep-core signer substrate
now needs to consume that concrete artifact so later self_v1/qc_v1
signing slices can fail closed on destination mismatch before
implementing real tx construction.

## Verification
- `go test ./pkg/covenantsigner`
- `go test ./config`
- `go test ./cmd`
## Summary
- require a concrete migration transaction plan alongside the
reservation artifact
- validate canonical Leaf-1 pre-signed policy fields in keep-core before
real signing work
- add focused negative coverage for bad plan inputs and HTTP submit
payloads

## Testing
- go test ./pkg/covenantsigner ./config ./cmd
## Summary
- wire the covenant signer server to a real engine from tbtc instead of
the passive stub
- add the first real self_v1 signer path that fetches the active
outpoint, verifies the reserved migration destination and transaction
plan, signs the canonical maturity spend, and returns READY with
transactionHex + deterministic artifact hash
- extend the bitcoin transaction builder with explicit
locktime/sequence/witness controls and add end-to-end signer coverage

## Testing
- go test ./pkg/bitcoin ./pkg/covenantsigner
- go test ./pkg/tbtc -run TestCovenantSignerEngine_SubmitSelfV1Ready -v
- go test ./config ./cmd
## Summary
- add a real qc_v1 signer path in keep-core that produces signer handoff
bundles
- build and sign the canonical unsigned migration spend, then return a
typed handoff instead of a final artifact
- cover the new handoff path with direct pkg/tbtc tests

## Testing
- go test ./pkg/tbtc -run focused covenant signer tests
- go test ./pkg/bitcoin ./pkg/covenantsigner ./config ./cmd
## Summary
- default the covenant signer HTTP listener to loopback and require a
bearer auth token for non-loopback exposure
- stop holding the submit mutex across engine.OnSubmit so deduped
callers are not serialized behind long signer work
- add focused tests for auth enforcement, config flags, and in-flight
submit dedupe semantics

## Testing
- go test ./pkg/covenantsigner -count=1
- go test ./pkg/tbtc -run 'TestCovenantSignerEngine_' -count=1
- go test ./cmd -count=1
## Summary
- add optional role-tagged artifact approval envelopes to covenant
signer requests
- validate approval payload bindings and required roles by route while
keeping legacy artifact signature arrays as the active compatibility
contract
- add focused tests for acceptance, rejection paths, and legacy-array
mismatch handling

## Testing
- go test ./pkg/covenantsigner
- go test ./pkg/tbtc -run CovenantSigner -count=1

## Notes
- stacked on top of codex/psbt-covenant-signer-hardening
- this is the structural validation slice only; it does not add
cryptographic verification of the approvals yet
## Summary
- add config-backed depositor and custodian trust roots keyed by
route/reserve/network
- enforce self_v1 depositor key pinning and qc_v1 custodian key pinning
before artifact approval signature verification
- add focused covenantsigner coverage for matching, mismatched, and
missing trust-root entries

## Testing
- go test ./pkg/covenantsigner -count=1
- go test ./pkg/tbtc -run 'SignerApprovalCertificate|CovenantSigner'
-count=1 -timeout=5m
…val-cutover' into codex/repair-keep-core-umbrella
## Summary
- add requestType to covenant signer requests and make it part of
normalization and request digests
- reject invalid qc_v1 + presign_self_v1 combinations while preserving
explicit self_v1 presign semantics
- refresh mirrored approval-contract vectors and add requestType
regressions in covenantsigner and tbtc engine tests

## Testing
- go test ./pkg/covenantsigner ./pkg/tbtc -run
'SignerApprovalCertificate|CovenantSigner|ApprovalContractVectors|RequestDigestDistinguishesSelfV1PresignFromReconstruct|RejectsQcV1PresignRequestType'
-count=1
## Summary
- add a production startup gate for missing covenant approval trust
roots
- expose the gate through keep-core config and CLI flags
- cover startup enforcement plus config/flag parsing in tests

## Testing
- go test ./pkg/covenantsigner ./cmd ./config -count=1
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.

1 participant