Skip to content

Instantly share code, notes, and snippets.

@l0rinc
l0rinc / benchmark.md
Last active March 24, 2025 11:27
Benchmarking meeting notes

Benchmarking meeting notes

Add a macro benchmark suite with longer-running operations, exercising a different set of functionality that is performance-critical.

  • One of them could be the speed of an assumeUTXO load-and-dump (this would check block read/write and (de)serialization, but only part of validation).
  • Another one could be an actual IBD for 840-880k blocks (small part of IBD, but should produce a representative comparison quickly).
  • Another one would be a reindex-chainstate up to e.g. 880k blocks (more realistic, but takes long and doesn't involve reading/writing blocks).
  • Lastly, several full IBDs to make sure the previous quick checks are representative (likely only required for big changes). We don't have to run all of these for every PR; it could be tied to labels added to PRs where the author/reviewers think they're relevant (e.g., not for doc typo fixes). This would require integration with CoreCheck.

Other suggested macro benchmarks by the participants:

  • Compact block reconstruction
@l0rinc
l0rinc / GetLegacySigOpCount.patch
Created May 17, 2025 15:12
[PATCH] Add paranoid sanity checks
diff --git a/src/script/script.cpp b/src/script/script.cpp
--- a/src/script/script.cpp (revision 6ddb22a8c89a40ec0d4d75a195c2bc0231933285)
+++ b/src/script/script.cpp (revision b34e14355d94b21064cc64977955bf696e09992e)
@@ -4,7 +4,8 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <script/script.h>
-
+#include <script/solver.h>
+#include <logging.h>
Pi 5, 4 GB, pruned node:
• Raspberry Pi 5 (4 GB RAM) - $66 - https://amazon.com/Raspberry-Pi-4GB-2023-Processor/dp/B0CK3L9WD3
• 128 GB NVMe SSD - $20 - https://www.amazon.com/Silicon-Power-128GB-P34A60-SP128GBP34A60M28/dp/B09HMWH1DG
• M.2 HAT for SSD - $8 - https://amazon.com/ZDE-ZP517A-Peripheral-Raspberry-Compatible/dp/B0D1QYDJJJ
• Aluminum heatsink - $4 - https://amazon.com/Raspberry-Aluminum-Heatsink-Cooling-Dissipation/dp/B0DY83ZZ31
• 5.1 V/5 A power supply - $13 - https://www.amazon.com/RasTech-Power-Supply-Raspberry-Adapter/dp/B0CLV6WB4L
Total: $111
----
@l0rinc
l0rinc / bip110_cache_poisoning.md
Created February 13, 2026 11:30
Script-execution cache poisoning via activation-boundary reorg

Script-execution cache poisoning via activation-boundary reorg

Disclaimer

It's no secret that I'm strongly opposed to this consensus change (trying to punish everyone just to send a signal to those we disagree with doesn't resonate with me).

But regardless of my views on it, I think it's important to disclose a serious consensus-critical bug in the current BIP-110 implementation, since it could harm users who choose to run this software even more.

Context

The new restrictions here don't apply to UTXOs created before the activation height. This is tracked via per-input flags that relax the mandatory verify flags for old UTXOs.