Skip to content

Refactor and expand script verification tests#13

Merged
stringintech merged 1 commit intomainfrom
script-verify-tests
Mar 30, 2026
Merged

Refactor and expand script verification tests#13
stringintech merged 1 commit intomainfrom
script-verify-tests

Conversation

@stringintech
Copy link
Copy Markdown
Owner

Summary

Refactors script verification tests to use stateful object references (transaction, script pubkey, transaction output, precomputed tx data) instead of inline hex params.

Expands coverage from a single file to 11 dedicated files, one per output type (P2PKH, P2SH multisig, CLTV, CSV, P2SH-P2WPKH, P2SH-P2WSH, P2WPKH, P2WSH, P2TR keypath, P2TR scriptpath), each testing valid, corrupted, and flag-sensitivity variants (based on how I expanded the tests in sedited/rust-bitcoinkernel#137).

Adapts the dependency tracker to detect refs nested inside array-valued params, and documents the new/changed methods in handler-spec.md.

@stringintech
Copy link
Copy Markdown
Owner Author

Tested pre-release v0.0.3-alpha.4 in stringintech/go-bitcoinkernel#12 (comment).

Copy link
Copy Markdown
Contributor

@janb84 janb84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 66e1f3c

This was straightforward to implement and the extension of the test is welcome :)

2 suggestions:

(not related to the current changes) In the makefile L21, add build so that for a test no separate build command has to be given but only a make test will suffice :

Details

From:

	go build -o $(MOCK_HANDLER_BIN) ./cmd/mock-handler

test:
	@echo "Running runner unit tests..."

To

	go build -o $(MOCK_HANDLER_BIN) ./cmd/mock-handler

test: build
	@echo "Running runner unit tests..."

other nit see comment

@stickies-v
Copy link
Copy Markdown
Contributor

Echo'ing what janb84 said, this was very straightforward to implement, updated stickies-v/py-bitcoinkernel#42 to v0.0.3-alpha.4. Didn't review the tests but the new structure is good, as is more coverage! LGTM (but I mostly just implemented it)

@stringintech
Copy link
Copy Markdown
Owner Author

Thanks a lot for looking into this. I’m sorry that I may not be able to address your comments soon enough - I have been experiencing very limited internet access for the past few weeks.

Refactor script verification tests to use stateful object references (transaction,
script pubkey, transaction output, precomputed tx data) instead of inline hex
params.

Expand coverage from a single file to 11 dedicated files, one per output
type (P2PKH, P2SH multisig, CLTV, CSV, P2SH-P2WPKH, P2SH-P2WSH, P2WPKH, P2WSH,
P2TR keypath, P2TR scriptpath), each testing valid, corrupted, and flag-sensitivity
variants.

Adapt dependency tracker to detect refs nested inside array-valued params.

Document the new/changed methods in handler-spec.md.
Copy link
Copy Markdown
Contributor

@janb84 janb84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK a77e99c

Changes since last ack:

  • extended tests

@stringintech stringintech merged commit 1428688 into main Mar 30, 2026
2 checks passed
@stringintech stringintech deleted the script-verify-tests branch March 30, 2026 15:49
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.

3 participants