Skip to content

Instantly share code, notes, and snippets.

View brunoerg's full-sized avatar
🏠
Working from home

Bruno Garcia brunoerg

🏠
Working from home
View GitHub Profile
@brunoerg
brunoerg / mutation-sp-mainimpl.md
Created October 24, 2025 17:22
Mutation testing for `silentpayments/main_impl.h`

src/modules/silentpayments/main_impl.h

  • Date: 2025-10-23 22:48:25
  • Mutation score: 0.92

Hunk ID: 240

  • commit: a0d2a33 id: 1 status: alive
@brunoerg
brunoerg / mutation-libsecp-ecdsa.md
Created October 23, 2025 07:21
Mutation testing report for libsecp's `ecdsa_impl.h`

src/ecdsa_impl.h

  • Date: 2025-10-22 18:42:50
  • Diff groups: 19
  • Entries: 35
  • Mutation score: 74%

Hunk ID: 41

  • commit: 7a2fff8 id: 1 status: alive
@brunoerg
brunoerg / 2025-10-21-privatebroadcast.md
Created October 22, 2025 07:25
Broadcast own transactions only via short-lived Tor or I2P connections #29415

Private broadcast discussion (bitcoin/bitcoin#29415)

The proposal: Just send the tx for one connection (Tor or I2P) and leave it to broadcast it.

  • Vasild started to split this PR into small PRs - some have been merged. The goal is to facilitate the review.

  • It’s going to have 1p1c on this - in a follow-up - there is no current support for it.

  • INV, GETDATA, then send the transaction - close the connection after sending the tx. The reason is to not send unsolicited txs because we might want to reject it in the future.

@brunoerg
brunoerg / mutation-testing-weekly.md
Last active February 17, 2025 14:08
Mutation testing weekly setup

Introduction

Mutation testing is software testing technique that introduces bugs (mutations) on the source code and verify if the automated tests are able to catch these bugs. I created mutation-core (a mutation testing tool) to perform mutation testing on Bitcoin Core codebase. It does not spend time by creating invalid mutants and can deal with some nuances of Bitcoin Core.

However, mutation testing is expensive since we have to compile and run the tests for every single mutant. That is, running mutation testing for every PR may be extremely costly. Instead, we could perform mutation testing once a week based on master branch and make it available for developers to check and decide to write better and/or more tests. That said, I have been doing it and publishing the reports at https://bitcoincore.space.

At this moment, I perform mutation testing for the following critical/more important code: src/wallet/coinselection.cpp, src/script/interpreter.cpp, src/consensus/tx_verify.cpp, `src/consensus/

@brunoerg
brunoerg / mutation-testing-29532.md
Created September 17, 2024 18:20
Mutation testing for #29532

Mutation testing - #29532

  • 64 mutants were generated for the Branch and Bound function.
  • coinselector_tests mutation score: 84.37%
  • coinselection_tests mutation score: 84.37%

Mutants not killed by coinselection_tests:

diff --git a/src/wallet/coinselection.cpp b/muts/coinselection.mutant.14.cpp
@brunoerg
brunoerg / json
Created September 26, 2023 14:18
clearnet-verbose-getaddrman
This file has been truncated, but you can view the full file.
{
"ipv4": {
"new": 23959,
"tried": 47,
"total": 24006
},
"ipv6": {
"new": 5325,
"tried": 5,
"total": 5330
@brunoerg
brunoerg / non-killed-addrman.md
Created April 17, 2023 16:25
Non-killed mutants for addrman

Not killed mutants

5

diff --git a/src/addrman.cpp b/src/addrman.cpp
index f5ca9a5c3..d033297b1 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -264,7 +264,7 @@ void AddrManImpl::Unserialize(Stream& s_)
     s >> nKey;
@brunoerg
brunoerg / chaincode.py
Created January 15, 2021 10:52
Chaincode Study Group
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""An example functional test
The module-level docstring should include a high-level description of
what the test is doing. It's the first thing people see when they open
the file and should give the reader information about *what* the test
is testing and *how* it's being tested