Skip to content

Instantly share code, notes, and snippets.

@s1na
s1na / index.js
Created May 17, 2019 09:41
keccak256 wasm
const fs = require('fs')
const path = require('path')
const memset = (mem, data, offset) => {
const asBytes = new Uint8Array(mem.buffer, offset, data.length)
asBytes.set(data)
}
const memget = (mem, offset, length) => {
return Buffer.from(new Uint8Array(mem.buffer, offset, length))
@s1na
s1na / README.md
Last active March 11, 2019 10:16
Modexp reduction benchmark

MODEXP reduction benchmark

State tests were executed and execution time of the expmod(B, E, M) instruction in the MODEXP precompile were measured for master and the PR which uses BN.red for computing MODEXP.

The measurements are in millisecond, and they've been sorted to give an idea of generally how long the two approaches take. Corresponding lines in the two files do not necessarily represent the same modexp operation.

@s1na
s1na / ethereumjs-vm-perf.md
Last active January 10, 2019 09:22
Profiling EthereumJS VM

As a first step to profile ethereumjs-vm, I used clinic on a couple of existing tests. To get a flamegraph of the blockchain tests, run:

NODE_OPTIONS="--max-old-space-size=4096" clinic flame -- node ./tests/tester.js -b --excludeDir='GeneralStateTests'

The image in this gist is the result of running this command on my personal computer.

@s1na
s1na / zos-lib-node-9-err
Created July 8, 2018 08:34
Error logs for npm install with npm v5.10
npm ERR! path /data/home/s1na/dev/eth/zos-lib/examples/complex/node_modules/.staging/zos-lib-5f365ef1/node_modules/@mrmlnc/readdir-enhanced
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/data/home/s1na/dev/eth/zos-lib/examples/complex/node_modules/.staging/zos-lib-5f365ef1/node_modules/@mrmlnc/readdir-enhanced' -> '/data/home/s1na/dev/eth/zos-lib/examples/complex/node_modules/.staging/@mrmlnc/readdir-enhanced-ff250cb7'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
@s1na
s1na / ipfs-cluster-test-races.log
Created April 24, 2018 13:20
ipfs-cluster races happening during tests
==================
WARNING: DATA RACE
Read at 0x00c4204329f0 by goroutine 33:
github.com/ipfs/ipfs-cluster/consensus/raft.(*Consensus).finishBootstrap()
/go/src/github.com/ipfs/ipfs-cluster/consensus/raft/consensus.go:119 +0x123
Previous write at 0x00c4204329f0 by goroutine 18:
github.com/ipfs/ipfs-cluster/consensus/raft.(*Consensus).SetClient()
/go/src/github.com/ipfs/ipfs-cluster/consensus/raft/consensus.go:179 +0x48
github.com/ipfs/ipfs-cluster.(*Cluster).setupRPCClients()