Skip to content

Instantly share code, notes, and snippets.

@JeremyRubin
JeremyRubin / gist:1a3260431b3ee4afbaa0
Last active August 29, 2015 14:24
Block Size Fix: Two Phase Commit

Block Size Fix: Two Phase Commit

With thanks to: Adam Back, Matt Corallo, Peter Todd, Alex Morcos, Dan Elitzer, Nathan Wilcox, Pindar Wong, Chelsea Barbaras, Jonathan Harvey-Buschel, and others for feedback on this proposal.

TL;DR:

  BIP: ___
  Title: Short Term Use Addresses for Scalability
  Author: Jeremy Rubin <jr@mit.edu>
  Status: Draft
  Type: Standards Track
  Created: 2015-06-23

Abstract

  BIP: ___
  Title: Minimum Viable TXin Hash
  Author: Jeremy Rubin <jr@mit.edu>
  Status: Draft
  Type: Standards Track
  Created: 2015-06-24

Abstract

@JeremyRubin
JeremyRubin / blog-lockfree-bitcoin.md
Last active August 5, 2016 17:24
Bitcoin Lock-Free CCheckQueue Design & Analysis

Bitcoin Lock-Free CCheckQueue Design & Analysis

Summary

When profiling where bitcoind was spending time and could be optimized, I noticed that the sigcache was locking twice per read. This seemed bad, and with Alex Morcos I was able to measure some bad contention. We put together a quick and dirty patch: we eliminated the unnecessary locking and used a lock-free queue to batch cleanup tasks. While Alex continued to look into the cache, I diverted my attention to other sources of contention. I found that the

@JeremyRubin
JeremyRubin / cachesimout
Created September 18, 2016 20:58
Better SigCache Performance
{'simulating':'11CuckooCacheI7uint256N14sigcache_tests13uint256HasherEE', 'load':0.1, 'mb':1, 'n':3276, 'hit':1, 'insert':182, 'lookup':27}
{'simulating':'N14sigcache_tests12_GLOBAL__N_115CSignatureCacheE', 'load':0.1, 'mb':1, 'n':3276, 'hit':1, 'insert':156, 'lookup':60}
{'simulating':'11CuckooCacheI7uint256N14sigcache_tests13uint256HasherEE', 'load':0.1, 'mb':2, 'n':6553, 'hit':1, 'insert':286, 'lookup':53}
{'simulating':'N14sigcache_tests12_GLOBAL__N_115CSignatureCacheE', 'load':0.1, 'mb':2, 'n':6553, 'hit':1, 'insert':338, 'lookup':137}
{'simulating':'11CuckooCacheI7uint256N14sigcache_tests13uint256HasherEE', 'load':0.1, 'mb':3, 'n':9830, 'hit':1, 'insert':515, 'lookup':81}
{'simulating':'N14sigcache_tests12_GLOBAL__N_115CSignatureCacheE', 'load':0.1, 'mb':3, 'n':9830, 'hit':1, 'insert':635, 'lookup':209}
{'simulating':'11CuckooCacheI7uint256N14sigcache_tests13uint256HasherEE', 'load':0.1, 'mb':4, 'n':13107, 'hit':1, 'insert':631, 'lookup':107}
{'simulating':'N14sigcache_tests12_GLOBAL__N_115CSignatureCac
#include <cstddef>
static const size_t MAX_DEPTH = 32;
static const size_t NODE_WIDTH = 32;
static const size_t PROOF_SIZE_WIDTH = 33 + 32*32;
static const size_t MAX_STACK_SIZE = 1000;
static const size_t MAX_STACK_ELT_SIZE = 520;
static const size_t MAX_STACK_SIZE_BYTES = MAX_STACK_SIZE*MAX_STACK_ELT_SIZE;
static const size_t NBITS_STACK_WIDTH = 19;
static const size_t MAX_SCRIPT_SIZE_BYTES = 10000;
static const size_t NBITS_SCRIPT_WIDTH = 14;
travis_fold:start:worker_info
[0K[33;1mWorker information[0m
hostname: 151579ac-8915-47f0-94ea-d7ecbc718941@1.worker-org-95567d544-phbx9.gce-production-3
version: v6.2.1 https://github.com/travis-ci/worker/tree/4e3246c044eb4915c2378ffacd0b3d3ed0136bba
instance: travis-job-ed9d5aca-3b0a-4c5c-84c6-428f469e206d travis-ci-stevonnie-xenial-1553530512-f909ac5 (via amqp)
startup: 6.920152873s
travis_fold:end:worker_info
[0Ktravis_time:start:29ebd9fc
[0Ktravis_time:end:29ebd9fc:start=1572552714744409971,finish=1572552714905957133,duration=161547162,event=no_world_writable_dirs
[0Ktravis_time:start:10b29a20
Board = int
def NewBoard():
# 9*2 digits long
return 0b1_000_000_000_000_000_000
def all_filled(board: Board) -> bool:
return (board & 0b111111111) | ((board >> 9) & 0b111111111) == 0b111111111
winning_patterns = [
0b111_000_000,
0b000_111_000,
0b000_000_111,
import numpy as np
TRIALS = 10000
MARS_DIST_LIGHT_MINUTES_MAX = 22
RTT = MARS_DIST_LIGHT_MINUTES_MAX*60*2
gen = lambda mins: list(np.round(np.random.exponential(mins*60, TRIALS)))
# Assume miner_1 has 50% hashrate and miner_2 has 50%... find blocks every 20 mins each
March 23rd 2021 Taproot Activation Meeting Notes.
We had a very productive meeting today. Here is a summary of the meeting -- I've done my best to
summarize in an unbiased way.
1. On the use of a speedy trial variant:
- There are no new objections to speedy trial generally.
- There is desire to know if Rusty retracts or reaffirms his NACK in light of the responses.