Skip to content

Commit

Permalink
Merge branch 'master' into lem-new-structure
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-barrett authored Jul 17, 2023
2 parents b9ca220 + 4e6397b commit d505982
Show file tree
Hide file tree
Showing 27 changed files with 2,395 additions and 1,521 deletions.
40 changes: 31 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ rust-version = "1.68.2"
[dependencies]
ahash = "0.7.6"
anyhow = { workspace = true }
anymap = "0.12.1"
anymap = "1.0.0-beta.2"
base32ct = { version = "0.2.0", features = ["std"] }
base64 = { workspace = true }
base-x = "0.2.11"
bellperson = { workspace = true }
bincode = "1.3.3"
bincode = { workspace = true }
blstrs = { workspace = true }
clap = "4.1.8"
clap = { version = "4.3.10", features = ["derive"] }
dashmap = "5.4.0"
ff = { workspace = true }
generic-array = "0.14.6"
Expand Down Expand Up @@ -95,6 +95,7 @@ members = ["clutch",
anyhow = "1.0.69"
base64 = "0.13.1"
bellperson = "0.25"
bincode = "1.3.3"
blstrs = "0.7.0"
# TODO: clap
ff = "0.13"
Expand Down Expand Up @@ -144,3 +145,6 @@ harness = false
[[bench]]
name = "public_params"
harness = false

[patch.crates-io]
sppark = { git = "https://github.com/supranational/sppark", rev="5fea26f43cc5d12a77776c70815e7c722fd1f8a7" }
94 changes: 52 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Set the environment variable `LURK_FIELD` to specify the scalar field of the Lur
```
➜ lurk-rs ✗ bin/lurk
Finished release [optimized] target(s) in 0.06s
Running `target/release/examples/repl`
Running `target/release/lurk`
Lurk REPL welcomes you.
> (let ((square (lambda (x) (* x x)))) (square 8))
[9 iterations] => 64
Expand All @@ -107,49 +107,59 @@ Or enable `info` log-level for a trace of reduction frames:
```
➜ lurk-rs ✗ RUST_LOG=info bin/lurk
Finished release [optimized] target(s) in 0.05s
Running `target/release/examples/repl`
Running `target/release/lurk`
Lurk REPL welcomes you.
> (let ((square (lambda (x) (* x x)))) (square 8))
INFO lurk::eval > Frame: 0
Expr: (LET ((SQUARE (LAMBDA (X) (* X X)))) (SQUARE 8))
Env: NIL
Cont: Outermost
INFO lurk::eval > Frame: 1
Expr: (LAMBDA (X) (* X X))
Env: NIL
Cont: Let{ var: SQUARE, body: (SQUARE 8), saved_env: NIL, continuation: Outermost }
INFO lurk::eval > Frame: 2
Expr: (SQUARE 8)
Env: ((SQUARE . <FUNCTION (X) . ((* X X))>))
Cont: Tail{ saved_env: NIL, continuation: Outermost }
INFO lurk::eval > Frame: 3
Expr: SQUARE
Env: ((SQUARE . <FUNCTION (X) . ((* X X))>))
Cont: Call{ unevaled_arg: 8, saved_env: ((SQUARE . <FUNCTION (X) . ((* X X))>)), continuation: Tail{ saved_env: NIL, continuation: Outermost } }
INFO lurk::eval > Frame: 4
Expr: 8
Env: ((SQUARE . <FUNCTION (X) . ((* X X))>))
Cont: Call2{ function: <FUNCTION (X) . ((* X X))>, saved_env: ((SQUARE . <FUNCTION (X) . ((* X X))>)), continuation: Tail{ saved_env: NIL, continuation: Outermost } }
INFO lurk::eval > Frame: 5
Expr: (* X X)
Env: ((X . 8))
Cont: Tail{ saved_env: NIL, continuation: Outermost }
INFO lurk::eval > Frame: 6
Expr: X
Env: ((X . 8))
Cont: Binop{ operator: Product, unevaled_args: (X), saved_env: ((X . 8)), continuation: Tail{ saved_env: NIL, continuation: Outermost } }
INFO lurk::eval > Frame: 7
Expr: X
Env: ((X . 8))
Cont: Binop2{ operator: Product, evaled_arg: 8, continuation: Tail{ saved_env: NIL, continuation: Outermost } }
INFO lurk::eval > Frame: 8
Expr: Thunk{ value: 64 => cont: Outermost}
Env: NIL
Cont: Dummy
INFO lurk::eval > Frame: 9
Expr: 64
Env: NIL
Cont: Terminal
INFO lurk::eval > Frame: 0
Expr: (let ((square (lambda (x) (* x x)))) (square 8))
Env: nil
Cont: Outermost
INFO lurk::eval > Frame: 1
Expr: (lambda (x) (* x x))
Env: nil
Cont: Let{ var: square, body: (square 8), saved_env: nil, continuation: Outermost }
INFO lurk::eval > Frame: 2
Expr: (square 8)
Env: ((square . <FUNCTION (x) (* x x)>))
Cont: Tail{ saved_env: nil, continuation: Outermost }
INFO lurk::eval > Frame: 3
Expr: square
Env: ((square . <FUNCTION (x) (* x x)>))
Cont: Call{ unevaled_arg: 8, saved_env: ((square . <FUNCTION (x) (* x x)>)), continuation: Tail{ saved_env: nil, continuation: Outermost } }
INFO lurk::eval > Frame: 4
Expr: 8
Env: ((square . <FUNCTION (x) (* x x)>))
Cont: Call2{ function: <FUNCTION (x) (* x x)>, saved_env: ((square . <FUNCTION (x) (* x x)>)), continuation: Tail{ saved_env: nil, continuation: Outermost } }
INFO lurk::eval > Frame: 5
Expr: (* x x)
Env: ((x . 8))
Cont: Tail{ saved_env: nil, continuation: Outermost }
INFO lurk::eval > Frame: 6
Expr: x
Env: ((x . 8))
Cont: Binop{ operator: product#, unevaled_args: (x), saved_env: ((x . 8)), continuation: Tail{ saved_env: nil, continuation: Outermost } }
INFO lurk::eval > Frame: 7
Expr: x
Env: ((x . 8))
Cont: Binop2{ operator: product#, evaled_arg: 8, continuation: Tail{ saved_env: nil, continuation: Outermost } }
INFO lurk::eval > Frame: 8
Expr: Thunk{ value: 64 => cont: Outermost}
Env: nil
Cont: Dummy
INFO lurk::eval > Frame: 9
Expr: 64
Env: nil
Cont: Terminal
[9 iterations] => 64
>
```
Expand Down
1 change: 1 addition & 0 deletions clutch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repository = "https://github.com/lurk-lab/lurk-rs"
anyhow = { workspace = true }
blstrs = { workspace = true }
clap = "4.1.8"
fcomm = { path = "../fcomm" }
ff = "0.13"
lurk = { path = "../" }
pasta_curves = { workspace = true, features = ["repr-c", "serde"] }
Expand Down
12 changes: 7 additions & 5 deletions clutch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

use anyhow::{anyhow, bail, Context, Error, Result};
use clap::{Arg, ArgAction, Command};
use lurk::public_parameters::{
public_params, Claim, Commitment, CommittedExpression, CommittedExpressionMap, LurkCont,
LurkPtr, NovaProofCache, Opening, Proof, PtrEvaluation,
use fcomm::{
committed_expression_store, nova_proof_cache, Claim, Commitment, CommittedExpression,
CommittedExpressionMap, LurkCont, LurkPtr, NovaProofCache, Opening, Proof, PtrEvaluation,
};
use lurk::public_parameters::public_params;

use pasta_curves::pallas;

use lurk::coprocessor::Coprocessor;
Expand Down Expand Up @@ -121,8 +123,8 @@ impl ReplTrait<F, Coproc<F>> for ClutchState<F, Coproc<F>> {
) -> Self {
let reduction_count = DEFAULT_REDUCTION_COUNT;

let proof_map = lurk::public_parameters::nova_proof_cache(reduction_count);
let expression_map = lurk::public_parameters::committed_expression_store();
let proof_map = nova_proof_cache(reduction_count);
let expression_map = committed_expression_store();

let demo = command.clone().and_then(|c| {
let l = Self::base_prompt().trim_start_matches('\n').len();
Expand Down
4 changes: 4 additions & 0 deletions fcomm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ name = "fcomm"
path = "src/bin/fcomm.rs"

[dependencies]
anyhow = { workspace = true }
base64 = { workspace = true }
bellperson = { workspace = true }
bincode = { workspace = true }
blstrs = { workspace = true }
clap = { version = "3.2", features = ["derive"] }
clap-verbosity-flag = "1.0"
Expand All @@ -25,6 +27,8 @@ once_cell = { workspace = true }
pairing = { workspace = true }
pasta_curves = { workspace = true, features = ["repr-c", "serde"] }
pretty_env_logger = { workspace = true }
proptest = "1.1.0"
proptest-derive = "0.3.0"
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
Expand Down
18 changes: 11 additions & 7 deletions fcomm/src/bin/fcomm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ use lurk::eval::{
use lurk::field::LurkField;
use lurk::proof::{nova::NovaProver, Prover};
use lurk::ptr::{Ptr, TypePredicates};
use lurk::public_parameters::error;
use lurk::store::Store;

use clap::{AppSettings, Args, Parser, Subcommand};
use clap_verbosity_flag::{Verbosity, WarnLevel};

use lurk::public_parameters::{
committed_expression_store, error::Error, evaluate, public_params, Claim, Commitment,
CommittedExpression, Evaluation, Expression, FileStore, LurkPtr, Opening, OpeningRequest,
Proof, ReductionCount, S1,
use fcomm::{
committed_expression_store, error::Error, evaluate, Claim, Commitment, CommittedExpression,
Evaluation, Expression, LurkPtr, Opening, OpeningRequest, Proof, ReductionCount, S1,
};

use lurk::public_parameters::{public_params, FileStore};

/// Functional commitments
#[derive(Parser, Debug)]
#[clap(version, about, long_about = None)]
Expand Down Expand Up @@ -485,12 +487,14 @@ fn expression<P: AsRef<Path>, F: LurkField + Serialize + DeserializeOwned>(

fn opening_request<P: AsRef<Path>, F: LurkField + Serialize + DeserializeOwned>(
request_path: P,
) -> Result<OpeningRequest<F>, Error> {
OpeningRequest::read_from_json_path(request_path)
) -> Result<OpeningRequest<F>, error::Error> {
OpeningRequest::read_from_path(request_path)
}

// Get proof from supplied path or else from stdin.
fn proof<'a, P: AsRef<Path>, F: LurkField>(proof_path: Option<P>) -> Result<Proof<'a, F>, Error>
fn proof<'a, P: AsRef<Path>, F: LurkField>(
proof_path: Option<P>,
) -> Result<Proof<'a, F>, error::Error>
where
F: Serialize + for<'de> Deserialize<'de>,
{
Expand Down
Loading

0 comments on commit d505982

Please sign in to comment.