Skip to content

Instantly share code, notes, and snippets.

View LarryRuane's full-sized avatar

Larry Ruane LarryRuane

View GitHub Profile
@LarryRuane
LarryRuane / debug-logging.diff
Created October 25, 2022 19:38
exclude "rand" logging category to make functional test debug.log files easier to read
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -102,6 +102,7 @@ class TestNode():
"-debug",
"-debugexclude=libevent",
"-debugexclude=leveldb",
+ "-debugexclude=rand",
"-uacomment=testnode%d" % i,
]
if use_valgrind:
@LarryRuane
LarryRuane / static_assert.c
Last active August 27, 2022 15:29
example static assert implemention
#define static_assert(c) do { int _x = 1/((int)c); } while (0)
int main() {
static_assert(sizeof(int) == 4);
static_assert(sizeof(int) < 4);
return 0;
}
/* output:
$ gcc t.c
@LarryRuane
LarryRuane / bgrant2022.md
Last active August 27, 2022 15:30
brink full time grant application

Dear Brink Board,

Thanks to 20% support from Brink, I've been very fortunate to work part-time on Bitcoin Core engineering, mostly review, for almost a year. These are some of the accomplishments during this time:

  • biweekly calls with John Newbery until he stepped away, during which we discussed code review best practices, how to host review club, Bitcoin Core design philosophy, thread safety, book recommendations (both ways), suggestions for PRs to review and specifics of some of those, release engineering (version numbers, tagging), debugging, and many other topics
  • hosted Review Club three times (14707,

The Brink grant beginning on 11 June 2021 allowed me to reduce my commitment to my full-time job with The Electric Coin Company (ECC) from 40 to 32 hours per week, freeing 8 hours per week to dedicate to the advancement of Bitcoin, especially Bitcoin Core. As I did not make a request to work on a specific project, most of my efforts have been contributing to PR review.

Most of my time has involved reviewing the Review Club PR for the week. I hosted Review Club once, during which I demonstrated (in a video meeting) how use of the standard debugger, gdb, can be helpful in PR review (I had routinely been doing this myself.) This session was recorded and will be (or has been) used in an educational series that Adam Jonas (Chaincode Labs) is creating to onboard new Bitcoin Core developers.

@LarryRuane
LarryRuane / gist:45f2316f99c84b8f83e7c1e5e697fffd
Created July 28, 2021 19:47
absently DM after bitcoin core review 2021-7-28, but he was no longer online
absently>
Thought experiment, if economic exchange is better off by destroying 1 bitcoin, then does it follow that destroying half of everyone's bitcoin balance is beneficial? I'd argue no but the "destroying stores of wealth results in prosperity" argument says yes
12:40 PM
← absently left #bitcoin-core-pr-reviews ([email protected])
1:44 PM <larryruane> Larry Ruane
Hi absently, I think you're exactly right, destroying half of everyone's balance would not create prosperity... it would have no effect, other than doubling the value of each bitcoin ... so the USD bitcoin price would double from 40k (or whatever it is now) to 80k, and the price of things in units of bitcoin would reduce by half ... But this is because *everyone's* bitcoin balance is affected equally (is multiplied by the same constant, 0.5), so it's a simple scaling effect... It could be disruptive if it this change was unexpected but that's a second-order effect.
What I was trying to say is that if I
@LarryRuane
LarryRuane / bitcoin-core-debugging.md
Last active March 27, 2023 12:59
Some tips and tricks for debugging Bitcoin Core

Using debuggers with Bitcoin Core

Please also refer to Fabian Jahr's excellent documentation and video. In this document, I'll cover only some of what his document does in slightly greater detail, while trying not to duplicate too much, and focused on gdb and Linux.

Video version of (most of) this document: https://vimeo.com/576956296/df0b66fbfc NOTE if you watch the video: Near the end, I had problems attaching to

I discovered the Bitcoin Core project through my full-time position at the Electric Coin Company, creators of Zcash, a code-fork of Bitcoin Core. Upon discovering a small bug in Zcash in 2019, I found that the bug also existed in Bitcoin Core; the fix became my first PR. I immediately fell in love with the development community, and since then have been contributing review and a few small PRs on my own time, while continuing full-time with ECC. I was accepted to the 2020 Chaincode Residency program in New York, which was canceled, but I did participate in the Chaincode study group. My goal is to gradually move to working on Bitcoin Core full-time.

It's well-know that Bitcoin Core is in crucial need of PR review, and this grant will allow me to spend one day of each week (20%) reviewing and testing PRs, while continuing 80% with ECC. I especially plan to take advantage of the weekly Bitcoin Core Review Club. I'll wo

@LarryRuane
LarryRuane / zcash-debugging.md
Last active July 9, 2021 21:23
zcash debugging tips and tricks

debugging cheat sheet

recommended ~/.gdbinit settings

set print pretty
set height 0
set print elements unlimited
set history save on
@LarryRuane
LarryRuane / corrupt-block.diff
Created July 28, 2020 22:29
make the number of transactions field (just beyond header) 0xff instead of 0xfd (illegal)
--- before 2020-07-28 17:12:10.039607983 -0500
+++ after 2020-07-28 17:21:12.859607983 -0500
@@ -1,7 +1,7 @@
00000000: 0b11 0907 e7e1 0100 0200 0000 01e9 7a2c ..............z,
00000010: fabb 443a 6a13 51a1 22f7 59cf 4d72 00c9 ..D:j.Q.".Y.Mr..
00000020: c8c2 18b3 ad30 9661 0000 0000 c6c3 d1f5 .....0.a........
00000030: 6e72 3ad0 b05b e01f 88e0 c688 8158 0e9a nr:..[.......X..
00000040: b6ed 2517 c457 11e1 35fb 9382 e1b8 ac53 ..%..W..5......S
-00000050: ffff 001d 0002 622a fd4c 0101 0000 0001 ......b*.L......
+00000050: ffff 001d 0002 622a ff00 0000 0000 0000 ......b*.L......
#!/bin/bash
# reproduce https://github.com/zcash/zcash/issues/4301
test ! -f zcashd && { echo ./zcashd not found;exit 1;}
rm -rf dd
mkdir dd
(echo regtest=1 ; testnet=1 ; echo rpcuser=u ; echo rpcpassword=p) > dd/zcash.conf
./zcashd -datadir=dd -nuparams=5ba81b19:1 -nuparams=76b809bb:2 -nuparams=2bb40e60:3 -nuparams=f5b9230b:4 &
sleep 8
./zcash-cli -datadir=dd generate 4
./zcash-cli -datadir=dd z_getnewaddress sapling >testzaddr