Skip to content

Instantly share code, notes, and snippets.

View nikkolasg's full-sized avatar

Nicolas Gailly nikkolasg

View GitHub Profile
@nikkolasg
nikkolasg / estimator.py
Created January 4, 2024 20:05
estimator of wall time & cpu time for recursive vs sequential approach
from sympy import *
# n = number of initial leaves
# u = number of updates in a block
# r = range of blocks
# d = depth of the storage trie
n, u, r, d = symbols('n u r d',positive=True)
# depth of the state trie
dstate = 10
@nikkolasg
nikkolasg / drand_round.go
Created July 21, 2022 15:27
get drand round number and timestamp in CSV format
package main
import (
"context"
"encoding/csv"
"encoding/hex"
"fmt"
"os"
"strconv"
"time"
*
Verifying Drands BLS12-381 Signatures in GoLang
Using the following randomness payloads:
{
"round": 1657526,
"randomness": "58b26a65bf4032555748c2949311abb2c4f580e7d7d7f70b13d0533b793c4c7d",
"signature": "8434e45af135f363b04b792c1d77b83e36ef66829b0a09f7eed058103429f0e7f759ebf6d001cf73e9138f5b7a7f04b602c4167390c323432562d6367e09169422707a9778eba260c4d6434ea5e1d2c81462a4e3cd430990aebc593f4ae7517c",
"previous_signature": "ab9e594732265dd737b536a144fb955bfeabe929116fc78f7bb740de3f43629691cabcec507eeb39a98d51be11942cf4062b0a38dd1be18be5e23bea7efd3935bb23032dba4da0374899e583feb937119f33f6b645048e0e91cde0de00e3e9ee"
},
#!/usr/bin/env python3
import math
def bench(n,f,N):
lf = math.ceil(math.log(f,2))
d = math.ceil(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
c_v = 2249 # constraints to perform variable based multiplication
#!/usr/bin/env python3
import math
n = 2**30 # 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
#!/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
@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
@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 / 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