feat(script_tracer): add script-tracer feature#201
Draft
alexanderwiederin wants to merge 7 commits into
Draft
Conversation
314b752 to
4c094d2
Compare
…f591d0b84 2df591d0b84 kernel: Add script tracer f26c15bdd28 Merge bitcoin/bitcoin#35397: ci: add OpenBSD Clang cross job dc282ff31d1 Merge bitcoin/bitcoin#35597: logging: More fully remove libevent log category ec98037f7ae Merge bitcoin/bitcoin#35615: fuzz: restore CreateSock in PCP targets 43d89bb6e10 Merge bitcoin/bitcoin#35610: bitcoin-util: Add netmagic command e35c8054894 Merge bitcoin/bitcoin#35129: test: add fuzz test for private broadcast a318f43254c bitcoin-util: Add netmagic command 3c76bd43568 Merge bitcoin/bitcoin#35603: build: QRencode cleanups 57b3bf84960 Merge bitcoin/bitcoin#35609: ci: Bump tsan config to ubuntu:26.04 with -U_FORTIFY_SOURCE d64ea158240 ci: add openBSD cross CI job 5404b620742 depends: add openbsd_LDFLAGS 2a9e35d293b Merge bitcoin/bitcoin#35588: scripted-diff: Rename `Sock::{RECV,SEND,ERR}` a0e5e30010a fuzz: restore CreateSock in PCP targets 41ceea400e8 scripted-diff: Rename `StatusLevel::{INFO,WARN,ERR}` f395acdeeea scripted-diff: Rename `Sock::{RECV,SEND,ERR}` 7a74f652935 Merge bitcoin/bitcoin#35536: fuzz: share a single mocked steady clock across FuzzedSock instances e1290ce7f74 Merge bitcoin/bitcoin#35543: test: introduce ExtendedPrivateKey and ExtendedPublicKey classes 7ac25c91771 util, refactor: Rename local `ERR` in `Sock::Accept` bbbbab86a81 ci: Bump tsan config to ubuntu:26.04 with -U_FORTIFY_SOURCE ea9afb61a1c Merge bitcoin/bitcoin#35602: doc: Clarify build docs about `pkgconf` / `pkg-config` requirements 672eedc46b0 Merge bitcoin/bitcoin#35220: fuzz: connman: strengthen assertions and extend coverage 0e5c718d8af Merge bitcoin/bitcoin#35506: test: ensure group data cluster pointers are live 93012d7ff91 Merge bitcoin/bitcoin#35601: wallet: remove experimental warning from send and sendall 829255c8bed cmake: Remove `SelectLibraryConfigurations` from `FindQRencode` module 5c55606da9b depends: Remove unused `lib/pkgconfig` in `qrencode` package 402ba10b20b cmake: Drop optional `PkgConfig` use in `FindQRencode` module 8ebfff0f88b doc: add send RPC release note fb8a1038867 doc: Clarify build docs about `pkgconf` / `pkg-config` requirements 5884f5a4fa9 wallet: remove experimental warning from send RPCs 7b84e5106c3 Merge bitcoin/bitcoin#35595: ci: remove some packages from Chimera job 58560c281d0 ci: remove some packages from Chimera job 295ce6f45c8 Merge bitcoin/bitcoin#35576: test: raise `feature_reindex` RPC timeout 633044f1436 Merge bitcoin/bitcoin#35266: rpc, wallet: add an option to not load the wallet after migrating d6269e2a903 Merge bitcoin/bitcoin#35594: fuzz: cover async chainstate compaction 3765b428d19 logging: More fully remove libevent log category 703a671fbc2 fuzz: compact coins view db during fuzzing 0868c85fd57 refactor: rename async coin compaction 6fa4132298a fuzz: share a single mocked steady clock across FuzzedSock instances 8791c4764ca test: use ExtendedPrivateKey in wallet_taproot.py 89ceafafb9f test: use ExtendedPrivateKey in wallet_listdescriptors.py bbfffcab588 test: use ExtendedPrivateKey in wallet_send.py 2ab6e590f73 test: use ExtendedPrivateKey in wallet_keypool.py 9e20118720d test: use ExtendedPrivateKey in wallet_fundrawtransaction.py 06af0cddbb9 test: use ExtendedPrivateKey in wallet_descriptor.py 4100fac20e8 test: use ExtendedPrivateKey in wallet_createwallet.py ff3f6def9a5 test: use ExtendedPrivateKey in wallet_bumpfee.py 003f2a01f63 test: use ExtendedPrivateKey in feature_notifications.py f988e6d6e64 test: use ExtendedPrivateKey in wallet_importdescriptors.py 0cdd817a82a add release note 517d37ce3eb test: tests wallet migration with load_wallet disabled b98dd63da7b rpc: Add load_wallet argument to migratewallet RPC 4acd063ba6f wallet: make loading the wallet after migrating optional 1a3cfdf1b7a fuzz: connman: cover AddLocalServices/RemoveLocalServices c507fb30634 fuzz: connman: add outbound-bytes invariants 4a6fce43ead fuzz: connman: add AddNode/RemoveAddedNode invariants 9e6546c517c test: raise reindex mining RPC timeout d2a03d50acb test: add extendedkey.py unit tests by using BIP32 test vectors afdb3780821 test: introduce ExtendedPrivateKey and ExtendedPublicKey classes 2ee4fafa3f4 test: add fuzz test for private broadcast 08b7c61fc70 private broadcast: enforce sending to unique node ids 4dbaa7cc65b test: generalise byte_to_base58 utility function to allow more version types df9eb72b129 test: ensure group data cluster pointers are live a5859edef45 fuzz: connman: set m_local_services/m_use_addrman_outgoing/m_max_automatic_connections 4b84c9125ad fuzz: connman: add network activity invariants 97d08d62baf refactor: store wallet names to MigrationResult git-subtree-dir: libbitcoinkernel-sys/bitcoin git-subtree-split: 2df591d0b8497b5b1fb48b762990b829acd5f843
Add script executiong trace hooks (btck_script_trace_register_callback / btck_script_trace_unregister_callback), including the btck_ScriptTraceFrame struct, its enums and layout guards for 32-/64-bit targets. Add a script-trace Cargo feature (off by default) that passes -DENABLE_SCRIPT_TRACE=ON to CMake.
Add a `script_trace` module for registering a global callbac that receives per-opcode `ScriptTraceFrame`s during script execution. Gated by the new `script-trace` feature; returns `KernelError::ScriptTraceUnavailable` if the kernel wasn't built with `ENABLE_SCRIPT_TRACE`.
Move verify_test out of tests/test.rs into tests/common so it can be shared and add tests/script_trace.rs which registers a trace callback, verifies a P2PKH spend and asserts the expected frames are captured. Gated behind the script-trace feature and run serially (serial_test) since the trace callback is global.
Add a `scripttrace` example binary demonstrating the `script_trace` feature. Registers a script trace callback via `set_script_trace_callback` that prints per-opcode frames (opcode name, exec flag, op count and stack contents) during verification of a P2PKH spend, then unregisters it. Opcode names are decoded via rust-bitcoin's `Opcode` table. Requires the `script-trace` feature.
4c094d2 to
2b963fc
Compare
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.
Summary
Introduces the ScriptTracer behind a
script-tracerfeature flag.depends on bitcoin/bitcoin/pull/35641