Skip to content

Instantly share code, notes, and snippets.

View imeckler's full-sized avatar
🤷‍♂️
¯\_(ツ)_/¯

Izaak Meckler imeckler

🤷‍♂️
¯\_(ツ)_/¯
View GitHub Profile
@imeckler
imeckler / gadts.ml
Last active July 18, 2023 03:56
Lists with length in OCaml
(* These types are just used as indices for nlist. *)
type z = Z_
type 'a suc = S_
(* A term of type (n, m, k) add is a proof that n + m = k *)
type (_, _, _) add =
| AddZ : (z, 'n, 'n) add
| AddS : ('n, 'm, 'k) add -> ('n suc, 'm, 'k suc) add
(* An (n, 'a) nlist is a list of 'a of length n *)
@imeckler
imeckler / zprize_combine.rs
Created May 11, 2022 20:51
Information for combine ZPrize
fn combine(
g1: &[ark_pallas::Affine],
g2: &[ark_pallas::Affine],
chal: &[bool]) -> Vec<ark_pallas::Affine> {
let c = endo_challenge_to_field(chal);
g1.iter().zip(g2.iter()).map(|(p1, p2)| p1 + &p2.mul(c))
.collect()
}
fn endo_challenge_to_field(chal: &[bool]) -> ark_pallas::Affine::ScalarField {
@imeckler
imeckler / encryption.markdown
Created February 25, 2022 18:23
snarkyJS compatible encryption algorithm

If you need a public key encryption system compatible with snarkyJS, I would suggest a hybrid cryptosystem using the Pallas curve (the Group type in snarkyJS) for the public key part, and Poseidon for the symmetric part.

To give a bit more detail:

  • a private key would be a scalar field element x
  • the corresponding public key would be the group element Group.generator.scale(x).

Let's say a message is an array of field elements msg: Array<Field> against a public key h: Group. In pseudcode:

type CipherText = {

Note: If you haven't already added your qanet public address to our Google Sheet, please go ahead and add it using the link below. Only public addresses listed in this doc will receive public qanet tokens for testing. If you added your public address while a public qanet is running, you will have to wait until the next release to receive your tokens. Alternatively, you can ask the community members in the qa-task-force channel to send you some tokens now. Link to the Google sheet: https://docs.google.com/spreadsheets/d/15YT8DALkufDAxiYzT9dx-eW-JALjZTt-9H9ZqtvLPm0/edit?usp=sharing

If you ran a node before the hardfork:

  • run coda client stop-daemon (or docker exec -it mina coda client stop-daemon) to gracefully shut down your existing node
  • move any log files or keys (especially ~/.coda-config/coda.log and ~/.coda-config/wallet) to a new location for backup. Please send us your ~/.coda-config/mina-best-tip.log as well so that we can validate our chosen "best tip" for the new chain after the fork.
use algebra::Field;
const rounds_full: usize = 8;
const rounds_partial: usize = 33;
const half_rounds_full: usize = rounds_full / 2;
pub trait Sponge<Input, Digest> {
type Params;

This document makes explicit what is hinted at in the Halo paper, which is a technique for taking two AHIOPs that have efficient "incremental verification" and "gluing them together" to obtain one recursive proof system.

More specifically, if we have

  • An AHIOP $S_0$ for verifying $\F_p$ arithmetic
  • An AHIOP $S_1$ for verifying $\F_q$ arithmetic
  • A polynomial commitment scheme $C_0$ for polynomials in $\F_p[x]$ and whose proofs can
let n = something
let k = log2 n
let b (u : f_q array) (x : f_q) : f_q =
let x_to_pow2s =
let res = Array.create k x in
for i = 1 to k - 1 do
res.(i) <- square (res.(i - 1))
done
in
@imeckler
imeckler / gist:3885281
Created October 13, 2012 16:39
Pithy finite state machine in haskell
import Control.Monad
import Data.Maybe
import Prelude hiding (any, elem)
import Data.Foldable
type State = String
type Map a b = [(a, b)]
-- In Map State (Map Char (m State)), the monad m determines the kind of FSM that is being run.
-- If m = [] (or Set), these functions work as a NFA. If m = Maybe, we essentially have a DFA.

Keybase proof

I hereby claim:

  • I am imeckler on github.
  • I am ihm (https://keybase.io/ihm) on keybase.
  • I have a public key ASAx8w6RrIQZCA-t7qutmJ98uFt4NaqfjShO7pdJIAs7GAo

To claim this, I am signing this object:

@imeckler
imeckler / pipeline.hs
Last active October 12, 2017 01:56
Haskell pipeline
{-# LANGUAGE GADTs #-}
import Data.Char (digitToInt)
data Nil
data Cons a b
data Pipeline ts a c where
(:>) :: (a -> b) -> Pipeline ts b c -> Pipeline (Cons (a -> b) ts) a c
Id :: Pipeline Nil t t