Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions spec/crypto.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
module FROST = struct
type verification_key = Placeholder.t
type signing_share = Placeholder.t
type nonces = Placeholder.t
type nonces_commitments = Placeholder.t
type group_commitment = Placeholder.t
type share_commitment = Placeholder.t
type signature_share = Placeholder.t
type lagrange_coefficient = Placeholder.t

module Identifier : sig
type t

val of_int : int -> t
val to_int : t -> int
val equal : t -> t -> bool
val compare : t -> t -> int
end = struct
type t = int

let of_int = Fun.id
let to_int = Fun.id
let equal = Int.equal
let compare = Int.compare
end

module KeyGen = struct
type coefficients = Placeholder.t
type commitments = Placeholder.t
type secret_share = Placeholder.t

let random_coefficients (_threshold : int) : coefficients =
Placeholder.fn ()

let commit (_ : coefficients) : commitments = Placeholder.fn ()
let verify_proof (_ : commitments) : bool = Placeholder.fn ()

let secret_shares (_ : coefficients) (_ : Identifier.t list) :
(Identifier.t * secret_share) list =
Placeholder.fn ()

let encrypt_secret_share (_ : coefficients) (_ : commitments)
(_ : secret_share) : secret_share =
Placeholder.fn ()

let decrypt_secret_share (_ : coefficients) (_ : commitments)
(_ : secret_share) : secret_share =
Placeholder.fn ()

let verify_secret_share (_ : commitments) (_ : secret_share) : bool =
Placeholder.fn ()

let group_public_key (_ : (Identifier.t * commitments) list) :
verification_key =
Placeholder.fn ()

let signing_share (_ : (Identifier.t * secret_share) list) : signing_share =
Placeholder.fn ()
end

let generate_nonces (_ : signing_share) : nonces = Placeholder.fn ()

let signature_commitments (_ : Identifier.t)
(_ : (Identifier.t * nonces_commitments) list) :
group_commitment * share_commitment =
Placeholder.fn ()

let signature_share (_ : Identifier.t) (_ : signing_share) (_ : string)
(_ : verification_key) (_ : (Identifier.t * nonces_commitments) list) :
signature_share
* group_commitment
* (Identifier.t * share_commitment * lagrange_coefficient) list =
Placeholder.fn ()

let encode_nonces (_ : nonces) : Eth.Abi.t list = Placeholder.fn ()

let encode_nonces_commitments (_ : nonces_commitments) : Eth.Abi.t list =
Placeholder.fn ()

let encode_verification_share (_ : Identifier.t) (_ : share_commitment)
(_ : lagrange_coefficient) (_ : group_commitment) : Eth.Abi.t list =
Placeholder.fn ()
end

module Keccak256 = struct
let hash (_ : string) : string = Placeholder.fn ()
end

module MerkleTree = struct
type root = string
type proof = string list

module type LeafType = sig
type t

val encode : t -> string
end

module Make (Leaf : LeafType) = struct
type leaf = Leaf.t
type t = leaf list

let root (_ : t) : root = Placeholder.fn ()
let proof (_ : leaf) (_ : t) : proof = Placeholder.fn ()
end
end
20 changes: 20 additions & 0 deletions spec/eth.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Address = struct
type t = string

let equal = String.equal
let compare = String.compare
end

module Abi = struct
type t =
[ `Uint32 of int
| `Uint64 of int
| `Uint256 of int
| `Address of Address.t
| `Bytes32 of string ]

let encode (_ : t list) = Placeholder.fn ()
let encode_packed (_ : t list) = Placeholder.fn ()
let encode_call (_ : string) (_ : t list) = Placeholder.fn ()
let hash_typed_data (_ : 'a) : string = Placeholder.fn ()
end
11 changes: 11 additions & 0 deletions spec/id.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Make () : sig
type t

val of_string : string -> t
val equal : t -> t -> bool
val compare : t -> t -> int
end = struct
include String

let of_string = Fun.id
end
3 changes: 3 additions & 0 deletions spec/placeholder.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type t = unit

let fn () = failwith "placeholder"
Loading