Skip to content

Instantly share code, notes, and snippets.

@cdetrio
cdetrio / async-wasm.html
Created December 31, 2017 01:09
async wasm imports don't work
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Async wasm doesnt work</title>
</head>
<script>
/*
// wasm code:
@cdetrio
cdetrio / readme.md
Created January 24, 2019 00:49
estimating stateless contract block sizes on Ethereum

Estimating stateless contract block sizes on Ethereum

Results of running the script for 100 blocks (#7021700 - #7021800).

>>> sizes = [852946, 221839, 637053, 672740, 1093313, 225852, 1678145, 761029, 1419458, 1152028, 653192, 67545, 29260, 249825, 1526471, 76492, 791376, 0, 204216, 973265, 561570, 579943, 1515495, 1738738, 1717572, 395549, 354647, 16870, 551612, 89760, 1848829, 290080, 505966, 22421, 1471108, 28740, 1578582, 880692, 13205, 1442855, 1255767, 644168, 1634534, 2631529, 869398, 437570, 452382, 1236448, 870726, 203800, 570037, 446159, 6947, 55375, 599809, 308926, 113536, 0, 605908, 357154, 829124, 1583076, 1413534, 854483, 198182, 1015926, 1080430, 59555, 1106610, 205846, 445871, 379150, 980513, 72306, 1293635, 40396, 942147, 561540, 297171, 1035896, 917608, 272911, 776640, 0, 1293114, 627284, 3675, 965540, 32970, 168510, 113672, 863180, 25912, 1245664, 532234, 576862, 1332396, 590317, 760537, 1295538, 1543689]
>>> len(sizes)
101
>>> np.mean(sizes)
698258.3762376237
@cdetrio
cdetrio / ewasm-bencher.js
Created April 2, 2019 18:07
minimal node.js script for benchmarking ewasm contracts/precompiles
// node --experimental-wasm-bigint ewasm-bencher.js bn128mul_metered.wasm "039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" "00a1a234d08efaa2616607e31eca1980128b00b415c845ff25bba3afcb81dc00242077290ed33906aeb8e42fd98c41bcb9057ba03421af3f2d08cfc441186024"
var args = process.argv.slice(2);
var wasmfile = args[0];
var input = args[1];
var expected = args[2];
if (args.length < 3) {
console.log('missing an arg!');
process.exit(1);
@cdetrio
cdetrio / readme.md
Created July 11, 2019 14:53
starter pack: merkle-patricia-trie proof verifier

Building on the Stateless MPT-based token script for Scout.

instructions

  1. use smtp-proof-generator.js to generate a test vector for a basic merkle-patricia-trie proof verifier.
  2. paste the test vector into verify-branch.js

TODO

  • verify-branch.js only verifies a single proof (i.e. a single merkle branch)