Skip to content

Instantly share code, notes, and snippets.

View TheCharlatan's full-sized avatar
🍦
Ice Cream

Reproducibility Matters TheCharlatan

🍦
Ice Cream
View GitHub Profile
@TheCharlatan
TheCharlatan / Chainstate Assumeutxo.md
Last active March 11, 2025 21:42
Splitting assumeutxo out of the chainstate
  • Move AcceptBlock into a static function, or into the chainstate
  • Move LoadExternalBlockFile into a static function, maybe give it a list?
  • Figure something out for moving IsInitialBlockDownload into the chainstate
  • Remove usage of snapshot_download_completed
  • Handle call to CheckBlockIndex
  • Handle MaybeRebalanceCaches
  • Handle FindFilesToPrune
  • Handle LoadGenesisBlock
  • Change UpdatedTip to not use ActiveChainstate()
  • Handle the call to MaybeCompleteSnapshotValidation()
----------------------------- Stream ---------------------------
|
|----------------------------------------------------------------
| | | |
+------------+ +--------------------+ +------------+ +-----------------+
| | | | | | | |
| Meta Page | | Records Page | | Meta Page | | Internal Page |
| (outer) | | (root) | | (inner) | | (root) |
| | | +--------------+ | | | | +-------------+ |
| | | | Page Header | | | | | |Page Header | |

Kernel API design

Just some points and open questions:

  1. Possibly break up KernelNotifications
    • Move blockTip, headerTip, and progress to the ValidationInterface
      • The challenge here is that the gui (clientmodel.cpp) needs to consume the notifications from a non-node interface.
    • Remove the warning notification
      • Maybe this just needs a complete overhaul?
    • Handle flushError and fatalError through function return types
  2. std::optional fields will just have to become pointers instead

Bitcoin Core Pull Request Pre-Flight Checklist

  • Did you read through your changes commit by commit?
  • Use C++ headers like <cstdio> over C headers like <stdio.h> and friends.
  • Beware of unrelated changes.
  • Beware of changing the same line multiple times between commits within the same pull request.
  • Try to check the header includes of files that are touched with IWYU, you can check single files on your machine with iwyu_tool.
  • Are your commits atomic?
  • Did you check spelling and grammar of your commit message?
  • Don't explain what you did in the commit, explain why you did it.
@TheCharlatan
TheCharlatan / Regtest.md
Last active September 2, 2021 13:54
Monero Regtest and generateblocks

Start the monero daemon with the following flags:

./monerod --regtest --offline --fixed-difficulty 1

--fixed-difficulty keeps the difficulty constant, allowing users to quickly generate a large number of blocks --offline ensures that the node does not connect to the main network and learn of its latest chaintip

New blocks can be generated with the following RPC call, mining the new block directly to a specific address:

for i in {1..5}; do for j in {1..5}; do ./bitcoin-cli -regtest -rpcport=18443 -rpcuser=rpcuser -rpcpassword=rpcpass sendtoaddress 2NAMFsUHCk1cgT3NgdNXGF4PuPjbjTN4Xw6 1 ; done && ./bitcoin-cli -regtest -rpcport=18443 -rpcuser=rpcuser -rpcpassword=rpcpass generatetoaddress 1 2MtzpX3E5PZg3LoCx18UtgRNLyuUNn2aHjd ; done

General

  • Each key is 256 bit long, or 32 hexadecimal characters, each key needs to be less than "curve order" (function is called sc_reduce)
  • Address = Public Spend Key + Public View Key (with some check encoding)
  • All hashing is done with Keccak-256

Deterministic Key Derivation:

With 25 word Mnemonic:

Type `git log` and choose the last commit hash not belonging to your commit range. Then do `git rebase -i #said_hash`. You then can interactively select which commits should be squashed together.
The range will be at the top, the youngest at the bottom. Lets say their first bytes are 13a7d88, 344f90f, 7535a83, 2272888 (top to bottom) and you want squash 13a7d88, 344f90f and 7535a83 together.
Change the text next to 344f90f and 7535a83 to squash. This will leave 227288 alone. When you exit the editor git will perform the rebase. Once done it will open an editor.
It will then display the three original commit messages. You can edit these at will (I prefer to remove the `commit message #2` lines for example and mold the text into a single nice message). Quit the editor and the squash will be completed.
package=cmake
$(package)_version=3.10.3
$(package)_download_path=https://cmake.org/files/v3.10
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=0c3a1dcf0be03e40cf4f341dda79c96ffb6c35ae35f2f911845b72dab3559cf8
$(package)_dependencies=openssl
define $(package)_config_cmds
./configure
endef