Skip to content

Instantly share code, notes, and snippets.

View tyler-smith's full-sized avatar

Tyler Smith tyler-smith

View GitHub Profile
#!/bin/bash
set -e
# Examples:
# ./gecko-entrypoint.sh ./build/ava -api-ipcs-enabled=true
#
# docker run -v gecko-entrypoint.sh:/gecko-entrypoint.sh --entrypoint /gecko-entrypoint.sh avaplatform/gecko ./build/ava -api-ipcs-enabled=true
# Attempt to enable IPC continuously
(while true
@tyler-smith
tyler-smith / output.txt
Created May 13, 2020 21:00
build_test.sh output
<gecko> ./scripts/build_test.sh
ok github.com/ava-labs/gecko/api 1.267s coverage: 63.6% of statements
? github.com/ava-labs/gecko/api/admin [no test files]
? github.com/ava-labs/gecko/api/ipcs [no test files]
# github.com/ava-labs/salticidae-go
Undefined symbols for architecture x86_64:
"_bytearray_free", referenced from:
__cgo_67f9b454acd8_Cfunc_bytearray_free in _x008.o
(maybe you meant: __cgo_67f9b454acd8_Cfunc_bytearray_free)
"_bytearray_new", referenced from:
version: '3.5'
gecko:
image: "/path/to/internal/repo/gecko"
command: [
"./build/ava",
"--db-dir=/var/lib/gecko",
"--staking-tls-cert-file=/var/lib/gecko/keys/staker.crt",
"--staking-tls-key-file=/var/lib/gecko/keys/staker.key"
]
ports:
package main
import (
"fmt"
"github.com/ava-labs/gecko/genesis"
"github.com/ava-labs/gecko/ids"
"github.com/ava-labs/gecko/vms/avm"
"github.com/ava-labs/gecko/vms/platformvm"
)

Copied from https://calaganne.blogspot.com/2018/11/consensus-by-avalanche.html by Hasan Karahan

Example run

$ ./avalanche.py --population=100000 --max-sample=10 --max-round=13

# {"population": 100000, "max_sample": 10, "max_round": 13}
4.988699999999999801e-01 4.966800000000000104e-01 4.984000000000000097e-01 5.022699999999999942e-01 5.014100000000000223e-01 5.012299999999999534e-01 5.022900000000000142e-01 5.009400000000000519e-01 5.020000000000000018e-01 5.022199999999999998e-01
4.988299999999999956e-01 4.967199999999999949e-01 4.961999999999999744e-01 5.048200000000000465e-01 5.040599999999999525e-01 5.027399999999999647e-01 5.079200000000000381e-01 5.044100000000000250e-01 5.049900000000000500e-01 5.068599999999999772e-01
5.008399999999999519e-01 4.946300000000000141e-01 4.975700000000000123e-01 5.091999999999999860e-01 5.078399999999999581e-01 5.056699999999999529e-01 5.165199999999999791e-01 5.125600000000000156e-01 5.125399999999999956e-01 5.180099999999999705e-01
@tyler-smith
tyler-smith / output.txt
Created February 6, 2020 01:49
Snarky recursive composition - Incrementing integers
~/dev/zkpow> make run
ocamlopt bin/zkpow/main.exe
ld: warning: directory not found for option '-L/opt/local/lib'
Swap is not beneficial, not performing
* QAP number of variables: 11
* QAP pre degree: 6
* QAP degree: 16
* QAP number of input variables: 6
* G1 window: 4
* G2 window: 2
@tyler-smith
tyler-smith / main.ml
Created January 29, 2020 21:30
Updated Snarky example
open Core
open Snarky
module Impl = Snark.Run.Make (Backends.Bn128.Default) (Unit)
open Impl
let check_product (l : Field.t list) (total : Field.t) () =
let open Field in
let checked_total = List.fold ~init:one l ~f:( * ) in
Assert.equal checked_total total
#!/bin/sh
coda daemon \
-discovery-port 8303 \
-snark-worker-fee 1
-propose-key ~/keys/my-wallet.pub \
-peer /dns4/seed-one.genesis.o1test.net/tcp/10002/ipfs/12D3KooWP7fTKbyiUcYJGajQDpCFo2rDexgTHFJTxCH8jvcL1eAH \
-peer /dns4/seed-two.genesis.o1test.net/tcp/10002/ipfs/12D3KooWL9ywbiXNfMBqnUKHSB1Q1BaHFNUzppu6JLMVn9TTPFSA \
-run-snark-worker $CODA_PK
@tyler-smith
tyler-smith / snowglobe.md
Last active December 19, 2019 19:34
A draft spec for the Snowglobe pre/post concensus protocol.

NOTE: This document is an unfinished work in progress, working toward v0.1.0!

  Title: Active local state reconcilation using Avalanche
  Author: Tyler Smith (tcrypt) 
  Status: Draft
  Created: 2019-10-01
  License: MIT
// Before
type utxoCache struct {
// ...
mtx sync.Mutex
}
// After
import "github.com/gcash/bchutil"
type utxoCache struct {