Skip to content

Instantly share code, notes, and snippets.

View gballet's full-sized avatar
🗿

Guillaume Ballet gballet

🗿
View GitHub Profile
@gballet
gballet / call_test.go
Created May 1, 2018 12:51
A golang test related to some hacks in go-interpreter/wagon that would let WASM code execute native code.
package exec
import (
"reflect"
"testing"
"github.com/go-interpreter/wagon/wasm"
)
const secretValue = 0xdeadbeef
@gballet
gballet / compile_contract.sh
Last active May 12, 2018 17:24
Script to generate host functions from C with emscripten
#!/bin/sh
# This script takes a rather dumb approach to declare external functions and
# tell emscripten not to link any library. This has the disadvantage that
# standard C libraries don't get linked either. This is fine if your WASM
# code doesn't need anything from the standard library. If your project is
# made of several modules, you need to #include them all which is not very
# nice.
if [ $# -lt 2 ]
then
@gballet
gballet / tx_conflicts.gv
Last active December 6, 2018 13:20
Graphviz representation of conflicts
digraph G {
rankdir=LR;
subgraph {
state01 [shape=none,margin=0,label=<
<table BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
@gballet
gballet / bits.c
Last active February 8, 2019 14:53
Zokrates WASM version of Rust helpers
#define WASM_EXPORT __attribute__((visibility("default")))
typedef unsigned long int uint32_t;
typedef long int int32_t;
typedef unsigned char field_t[32];
/* List of exports */
WASM_EXPORT
const int32_t field_size = sizeof(field_t); /* Maximum accepted number of bytes to encode a field */
WASM_EXPORT
@gballet
gballet / update_geth.rb
Created February 21, 2019 16:08
Small script to produce the ewasm precompile Go source files from the binaries compiled in ewasm/ewasm=precompiles
#!/usr/bin/env ruby
TARGETDIR = "./target/wasm32-unknown-unknown/release"
GETHDIR = "#{ENV["HOME"]}/go/src/github.com/ethereum/go-ethereum/core/vm"
`find #{TARGETDIR}/ewasm_precompile_*.wasm`.each_line do |line|
if line =~ /#{TARGETDIR}\/ewasm_precompile_(.*)\.wasm/
data = File.read(TARGETDIR+"/ewasm_precompile_#{$1}.wasm").bytes
filename = "#{GETHDIR}/ewasm_precompile_#{$1}.go"
@gballet
gballet / call_contract.sh
Created January 30, 2020 09:01
Various files needed when testing Jupiter
#!/bin/sh
go run ./cmd/evm/ \
--code=60966000600037600060016096600060ff600a6006f100 \
--prestate my_genesis.json \
--receiver a8c3eeb2915373139bcfc287d4ae9e660d734881 \
--inputfile callverify.evm \
-json \
run

Keybase proof

I hereby claim:

  • I am gballet on github.
  • I am gdawg (https://keybase.io/gdawg) on keybase.
  • I have a public key ASDbY_vwZEpfnTs-LdmsGSrJDDdsI079AXcW2XoduwIyzwo

To claim this, I am signing this object:

DIFFICULTY 0x9765fea9752505a685c1bce137ae5b2efe8ddf62 605
DIFFICULTY 0xf8a4d3a0b5859a24cd1320ba014ab17f623612e2 153
DIFFICULTY 0x0000000000009480cded7b47d438e73edf0f67e5 27
DIFFICULTY 0x0635e7362e13215d6dcc0e63a0007eebecc408e4 12
BLOCKHASH 0x5650ca3f0289c762f83dde1894faa9b6d0d89798 17
BLOCKHASH 0xd1ceeeeee83f8bcf3bedad437202b6154e9f5405 208
BLOCKHASH 0xb6ed7644c69416d67b522e20bc294a9a9b405b31 33
BLOCKHASH 0x1edc9ba729ef6fb017ef9c687b1a37d48b6a166c 9
BLOCKHASH 0x4f8e54e2e840561e5aa8a296ad5f7b0ae18e6eff 1
BLOCKHASH 0x1738b62e403090666687243e758b1c29edffc90e 4
@gballet
gballet / blockhash.csv
Last active April 29, 2021 13:28
List of contracts calling instructions BLOCKHASH and DIFFICULTY up to block 11555359
contract address opcode count
340113cd9eceedc5ae1f08bc391f120daf53277a 4147134
f5ae0e27cf423b1ed6513c3ca35cc14c22ee66fd 3677603
f0155486a14539f784739be1c02e93f28eb8e960 3493554
00868b5f38673a0c6804a4e1c130b7676177bb48 2665302
d1ceeeeee83f8bcf3bedad437202b6154e9f5405 2463296
f97e0a5b616dffc913e72455fde9ea8bbe946a2b 2424092
3401cab9bee49bcb76e13a8a09619e53d45c0af0 1414773
b77feddb7e627a78140a2a32cac65a49ed1dba8e 923262
6f6deb5db0c4994a8283a01d6cfeeb27fc3bbe9c 776227
@gballet
gballet / i7.csv
Created June 10, 2021 08:41
Benchmarks comparing the performance of the EC multiplication of secp256k1 and alt_bn128. In the first column, 0 indicates alt_bn128 and 1 indicates secp256k1.
0 44124
1 2208673
0 43598
1 2209066
0 43718
1 2518759
0 47691
1 2203296
0 43962
1 2272930