Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nikkolasg's full-sized avatar

Nicolas Gailly nikkolasg

View GitHub Profile
@nikkolasg
nikkolasg / udp.go
Created January 20, 2016 21:11
UDP size buffer
package main
import (
"encoding/binary"
"fmt"
"net"
"os"
"time"
)
@nikkolasg
nikkolasg / keybase.md
Created August 16, 2016 11:50
my keybase proof

Keybase proof

I hereby claim:

  • I am nikkolasg on github.
  • I am nikkolasg (https://keybase.io/nikkolasg) on keybase.
  • I have a public key whose fingerprint is 9AD7 EF74 6E80 E200 EEAF FB7D CBC7 B06D 574A 4C6A

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1PErskqD6PhcP1SFeWbzDTFu23iU4EBc1U https://explorer.blockstack.org/address/1PErskqD6PhcP1SFeWbzDTFu23iU4EBc1U
@nikkolasg
nikkolasg / wdrand.py
Last active June 3, 2020 13:24
weidghted drand numbers constraint solver
#!/usr/bin/env python3
# requires installation of https://pypi.org/project/python-constraint/
# `pip3 python-constraint` should do it
from constraint import *
import math
import json
# Let X the number of tier 1 nodes.
# Let Y the number of tier 2 nodes.
# Let R be the weight / replication factor of each tier 1 node
#!/usr/bin/env python3
from datetime import timedelta
period = 30
catchup = 10
downtime_h = 3
downtime_rounds = 2 * 60 * downtime_h
downtime = period * downtime_rounds
@nikkolasg
nikkolasg / gas.py
Created September 16, 2020 12:52
Compute the maximum storage size given some conditions and the time to reach it
#!/usr/bin/env python3
precommitGas = 9000000
provecommitGas = 40000000
windowpostGas = 512265727
windowPostInPartition = 2349
sectorSize = 32
blockLimitGas = 10e9
@nikkolasg
nikkolasg / gas_simulation.py
Created September 17, 2020 12:42
Simulation of pre/provecommit + window post evolution
#!/usr/bin/env python3
precommitGas = 9000000
provecommitGas = 40000000
windowpostGas = 512265727
maxSectorsPerWindowPost = 10000
sectorSize = 32
blockLimitGas = 10e9
@nikkolasg
nikkolasg / gas3.py
Last active September 21, 2020 09:44
#!/usr/bin/env python3
precommitGas = 9000000
provecommitGas = 40000000
windowpostGas = 512265727
sectorsInPartition = 2349
maxSectorsPerWindowPost = 10000
sectorSize = 32
blockLimitGas = 10e9
tipset = 5
#!/usr/bin/env python3
import math
n = 2**29 # number of nodes in total
f = 256 # width of each node in the vtree
lf = math.log(f,2)
d = math.log(n,f) # number of layers in the vtree
c_h = 505 # constraints to hash
c_f = 506 # constraints to perform fixed based multiplication
#!/usr/bin/env python3
import math
n = 2**29 # number of nodes in total
f = 256 # width of each node in the vtree
lf = math.log(f,2)
d = math.log(n,f) # number of layers in the vtree
c_h = 505 # constraints to hash
c_f = 506 # constraints to perform fixed based multiplication