diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-01-25 09:14:20 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-01-25 09:14:48 +0100 |
commit | bd482b3ffebc68130f8a18dabf08ed1aff7ea159 (patch) | |
tree | eabb474f9efc941eec73525f5caede4e0e76b844 /src/test | |
parent | 69ef0a107f0d371d1cd65e3033e8751738964a8d (diff) | |
parent | cfa575266bc0198574a82e8e386040e969b05dea (diff) |
Merge bitcoin/bitcoin#24105: Optimize CHECKSIGADD Script Validation
cfa575266bc0198574a82e8e386040e969b05dea Optimize CHECKSIGADD Script Validation (Jeremy Rubin)
Pull request description:
This is a mild validation improvement that improves performance by caching some signature data when you have a Taproot script fragment that uses CHECKSIGADD Multisignatures with sighash single. In some basic testing I showed this to have about a 0.6% speedup during block validation for a block with a lot of CHECKSIGADDs, but that was with the entirety of block validation so the specific impact on the script interpreter performance should be a bit more once you subtract things like coin fetching. If desired I can produce a more specific/sharable bench for this, the code I used to test was just monkey patching the existing taproot tests since generating valid spends is kinda tricky. But it's sort of an obvious win so I'm not sure it needs a rigorous bench, but I will tinker on one of those while the code is being reviewed for correctness.
The overhead of this approach is that:
1. ScriptExecutionData is no longer const
2. around 32 bytes of extra stack space
3. zero extra hashing since we only cache on first use
ACKs for top commit:
sipa:
utACK cfa575266bc0198574a82e8e386040e969b05dea
MarcoFalke:
review ACK cfa575266bc0198574a82e8e386040e969b05dea
jonatack:
ACK cfa575266bc0198574a82e8e386040e969b05dea
theStack:
Code-review ACK cfa575266bc0198574a82e8e386040e969b05dea
Tree-SHA512: d5938773724bb9c97b6fd623ef7efdf7f522af52dc0903ecb88c38a518b628d7915b7eae6a774f7be653dc6bcd92e9abc4dd5e8b11f3a995e01e0102d2113d09
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/signature_checker.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/fuzz/signature_checker.cpp b/src/test/fuzz/signature_checker.cpp index deffe26b17..f6c591aca4 100644 --- a/src/test/fuzz/signature_checker.cpp +++ b/src/test/fuzz/signature_checker.cpp @@ -34,7 +34,7 @@ public: return m_fuzzed_data_provider.ConsumeBool(); } - bool CheckSchnorrSignature(Span<const unsigned char> sig, Span<const unsigned char> pubkey, SigVersion sigversion, const ScriptExecutionData& execdata, ScriptError* serror = nullptr) const override + bool CheckSchnorrSignature(Span<const unsigned char> sig, Span<const unsigned char> pubkey, SigVersion sigversion, ScriptExecutionData& execdata, ScriptError* serror = nullptr) const override { return m_fuzzed_data_provider.ConsumeBool(); } |