Repository navigation
Conversation
jtobin
requested changes
Nov 13, 2026
jtobin
left a comment
Member
There was a problem hiding this comment.
Opus flags a corner case problem here, and extant on main, around backups w/timelocks, in that a check should extend to additional inputs, but doesn't at present. Seems worth fixing.
Example fix, which just propagates the flag via the context:
Details
diff --git a/proof/verifier.go b/proof/verifier.go
index 2efc4d51a..1ca36861e 100644
--- a/proof/verifier.go
+++ b/proof/verifier.go
@@ -73,6 +73,10 @@ type VerifierCtx struct {
// into its nested input files.
trustedRoot bool
+ // skipTimeLockValidation propagates the skip requested by
+ // WithSkipTimeLockValidationForAllProofs into nested input files.
+ skipTimeLockValidation bool
+
// ActivationHeight is the block height from which transition proofs
// must satisfy the activation rules. A confirmed proof anchored below
// it is exempt only if chain verification binds a non-zero claimed
@@ -107,8 +111,9 @@ type verifyOptions struct {
skipTimeLockValidationForFinalProof bool
// skipTimeLockValidation skips locktime checks for all proofs in a
- // file. This is used when verifying proofs without access to the
- // chain backend (e.g. during backup pre-verification).
+ // file and in the files of their additional inputs. This is used when
+ // verifying proofs without access to the chain backend (e.g. during
+ // backup pre-verification).
skipTimeLockValidation bool
// trustedRoot permits a proof file to start at a proof other than a
@@ -139,8 +144,8 @@ func WithSkipTimeLockValidationForFinalProof() VerifyOption {
}
// WithSkipTimeLockValidationForAllProofs skips locktime checks for
-// every proof in the file. Use this when verifying proofs without
-// access to the chain backend.
+// every proof in the file, and in the files of their additional inputs.
+// Use this when verifying proofs without access to the chain backend.
func WithSkipTimeLockValidationForAllProofs() VerifyOption {
return func(o *verifyOptions) {
o.skipTimeLockValidation = true
@@ -1923,6 +1928,13 @@ func (f *File) Verify(ctx context.Context,
trustedRoot := verifyOpts.trustedRoot || vCtx.trustedRoot
vCtx.trustedRoot = trustedRoot
+ // The files of additional inputs are verified with vCtx, which carries
+ // the skip for all proofs into them. The final proof options apply to
+ // the tip of this file only, so they stay here.
+ skipTimeLocks := verifyOpts.skipTimeLockValidation ||
+ vCtx.skipTimeLockValidation
+ vCtx.skipTimeLockValidation = skipTimeLocks
+
// A proof file must contain at least one proof to establish an asset
// state.
if err := f.IsValid(); err != nil {
@@ -2011,9 +2023,7 @@ func (f *File) Verify(ctx context.Context,
var proofOpts []ProofVerificationOption
// Skip timelocks for all proofs if requested.
- if verifyOpts.skipTimeLockValidation &&
- assetUsesTimeLock(&decodedProof.Asset) {
-
+ if skipTimeLocks && assetUsesTimeLock(&decodedProof.Asset) {
proofOpts = append(
proofOpts, WithSkipTimeLockValidation(),
)Otherwise looks solid.
darioAnongba
force-pushed
the
darioAnongba/embedded-engine-groundwork
branch
from
November 13, 2026 12:56
e89246a to
1451fab
Compare
darioAnongba
force-pushed
the
darioAnongba/embedded-engine-test-deps
branch
from
November 13, 2026 13:03
160576e to
2650d42
Compare
MockSigner and RandCommitmentKeyRing live in internal/test/lndmock and the gRPC server helpers in internal/test/grpcmock. Package test itself imports neither lndclient, lnwallet nor grpc, so the packages whose mock files import it do not link lnd's RPC clients. The unused ParseRPCKeyDescriptor helper is dropped.
URLDispatch returns a MockProofCourier for the mockcourier address scheme, so the type is part of the courier code rather than of the test helpers in mock.go.
WithSkipTimeLockValidationForAllProofs applies to every proof of a file and to the files of the additional inputs those proofs carry. The backup pre-verification pass has no chain backend and relies on it for an asset with a time locked input in its history.
The pre-verification pass of an import skips time lock validation and must not reach the chain backend. Its chain lookup is a type local to the package that answers every query with a zero value, so the import path does not depend on the test helpers of package proof.
RandTapCommitVersion is a test helper, so it lives with the other random generators. The minting code in mint.go does not import internal/test.
The property test generators of package asset live in asset/assetmock. Their package-level initializers instantiate much of the rapid library, so a production build of asset stays free of that code. The alt leaf encoding test runs as an external test of asset.
darioAnongba
force-pushed
the
darioAnongba/embedded-engine-groundwork
branch
from
November 13, 2026 13:52
1451fab to
5e423f4
Compare
darioAnongba
force-pushed
the
darioAnongba/embedded-engine-test-deps
branch
from
November 13, 2026 13:55
73c2b3f to
b80a84e
Compare
jtobin
merged commit Nov 13, 2026
f1d7c22
into
darioAnongba/embedded-engine-groundwork
2 checks passed
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.
Depends on #2387.
asset,commitment,tapscript,vm,proof,tappsbt,tapsendandaddresscarry mock files in their regular build. Those files importinternal/test, which importslndclient,lnwalletand gRPC, so a program that imports any of the eight packages links lnd's RPC clients. With this changego list -depsreports nolndclientfor them.internal/testkeepsMockSignerandRandCommitmentKeyRingininternal/test/lndmockand the gRPC server helpers ininternal/test/grpcmock. The package itself imports none of the three.MockProofCourieris declared inproof/courier.go, sinceURLDispatchreturns it for themockcourieraddress scheme.backup, so the import path does not depend on the test helpers ofproof.WithSkipTimeLockValidationForAllProofsreaches the proof files of additional inputs. The pre-verification pass has no chain backend, and it accepts an asset with a time locked input in its history.RandTapCommitVersionis declared incommitment/mock.gowith the other random generators.assetlive inasset/assetmock, so a regular build ofassetdoes not run their package-level initializers.The mock files still link
internal/testitself into the eight packages, andpgregory.net/rapidwith it.