From b422705decc8f33ab26ac73b7bae9f0815a0dfdc Mon Sep 17 00:00:00 2001 From: MRain Date: Tue, 9 Jul 2024 10:33:51 -0400 Subject: [PATCH 01/44] develop setup --- .gitignore | 6 + README.md | 11 + flake.lock | 294 ++ flake.nix | 132 + shell.nix | 10 + sp1/.gitignore | 21 + sp1/.gitmodules | 6 + sp1/.vscode/settings.json | 37 + sp1/README.md | 44 + sp1/contracts/.github/workflows/test.yml | 34 + sp1/contracts/.gitignore | 15 + sp1/contracts/foundry.toml | 7 + sp1/contracts/remappings.txt | 1 + sp1/contracts/src/Fibonacci.sol | 32 + sp1/contracts/src/fixtures/fixture.json | 8 + sp1/contracts/test/Fibonacci.t.sol | 55 + sp1/program/Cargo.lock | 1581 ++++++ sp1/program/Cargo.toml | 10 + sp1/program/src/main.rs | 27 + sp1/rust-toolchain | 3 + sp1/script/Cargo.lock | 5827 ++++++++++++++++++++++ sp1/script/Cargo.toml | 21 + sp1/script/build.rs | 5 + sp1/script/rust-toolchain | 3 + sp1/script/src/bin/prove.rs | 118 + sp1/utils/Cargo.toml | 7 + sp1/utils/src/lib.rs | 4 + sp1/utils/src/ns_table.rs | 17 + 28 files changed, 8336 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix create mode 100644 sp1/.gitignore create mode 100644 sp1/.gitmodules create mode 100644 sp1/.vscode/settings.json create mode 100644 sp1/README.md create mode 100644 sp1/contracts/.github/workflows/test.yml create mode 100644 sp1/contracts/.gitignore create mode 100644 sp1/contracts/foundry.toml create mode 100644 sp1/contracts/remappings.txt create mode 100644 sp1/contracts/src/Fibonacci.sol create mode 100644 sp1/contracts/src/fixtures/fixture.json create mode 100644 sp1/contracts/test/Fibonacci.t.sol create mode 100644 sp1/program/Cargo.lock create mode 100644 sp1/program/Cargo.toml create mode 100644 sp1/program/src/main.rs create mode 100644 sp1/rust-toolchain create mode 100644 sp1/script/Cargo.lock create mode 100644 sp1/script/Cargo.toml create mode 100644 sp1/script/build.rs create mode 100644 sp1/script/rust-toolchain create mode 100644 sp1/script/src/bin/prove.rs create mode 100644 sp1/utils/Cargo.toml create mode 100644 sp1/utils/src/lib.rs create mode 100644 sp1/utils/src/ns_table.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b4c6efd --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.DS_Store +.idea +*.log +tmp/ +.pre-commit-config.yaml +target/ diff --git a/README.md b/README.md index 07b465c..0620f43 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ # zkrollup-integration Tools for zkRollups to integrate with Espresso + +## Getting Started + +To enter the development shell: `nix develop` + +### SP1 stack + +To build the ELF executable for your program and generate the proof, you will have to run outside the nix dev-shell. +For contract developments, you can enter nix shell to use necessary tools. + +Follow [`./sp1/README.md`](./sp1/README.md) for concrete instructions. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..20b240c --- /dev/null +++ b/flake.lock @@ -0,0 +1,294 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "foundry": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1717405880, + "narHash": "sha256-qcXXOnRSl0sGKm7JknntBU4su8/342YKZvjklHsIl+Q=", + "owner": "shazow", + "repo": "foundry.nix", + "rev": "708c0df1e36b5185a727a3c517a5100e46392792", + "type": "github" + }, + "original": { + "owner": "shazow", + "ref": "monthly", + "repo": "foundry.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1666753130, + "narHash": "sha256-Wff1dGPFSneXJLI2c0kkdWTgxnQ416KE6X4KnFkgPYQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f540aeda6f677354f1e7144ab04352f61aaa0118", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1718811006, + "narHash": "sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90++qRN3lukGaIk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "03d771e513ce90147b65fe922d87d3a0356fc125", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1719254875, + "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1682516527, + "narHash": "sha256-1joLG1A4mwhMrj4XVp0mBTNIHphVQSEMIlZ50t0Udxk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "171987b2980d986732f0f710cf0e3361989f71c8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1719259945, + "narHash": "sha256-F1h+XIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "foundry": "foundry", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": "pre-commit-hooks", + "rust-overlay": "rust-overlay", + "solc-bin": "solc-bin" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1719541143, + "narHash": "sha256-YdHqW6EM5pXMwXHhC+KniBv3aquXuJrFar2XXaV7x+c=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "ed12832f267ab223cd085b0bd6ee3432caa69067", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "solc-bin": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1710883285, + "narHash": "sha256-WLlGNJb0yHZaBhsNzswGahUxYlveR6ZJPZ2cniy1cP4=", + "owner": "EspressoSystems", + "repo": "nix-solc-bin", + "rev": "e8c4721859e18a4d889be061c92f0754feca0514", + "type": "github" + }, + "original": { + "owner": "EspressoSystems", + "repo": "nix-solc-bin", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..78d8ec0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,132 @@ +{ + description = "Dev env for zkRollup integration with Espresso"; + + nixConfig = { + extra-substituters = [ "https://espresso-systems-private.cachix.org" ]; + extra-trusted-public-keys = [ + "espresso-systems-private.cachix.org-1:LHYk03zKQCeZ4dvg3NctyCq88e44oBZVug5LpYKjPRI=" + ]; + }; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-compat.follows = "flake-compat"; + }; + }; + foundry.url = + "github:shazow/foundry.nix/monthly"; # Use monthly branch for permanent releases + solc-bin.url = "github:EspressoSystems/nix-solc-bin"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = + { self + , nixpkgs + , flake-utils + , flake-compat + , pre-commit-hooks + , foundry + , solc-bin + , rust-overlay + , ... + }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = + [ foundry.overlay solc-bin.overlays.default (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + nightlyRustToolchain = pkgs.rust-bin.nightly.latest.minimal.override { + extensions = [ + "clippy" + "llvm-tools-preview" + "rustc-dev" + "rust-analyzer" + "rustfmt" + ]; + }; + + in + with pkgs; { + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + check-format = { + enable = true; + files = "\\.rs$"; + entry = "cargo fmt -- --check"; + }; + cargo-clippy = { + enable = true; + description = "Lint Rust code."; + entry = "cargo-clippy --workspace -- -D warnings"; + files = "\\.rs$"; + pass_filenames = false; + }; + cargo-sort = { + enable = true; + description = "Ensure Cargo.toml are sorted"; + entry = "cargo sort sp1/program sp1/script"; + pass_filenames = false; + }; + spell-check = { + enable = true; + description = "Spell check"; + entry = "typos"; + pass_filenames = false; + }; + nixpkgs-fmt.enable = true; + }; + }; + }; + + devShells.default = + let + # nixWithFlakes allows pre v2.4 nix installations to use + # flake commands (like `nix flake update`) + nixWithFlakes = pkgs.writeShellScriptBin "nix" '' + exec ${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@" + ''; + solc = pkgs.solc-bin.latest; + in + mkShell { + buildInputs = [ + git + nixWithFlakes + entr + typos + just + + # Ethereum contracts, solidity, ... + foundry-bin + solc + + # Rust + nightlyRustToolchain + ] ++ lib.optionals stdenv.isDarwin + [ darwin.apple_sdk.frameworks.SystemConfiguration ]; + shellHook = '' + export RUST_BACKTRACE=full + export RUST_LOG=info + export PATH="$PATH:$(pwd)/target/debug:$(pwd)/target/release" + # Prevent cargo aliases from using programs in `~/.cargo` to avoid conflicts with local rustup installations. + export CARGO_HOME=$HOME/.cargo-nix + + # Ensure `cargo fmt` uses `rustfmt` from nightly. + export RUSTFMT="${nightlyRustToolchain}/bin/rustfmt" + '' + self.checks.${system}.pre-commit-check.shellHook; + FOUNDRY_SOLC = "${solc}/bin/solc"; + CARGO_TARGET_DIR = "target/nix_rustc"; + + }; + }); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..78069ca --- /dev/null +++ b/shell.nix @@ -0,0 +1,10 @@ +(import + ( + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in fetchTarball { + url = + "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { src = ./.; }).shellNix diff --git a/sp1/.gitignore b/sp1/.gitignore new file mode 100644 index 0000000..8fabca8 --- /dev/null +++ b/sp1/.gitignore @@ -0,0 +1,21 @@ +# Cargo build +**/target + +# Cargo config +.cargo + +# Profile-guided optimization +/tmp +pgo-data.profdata + +# MacOS nuisances +.DS_Store + +# Proofs +**/proof-with-pis.json +**/proof-with-io.json + +# Env +.env + +program/elf/* diff --git a/sp1/.gitmodules b/sp1/.gitmodules new file mode 100644 index 0000000..0551f57 --- /dev/null +++ b/sp1/.gitmodules @@ -0,0 +1,6 @@ +[submodule "contracts/lib/forge-std"] + path = contracts/lib/forge-std + url = https://github.com/foundry-rs/forge-std +[submodule "contracts/lib/sp1-contracts"] + path = contracts/lib/sp1-contracts + url = https://github.com/succinctlabs/sp1-contracts diff --git a/sp1/.vscode/settings.json b/sp1/.vscode/settings.json new file mode 100644 index 0000000..ca6a515 --- /dev/null +++ b/sp1/.vscode/settings.json @@ -0,0 +1,37 @@ +{ + "rust-analyzer.linkedProjects": [ + "program/Cargo.toml", + "script/Cargo.toml" + ], + "rust-analyzer.check.overrideCommand": [ + "cargo", + "clippy", + "--workspace", + "--message-format=json", + "--all-features", + "--all-targets", + "--", + "-A", + "incomplete-features" + ], + "rust-analyzer.runnables.extraEnv": { + "RUST_LOG": "debug", + "RUSTFLAGS": "-Ctarget-cpu=native" + }, + "rust-analyzer.runnables.extraArgs": [ + "--release", + "+nightly" + ], + "rust-analyzer.diagnostics.disabled": [ + "unresolved-proc-macro" + ], + "editor.rulers": [ + 100 + ], + "editor.inlineSuggest.enabled": true, + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer", + "editor.formatOnSave": true, + "editor.hover.enabled": true + }, +} \ No newline at end of file diff --git a/sp1/README.md b/sp1/README.md new file mode 100644 index 0000000..91e6dcd --- /dev/null +++ b/sp1/README.md @@ -0,0 +1,44 @@ +# SP1 Project Template + +This is a template for creating an end-to-end [SP1](https://github.com/succinctlabs/sp1) project +that can generate a proof of any RISC-V program and verify the proof onchain. + +## Requirements + +- [Rust](https://rustup.rs/) +- [SP1](https://succinctlabs.github.io/sp1/getting-started/install.html) +- [Foundry](https://book.getfoundry.sh/getting-started/installation) + +## Standard Proof Generation + +> [!WARNING] +> You will need at least 16GB RAM to generate the default proof. + +Generate the proof for your program using the standard prover. + +``` +cd script +RUST_LOG=info cargo run --bin prove --release +``` + +## EVM-Compatible Proof Generation & Verification + +> [!WARNING] +> You will need at least 128GB RAM to generate the PLONK proof. + +Generate the proof that is small enough to be verified on-chain and verifiable by the EVM. This command also generates a fixture that can be used to test the verification of SP1 zkVM proofs inside Solidity. + +``` +cd script +RUST_LOG=info cargo run --bin prove --release -- --evm +``` + +### Solidity Proof Verification + +After generating the verify the proof with the SP1 EVM verifier. + +``` +cd ../contracts +forge test -v +``` + diff --git a/sp1/contracts/.github/workflows/test.yml b/sp1/contracts/.github/workflows/test.yml new file mode 100644 index 0000000..9282e82 --- /dev/null +++ b/sp1/contracts/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test + +on: workflow_dispatch + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + id: build + + - name: Run Forge tests + run: | + forge test -vvv + id: test diff --git a/sp1/contracts/.gitignore b/sp1/contracts/.gitignore new file mode 100644 index 0000000..59ae5b1 --- /dev/null +++ b/sp1/contracts/.gitignore @@ -0,0 +1,15 @@ +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +/broadcast +/broadcast/*/11155111/ +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/sp1/contracts/foundry.toml b/sp1/contracts/foundry.toml new file mode 100644 index 0000000..9430db1 --- /dev/null +++ b/sp1/contracts/foundry.toml @@ -0,0 +1,7 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] +fs_permissions = [{ access = "read-write", path = "./" }] + +# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/sp1/contracts/remappings.txt b/sp1/contracts/remappings.txt new file mode 100644 index 0000000..4483f06 --- /dev/null +++ b/sp1/contracts/remappings.txt @@ -0,0 +1 @@ +@sp1-contracts/=./lib/sp1-contracts/contracts/src/ \ No newline at end of file diff --git a/sp1/contracts/src/Fibonacci.sol b/sp1/contracts/src/Fibonacci.sol new file mode 100644 index 0000000..47ac73a --- /dev/null +++ b/sp1/contracts/src/Fibonacci.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +import {SP1Verifier} from "@sp1-contracts/SP1Verifier.sol"; + +/// @title Fibonacci. +/// @author Succinct Labs +/// @notice This contract implements a simple example of verifying the proof of a computing a +/// fibonacci number. +contract Fibonacci is SP1Verifier { + /// @notice The verification key for the fibonacci program. + bytes32 public fibonacciProgramVkey; + + constructor(bytes32 _fibonacciProgramVkey) { + fibonacciProgramVkey = _fibonacciProgramVkey; + } + + /// @notice The entrypoint for verifying the proof of a fibonacci number. + /// @param proof The encoded proof. + /// @param publicValues The encoded public values. + function verifyFibonacciProof( + bytes memory proof, + bytes memory publicValues + ) public view returns (uint32, uint32, uint32) { + this.verifyProof(fibonacciProgramVkey, publicValues, proof); + (uint32 n, uint32 a, uint32 b) = abi.decode( + publicValues, + (uint32, uint32, uint32) + ); + return (n, a, b); + } +} diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json new file mode 100644 index 0000000..e7f7d14 --- /dev/null +++ b/sp1/contracts/src/fixtures/fixture.json @@ -0,0 +1,8 @@ +{ + "a": 1268, + "b": 1926, + "n": 500, + "vkey": "0x000c413c257554c0d44f840ea4e6e3cf6acf1ec722af839547814ce9632fd6bf", + "publicValues": "0x00000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000004f40000000000000000000000000000000000000000000000000000000000000786", + "proof": "0x1b24bf0ece10786a2307e121b48c2c90c4b07641f81b773502cb132296a837c61c37e1fb4402606cacf385295f7b4832d2222f9ecd9803d022c09fb159e8af8f0fd2cb1fceb65e32058b0f7e04734682cca35b917098b6e0a95aeb02f69272c4168899e7867a5ddfa8246ec4fe35a0e2d2ac85355a26b2490ed78aea20a2869a115b66835ee849fa9fbd3462138bccb3092b4f4cb8cdd5af495ae5ab06f0e1a00c043787dcda55e88dca9a6b845806f626b29c0d191aaf48ae93d00e02ffda7a2680eaf720b34b00aa4477b6b9b4512e0cc94b2df5a865a6c0cb491bdc834f5800c80881e1ce55a364dcce58fb1daaaf9f5986845036b1831024e03072a3ac56051d6c07a287a27414da42ba86bf42cc9d0ef7f17ebb1226f6b263086c2d77b910466c8d8b6675c0d0fce875f6b594722ad5bdaeeca7d4b673467adf065cf00d2f2ecdf78010fe75f1212dd9c6540c96a6e1eb11530290e966699018c1e41d7b07e3a1a08cb13adcf536851e5f58e33f464321118b67f8c80db338733c3bda72039aa214dfe5015f117b6f876b018199424510024b2946bb5f8027245225ff8b240237bdef147c509f04f33a09da19549a27411430c059cd1376f2706549b6671694bb18973c35c9fe8cc4d40f08c60aca4c277ddf09eb2e095556f3c3156ba51550b6a94fd21d4540764d093fb39e4e6c4517bd4ccc87c21f08fdd4588ff27b032cbbfb8c6a8cd431524521677d40aed6700eac960e2ca5f66c6f19cbcbe1af16f962c9e5eae242aab756079cee9a1419474da4e3f5d531f70738e6dac99dd40858cee714f519e6af127d3c57553c1e3ace3206dc24866f6dce3b6a9fa99ced10ef7440dc5227ab24c05201207fdfeb341fbe716f2a969c9663d6b2188c25271abff2b7c68177be370f2d804306693461a5f749de729433ad45e6eff0b692e216c9216e5596d7a39e5971c5bcfed0cebb520014059ec9ade2c7a1196d967f4121aa5603cda863fbda14a380853fdac1e09de824fc8bb65c29ef2fd78d32aa8e24bef20ab27682cd82dcaee11a478bc5f9da361d87262686b1b2d91f135a10d3120954d3a8f3f5c14c069730d0c9bfc2bb86f7cd6a106e294f1ecddd3543b7110bc67355e1fc211b968f314ebcf9ea8352a01d0b9a1bbaac88457409b49388ac189007a6b62c2839220edd1f012ff5331baec07c4077522fce86fd3b8931e8a4" +} \ No newline at end of file diff --git a/sp1/contracts/test/Fibonacci.t.sol b/sp1/contracts/test/Fibonacci.t.sol new file mode 100644 index 0000000..f5814e7 --- /dev/null +++ b/sp1/contracts/test/Fibonacci.t.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +import {Test, console} from "forge-std/Test.sol"; +import {stdJson} from "forge-std/StdJson.sol"; +import {Fibonacci} from "../src/Fibonacci.sol"; +import {SP1Verifier} from "@sp1-contracts/SP1Verifier.sol"; + +struct SP1ProofFixtureJson { + uint32 a; + uint32 b; + uint32 n; + bytes proof; + bytes publicValues; + bytes32 vkey; +} + +contract FibonacciTest is Test { + using stdJson for string; + + Fibonacci public fibonacci; + + function loadFixture() public view returns (SP1ProofFixtureJson memory) { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/src/fixtures/fixture.json"); + string memory json = vm.readFile(path); + bytes memory jsonBytes = json.parseRaw("."); + return abi.decode(jsonBytes, (SP1ProofFixtureJson)); + } + + function setUp() public { + SP1ProofFixtureJson memory fixture = loadFixture(); + fibonacci = new Fibonacci(fixture.vkey); + } + + function test_ValidFibonacciProof() public view { + SP1ProofFixtureJson memory fixture = loadFixture(); + (uint32 n, uint32 a, uint32 b) = fibonacci.verifyFibonacciProof( + fixture.proof, + fixture.publicValues + ); + assert(n == fixture.n); + assert(a == fixture.a); + assert(b == fixture.b); + } + + function testFail_InvalidFibonacciProof() public view { + SP1ProofFixtureJson memory fixture = loadFixture(); + + // Create a fake proof. + bytes memory fakeProof = new bytes(fixture.proof.length); + + fibonacci.verifyFibonacciProof(fakeProof, fixture.publicValues); + } +} diff --git a/sp1/program/Cargo.lock b/sp1/program/Cargo.lock new file mode 100644 index 0000000..1bc0b67 --- /dev/null +++ b/sp1/program/Cargo.lock @@ -0,0 +1,1581 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "alloy-primitives" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a43b18702501396fa9bcdeecd533bc85fac75150d308fc0f6800a01e6234a003" +dependencies = [ + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" +dependencies = [ + "alloy-sol-macro-input", + "const-hex", + "heck", + "indexmap", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.68", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" +dependencies = [ + "const-hex", + "dunce", + "heck", + "proc-macro2", + "quote", + "syn 2.0.68", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-types" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" +dependencies = [ + "alloy-primitives", + "alloy-sol-macro", + "const-hex", + "serde", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.0", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "cc" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-hex" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn 2.0.68", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "tap", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "espresso-derivation" +version = "0.1.0" +dependencies = [ + "alloy-sol-types", + "espresso-derivation-utils", + "sp1-zkvm", +] + +[[package]] +name = "espresso-derivation-utils" +version = "0.1.0" +dependencies = [ + "serde", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "bitvec", + "rand_core", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak-asm" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pest" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "scale-info" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3-asm" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" +dependencies = [ + "cc", + "cfg-if", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + +[[package]] +name = "snowbridge-amcl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460a9ed63cdf03c1b9847e8a12a5f5ba19c4efd5869e4a737e05be25d7c427e5" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "sp1-precompiles" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "getrandom", + "hex", + "k256", + "num", + "rand", + "serde", + "snowbridge-amcl", +] + +[[package]] +name = "sp1-zkvm" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "bincode", + "cfg-if", + "getrandom", + "k256", + "lazy_static", + "libm", + "once_cell", + "rand", + "serde", + "sha2", + "sp1-precompiles", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn-solidity" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml new file mode 100644 index 0000000..046d844 --- /dev/null +++ b/sp1/program/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +[package] +version = "0.1.0" +name = "espresso-derivation" +edition = "2021" + +[dependencies] +alloy-sol-types = "0.7.2" +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.7-testnet" } +espresso-derivation-utils = { path = "../utils" } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs new file mode 100644 index 0000000..d9f20f8 --- /dev/null +++ b/sp1/program/src/main.rs @@ -0,0 +1,27 @@ +//! This program proves that the executed transactions are correctly derived from an espresso block. +// Inputs: +// - Namespace ID (public) +// - Namespace table (public) +// - VID commitment (public) +// - Rollup transactions commitment (public) +// - An index in the namespace table for the rollup +// - Two offsets that defines the namespace range +// - All transactions +// This program proves that +// - The namespace table contains an entry of this namespace ID. +// - Transactions given by two offsets in the (VID) committed payload are the ones committed by the rollup. + +#![no_main] +sp1_zkvm::entrypoint!(main); + +use espresso_derivation_utils::ns_table::{NamespaceId, NsTable}; + +pub fn main() { + let ns_id = sp1_zkvm::io::read::(); + let _ns_table = sp1_zkvm::io::read::(); + // let vid_comm = sp1::zkvm::io::read::<>(); + // let rollup_comm = sp1::zkvm::io::read::<>(); + // let ns_index = sp1_zkvm::io::read::(); + + sp1_zkvm::io::commit(&ns_id); +} diff --git a/sp1/rust-toolchain b/sp1/rust-toolchain new file mode 100644 index 0000000..989860f --- /dev/null +++ b/sp1/rust-toolchain @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2024-04-17" +components = ["llvm-tools", "rustc-dev"] diff --git a/sp1/script/Cargo.lock b/sp1/script/Cargo.lock new file mode 100644 index 0000000..c04cf3e --- /dev/null +++ b/sp1/script/Cargo.lock @@ -0,0 +1,5827 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "alloy-primitives" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a43b18702501396fa9bcdeecd533bc85fac75150d308fc0f6800a01e6234a003" +dependencies = [ + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" +dependencies = [ + "alloy-sol-macro-input", + "const-hex", + "heck", + "indexmap 2.2.6", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.68", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" +dependencies = [ + "const-hex", + "dunce", + "heck", + "proc-macro2", + "quote", + "syn 2.0.68", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-types" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" +dependencies = [ + "alloy-primitives", + "alloy-sol-macro", + "const-hex", + "serde", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint 0.4.6", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint 0.4.6", + "num-traits", + "paste", + "rustc_version 0.4.0", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint 0.4.6", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version 0.4.0", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.4.0", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "serde", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.68", + "which", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "blake3" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "rayon", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "bls12_381" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3c196a77437e7cc2fb515ce413a6401291578b5afc8ecb29a3c7ab957f05941" +dependencies = [ + "ff 0.12.1", + "group 0.12.1", + "pairing", + "rand_core", + "subtle", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "sha2", + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytemuck" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +dependencies = [ + "serde", +] + +[[package]] +name = "camino" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets 0.52.5", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58", + "coins-core", + "digest 0.10.7", + "hmac", + "k256", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.7", + "bech32", + "bs58", + "digest 0.10.7", + "generic-array 0.14.7", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2", + "sha3", + "thiserror", +] + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + +[[package]] +name = "const-hex" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array 0.14.7", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.7", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "fiat-crypto", + "rustc_version 0.4.0", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "darling" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.68", +] + +[[package]] +name = "darling_macro" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn 2.0.68", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enr" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" +dependencies = [ + "base64 0.21.7", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "espresso-derivation-prover" +version = "0.1.0" +dependencies = [ + "alloy-sol-types", + "clap", + "espresso-derivation-utils", + "serde", + "serde_json", + "sp1-helper", + "sp1-sdk", + "tracing", +] + +[[package]] +name = "espresso-derivation-utils" +version = "0.1.0" +dependencies = [ + "serde", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", +] + +[[package]] +name = "ethers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-middleware", + "ethers-providers", + "ethers-signers", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" +dependencies = [ + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_json", + "syn 2.0.68", + "toml", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.68", +] + +[[package]] +name = "ethers-core" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" +dependencies = [ + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", + "generic-array 0.14.7", + "k256", + "num_enum 0.7.2", + "once_cell", + "open-fastrlp", + "rand", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.68", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.7", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http 0.2.12", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", +] + +[[package]] +name = "ethers-signers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand", + "sha2", + "thiserror", + "tracing", +] + +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "bitvec", + "rand_core", + "subtle", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "bitvec", + "byteorder", + "ff_derive", + "rand_core", + "subtle", +] + +[[package]] +name = "ff_derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" +dependencies = [ + "addchain", + "cfg-if", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "generic-array" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "152dd546e5bdac80844ce6befabb9af5784ce375cb6cea554aed99fe2d1fb169" +dependencies = [ + "serde", + "typenum", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "git2" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" +dependencies = [ + "bitflags 2.6.0", + "libc", + "libgit2-sys", + "log", + "url", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff 0.12.1", + "memuse", + "rand_core", + "subtle", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.0", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "halo2" +version = "0.1.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a23c779b38253fe1538102da44ad5bd5378495a61d2c4ee18d64eaa61ae5995" +dependencies = [ + "halo2_proofs", +] + +[[package]] +name = "halo2_proofs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e925780549adee8364c7f2b685c753f6f3df23bde520c67416e93bf615933760" +dependencies = [ + "blake2b_simd", + "ff 0.12.1", + "group 0.12.1", + "pasta_curves 0.4.1", + "rand_core", + "rayon", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.4.0", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.4.0", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.4.0", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "indicatif" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +dependencies = [ + "console", + "instant", + "number_prefix", + "portable-atomic", + "unicode-width", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.7", + "pem", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "jubjub" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a575df5f985fe1cd5b2b05664ff6accfc46559032b954529fd225a2168d27b0f" +dependencies = [ + "bitvec", + "bls12_381", + "ff 0.12.1", + "group 0.12.1", + "rand_core", + "subtle", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-asm" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin 0.9.8", +] + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libgit2-sys" +version = "0.16.2+1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", +] + +[[package]] +name = "libz-sys" +version = "1.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memuse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2145869435ace5ea6ea3d35f59be559317ec9a0d04e1812d5f185a87b6d36f1a" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint 0.4.6", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint 0.4.6", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive 0.7.2", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "object" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "openssl" +version = "0.10.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "p3-air" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "p3-field", + "p3-matrix", +] + +[[package]] +name = "p3-baby-bear" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "num-bigint 0.4.6", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "rand", + "serde", +] + +[[package]] +name = "p3-blake3" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "blake3", + "p3-symmetric", +] + +[[package]] +name = "p3-bn254-fr" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "ff 0.13.0", + "num-bigint 0.4.6", + "p3-field", + "p3-poseidon2", + "p3-symmetric", + "rand", + "serde", +] + +[[package]] +name = "p3-challenger" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-commit" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "p3-challenger", + "p3-field", + "p3-matrix", + "p3-util", + "serde", +] + +[[package]] +name = "p3-dft" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "num-bigint 0.4.6", + "num-traits", + "p3-util", + "rand", + "serde", +] + +[[package]] +name = "p3-fri" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-interpolation", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "serde", + "tracing", +] + +[[package]] +name = "p3-interpolation" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "p3-field", + "p3-matrix", + "p3-util", +] + +[[package]] +name = "p3-keccak" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "p3-symmetric", + "tiny-keccak", +] + +[[package]] +name = "p3-keccak-air" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "p3-air", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-matrix" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "rayon", +] + +[[package]] +name = "p3-mds" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-merkle-tree" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "p3-commit", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-symmetric", + "p3-util", + "serde", + "tracing", +] + +[[package]] +name = "p3-poseidon2" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "gcd", + "p3-field", + "p3-mds", + "p3-symmetric", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "p3-field", + "serde", +] + +[[package]] +name = "p3-uni-stark" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "itertools 0.12.1", + "p3-air", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "serde", + "tracing", +] + +[[package]] +name = "p3-util" +version = "0.1.0" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" +dependencies = [ + "serde", +] + +[[package]] +name = "pairing" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135590d8bdba2b31346f9cd1fb2a912329f5135e832a4f422942eb6ead8b6b3b" +dependencies = [ + "group 0.12.1", +] + +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.5", +] + +[[package]] +name = "pasta_curves" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc65faf8e7313b4b1fbaa9f7ca917a0eed499a9663be71477f87993604341d8" +dependencies = [ + "blake2b_simd", + "ff 0.12.1", + "group 0.12.1", + "lazy_static", + "rand", + "static_assertions", + "subtle", +] + +[[package]] +name = "pasta_curves" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e57598f73cc7e1b2ac63c79c517b31a0877cd7c402cdcaa311b5208de7a095" +dependencies = [ + "blake2b_simd", + "ff 0.13.0", + "group 0.13.0", + "lazy_static", + "rand", + "static_assertions", + "subtle", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version 0.4.0", +] + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.68", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.6.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.4", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quinn" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +dependencies = [ + "bytes", + "rand", + "ring 0.17.8", + "rustc-hash", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +dependencies = [ + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "rayon-scan" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f87cc11a0140b4b0da0ffc889885760c61b13672d80a908920b2c0df078fa14" +dependencies = [ + "rayon", +] + +[[package]] +name = "redox_syscall" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +dependencies = [ + "bitflags 2.6.0", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.29", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.50.0", +] + +[[package]] +name = "reqwest" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.4.0", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", + "winreg 0.52.0", +] + +[[package]] +name = "reqwest-middleware" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39346a33ddfe6be00cbc17a34ce996818b97b230b87229f10114693becca1268" +dependencies = [ + "anyhow", + "async-trait", + "http 1.1.0", + "reqwest 0.12.5", + "serde", + "thiserror", + "tower-service", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "git+https://github.com/GregAC/rrs.git#b23afc16b4e6a1fb5c4a73eb1e337e9400816507" +dependencies = [ + "downcast-rs", + "num_enum 0.5.11", + "paste", +] + +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint 0.4.6", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +dependencies = [ + "once_cell", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "rustls-webpki" +version = "0.102.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted 0.9.0", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-info" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scc" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ad2bbb0ae5100a07b7a6f2ed7ab5fd0045551a4c507989b7a620046ea3efdc" +dependencies = [ + "sdd", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2", +] + +[[package]] +name = "sdd" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array 0.14.7", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "serde_json" +version = "1.0.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "079f3a42cd87588d924ed95b533f8d30a483388c4e400ab736a7058e34f16169" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.2.6", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc03aad67c1d26b7de277d51c86892e7d9a0110a2fe44bf6b26cc569fba302d6" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "serial_test" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" +dependencies = [ + "futures", + "log", + "once_cell", + "parking_lot", + "scc", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sha3-asm" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" +dependencies = [ + "cc", + "cfg-if", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "thiserror", + "time", +] + +[[package]] +name = "size" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fed904c7fb2856d868b92464fc8fa597fce366edea1a9cbfaa8cb5fe080bd6d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "snowbridge-amcl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460a9ed63cdf03c1b9847e8a12a5f5ba19c4efd5869e4a737e05be25d7c427e5" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "sp1-core" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "anyhow", + "arrayref", + "bincode", + "blake3", + "bytemuck", + "cfg-if", + "curve25519-dalek", + "elf", + "elliptic-curve", + "generic-array 1.0.1", + "hex", + "itertools 0.13.0", + "k256", + "log", + "nohash-hasher", + "num", + "num-bigint 0.4.6", + "num_cpus", + "p3-air", + "p3-baby-bear", + "p3-blake3", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-fri", + "p3-keccak", + "p3-keccak-air", + "p3-matrix", + "p3-maybe-rayon", + "p3-merkle-tree", + "p3-poseidon2", + "p3-symmetric", + "p3-uni-stark", + "p3-util", + "rand", + "rayon-scan", + "rrs-lib", + "serde", + "serde_with", + "size", + "snowbridge-amcl", + "sp1-derive", + "sp1-primitives", + "strum", + "strum_macros", + "tempfile", + "thiserror", + "tracing", + "tracing-forest", + "tracing-subscriber", + "typenum", + "web-time", +] + +[[package]] +name = "sp1-derive" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "sp1-helper" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "cargo_metadata", + "chrono", +] + +[[package]] +name = "sp1-primitives" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "itertools 0.13.0", + "lazy_static", + "p3-baby-bear", + "p3-field", + "p3-poseidon2", + "p3-symmetric", +] + +[[package]] +name = "sp1-prover" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "anyhow", + "backtrace", + "bincode", + "bytemuck", + "clap", + "dirs", + "futures", + "hex", + "indicatif", + "itertools 0.13.0", + "num-bigint 0.4.6", + "p3-baby-bear", + "p3-bn254-fr", + "p3-challenger", + "p3-commit", + "p3-field", + "p3-util", + "rand", + "rayon", + "reqwest 0.12.5", + "serde", + "serde_json", + "serial_test", + "sha2", + "size", + "sp1-core", + "sp1-primitives", + "sp1-recursion-circuit", + "sp1-recursion-compiler", + "sp1-recursion-core", + "sp1-recursion-gnark-ffi", + "sp1-recursion-program", + "subtle-encoding", + "tempfile", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "sp1-recursion-circuit" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "bincode", + "itertools 0.13.0", + "p3-air", + "p3-baby-bear", + "p3-bn254-fr", + "p3-commit", + "p3-field", + "p3-fri", + "p3-matrix", + "p3-util", + "serde", + "sp1-core", + "sp1-recursion-compiler", + "sp1-recursion-core", + "sp1-recursion-derive", + "sp1-recursion-program", +] + +[[package]] +name = "sp1-recursion-compiler" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "backtrace", + "itertools 0.13.0", + "p3-air", + "p3-baby-bear", + "p3-bn254-fr", + "p3-commit", + "p3-field", + "p3-fri", + "p3-matrix", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "serde", + "sp1-core", + "sp1-recursion-core", + "sp1-recursion-derive", + "tracing", +] + +[[package]] +name = "sp1-recursion-core" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "arrayref", + "backtrace", + "ff 0.13.0", + "hashbrown 0.14.5", + "itertools 0.13.0", + "p3-air", + "p3-baby-bear", + "p3-bn254-fr", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-fri", + "p3-matrix", + "p3-maybe-rayon", + "p3-merkle-tree", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "serde", + "serde_with", + "sp1-core", + "sp1-derive", + "sp1-primitives", + "static_assertions", + "tracing", + "zkhash", +] + +[[package]] +name = "sp1-recursion-derive" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "sp1-recursion-gnark-ffi" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "anyhow", + "bincode", + "bindgen", + "cc", + "cfg-if", + "hex", + "log", + "num-bigint 0.4.6", + "p3-baby-bear", + "p3-field", + "p3-symmetric", + "rand", + "serde", + "serde_json", + "sha2", + "sp1-core", + "sp1-recursion-compiler", + "tempfile", +] + +[[package]] +name = "sp1-recursion-program" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "itertools 0.13.0", + "p3-air", + "p3-baby-bear", + "p3-challenger", + "p3-commit", + "p3-dft", + "p3-field", + "p3-fri", + "p3-matrix", + "p3-maybe-rayon", + "p3-merkle-tree", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "rand", + "serde", + "sp1-core", + "sp1-recursion-compiler", + "sp1-recursion-core", + "tracing", +] + +[[package]] +name = "sp1-sdk" +version = "0.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" +dependencies = [ + "alloy-sol-types", + "anyhow", + "async-trait", + "axum", + "bincode", + "cfg-if", + "dirs", + "ethers", + "futures", + "hex", + "indicatif", + "log", + "num-bigint 0.4.6", + "p3-commit", + "p3-field", + "p3-matrix", + "prost", + "reqwest 0.12.5", + "reqwest-middleware", + "serde", + "serde_json", + "sha2", + "sp1-core", + "sp1-prover", + "strum", + "strum_macros", + "tempfile", + "thiserror", + "tokio", + "tracing", + "twirp", + "vergen", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.68", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "subtle-encoding" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" +dependencies = [ + "zeroize", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn-solidity" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.14", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.2.6", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap 2.2.6", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.13", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-forest" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee40835db14ddd1e3ba414292272eddde9dad04d3d4b65509656414d1c42592f" +dependencies = [ + "ansi_term", + "smallvec", + "thiserror", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "twirp" +version = "0.3.0" +source = "git+https://github.com/github/twirp-rs.git?rev=c85f31f9c54957374e7dcb3534fc52cff0aa2dc5#c85f31f9c54957374e7dcb3534fc52cff0aa2dc5" +dependencies = [ + "async-trait", + "axum", + "bytes", + "futures", + "http 1.1.0", + "http-body-util", + "hyper 1.4.0", + "prost", + "reqwest 0.12.5", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "url", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "vergen" +version = "8.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" +dependencies = [ + "anyhow", + "cfg-if", + "git2", + "rustversion", + "time", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.68", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "wasm-streams" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version 0.4.0", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "zkhash" +version = "0.2.0" +source = "git+https://github.com/HorizenLabs/poseidon2#bb476b9ca38198cf5092487283c8b8c5d4317c4e" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "bitvec", + "blake2", + "bls12_381", + "byteorder", + "cfg-if", + "group 0.12.1", + "group 0.13.0", + "halo2", + "hex", + "jubjub", + "lazy_static", + "pasta_curves 0.5.1", + "rand", + "serde", + "sha2", + "sha3", + "subtle", +] diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml new file mode 100644 index 0000000..50ece5b --- /dev/null +++ b/sp1/script/Cargo.toml @@ -0,0 +1,21 @@ +[workspace] +[package] +version = "0.1.0" +name = "espresso-derivation-prover" +edition = "2021" + +[[bin]] +name = "prove" +path = "src/bin/prove.rs" + +[dependencies] +alloy-sol-types = "0.7.2" +clap = { version = "4.0", features = ["derive", "env"] } +serde = { version = "1.0", default-features = false, features = ["derive"] } +serde_json = { version = "1.0", default-features = false, features = ["alloc"] } +sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.7-testnet" } +tracing = "0.1.40" +espresso-derivation-utils = { path = "../utils" } + +[build-dependencies] +sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.7-testnet" } diff --git a/sp1/script/build.rs b/sp1/script/build.rs new file mode 100644 index 0000000..32b9927 --- /dev/null +++ b/sp1/script/build.rs @@ -0,0 +1,5 @@ +use sp1_helper::build_program; + +fn main() { + build_program("../program") +} diff --git a/sp1/script/rust-toolchain b/sp1/script/rust-toolchain new file mode 100644 index 0000000..989860f --- /dev/null +++ b/sp1/script/rust-toolchain @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2024-04-17" +components = ["llvm-tools", "rustc-dev"] diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs new file mode 100644 index 0000000..1f5adc9 --- /dev/null +++ b/sp1/script/src/bin/prove.rs @@ -0,0 +1,118 @@ +//! Using the SP1 SDK to generate a proof of correct derivation from an espresso block. +//! +//! You can run this script using the following command: +//! ```shell +//! RUST_LOG=info cargo run --package espresso-derivation-prover --bin prove --release +//! ``` + +// TODO: this crate should take inputs of an espresso block, block header, and other +// information from espresso light client or query service, extract public and private +// inputs for derivation pipeline, and generate need proofs. (Incomplete) workflow: +// - Program input: espresso block, block header, etc. +// - Scan through the namespace table for the index of this rollup's namespace ID. +// - Feed these input to the program to generate a proof. + +use std::path::PathBuf; + +use clap::Parser; +use espresso_derivation_utils::ns_table::NamespaceId; +use serde::{Deserialize, Serialize}; +use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1VerifyingKey}; + +/// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. +/// +/// This file is generated by running `cargo prove build` inside the `program` directory. +pub const ELF: &[u8] = include_bytes!("../../../program/elf/riscv32im-succinct-zkvm-elf"); + +/// The arguments for the prove command. +// TODO: fill in other details +#[derive(Parser, Debug)] +#[clap(author, version, about, long_about = None)] +struct ProveArgs { + #[clap(long, default_value = "0")] + ns_id: NamespaceId, + + #[clap(long, default_value = "false")] + evm: bool, +} + +fn main() { + // Setup the logger. + sp1_sdk::utils::setup_logger(); + + // Parse the command line arguments. + let args = ProveArgs::parse(); + + // Setup the prover client. + let client = ProverClient::new(); + + // Setup the program. + let (pk, vk) = client.setup(ELF); + + // Setup the inputs.; + let mut stdin = SP1Stdin::new(); + stdin.write(&args.ns_id); + + println!("Namespace ID: {:#x}", args.ns_id); + + if args.evm { + // Generate the proof. + let proof = client + .prove_plonk(&pk, stdin) + .expect("failed to generate proof"); + create_plonk_fixture(&proof, &vk); + } else { + // Generate the proof. + let proof = client.prove(&pk, stdin).expect("failed to generate proof"); + let ns_id = u32::from_le_bytes(proof.public_values.as_slice().try_into().unwrap()); + println!("Successfully generated proof!"); + println!("Namespace ID: {:#x}", ns_id); + + // Verify the proof. + client.verify(&proof, &vk).expect("failed to verify proof"); + } +} + +/// A fixture that can be used to test the verification of SP1 zkVM proofs inside Solidity. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct ProofFixture { + vkey: String, + public_values: String, + proof: String, +} + +/// Create a fixture for the given proof. +fn create_plonk_fixture(proof: &SP1PlonkBn254Proof, vk: &SP1VerifyingKey) { + // Create the testing fixture so we can test things end-to-end. + let fixture = ProofFixture { + vkey: vk.bytes32().to_string(), + public_values: proof.public_values.bytes().to_string(), + proof: proof.bytes().to_string(), + }; + + // The verification key is used to verify that the proof corresponds to the execution of the + // program on the given input. + // + // Note that the verification key stays the same regardless of the input. + println!("Verification Key: {}", fixture.vkey); + + // The public values are the values whicha are publicly committed to by the zkVM. + // + // If you need to expose the inputs or outputs of your program, you should commit them in + // the public values. + println!("Public Values: {}", fixture.public_values); + + // The proof proves to the verifier that the program was executed with some inputs that led to + // the give public values. + println!("Proof Bytes: {}", fixture.proof); + + // Save the fixture to a file. + let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../contracts/src/fixtures"); + std::fs::create_dir_all(&fixture_path).expect("failed to create fixture path"); + std::fs::write( + fixture_path.join("fixture.json"), + serde_json::to_string_pretty(&fixture).unwrap(), + ) + .expect("failed to write fixture"); +} diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml new file mode 100644 index 0000000..060ba5a --- /dev/null +++ b/sp1/utils/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "espresso-derivation-utils" +version = "0.1.0" +edition = "2021" + +[dependencies] +serde = { version = "1.0.195", features = ["derive"] } diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs new file mode 100644 index 0000000..de3dd9e --- /dev/null +++ b/sp1/utils/src/lib.rs @@ -0,0 +1,4 @@ +//! Espresso derivation utilities for rollup integration. + +pub mod ns_table; +// TODO: modules for espresso block and rollup transaction hash diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs new file mode 100644 index 0000000..2e5e277 --- /dev/null +++ b/sp1/utils/src/ns_table.rs @@ -0,0 +1,17 @@ +//! Definitions and utilities for namespace table of an espresso block. + +use serde::{Deserialize, Serialize}; + +/// Type definition for a namespace table. +/// TODO: Fill in details. +#[derive(Serialize, Deserialize)] +pub struct NsTable; + +/// Type definition for namespace id. +pub type NamespaceId = u32; + +impl AsRef<[u8]> for NsTable { + fn as_ref(&self) -> &[u8] { + &[] + } +} From dddd849d604a486a36354d200a403dc31534ad53 Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 10 Jul 2024 23:01:47 -0400 Subject: [PATCH 02/44] ns filtering gadget --- sp1/program/src/main.rs | 17 +++++++--- sp1/script/src/bin/prove.rs | 38 ++++++++++++++++++---- sp1/utils/Cargo.lock | 65 +++++++++++++++++++++++++++++++++++++ sp1/utils/Cargo.toml | 1 + sp1/utils/src/ns_table.rs | 58 ++++++++++++++++++++++++++++++--- 5 files changed, 165 insertions(+), 14 deletions(-) create mode 100644 sp1/utils/Cargo.lock diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index d9f20f8..6f75f80 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -18,10 +18,19 @@ use espresso_derivation_utils::ns_table::{NamespaceId, NsTable}; pub fn main() { let ns_id = sp1_zkvm::io::read::(); - let _ns_table = sp1_zkvm::io::read::(); - // let vid_comm = sp1::zkvm::io::read::<>(); - // let rollup_comm = sp1::zkvm::io::read::<>(); - // let ns_index = sp1_zkvm::io::read::(); + let ns_table = sp1_zkvm::io::read::(); + // let vid_comm = sp1::zkvm::io::read::<_>(); + // let rollup_comm = sp1::zkvm::io::read::<_>(); + let ns_index = sp1_zkvm::io::read::(); + let ns_range_start = sp1_zkvm::io::read::(); + let ns_range_end = sp1_zkvm::io::read::(); + // let pay_load = sp1_zkvm::io::read::(); + + let (id, start, end) = ns_table.read(ns_index).expect("Index out of bound."); + assert!(id == ns_id); + assert!(ns_range_start == start); + assert!(ns_range_end == end); sp1_zkvm::io::commit(&ns_id); + sp1_zkvm::io::commit(&ns_table); } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 1f5adc9..01bc623 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -15,7 +15,7 @@ use std::path::PathBuf; use clap::Parser; -use espresso_derivation_utils::ns_table::NamespaceId; +use espresso_derivation_utils::ns_table::NsTable; use serde::{Deserialize, Serialize}; use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1VerifyingKey}; @@ -29,13 +29,34 @@ pub const ELF: &[u8] = include_bytes!("../../../program/elf/riscv32im-succinct-z #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] struct ProveArgs { + #[clap(long, default_value = "29")] + ns_id: u32, + + #[clap(long, value_parser = parse_bytes, default_value = "010000001D0000000B000000")] + ns_table: NsTable, + + #[clap(long, default_value = "0")] + ns_index: u32, + #[clap(long, default_value = "0")] - ns_id: NamespaceId, + ns_range_start: u32, + + #[clap(long, default_value = "11")] + ns_range_end: u32, #[clap(long, default_value = "false")] evm: bool, } +fn parse_bytes(arg: &str) -> Result { + Ok(NsTable( + (0..arg.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&arg[i..i + 2], 16)) + .collect::, _>>()?, + )) +} + fn main() { // Setup the logger. sp1_sdk::utils::setup_logger(); @@ -52,8 +73,15 @@ fn main() { // Setup the inputs.; let mut stdin = SP1Stdin::new(); stdin.write(&args.ns_id); + stdin.write(&args.ns_table); + stdin.write(&args.ns_index); + stdin.write(&args.ns_range_start); + stdin.write(&args.ns_range_end); - println!("Namespace ID: {:#x}", args.ns_id); + println!( + "Index: {}, Namespace ID: {:#x}, range: ({}, {})", + args.ns_index, args.ns_id, args.ns_range_start, args.ns_range_end + ); if args.evm { // Generate the proof. @@ -64,9 +92,7 @@ fn main() { } else { // Generate the proof. let proof = client.prove(&pk, stdin).expect("failed to generate proof"); - let ns_id = u32::from_le_bytes(proof.public_values.as_slice().try_into().unwrap()); - println!("Successfully generated proof!"); - println!("Namespace ID: {:#x}", ns_id); + println!("Public values: {:?}", proof.public_values.as_slice()); // Verify the proof. client.verify(&proof, &vk).expect("failed to verify proof"); diff --git a/sp1/utils/Cargo.lock b/sp1/utils/Cargo.lock new file mode 100644 index 0000000..a2fb630 --- /dev/null +++ b/sp1/utils/Cargo.lock @@ -0,0 +1,65 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "espresso-derivation-utils" +version = "0.1.0" +dependencies = [ + "serde", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml index 060ba5a..ba72b1f 100644 --- a/sp1/utils/Cargo.toml +++ b/sp1/utils/Cargo.toml @@ -1,3 +1,4 @@ +[workspace] [package] name = "espresso-derivation-utils" version = "0.1.0" diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs index 2e5e277..0f718cc 100644 --- a/sp1/utils/src/ns_table.rs +++ b/sp1/utils/src/ns_table.rs @@ -1,11 +1,17 @@ //! Definitions and utilities for namespace table of an espresso block. - +//! Most of contents are "unwrapped" from espresso-sequencer repo. use serde::{Deserialize, Serialize}; +/// Byte lengths for the different items that could appear in a namespace table. +const NUM_NSS_BYTE_LEN: usize = 4; +const NS_OFFSET_BYTE_LEN: usize = 4; + +// Byte length for namespace IDs. +const NS_ID_BYTE_LEN: usize = 4; + /// Type definition for a namespace table. -/// TODO: Fill in details. -#[derive(Serialize, Deserialize)] -pub struct NsTable; +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct NsTable(pub Vec); /// Type definition for namespace id. pub type NamespaceId = u32; @@ -15,3 +21,47 @@ impl AsRef<[u8]> for NsTable { &[] } } + +impl NsTable { + /// Number of entries in the namespace table. + /// + /// Defined as the maximum number of entries that could fit in the namespace + /// table, ignoring what's declared in the table header. + #[allow(clippy::len_without_is_empty)] + pub fn len(&self) -> u32 { + u32::from_le_bytes(self.0[..NUM_NSS_BYTE_LEN].try_into().unwrap()) + } + + /// Read from namespace table given an index. + /// + /// Return None if there's no corresponding entry, or a triple + /// (id, start, end) which specifies the namespacd ID and its range in the + /// payload [start, end). + pub fn read(&self, index: u32) -> Option<(u32, u32, u32)> { + if index >= self.len() { + None + } else { + Some(self.read_unchecked(index)) + } + } + + /// Read from namespace table given an index without range check. + /// + /// Return a triple (id, start, end) which specifies the namespacd ID and its + /// range [start, end) in the payload. + pub fn read_unchecked(&self, index: u32) -> (u32, u32, u32) { + let pos = index as usize * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN) + NUM_NSS_BYTE_LEN; + let id = u32::from_le_bytes(self.0[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); + let end = u32::from_le_bytes( + self.0[pos + NS_ID_BYTE_LEN..pos + NS_OFFSET_BYTE_LEN + NS_ID_BYTE_LEN] + .try_into() + .unwrap(), + ); + let start = if index == 0 { + 0u32 + } else { + u32::from_le_bytes(self.0[pos - NS_OFFSET_BYTE_LEN..pos].try_into().unwrap()) + }; + (id, start, end) + } +} From 3084c1a3d08b0b4a97df368001130a6f685882bf Mon Sep 17 00:00:00 2001 From: MRain Date: Thu, 11 Jul 2024 09:17:09 -0400 Subject: [PATCH 03/44] cargo workspace clean --- Cargo.toml | 2 +- sp1/program/Cargo.lock | 1581 ---------------------------------------- sp1/utils/Cargo.lock | 65 -- sp1/utils/Cargo.toml | 1 - 4 files changed, 1 insertion(+), 1648 deletions(-) delete mode 100644 sp1/program/Cargo.lock delete mode 100644 sp1/utils/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index b44f14c..e437d8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] resolver = "2" -members = ["sp1/program", "sp1/script"] +members = ["sp1/program", "sp1/script", "sp1/utils"] diff --git a/sp1/program/Cargo.lock b/sp1/program/Cargo.lock deleted file mode 100644 index 1bc0b67..0000000 --- a/sp1/program/Cargo.lock +++ /dev/null @@ -1,1581 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "alloy-primitives" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f783611babedbbe90db3478c120fb5f5daacceffc210b39adc0af4fe0da70bad" -dependencies = [ - "alloy-rlp", - "bytes", - "cfg-if", - "const-hex", - "derive_more", - "hex-literal", - "itoa", - "k256", - "keccak-asm", - "proptest", - "rand", - "ruint", - "serde", - "tiny-keccak", -] - -[[package]] -name = "alloy-rlp" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a43b18702501396fa9bcdeecd533bc85fac75150d308fc0f6800a01e6234a003" -dependencies = [ - "arrayvec", - "bytes", -] - -[[package]] -name = "alloy-sol-macro" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bad41a7c19498e3f6079f7744656328699f8ea3e783bdd10d85788cd439f572" -dependencies = [ - "alloy-sol-macro-expander", - "alloy-sol-macro-input", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.68", -] - -[[package]] -name = "alloy-sol-macro-expander" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9899da7d011b4fe4c406a524ed3e3f963797dbc93b45479d60341d3a27b252" -dependencies = [ - "alloy-sol-macro-input", - "const-hex", - "heck", - "indexmap", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.68", - "syn-solidity", - "tiny-keccak", -] - -[[package]] -name = "alloy-sol-macro-input" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d595768fdc61331a132b6f65db41afae41b9b97d36c21eb1b955c422a7e60" -dependencies = [ - "const-hex", - "dunce", - "heck", - "proc-macro2", - "quote", - "syn 2.0.68", - "syn-solidity", -] - -[[package]] -name = "alloy-sol-types" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49042c6d3b66a9fe6b2b5a8bf0d39fc2ae1ee0310a2a26ffedd79fb097878dd" -dependencies = [ - "alloy-primitives", - "alloy-sol-macro", - "const-hex", - "serde", -] - -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - -[[package]] -name = "ark-ff" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" -dependencies = [ - "ark-ff-asm 0.3.0", - "ark-ff-macros 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", - "derivative", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.3.3", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm 0.4.2", - "ark-ff-macros 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", - "derivative", - "digest 0.10.7", - "itertools", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.4.0", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" -dependencies = [ - "num-bigint", - "num-traits", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-serialize" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" -dependencies = [ - "ark-std 0.3.0", - "digest 0.9.0", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-std 0.4.0", - "digest 0.10.7", - "num-bigint", -] - -[[package]] -name = "ark-std" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" -dependencies = [ - "num-traits", - "rand", -] - -[[package]] -name = "ark-std" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand", -] - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "auto_impl" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.68", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - -[[package]] -name = "cc" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "const-hex" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" -dependencies = [ - "cfg-if", - "cpufeatures", - "hex", - "proptest", - "serde", -] - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_more" -version = "0.99.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version 0.4.0", - "syn 2.0.68", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "dunce" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core", - "sec1", - "subtle", - "tap", - "zeroize", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "espresso-derivation" -version = "0.1.0" -dependencies = [ - "alloy-sol-types", - "espresso-derivation-utils", - "sp1-zkvm", -] - -[[package]] -name = "espresso-derivation-utils" -version = "0.1.0" -dependencies = [ - "serde", -] - -[[package]] -name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - -[[package]] -name = "fastrlp" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", -] - -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "bitvec", - "rand_core", - "subtle", -] - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "k256" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2", - "signature", -] - -[[package]] -name = "keccak-asm" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" -dependencies = [ - "digest 0.10.7", - "sha3-asm", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "parity-scale-codec" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pest" -version = "2.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "primitive-types" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" -dependencies = [ - "fixed-hash", - "impl-codec", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" -dependencies = [ - "toml_edit", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proptest" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" -dependencies = [ - "bit-set", - "bit-vec", - "bitflags", - "lazy_static", - "num-traits", - "rand", - "rand_chacha", - "rand_xorshift", - "regex-syntax", - "rusty-fork", - "tempfile", - "unarray", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_xorshift" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" -dependencies = [ - "rand_core", -] - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "rlp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" -dependencies = [ - "bytes", - "rustc-hex", -] - -[[package]] -name = "ruint" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" -dependencies = [ - "alloy-rlp", - "ark-ff 0.3.0", - "ark-ff 0.4.2", - "bytes", - "fastrlp", - "num-bigint", - "num-traits", - "parity-scale-codec", - "primitive-types", - "proptest", - "rand", - "rlp", - "ruint-macro", - "serde", - "valuable", - "zeroize", -] - -[[package]] -name = "ruint-macro" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.23", -] - -[[package]] -name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "rusty-fork" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" -dependencies = [ - "fnv", - "quick-error", - "tempfile", - "wait-timeout", -] - -[[package]] -name = "scale-info" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" -dependencies = [ - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - -[[package]] -name = "serde" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.68", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha3-asm" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" -dependencies = [ - "cc", - "cfg-if", -] - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest 0.10.7", - "rand_core", -] - -[[package]] -name = "snowbridge-amcl" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460a9ed63cdf03c1b9847e8a12a5f5ba19c4efd5869e4a737e05be25d7c427e5" -dependencies = [ - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "sp1-precompiles" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" -dependencies = [ - "anyhow", - "bincode", - "cfg-if", - "getrandom", - "hex", - "k256", - "num", - "rand", - "serde", - "snowbridge-amcl", -] - -[[package]] -name = "sp1-zkvm" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.7-testnet#b35be4200e7369bd987d8ba101f70dd7dec3df1a" -dependencies = [ - "bincode", - "cfg-if", - "getrandom", - "k256", - "lazy_static", - "libm", - "once_cell", - "rand", - "serde", - "sha2", - "sp1-precompiles", -] - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn-solidity" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d71e19bca02c807c9faa67b5a47673ff231b6e7449b251695188522f1dc44b2" -dependencies = [ - "paste", - "proc-macro2", - "quote", - "syn 2.0.68", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "tempfile" -version = "3.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" -dependencies = [ - "cfg-if", - "fastrand", - "rustix", - "windows-sys", -] - -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.68", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "toml_datetime" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" - -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.68", -] diff --git a/sp1/utils/Cargo.lock b/sp1/utils/Cargo.lock deleted file mode 100644 index a2fb630..0000000 --- a/sp1/utils/Cargo.lock +++ /dev/null @@ -1,65 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "espresso-derivation-utils" -version = "0.1.0" -dependencies = [ - "serde", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "serde" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "syn" -version = "2.0.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml index ba72b1f..060ba5a 100644 --- a/sp1/utils/Cargo.toml +++ b/sp1/utils/Cargo.toml @@ -1,4 +1,3 @@ -[workspace] [package] name = "espresso-derivation-utils" version = "0.1.0" From f22f0938b243eaac7b3040a7c4cfd116e67b6c19 Mon Sep 17 00:00:00 2001 From: MRain Date: Thu, 11 Jul 2024 10:51:49 -0400 Subject: [PATCH 04/44] scan for ns_id --- .gitignore | 1 + sp1/program/src/main.rs | 24 ++++++++++++------------ sp1/script/src/bin/prove.rs | 25 +++++++++---------------- sp1/utils/src/ns_table.rs | 32 +++++++++++++++++++++++--------- 4 files changed, 45 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index b4c6efd..3b20ac8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ tmp/ .pre-commit-config.yaml target/ +elf/ diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 6f75f80..0598b02 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -4,33 +4,33 @@ // - Namespace table (public) // - VID commitment (public) // - Rollup transactions commitment (public) -// - An index in the namespace table for the rollup -// - Two offsets that defines the namespace range // - All transactions // This program proves that -// - The namespace table contains an entry of this namespace ID. +// - The namespace table contains an entry of this namespace ID which specifies its byte range in the payload. // - Transactions given by two offsets in the (VID) committed payload are the ones committed by the rollup. #![no_main] sp1_zkvm::entrypoint!(main); -use espresso_derivation_utils::ns_table::{NamespaceId, NsTable}; +use espresso_derivation_utils::ns_table::NsTable; pub fn main() { - let ns_id = sp1_zkvm::io::read::(); + let ns_id = sp1_zkvm::io::read::(); let ns_table = sp1_zkvm::io::read::(); // let vid_comm = sp1::zkvm::io::read::<_>(); // let rollup_comm = sp1::zkvm::io::read::<_>(); - let ns_index = sp1_zkvm::io::read::(); - let ns_range_start = sp1_zkvm::io::read::(); - let ns_range_end = sp1_zkvm::io::read::(); // let pay_load = sp1_zkvm::io::read::(); - let (id, start, end) = ns_table.read(ns_index).expect("Index out of bound."); - assert!(id == ns_id); - assert!(ns_range_start == start); - assert!(ns_range_end == end); + let (ns_range_start, ns_range_end) = ns_table + .scan_for_id(ns_id) + .expect("Namespace ID not found."); + + std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); sp1_zkvm::io::commit(&ns_id); sp1_zkvm::io::commit(&ns_table); + + // Temporarily commit the range + sp1_zkvm::io::commit(&ns_range_start); + sp1_zkvm::io::commit(&ns_range_end); } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 01bc623..644b42f 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -22,7 +22,7 @@ use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1Verify /// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. /// /// This file is generated by running `cargo prove build` inside the `program` directory. -pub const ELF: &[u8] = include_bytes!("../../../program/elf/riscv32im-succinct-zkvm-elf"); +pub const ELF: &[u8] = include_bytes!("../../../../elf/riscv32im-succinct-zkvm-elf"); /// The arguments for the prove command. // TODO: fill in other details @@ -35,15 +35,14 @@ struct ProveArgs { #[clap(long, value_parser = parse_bytes, default_value = "010000001D0000000B000000")] ns_table: NsTable, - #[clap(long, default_value = "0")] - ns_index: u32, + // #[clap(long, default_value = "0")] + // ns_index: u32, - #[clap(long, default_value = "0")] - ns_range_start: u32, - - #[clap(long, default_value = "11")] - ns_range_end: u32, + // #[clap(long, default_value = "0")] + // ns_range_start: u32, + // #[clap(long, default_value = "11")] + // ns_range_end: u32, #[clap(long, default_value = "false")] evm: bool, } @@ -74,14 +73,8 @@ fn main() { let mut stdin = SP1Stdin::new(); stdin.write(&args.ns_id); stdin.write(&args.ns_table); - stdin.write(&args.ns_index); - stdin.write(&args.ns_range_start); - stdin.write(&args.ns_range_end); - - println!( - "Index: {}, Namespace ID: {:#x}, range: ({}, {})", - args.ns_index, args.ns_id, args.ns_range_start, args.ns_range_end - ); + + println!("Namespace ID: {:#X}", args.ns_id); if args.evm { // Generate the proof. diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs index 0f718cc..d0be6c3 100644 --- a/sp1/utils/src/ns_table.rs +++ b/sp1/utils/src/ns_table.rs @@ -13,15 +13,6 @@ const NS_ID_BYTE_LEN: usize = 4; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct NsTable(pub Vec); -/// Type definition for namespace id. -pub type NamespaceId = u32; - -impl AsRef<[u8]> for NsTable { - fn as_ref(&self) -> &[u8] { - &[] - } -} - impl NsTable { /// Number of entries in the namespace table. /// @@ -64,4 +55,27 @@ impl NsTable { }; (id, start, end) } + + /// Read from namespace table given a namespace ID. + /// + /// Return None if given ID is not present, or a tuple (start, end) specifying + /// its bytes range [start, end) in the payload. + pub fn scan_for_id(&self, id: u32) -> Option<(u32, u32)> { + let mut pos = NUM_NSS_BYTE_LEN; + let mut last_offset = 0u32; + for _ in 0..self.len() { + let cur_id = u32::from_le_bytes(self.0[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); + let cur_offset = u32::from_le_bytes( + self.0[pos + NS_ID_BYTE_LEN..pos + NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN] + .try_into() + .unwrap(), + ); + if id == cur_id { + return Some((last_offset, cur_offset)); + } + last_offset = cur_offset; + pos += NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN; + } + None + } } From 8c7db61e2d01833093beb2724f68627888b658ad Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 17 Jul 2024 15:31:40 -0400 Subject: [PATCH 05/44] namespace table filtering & mock input --- Cargo.lock | 495 ++++++++++++++++++++++++++++++++- Cargo.toml | 15 + sp1/program/Cargo.toml | 2 + sp1/program/src/main.rs | 42 ++- sp1/script/Cargo.toml | 4 +- sp1/script/src/bin/prove.rs | 47 +++- sp1/utils/Cargo.toml | 10 +- sp1/utils/src/block.rs | 4 + sp1/utils/src/block/header.rs | 224 +++++++++++++++ sp1/utils/src/block/payload.rs | 11 + sp1/utils/src/lib.rs | 1 + sp1/utils/src/ns_table.rs | 13 + 12 files changed, 846 insertions(+), 22 deletions(-) create mode 100644 sp1/utils/src/block.rs create mode 100644 sp1/utils/src/block/header.rs create mode 100644 sp1/utils/src/block/payload.rs diff --git a/Cargo.lock b/Cargo.lock index bdb12bc..ada526c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -246,6 +246,133 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "ark-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bw6-761" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0605daf0cc5aa2034b78d008aaf159f56901d92a52ee4f6ecdfdac4f426700" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "sha2", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "rayon", + "zeroize", +] + +[[package]] +name = "ark-ed-on-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b10d901b9ac4b38f9c32beacedfadcdd64e46f8d7f8e88c1ae1060022cf6f6c6" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ed-on-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6d678bb98a7e4f825bd4e332e93ac4f5a114ce2e3340dee4d7dc1c7ab5b323" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ed-on-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71892f265d01650e34988a546b37ea1d2ba1da162a639597a03d1550f26004d8" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -280,6 +407,7 @@ dependencies = [ "num-bigint 0.4.6", "num-traits", "paste", + "rayon", "rustc_version 0.4.0", "zeroize", ] @@ -329,6 +457,31 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "rayon", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "tracing", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -345,11 +498,35 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ + "ark-serialize-derive", "ark-std 0.4.0", "digest 0.10.7", "num-bigint 0.4.6", ] +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -368,6 +545,7 @@ checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", "rand", + "rayon", ] [[package]] @@ -552,7 +730,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.12.1", + "itertools 0.11.0", "lazy_static", "lazycell", "log", @@ -894,6 +1072,24 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +[[package]] +name = "committable" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93c989a517928da3346fce6f6f75794285420edc3ef42c995ced45519f065acd" +dependencies = [ + "arbitrary", + "ark-serialize 0.4.2", + "bitvec", + "derivative", + "derive_more", + "funty", + "hex", + "serde", + "sha3", + "tagged-base64", +] + [[package]] name = "console" version = "0.15.8" @@ -963,6 +1159,12 @@ dependencies = [ "libc", ] +[[package]] +name = "crc-any" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1117,6 +1319,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.70", +] + [[package]] name = "derive_more" version = "0.99.18" @@ -1172,6 +1385,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.70", +] + [[package]] name = "downcast-rs" version = "1.2.1" @@ -1184,6 +1408,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + [[package]] name = "ecdsa" version = "0.16.9" @@ -1203,6 +1433,9 @@ name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +dependencies = [ + "serde", +] [[package]] name = "elf" @@ -1284,7 +1517,9 @@ name = "espresso-derivation" version = "0.1.0" dependencies = [ "alloy-sol-types", + "committable", "espresso-derivation-utils", + "jf-merkle-tree", "sp1-zkvm", ] @@ -1294,7 +1529,9 @@ version = "0.1.0" dependencies = [ "alloy-sol-types", "clap", + "committable", "espresso-derivation-utils", + "jf-merkle-tree", "serde", "serde_json", "sp1-helper", @@ -1306,7 +1543,15 @@ dependencies = [ name = "espresso-derivation-utils" version = "0.1.0" dependencies = [ + "ark-bn254", + "ark-serialize 0.4.2", + "committable", + "either", + "jf-merkle-tree", + "jf-vid", + "primitive-types", "serde", + "sha2", ] [[package]] @@ -1824,6 +2069,7 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ + "serde", "typenum", "version_check", "zeroize", @@ -1977,6 +2223,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -2362,6 +2617,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -2386,6 +2650,172 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jf-commitment" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-std 0.4.0", +] + +[[package]] +name = "jf-crhf" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "jf-merkle-tree" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "displaydoc", + "hashbrown 0.14.5", + "itertools 0.12.1", + "jf-relation", + "jf-rescue", + "jf-utils", + "num-bigint 0.4.6", + "num-traits", + "serde", + "sha3", + "tagged-base64", +] + +[[package]] +name = "jf-pcs" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "displaydoc", + "itertools 0.12.1", + "jf-utils", + "merlin", + "rayon", +] + +[[package]] +name = "jf-prf" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "jf-relation" +version = "0.4.4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-bn254", + "ark-bw6-761", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "displaydoc", + "downcast-rs", + "dyn-clone", + "hashbrown 0.14.5", + "itertools 0.12.1", + "jf-utils", + "num-bigint 0.4.6", + "rand_chacha", + "rayon", +] + +[[package]] +name = "jf-rescue" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-bn254", + "ark-bw6-761", + "ark-crypto-primitives", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-381", + "ark-ed-on-bn254", + "ark-ff 0.4.2", + "ark-std 0.4.0", + "displaydoc", + "itertools 0.12.1", + "jf-commitment", + "jf-crhf", + "jf-prf", + "jf-relation", + "jf-utils", +] + +[[package]] +name = "jf-utils" +version = "0.4.4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-381", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "digest 0.10.7", + "displaydoc", + "rand_chacha", + "rayon", + "serde", + "sha2", + "tagged-base64", +] + +[[package]] +name = "jf-vid" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "anyhow", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "displaydoc", + "generic-array 0.14.7", + "itertools 0.12.1", + "jf-merkle-tree", + "jf-pcs", + "jf-utils", + "rayon", + "serde", + "tagged-base64", +] + [[package]] name = "jobserver" version = "0.1.31" @@ -2585,6 +3015,18 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2145869435ace5ea6ea3d35f59be559317ec9a0d04e1812d5f185a87b6d36f1a" +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + [[package]] name = "mime" version = "0.3.17" @@ -3488,7 +3930,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.11.0", "proc-macro2", "quote", "syn 2.0.70", @@ -4395,6 +4837,27 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "snafu" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b835cb902660db3415a672d862905e791e54d306c6e8189168c7f3d9ae1c79d" +dependencies = [ + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d1e02fca405f6280643174a50c942219f0bbf4dbf7d480f1dd864d6f211ae5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.70", +] + [[package]] name = "snowbridge-amcl" version = "1.0.2" @@ -4907,6 +5370,32 @@ dependencies = [ "libc", ] +[[package]] +name = "tagged-base64" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b74bbf1db405a3fd2c6f8cd403bfa14727faa145925efe3012fa270b61551f1" +dependencies = [ + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "base64 0.22.1", + "crc-any", + "serde", + "snafu", + "tagged-base64-macros", + "wasm-bindgen", +] + +[[package]] +name = "tagged-base64-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcdea3c0150898fad2f7196a173ec3264f7fc455ba570939163c558f48ae85ac" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "tap" version = "1.0.1" @@ -5447,6 +5936,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", + "serde", + "serde_json", "wasm-bindgen-macro", ] diff --git a/Cargo.toml b/Cargo.toml index e437d8e..f694d0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,18 @@ [workspace] resolver = "2" members = ["sp1/program", "sp1/script", "sp1/utils"] + +[workspace.dependencies] +ark-bn254 = "0.4" +ark-serialize = "0.4" +serde = { version = "1.0", features = ["derive"] } +committable = "0.2" +either = { version = "1.13", features = ["serde"] } +jf-merkle-tree = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } +jf-vid = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } +sha2 = "0.10" +primitive-types = { version = "0.12", features = ["serde"] } diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 0507ec7..72cbdfe 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -5,5 +5,7 @@ edition = "2021" [dependencies] alloy-sol-types = "0.7.2" +committable = { workspace = true } sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } espresso-derivation-utils = { path = "../utils" } +jf-merkle-tree = { workspace = true } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 0598b02..b7af0f2 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -12,24 +12,48 @@ #![no_main] sp1_zkvm::entrypoint!(main); -use espresso_derivation_utils::ns_table::NsTable; +use committable::Committable; +use espresso_derivation_utils::block::header::{ + BlockHeader, BlockMerkleCommitment, BlockMerkleTree, BlockMerkleTreeProof, +}; +use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; pub fn main() { + // Block Merkle tree commitment in the light client state + let block_mt_comm = sp1_zkvm::io::read::(); + // public input + sp1_zkvm::io::commit(&block_mt_comm); + + // The block header + let header = sp1_zkvm::io::read::(); + // Make block height public + sp1_zkvm::io::commit(&header.height); + + // A membership proof for a given block header in the block Merkle tree + let mt_proof = sp1_zkvm::io::read::(); + + // Assert that the membership proof is valid + assert_eq!(block_mt_comm.height() + 1, mt_proof.proof.len()); + assert!( + BlockMerkleTree::verify(block_mt_comm.digest(), mt_proof.pos, &mt_proof) + .unwrap() + .is_ok() + ); + // Assert that the header is the one committed in the block Merkle tree + assert_eq!(&header.commit(), mt_proof.elem().unwrap()); + + // let header = mt_proof.elem().unwrap(); let ns_id = sp1_zkvm::io::read::(); - let ns_table = sp1_zkvm::io::read::(); - // let vid_comm = sp1::zkvm::io::read::<_>(); - // let rollup_comm = sp1::zkvm::io::read::<_>(); - // let pay_load = sp1_zkvm::io::read::(); + // public input + sp1_zkvm::io::commit(&ns_id); - let (ns_range_start, ns_range_end) = ns_table + let (ns_range_start, ns_range_end) = header + .ns_table .scan_for_id(ns_id) .expect("Namespace ID not found."); std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); - sp1_zkvm::io::commit(&ns_id); - sp1_zkvm::io::commit(&ns_table); - // Temporarily commit the range sp1_zkvm::io::commit(&ns_range_start); sp1_zkvm::io::commit(&ns_range_end); diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index c206b45..86930a2 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -10,11 +10,13 @@ path = "src/bin/prove.rs" [dependencies] alloy-sol-types = "0.7.2" clap = { version = "4.0", features = ["derive", "env"] } -serde = { version = "1.0", default-features = false, features = ["derive"] } +committable = { workspace = true } +serde = { workspace = true } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } tracing = "0.1.40" espresso-derivation-utils = { path = "../utils" } +jf-merkle-tree = { workspace = true } [build-dependencies] sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 644b42f..81ee580 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -15,7 +15,12 @@ use std::path::PathBuf; use clap::Parser; -use espresso_derivation_utils::ns_table::NsTable; +use committable::Committable; +use espresso_derivation_utils::{ + block::header::{BlockHeader, BlockMerkleTree}, + ns_table::NsTable, +}; +use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; use serde::{Deserialize, Serialize}; use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1VerifyingKey}; @@ -29,11 +34,11 @@ pub const ELF: &[u8] = include_bytes!("../../../../elf/riscv32im-succinct-zkvm-e #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] struct ProveArgs { - #[clap(long, default_value = "29")] - ns_id: u32, + // #[clap(long, default_value = "29")] + // ns_id: u32, - #[clap(long, value_parser = parse_bytes, default_value = "010000001D0000000B000000")] - ns_table: NsTable, + // #[clap(long, value_parser = parse_bytes, default_value = "010000001D0000000B000000")] + // ns_table: NsTable, // #[clap(long, default_value = "0")] // ns_index: u32, @@ -56,6 +61,33 @@ fn parse_bytes(arg: &str) -> Result { )) } +fn mock_inputs(stdin: &mut SP1Stdin) { + let mut block_merkle_tree = BlockMerkleTree::new(32); + let header = BlockHeader { + chain_config: Default::default(), + height: 10, + timestamp: 10, + l1_head: 10, + l1_finalized: None, + payload_commitment: Default::default(), + builder_commitment: [0u8; 32], + ns_table: parse_bytes("010000001D0000000B000000").unwrap(), + block_merkle_tree_root: block_merkle_tree.commitment(), + fee_merkle_tree_root: vec![0u8; 32], + fee_info: Default::default(), + }; + block_merkle_tree.push(header.commit()).unwrap(); + + let (_, mt_proof) = block_merkle_tree.lookup(0).expect_ok().unwrap(); + + let ns_id = 29u32; + + stdin.write(&block_merkle_tree.commitment()); + stdin.write(&header); + stdin.write(&mt_proof); + stdin.write(&ns_id); +} + fn main() { // Setup the logger. sp1_sdk::utils::setup_logger(); @@ -71,10 +103,7 @@ fn main() { // Setup the inputs.; let mut stdin = SP1Stdin::new(); - stdin.write(&args.ns_id); - stdin.write(&args.ns_table); - - println!("Namespace ID: {:#X}", args.ns_id); + mock_inputs(&mut stdin); if args.evm { // Generate the proof. diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml index 060ba5a..0d9edbf 100644 --- a/sp1/utils/Cargo.toml +++ b/sp1/utils/Cargo.toml @@ -4,4 +4,12 @@ version = "0.1.0" edition = "2021" [dependencies] -serde = { version = "1.0.195", features = ["derive"] } +ark-bn254 = { workspace = true } +ark-serialize = { workspace = true } +serde = { workspace = true } +committable = { workspace = true } +either = { workspace = true } +jf-merkle-tree = { workspace = true } +jf-vid = { workspace = true } +sha2 = { workspace = true } +primitive-types = { workspace = true } diff --git a/sp1/utils/src/block.rs b/sp1/utils/src/block.rs new file mode 100644 index 0000000..6f79f5d --- /dev/null +++ b/sp1/utils/src/block.rs @@ -0,0 +1,4 @@ +//! Definitions of necessary parts of an espresso block. + +pub mod header; +pub mod payload; diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs new file mode 100644 index 0000000..978accc --- /dev/null +++ b/sp1/utils/src/block/header.rs @@ -0,0 +1,224 @@ +//! Define the header struct of an espresso block. + +use super::payload::VidCommitment; +use crate::ns_table::NsTable; +use ark_serialize::CanonicalSerialize; +use committable::{Commitment, Committable, RawCommitmentBuilder}; +use either::Either; +use jf_merkle_tree::{prelude::LightWeightSHA3MerkleTree, MerkleTreeScheme}; +use primitive_types::{H160, H256, U256}; +use serde::{Deserialize, Serialize}; + +pub type BlockMerkleTree = LightWeightSHA3MerkleTree>; +pub type BlockMerkleTreeProof = ::MembershipProof; +pub type BlockMerkleCommitment = ::Commitment; + +#[derive(Serialize, Deserialize)] +pub struct BlockHeader { + pub chain_config: ResolvableChainConfig, + pub height: u64, + pub timestamp: u64, + + pub l1_head: u64, + + pub l1_finalized: Option, + + pub payload_commitment: VidCommitment, + /// Builder commitment is a Sha256 hash output, 32 bytes. + pub builder_commitment: [u8; 32], + /// A namespace table + pub ns_table: NsTable, + /// Root Commitment of Block Merkle Tree + pub block_merkle_tree_root: BlockMerkleCommitment, + /// Serialized root Commitment of `FeeMerkleTree` + pub fee_merkle_tree_root: Vec, + /// Fee infomation of this block + pub fee_info: FeeInfo, + // Builder signature is not formally part of the header and not committed. +} + +impl Committable for BlockHeader { + fn commit(&self) -> Commitment { + let mut bmt_bytes = vec![]; + self.block_merkle_tree_root + .serialize_with_mode(&mut bmt_bytes, ark_serialize::Compress::Yes) + .unwrap(); + + RawCommitmentBuilder::new(&Self::tag()) + .field("chain_config", self.chain_config.commit()) + .u64_field("height", self.height) + .u64_field("timestamp", self.timestamp) + .u64_field("l1_head", self.l1_head) + .optional("l1_finalized", &self.l1_finalized) + .constant_str("payload_commitment") + .fixed_size_bytes(self.payload_commitment.as_ref().as_ref()) + .constant_str("builder_commitment") + .fixed_size_bytes(&self.builder_commitment) + .field("ns_table", self.ns_table.commit()) + .var_size_field("block_merkle_tree_root", &bmt_bytes) + .var_size_field("fee_merkle_tree_root", &self.fee_merkle_tree_root) + .field("fee_info", self.fee_info.commit()) + .finalize() + } + + fn tag() -> String { + // We use the tag "BLOCK" since blocks are identified by the hash of their header. This will + // thus be more intuitive to users than "HEADER". + "BLOCK".into() + } +} + +#[derive(Hash, Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Default)] +/// `FeeInfo` holds data related to builder fees. +pub struct FeeInfo { + /// Directly using H160 because sp1 program cannot directly depends on ethers crate. + account: H160, + amount: U256, +} +impl FeeInfo { + pub fn account(&self) -> H160 { + self.account + } + + pub fn amount(&self) -> U256 { + self.amount + } +} + +impl Committable for FeeInfo { + fn commit(&self) -> Commitment { + let mut amt_bytes = [0u8; 32]; + self.amount.to_little_endian(&mut amt_bytes); + RawCommitmentBuilder::new(&Self::tag()) + .fixed_size_field("account", &self.account.to_fixed_bytes()) + .fixed_size_field("amount", &amt_bytes) + .finalize() + } + fn tag() -> String { + "FEE_INFO".into() + } +} + +/// Global variables for an Espresso blockchain. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] +pub struct ChainConfig { + /// Espresso chain ID + pub chain_id: U256, + + /// Maximum size in bytes of a block + pub max_block_size: u64, + + /// Minimum fee in WEI per byte of payload + pub base_fee: U256, + + /// Fee contract H160 on L1. + /// + /// This is optional so that fees can easily be toggled on/off, with no need to deploy a + /// contract when they are off. In a future release, after fees are switched on and thoroughly + /// tested, this may be made mandatory. + pub fee_contract: Option, + + /// Account that receives sequencing fees. + /// + /// This account in the Espresso fee ledger will always receive every fee paid in Espresso, + /// regardless of whether or not their is a `fee_contract` deployed. Once deployed, the fee + /// contract can decide what to do with tokens locked in this account in Espresso. + pub fee_recipient: H160, +} + +impl Committable for ChainConfig { + fn tag() -> String { + "CHAIN_CONFIG".to_string() + } + + fn commit(&self) -> Commitment { + let mut chain_id_bytes = [0u8; 32]; + self.chain_id.to_little_endian(&mut chain_id_bytes); + + let mut base_fee_bytes = [0u8; 32]; + self.base_fee.to_little_endian(&mut base_fee_bytes); + + let comm = committable::RawCommitmentBuilder::new(&Self::tag()) + .fixed_size_field("chain_id", &chain_id_bytes) + .u64_field("max_block_size", self.max_block_size) + .fixed_size_field("base_fee", &base_fee_bytes) + .fixed_size_field("fee_recipient", &self.fee_recipient.to_fixed_bytes()); + let comm = if let Some(addr) = self.fee_contract { + comm.u64_field("fee_contract", 1).fixed_size_bytes(&addr.0) + } else { + comm.u64_field("fee_contract", 0) + }; + comm.finalize() + } +} + +#[derive(Clone, Debug, Copy, PartialEq, Deserialize, Serialize, Eq, Hash)] +pub struct ResolvableChainConfig { + chain_config: Either>, +} + +impl Default for ResolvableChainConfig { + fn default() -> Self { + Self { + chain_config: Either::Left(Default::default()), + } + } +} + +impl ResolvableChainConfig { + pub fn commit(&self) -> Commitment { + match self.chain_config { + Either::Left(config) => config.commit(), + Either::Right(commitment) => commitment, + } + } + pub fn resolve(self) -> Option { + match self.chain_config { + Either::Left(config) => Some(config), + Either::Right(_) => None, + } + } +} + +impl From> for ResolvableChainConfig { + fn from(value: Commitment) -> Self { + Self { + chain_config: Either::Right(value), + } + } +} + +impl From for ResolvableChainConfig { + fn from(value: ChainConfig) -> Self { + Self { + chain_config: Either::Left(value), + } + } +} + +#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, Hash, PartialEq, Eq)] +pub struct L1BlockInfo { + pub number: u64, + pub timestamp: U256, + pub hash: H256, +} + +impl Committable for L1BlockInfo { + fn commit(&self) -> Commitment { + let mut timestamp = [0u8; 32]; + self.timestamp.to_little_endian(&mut timestamp); + + RawCommitmentBuilder::new(&Self::tag()) + .u64_field("number", self.number) + // `RawCommitmentBuilder` doesn't have a `u256_field` method, so we simulate it: + .constant_str("timestamp") + .fixed_size_bytes(×tamp) + .constant_str("hash") + .fixed_size_bytes(&self.hash.0) + .finalize() + } + + fn tag() -> String { + "L1BLOCK".into() + } +} diff --git a/sp1/utils/src/block/payload.rs b/sp1/utils/src/block/payload.rs new file mode 100644 index 0000000..f9da7d6 --- /dev/null +++ b/sp1/utils/src/block/payload.rs @@ -0,0 +1,11 @@ +//! Define the payload for an espresso block. +use ark_bn254::Bn254; +use jf_vid::{advz::Advz, VidScheme}; +use sha2::Sha256; +pub struct Payload(pub Vec); + +/// Private type alias for the EC pairing type parameter for [`Advz`]. +type E = Bn254; +/// Private type alias for the hash type parameter for [`Advz`]. +type H = Sha256; +pub type VidCommitment = as VidScheme>::Commit; diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index de3dd9e..00b6e09 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -1,4 +1,5 @@ //! Espresso derivation utilities for rollup integration. +pub mod block; pub mod ns_table; // TODO: modules for espresso block and rollup transaction hash diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs index d0be6c3..e1278de 100644 --- a/sp1/utils/src/ns_table.rs +++ b/sp1/utils/src/ns_table.rs @@ -1,5 +1,6 @@ //! Definitions and utilities for namespace table of an espresso block. //! Most of contents are "unwrapped" from espresso-sequencer repo. +use committable::{Commitment, Committable, RawCommitmentBuilder}; use serde::{Deserialize, Serialize}; /// Byte lengths for the different items that could appear in a namespace table. @@ -79,3 +80,15 @@ impl NsTable { None } } + +impl Committable for NsTable { + fn commit(&self) -> Commitment { + RawCommitmentBuilder::new(&Self::tag()) + .var_size_bytes(&self.0) + .finalize() + } + + fn tag() -> String { + "NSTABLE".into() + } +} From 4e487a090298b23869586807ae4fa37049f28cde Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 17 Jul 2024 16:21:43 -0400 Subject: [PATCH 06/44] update document; wrap public inputs --- Cargo.lock | 2 +- sp1/program/Cargo.toml | 1 - sp1/program/src/main.rs | 51 ++++++++++++++++++++++--------------- sp1/script/Cargo.toml | 1 + sp1/script/src/bin/prove.rs | 13 ++++++++-- sp1/utils/src/block.rs | 4 +++ sp1/utils/src/lib.rs | 13 +++++++++- 7 files changed, 59 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ada526c..9f9c7e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1516,7 +1516,6 @@ dependencies = [ name = "espresso-derivation" version = "0.1.0" dependencies = [ - "alloy-sol-types", "committable", "espresso-derivation-utils", "jf-merkle-tree", @@ -1528,6 +1527,7 @@ name = "espresso-derivation-prover" version = "0.1.0" dependencies = [ "alloy-sol-types", + "bincode", "clap", "committable", "espresso-derivation-utils", diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 72cbdfe..ab133f6 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -4,7 +4,6 @@ name = "espresso-derivation" edition = "2021" [dependencies] -alloy-sol-types = "0.7.2" committable = { workspace = true } sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } espresso-derivation-utils = { path = "../utils" } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index b7af0f2..f1dcb2d 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -1,41 +1,43 @@ //! This program proves that the executed transactions are correctly derived from an espresso block. // Inputs: -// - Namespace ID (public) -// - Namespace table (public) -// - VID commitment (public) -// - Rollup transactions commitment (public) -// - All transactions +// - (Public) A block Merkle tree commitment, from a light client state +// - (Private) A block header containing the block height (public), namespace table, payload VID commitment, etc. +// - (Private) A membership proof for the header above +// - (Public) Namespace ID +// - (Private) Payload data of this block, with all transactions +// - (Public) Rollup transactions commitment // This program proves that -// - The namespace table contains an entry of this namespace ID which specifies its byte range in the payload. -// - Transactions given by two offsets in the (VID) committed payload are the ones committed by the rollup. +// - There's a block header who is a member of the committed block Merkle tree in the light client state. +// - Given namespace ID appears in the namespace table of this block header, and it specifies a range in the payload data. +// - The corresponding transactions of rollup commitment are exactly the ones in the given range of the payload data, where the payload data are committed in the block header. #![no_main] sp1_zkvm::entrypoint!(main); use committable::Committable; -use espresso_derivation_utils::block::header::{ - BlockHeader, BlockMerkleCommitment, BlockMerkleTree, BlockMerkleTreeProof, +use espresso_derivation_utils::{ + block::{ + header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTree, BlockMerkleTreeProof}, + RollupCommitment, + }, + PublicInputs, }; use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; pub fn main() { // Block Merkle tree commitment in the light client state - let block_mt_comm = sp1_zkvm::io::read::(); - // public input - sp1_zkvm::io::commit(&block_mt_comm); + let block_merkle_tree_comm = sp1_zkvm::io::read::(); // The block header let header = sp1_zkvm::io::read::(); - // Make block height public - sp1_zkvm::io::commit(&header.height); // A membership proof for a given block header in the block Merkle tree let mt_proof = sp1_zkvm::io::read::(); // Assert that the membership proof is valid - assert_eq!(block_mt_comm.height() + 1, mt_proof.proof.len()); + assert_eq!(block_merkle_tree_comm.height() + 1, mt_proof.proof.len()); assert!( - BlockMerkleTree::verify(block_mt_comm.digest(), mt_proof.pos, &mt_proof) + BlockMerkleTree::verify(block_merkle_tree_comm.digest(), mt_proof.pos, &mt_proof) .unwrap() .is_ok() ); @@ -44,8 +46,6 @@ pub fn main() { // let header = mt_proof.elem().unwrap(); let ns_id = sp1_zkvm::io::read::(); - // public input - sp1_zkvm::io::commit(&ns_id); let (ns_range_start, ns_range_end) = header .ns_table @@ -54,7 +54,16 @@ pub fn main() { std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); - // Temporarily commit the range - sp1_zkvm::io::commit(&ns_range_start); - sp1_zkvm::io::commit(&ns_range_end); + // Rollup transaction commitment + let rollup_txs_comm = sp1_zkvm::io::read::(); + // TODO: commitment equivalence + + // Expose the public inputs + let public_inputs = PublicInputs { + block_merkle_tree_comm, + block_height: header.height, + ns_id, + rollup_txs_comm, + }; + sp1_zkvm::io::commit(&public_inputs); } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index 86930a2..3c75745 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -9,6 +9,7 @@ path = "src/bin/prove.rs" [dependencies] alloy-sol-types = "0.7.2" +bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } serde = { workspace = true } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 81ee580..5e5abbb 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -17,8 +17,12 @@ use std::path::PathBuf; use clap::Parser; use committable::Committable; use espresso_derivation_utils::{ - block::header::{BlockHeader, BlockMerkleTree}, + block::{ + header::{BlockHeader, BlockMerkleTree}, + RollupCommitment, + }, ns_table::NsTable, + PublicInputs, }; use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; use serde::{Deserialize, Serialize}; @@ -82,10 +86,13 @@ fn mock_inputs(stdin: &mut SP1Stdin) { let ns_id = 29u32; + let rollup_txs_comm: RollupCommitment = Default::default(); + stdin.write(&block_merkle_tree.commitment()); stdin.write(&header); stdin.write(&mt_proof); stdin.write(&ns_id); + stdin.write(&rollup_txs_comm); } fn main() { @@ -114,7 +121,9 @@ fn main() { } else { // Generate the proof. let proof = client.prove(&pk, stdin).expect("failed to generate proof"); - println!("Public values: {:?}", proof.public_values.as_slice()); + let public_values: PublicInputs = + bincode::deserialize(proof.public_values.as_slice()).unwrap(); + println!("Public values: {:?}", public_values); // Verify the proof. client.verify(&proof, &vk).expect("failed to verify proof"); diff --git a/sp1/utils/src/block.rs b/sp1/utils/src/block.rs index 6f79f5d..9197328 100644 --- a/sp1/utils/src/block.rs +++ b/sp1/utils/src/block.rs @@ -1,4 +1,8 @@ //! Definitions of necessary parts of an espresso block. +use primitive_types::H256; + pub mod header; pub mod payload; + +pub type RollupCommitment = H256; diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 00b6e09..5c5e76e 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -1,5 +1,16 @@ //! Espresso derivation utilities for rollup integration. +use block::{header::BlockMerkleCommitment, RollupCommitment}; +use serde::{Deserialize, Serialize}; + pub mod block; pub mod ns_table; -// TODO: modules for espresso block and rollup transaction hash + +#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug)] +/// Public inputs +pub struct PublicInputs { + pub block_merkle_tree_comm: BlockMerkleCommitment, + pub block_height: u64, + pub ns_id: u32, + pub rollup_txs_comm: RollupCommitment, +} From c154d9da039838eaeec07035e98b22c738cfd249 Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Wed, 17 Jul 2024 19:52:02 -0400 Subject: [PATCH 07/44] Update sp1/program/src/main.rs Co-authored-by: Gus Gutoski --- sp1/program/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index f1dcb2d..ea8afc4 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -44,7 +44,6 @@ pub fn main() { // Assert that the header is the one committed in the block Merkle tree assert_eq!(&header.commit(), mt_proof.elem().unwrap()); - // let header = mt_proof.elem().unwrap(); let ns_id = sp1_zkvm::io::read::(); let (ns_range_start, ns_range_end) = header From 73f8100c8b604ea8d10772537e5411597807efde Mon Sep 17 00:00:00 2001 From: MRain Date: Thu, 18 Jul 2024 16:02:07 -0400 Subject: [PATCH 08/44] global mark --- sp1/program/src/main.rs | 39 ++++++++++++++++++++++++++------------- sp1/utils/src/lib.rs | 4 ++++ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index ea8afc4..f77930e 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -24,7 +24,11 @@ use espresso_derivation_utils::{ }; use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; +#[allow(unused_assignments)] pub fn main() { + // Indicates that whether all inputs are consistent + let mut consistency_check = true; + // Block Merkle tree commitment in the light client state let block_merkle_tree_comm = sp1_zkvm::io::read::(); @@ -35,23 +39,31 @@ pub fn main() { let mt_proof = sp1_zkvm::io::read::(); // Assert that the membership proof is valid - assert_eq!(block_merkle_tree_comm.height() + 1, mt_proof.proof.len()); - assert!( - BlockMerkleTree::verify(block_merkle_tree_comm.digest(), mt_proof.pos, &mt_proof) - .unwrap() - .is_ok() - ); + if block_merkle_tree_comm.height() + 1 != mt_proof.proof.len() + || !BlockMerkleTree::verify(block_merkle_tree_comm.digest(), mt_proof.pos, &mt_proof) + .is_ok_and(|result| result.is_ok()) + { + std::println!("Incorrect membership proof for block Merkle tree"); + consistency_check = false; + } // Assert that the header is the one committed in the block Merkle tree - assert_eq!(&header.commit(), mt_proof.elem().unwrap()); + if !mt_proof.elem().is_some_and(|elem| elem == &header.commit()) { + std::println!("Membership proof is not consistent with the given block header."); + consistency_check = false; + } let ns_id = sp1_zkvm::io::read::(); - let (ns_range_start, ns_range_end) = header - .ns_table - .scan_for_id(ns_id) - .expect("Namespace ID not found."); - - std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); + match header.ns_table.scan_for_id(ns_id) { + None => { + std::println!("Namespace ID not found in the block"); + consistency_check = false; + } + Some((ns_range_start, ns_range_end)) => { + std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); + todo!() + } + } // Rollup transaction commitment let rollup_txs_comm = sp1_zkvm::io::read::(); @@ -63,6 +75,7 @@ pub fn main() { block_height: header.height, ns_id, rollup_txs_comm, + consistency_check, }; sp1_zkvm::io::commit(&public_inputs); } diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 5c5e76e..d5301f1 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -1,4 +1,7 @@ //! Espresso derivation utilities for rollup integration. +// Ideally we could directly import types and structs from `espresso-sequencer`` repo. However, one of its dependency, +// `HotShot` requires a minimum rust version of [1.76.0](https://github.com/EspressoSystems/HotShot/blob/4713af7704f88f38a8a69b708acd4677f76d8ff1/Cargo.toml#L5). +// This is incompatible with the current sp1 rust toolchain 1.75.0. use block::{header::BlockMerkleCommitment, RollupCommitment}; use serde::{Deserialize, Serialize}; @@ -13,4 +16,5 @@ pub struct PublicInputs { pub block_height: u64, pub ns_id: u32, pub rollup_txs_comm: RollupCommitment, + pub consistency_check: bool, } From 827665f6023ef202c82c8924d08fe9e4e4494bf1 Mon Sep 17 00:00:00 2001 From: MRain Date: Tue, 23 Jul 2024 21:30:47 -0400 Subject: [PATCH 09/44] tried namespace proof --- Cargo.lock | 117 +++++++++++++++++++++++++++++---- Cargo.toml | 4 ++ sp1/program/Cargo.toml | 1 + sp1/program/src/main.rs | 58 +++++++++++----- sp1/utils/Cargo.toml | 2 + sp1/utils/src/block/payload.rs | 58 +++++++++++++++- 6 files changed, 208 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9f9c7e9..c5f10d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -471,6 +471,24 @@ dependencies = [ "rayon", ] +[[package]] +name = "ark-poly-commit" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a741492629ffcd228337676dc223a28551aa6792eedb8a2a22c767f00df6c89" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "rayon", +] + [[package]] name = "ark-relations" version = "0.4.0" @@ -480,6 +498,7 @@ dependencies = [ "ark-ff 0.4.2", "ark-std 0.4.0", "tracing", + "tracing-subscriber 0.2.25", ] [[package]] @@ -527,6 +546,28 @@ dependencies = [ "ark-std 0.4.0", ] +[[package]] +name = "ark-srs" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6e9a7036d369a637b2b9f871bc06cefe52a947c98e898dbafab26548f8aa22" +dependencies = [ + "anyhow", + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly-commit", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "directories", + "hex-literal", + "rand", + "sha2", + "tracing", + "tracing-subscriber 0.3.18", + "ureq", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -730,7 +771,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.11.0", + "itertools 0.12.1", "lazy_static", "lazycell", "log", @@ -1165,6 +1206,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1364,6 +1414,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs" version = "5.0.1" @@ -1519,6 +1578,7 @@ dependencies = [ "committable", "espresso-derivation-utils", "jf-merkle-tree", + "jf-vid", "sp1-zkvm", ] @@ -1545,9 +1605,11 @@ version = "0.1.0" dependencies = [ "ark-bn254", "ark-serialize 0.4.2", + "ark-srs", "committable", "either", "jf-merkle-tree", + "jf-pcs", "jf-vid", "primitive-types", "serde", @@ -1903,6 +1965,16 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2617,15 +2689,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -3930,7 +3993,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.70", @@ -4403,6 +4466,7 @@ version = "0.23.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" dependencies = [ + "log", "once_cell", "ring 0.17.8", "rustls-pki-types", @@ -4933,7 +4997,7 @@ dependencies = [ "thiserror", "tracing", "tracing-forest", - "tracing-subscriber", + "tracing-subscriber 0.3.18", "typenum", "web-time", ] @@ -5029,7 +5093,7 @@ dependencies = [ "thiserror", "tokio", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] @@ -5692,7 +5756,7 @@ dependencies = [ "smallvec", "thiserror", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] @@ -5716,6 +5780,15 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + [[package]] name = "tracing-subscriber" version = "0.3.18" @@ -5837,6 +5910,22 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" +dependencies = [ + "base64 0.22.1", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "url", + "webpki-roots", +] + [[package]] name = "url" version = "2.5.2" diff --git a/Cargo.toml b/Cargo.toml index f694d0c..5fab0bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = ["sp1/program", "sp1/script", "sp1/utils"] [workspace.dependencies] ark-bn254 = "0.4" ark-serialize = "0.4" +ark-srs = "0.3.1" serde = { version = "1.0", features = ["derive"] } committable = "0.2" either = { version = "1.13", features = ["serde"] } @@ -14,5 +15,8 @@ jf-merkle-tree = { version = "0.1", git = "https://github.com/EspressoSystems/je jf-vid = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ "std", ] } +jf-pcs = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } sha2 = "0.10" primitive-types = { version = "0.12", features = ["serde"] } diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index ab133f6..2273ce6 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -8,3 +8,4 @@ committable = { workspace = true } sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } +jf-vid = { workspace = true } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index f77930e..d24f4ba 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -18,32 +18,45 @@ use committable::Committable; use espresso_derivation_utils::{ block::{ header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTree, BlockMerkleTreeProof}, + payload::{rollup_commit, vid_scheme, NsProof, Payload, Vid, VidCommon}, RollupCommitment, }, PublicInputs, }; use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; +use jf_vid::{ + payload_prover::{PayloadProver, Statement}, + VidScheme, +}; #[allow(unused_assignments)] pub fn main() { - // Indicates that whether all inputs are consistent - let mut consistency_check = true; - // Block Merkle tree commitment in the light client state let block_merkle_tree_comm = sp1_zkvm::io::read::(); - // The block header let header = sp1_zkvm::io::read::(); - // A membership proof for a given block header in the block Merkle tree let mt_proof = sp1_zkvm::io::read::(); + // Namespace ID + let ns_id = sp1_zkvm::io::read::(); + // Payload bytes for this namespace ID + let ns_payload = sp1_zkvm::io::read::(); + // Common data associated with the payload disperser + let vid_common = sp1_zkvm::io::read::(); + // Namespace proof for this payload + let ns_proof = sp1_zkvm::io::read::(); + // Rollup transaction commitment + let rollup_txs_comm = sp1_zkvm::io::read::(); + + // Indicates that whether all inputs are consistent + let mut consistency_check = true; // Assert that the membership proof is valid if block_merkle_tree_comm.height() + 1 != mt_proof.proof.len() || !BlockMerkleTree::verify(block_merkle_tree_comm.digest(), mt_proof.pos, &mt_proof) .is_ok_and(|result| result.is_ok()) { - std::println!("Incorrect membership proof for block Merkle tree"); + std::println!("Incorrect membership proof for block Merkle tree."); consistency_check = false; } // Assert that the header is the one committed in the block Merkle tree @@ -52,23 +65,38 @@ pub fn main() { consistency_check = false; } - let ns_id = sp1_zkvm::io::read::(); - match header.ns_table.scan_for_id(ns_id) { None => { - std::println!("Namespace ID not found in the block"); + std::println!("Namespace ID not found in the block."); consistency_check = false; } Some((ns_range_start, ns_range_end)) => { std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); - todo!() + // Calculate the rollup transaction commmitment + if rollup_commit(&ns_payload) != rollup_txs_comm { + std::println!("Rollup commitment mismatch."); + consistency_check = false; + } + + let num_storage_nodes = ::get_num_storage_nodes(&vid_common); + let vid = vid_scheme(num_storage_nodes); + if !vid + .payload_verify( + Statement { + payload_subslice: &ns_payload.0, + range: (ns_range_start as usize..ns_range_end as usize), + commit: &header.payload_commitment, + common: &vid_common, + }, + &ns_proof, + ) + .is_ok_and(|result| result.is_ok()) + { + std::println!("Failed namespace proof."); + consistency_check = false; + } } } - - // Rollup transaction commitment - let rollup_txs_comm = sp1_zkvm::io::read::(); - // TODO: commitment equivalence - // Expose the public inputs let public_inputs = PublicInputs { block_merkle_tree_comm, diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml index 0d9edbf..ef63fa4 100644 --- a/sp1/utils/Cargo.toml +++ b/sp1/utils/Cargo.toml @@ -6,10 +6,12 @@ edition = "2021" [dependencies] ark-bn254 = { workspace = true } ark-serialize = { workspace = true } +ark-srs = { workspace = true } serde = { workspace = true } committable = { workspace = true } either = { workspace = true } jf-merkle-tree = { workspace = true } jf-vid = { workspace = true } +jf-pcs = { workspace = true } sha2 = { workspace = true } primitive-types = { workspace = true } diff --git a/sp1/utils/src/block/payload.rs b/sp1/utils/src/block/payload.rs index f9da7d6..f44ff8a 100644 --- a/sp1/utils/src/block/payload.rs +++ b/sp1/utils/src/block/payload.rs @@ -1,11 +1,63 @@ //! Define the payload for an espresso block. use ark_bn254::Bn254; -use jf_vid::{advz::Advz, VidScheme}; -use sha2::Sha256; +use jf_pcs::{ + prelude::UnivariateUniversalParams, univariate_kzg::UnivariateKzgPCS, + PolynomialCommitmentScheme, +}; +use jf_vid::{ + advz::{payload_prover::LargeRangeProof, Advz}, + VidScheme, +}; +use serde::{Deserialize, Serialize}; +use sha2::{Digest, Sha256}; + +use super::RollupCommitment; + +#[derive(Debug, Serialize, Deserialize)] pub struct Payload(pub Vec); /// Private type alias for the EC pairing type parameter for [`Advz`]. type E = Bn254; /// Private type alias for the hash type parameter for [`Advz`]. type H = Sha256; -pub type VidCommitment = as VidScheme>::Commit; + +/// VidScheme +pub type Vid = Advz; + +/// VID commitment type +pub type VidCommitment = ::Commit; + +/// Public parameters for VID scheme +pub type VidCommon = ::Common; + +/// Namespace Proof type +pub type NsProof = LargeRangeProof< as PolynomialCommitmentScheme>::Evaluation>; + +/// Dummy rollup payload commit +pub fn rollup_commit(payload: &Payload) -> RollupCommitment { + let bytes: [u8; 32] = Sha256::digest(&payload.0).into(); + bytes.into() +} + +pub const SRS_DEGREE: usize = 2u64.pow(20) as usize + 2; + +/// Construct a VID scheme given the number of storage nodes. +/// Copied from espresso-sequencer repo +pub fn vid_scheme(num_storage_nodes: u32) -> Vid { + let recovery_threshold = 1 << num_storage_nodes.ilog2(); + + let srs = { + let srs = ark_srs::kzg10::aztec20::setup(SRS_DEGREE).expect("Aztec SRS failed to load"); + UnivariateUniversalParams { + powers_of_g: srs.powers_of_g, + h: srs.h, + beta_h: srs.beta_h, + powers_of_h: vec![srs.h, srs.beta_h], + } + }; + + Advz::new(num_storage_nodes, recovery_threshold, srs).unwrap_or_else(|err| { + panic!("advz construction failure: (num_storage nodes,recovery_threshold)=({num_storage_nodes},{recovery_threshold}); \ + error: {err}") + }) +} From 62f744547b26016884830acf60732e468a8427a0 Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 24 Jul 2024 12:59:04 -0400 Subject: [PATCH 10/44] redo srs --- Cargo.lock | 230 +++++++++++++++++---------------- Cargo.toml | 1 - sp1/program/src/main.rs | 21 ++- sp1/script/Cargo.toml | 3 + sp1/script/src/bin/prove.rs | 40 +++++- sp1/utils/Cargo.toml | 5 +- sp1/utils/src/block/payload.rs | 27 ++-- sp1/utils/src/lib.rs | 5 +- 8 files changed, 196 insertions(+), 136 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5f10d1..bd9a688 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -135,7 +135,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "syn-solidity", "tiny-keccak", ] @@ -151,7 +151,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "syn-solidity", ] @@ -591,9 +591,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" @@ -609,7 +609,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -637,7 +637,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -657,7 +657,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "hyper 1.4.1", "hyper-util", @@ -690,7 +690,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", @@ -781,7 +781,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.70", + "syn 2.0.72", "which", ] @@ -846,16 +846,16 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +checksum = "e9ec96fe9a81b5e365f9db71fe00edc4fe4ca2cc7dcb7861f0603012a7caa210" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", - "rayon", + "rayon-core", ] [[package]] @@ -916,9 +916,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" dependencies = [ "serde", ] @@ -957,13 +957,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.0" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" dependencies = [ "jobserver", "libc", - "once_cell", ] [[package]] @@ -1017,9 +1016,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.9" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +checksum = "8f6b81fb3c84f5563d509c59b5a48d935f689e993afa90fe39047f05adef9142" dependencies = [ "clap_builder", "clap_derive", @@ -1027,9 +1026,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.9" +version = "4.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +checksum = "5ca6706fd5224857d9ac5eb9355f6683563cc0541c7cd9d014043b57cbec78ac" dependencies = [ "anstream", "anstyle", @@ -1046,7 +1045,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1300,7 +1299,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1324,7 +1323,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1335,7 +1334,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1377,7 +1376,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1390,7 +1389,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1452,7 +1451,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1587,11 +1586,14 @@ name = "espresso-derivation-prover" version = "0.1.0" dependencies = [ "alloy-sol-types", + "ark-srs", "bincode", "clap", "committable", "espresso-derivation-utils", "jf-merkle-tree", + "jf-pcs", + "jf-vid", "serde", "serde_json", "sp1-helper", @@ -1605,11 +1607,12 @@ version = "0.1.0" dependencies = [ "ark-bn254", "ark-serialize 0.4.2", - "ark-srs", + "bincode", "committable", "either", "jf-merkle-tree", "jf-pcs", + "jf-utils", "jf-vid", "primitive-types", "serde", @@ -1748,7 +1751,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.70", + "syn 2.0.72", "toml", "walkdir", ] @@ -1766,7 +1769,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -1792,7 +1795,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.70", + "syn 2.0.72", "tempfile", "thiserror", "tiny-keccak", @@ -2077,7 +2080,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -2400,9 +2403,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http 1.1.0", @@ -2417,7 +2420,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -2468,7 +2471,7 @@ dependencies = [ "futures-util", "h2 0.4.5", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "httparse", "httpdate", "itoa", @@ -2522,7 +2525,7 @@ dependencies = [ "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "hyper 1.4.1", "pin-project-lite", "socket2", @@ -2881,9 +2884,9 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -2993,9 +2996,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -3113,13 +3116,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.11" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3305,7 +3309,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3325,9 +3329,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" dependencies = [ "memchr", ] @@ -3365,9 +3369,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -3386,7 +3390,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3397,9 +3401,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -3831,7 +3835,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3864,9 +3868,9 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" [[package]] name = "powerfmt" @@ -3887,7 +3891,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -3996,7 +4000,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -4041,14 +4045,13 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" dependencies = [ "libc", "once_cell", "socket2", - "tracing", "windows-sys 0.52.0", ] @@ -4137,9 +4140,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ "bitflags 2.6.0", ] @@ -4248,7 +4251,7 @@ dependencies = [ "futures-util", "h2 0.4.5", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "hyper 1.4.1", "hyper-rustls", @@ -4462,9 +4465,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.11" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ "log", "once_cell", @@ -4493,9 +4496,9 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.102.5" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring 0.17.8", "rustls-pki-types", @@ -4570,9 +4573,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.2" +version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af947d0ca10a2f3e00c7ec1b515b7c83e5cb3fa62d4c11a64301d9eec54440e9" +checksum = "1fadf67e3cf23f8b11a6c8c48a16cb2437381503615acd91094ec7b4686a5a53" dependencies = [ "sdd", ] @@ -4606,9 +4609,9 @@ dependencies = [ [[package]] name = "sdd" -version = "0.2.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d" +checksum = "85f05a494052771fc5bd0619742363b5e24e5ad72ab3111ec2e27925b8edc5f3" [[package]] name = "sec1" @@ -4626,9 +4629,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", "core-foundation", @@ -4639,9 +4642,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -4703,7 +4706,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -4750,9 +4753,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.3" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73139bc5ec2d45e6c5fd85be5a46949c1c39a4c18e56915f5eb4c12f975e377" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ "base64 0.22.1", "chrono", @@ -4768,14 +4771,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.3" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b80d3d6b56b64335c0180e5ffde23b3c5e08c14c585b51a15bd0e95393f46703" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -4800,7 +4803,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -4919,7 +4922,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5349,7 +5352,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5380,9 +5383,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.70" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -5398,7 +5401,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5480,22 +5483,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5567,32 +5570,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "d040ac2b29ab03b09d4129c2f5bbd012a3ac2f79d38ff506a4bf8dd34b0eac8a" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -5631,14 +5633,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "ac2caab0bf757388c6c0ae23b3293fdb463fee59434529014f85e3263b995c28" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.15", + "toml_edit 0.22.16", ] [[package]] @@ -5674,15 +5676,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.15" +version = "0.22.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" +checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" dependencies = [ "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.13", + "winnow 0.6.15", ] [[package]] @@ -5733,7 +5735,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -6041,7 +6043,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "wasm-bindgen-shared", ] @@ -6075,7 +6077,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6330,9 +6332,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "557404e450152cd6795bb558bca69e43c585055f4606e3bcae5894fc6dac9ba0" dependencies = [ "memchr", ] @@ -6402,7 +6404,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] @@ -6422,7 +6424,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.72", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 5fab0bf..56d7245 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ members = ["sp1/program", "sp1/script", "sp1/utils"] [workspace.dependencies] ark-bn254 = "0.4" ark-serialize = "0.4" -ark-srs = "0.3.1" serde = { version = "1.0", features = ["derive"] } committable = "0.2" either = { version = "1.13", features = ["serde"] } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index d24f4ba..0a80244 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -4,7 +4,10 @@ // - (Private) A block header containing the block height (public), namespace table, payload VID commitment, etc. // - (Private) A membership proof for the header above // - (Public) Namespace ID -// - (Private) Payload data of this block, with all transactions +// - (Private) Payload data of this rollup +// - (Private) Public parameters (SRS) for VID scheme, whose hash is made public +// - (Public) Common data associated with the VID disperse +// - (Private) A namespace of the given payload. // - (Public) Rollup transactions commitment // This program proves that // - There's a block header who is a member of the committed block Merkle tree in the light client state. @@ -18,7 +21,10 @@ use committable::Committable; use espresso_derivation_utils::{ block::{ header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTree, BlockMerkleTreeProof}, - payload::{rollup_commit, vid_scheme, NsProof, Payload, Vid, VidCommon}, + payload::{ + compute_vid_param_hash, rollup_commit, vid_scheme, NsProof, Payload, Vid, VidCommon, + VidParam, + }, RollupCommitment, }, PublicInputs, @@ -41,6 +47,8 @@ pub fn main() { let ns_id = sp1_zkvm::io::read::(); // Payload bytes for this namespace ID let ns_payload = sp1_zkvm::io::read::(); + // Public parameter for the VID scheme + let vid_param = sp1_zkvm::io::read::(); // Common data associated with the payload disperser let vid_common = sp1_zkvm::io::read::(); // Namespace proof for this payload @@ -48,6 +56,8 @@ pub fn main() { // Rollup transaction commitment let rollup_txs_comm = sp1_zkvm::io::read::(); + std::println!("All inputs are loaded"); + // Indicates that whether all inputs are consistent let mut consistency_check = true; @@ -78,8 +88,9 @@ pub fn main() { consistency_check = false; } + // Namespace proof w.r.t the VidCommitment let num_storage_nodes = ::get_num_storage_nodes(&vid_common); - let vid = vid_scheme(num_storage_nodes); + let vid = vid_scheme(num_storage_nodes, &vid_param); if !vid .payload_verify( Statement { @@ -97,6 +108,8 @@ pub fn main() { } } } + // commit the vid param + let vid_param_hash = compute_vid_param_hash(&vid_param); // Expose the public inputs let public_inputs = PublicInputs { block_merkle_tree_comm, @@ -104,6 +117,8 @@ pub fn main() { ns_id, rollup_txs_comm, consistency_check, + vid_param_hash, + vid_common, }; sp1_zkvm::io::commit(&public_inputs); } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index 3c75745..d137592 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -9,6 +9,7 @@ path = "src/bin/prove.rs" [dependencies] alloy-sol-types = "0.7.2" +ark-srs = "0.3.1" bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } @@ -18,6 +19,8 @@ sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testn tracing = "0.1.40" espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } +jf-pcs = { workspace = true } +jf-vid = { workspace = true } [build-dependencies] sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 5e5abbb..a444310 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -19,12 +19,14 @@ use committable::Committable; use espresso_derivation_utils::{ block::{ header::{BlockHeader, BlockMerkleTree}, - RollupCommitment, + payload::{rollup_commit, vid_scheme, NsProof, Payload, VidParam}, }, ns_table::NsTable, PublicInputs, }; use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; +use jf_pcs::prelude::UnivariateUniversalParams; +use jf_vid::{payload_prover::PayloadProver, VidScheme}; use serde::{Deserialize, Serialize}; use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1VerifyingKey}; @@ -67,13 +69,29 @@ fn parse_bytes(arg: &str) -> Result { fn mock_inputs(stdin: &mut SP1Stdin) { let mut block_merkle_tree = BlockMerkleTree::new(32); + let num_storage_nodes = 10; + + let ns_range = 0..11; + + let payload = Payload(vec![0u8; 20]); + let ns_payload = Payload(vec![0u8; 11]); + + let vid_param = load_srs(); + let mut vid = vid_scheme(num_storage_nodes, &vid_param); + + let vid_disperse = vid.disperse(&payload.0).unwrap(); + let vid_common = vid_disperse.common; + let vid_commitment = vid_disperse.commit; + + let ns_proof: NsProof = vid.payload_proof(payload.0, ns_range).unwrap(); + let header = BlockHeader { chain_config: Default::default(), height: 10, timestamp: 10, l1_head: 10, l1_finalized: None, - payload_commitment: Default::default(), + payload_commitment: vid_commitment, builder_commitment: [0u8; 32], ns_table: parse_bytes("010000001D0000000B000000").unwrap(), block_merkle_tree_root: block_merkle_tree.commitment(), @@ -86,12 +104,16 @@ fn mock_inputs(stdin: &mut SP1Stdin) { let ns_id = 29u32; - let rollup_txs_comm: RollupCommitment = Default::default(); + let rollup_txs_comm = rollup_commit(&ns_payload); stdin.write(&block_merkle_tree.commitment()); stdin.write(&header); stdin.write(&mt_proof); stdin.write(&ns_id); + stdin.write(&ns_payload); + stdin.write(&vid_param); + stdin.write(&vid_common); + stdin.write(&ns_proof); stdin.write(&rollup_txs_comm); } @@ -173,3 +195,15 @@ fn create_plonk_fixture(proof: &SP1PlonkBn254Proof, vk: &SP1VerifyingKey) { ) .expect("failed to write fixture"); } + +fn load_srs() -> VidParam { + // low degree for demo only + pub const SRS_DEGREE: usize = 32usize; + let srs = ark_srs::kzg10::aztec20::setup(SRS_DEGREE).expect("Aztec SRS failed to load"); + VidParam(UnivariateUniversalParams { + powers_of_g: srs.powers_of_g, + h: srs.h, + beta_h: srs.beta_h, + powers_of_h: vec![srs.h, srs.beta_h], + }) +} diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml index ef63fa4..c023ce6 100644 --- a/sp1/utils/Cargo.toml +++ b/sp1/utils/Cargo.toml @@ -6,12 +6,15 @@ edition = "2021" [dependencies] ark-bn254 = { workspace = true } ark-serialize = { workspace = true } -ark-srs = { workspace = true } +bincode = "1.3" serde = { workspace = true } committable = { workspace = true } either = { workspace = true } jf-merkle-tree = { workspace = true } jf-vid = { workspace = true } jf-pcs = { workspace = true } +jf-utils = { version = "0.4.4", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } sha2 = { workspace = true } primitive-types = { workspace = true } diff --git a/sp1/utils/src/block/payload.rs b/sp1/utils/src/block/payload.rs index f44ff8a..475cd06 100644 --- a/sp1/utils/src/block/payload.rs +++ b/sp1/utils/src/block/payload.rs @@ -4,10 +4,12 @@ use jf_pcs::{ prelude::UnivariateUniversalParams, univariate_kzg::UnivariateKzgPCS, PolynomialCommitmentScheme, }; +use jf_utils::canonical; use jf_vid::{ advz::{payload_prover::LargeRangeProof, Advz}, VidScheme, }; +use primitive_types::H256; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; @@ -27,9 +29,13 @@ pub type Vid = Advz; /// VID commitment type pub type VidCommitment = ::Commit; -/// Public parameters for VID scheme +/// Type of common data for VID scheme pub type VidCommon = ::Common; +/// Public parameters to setup the VID scheme +#[derive(Debug, Serialize, Deserialize)] +pub struct VidParam(#[serde(with = "canonical")] pub UnivariateUniversalParams); + /// Namespace Proof type pub type NsProof = LargeRangeProof< as PolynomialCommitmentScheme>::Evaluation>; @@ -39,24 +45,19 @@ pub fn rollup_commit(payload: &Payload) -> RollupCommitment { bytes.into() } +pub fn compute_vid_param_hash(param: &VidParam) -> H256 { + let bytes: [u8; 32] = Sha256::digest(bincode::serialize(param).unwrap()).into(); + bytes.into() +} + pub const SRS_DEGREE: usize = 2u64.pow(20) as usize + 2; /// Construct a VID scheme given the number of storage nodes. /// Copied from espresso-sequencer repo -pub fn vid_scheme(num_storage_nodes: u32) -> Vid { +pub fn vid_scheme(num_storage_nodes: u32, param: &VidParam) -> Vid { let recovery_threshold = 1 << num_storage_nodes.ilog2(); - let srs = { - let srs = ark_srs::kzg10::aztec20::setup(SRS_DEGREE).expect("Aztec SRS failed to load"); - UnivariateUniversalParams { - powers_of_g: srs.powers_of_g, - h: srs.h, - beta_h: srs.beta_h, - powers_of_h: vec![srs.h, srs.beta_h], - } - }; - - Advz::new(num_storage_nodes, recovery_threshold, srs).unwrap_or_else(|err| { + Advz::new(num_storage_nodes, recovery_threshold, ¶m.0).unwrap_or_else(|err| { panic!("advz construction failure: (num_storage nodes,recovery_threshold)=({num_storage_nodes},{recovery_threshold}); \ error: {err}") }) diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index d5301f1..1c2427e 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -3,7 +3,8 @@ // `HotShot` requires a minimum rust version of [1.76.0](https://github.com/EspressoSystems/HotShot/blob/4713af7704f88f38a8a69b708acd4677f76d8ff1/Cargo.toml#L5). // This is incompatible with the current sp1 rust toolchain 1.75.0. -use block::{header::BlockMerkleCommitment, RollupCommitment}; +use block::{header::BlockMerkleCommitment, payload::VidCommon, RollupCommitment}; +use primitive_types::H256; use serde::{Deserialize, Serialize}; pub mod block; @@ -17,4 +18,6 @@ pub struct PublicInputs { pub ns_id: u32, pub rollup_txs_comm: RollupCommitment, pub consistency_check: bool, + pub vid_param_hash: H256, + pub vid_common: VidCommon, } From f375191c97b9432db98b082321809f8daddd3adb Mon Sep 17 00:00:00 2001 From: MRain Date: Thu, 25 Jul 2024 15:53:11 -0400 Subject: [PATCH 11/44] manual (de)ser for VidParam --- sp1/script/src/bin/prove.rs | 5 ++--- sp1/utils/src/block/payload.rs | 36 ++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index a444310..072949f 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -12,8 +12,6 @@ // - Scan through the namespace table for the index of this rollup's namespace ID. // - Feed these input to the program to generate a proof. -use std::path::PathBuf; - use clap::Parser; use committable::Committable; use espresso_derivation_utils::{ @@ -29,6 +27,7 @@ use jf_pcs::prelude::UnivariateUniversalParams; use jf_vid::{payload_prover::PayloadProver, VidScheme}; use serde::{Deserialize, Serialize}; use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1VerifyingKey}; +use std::path::PathBuf; /// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. /// @@ -198,7 +197,7 @@ fn create_plonk_fixture(proof: &SP1PlonkBn254Proof, vk: &SP1VerifyingKey) { fn load_srs() -> VidParam { // low degree for demo only - pub const SRS_DEGREE: usize = 32usize; + pub const SRS_DEGREE: usize = 1024usize; let srs = ark_srs::kzg10::aztec20::setup(SRS_DEGREE).expect("Aztec SRS failed to load"); VidParam(UnivariateUniversalParams { powers_of_g: srs.powers_of_g, diff --git a/sp1/utils/src/block/payload.rs b/sp1/utils/src/block/payload.rs index 475cd06..babb89a 100644 --- a/sp1/utils/src/block/payload.rs +++ b/sp1/utils/src/block/payload.rs @@ -1,16 +1,16 @@ //! Define the payload for an espresso block. use ark_bn254::Bn254; +use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; use jf_pcs::{ prelude::UnivariateUniversalParams, univariate_kzg::UnivariateKzgPCS, PolynomialCommitmentScheme, }; -use jf_utils::canonical; use jf_vid::{ advz::{payload_prover::LargeRangeProof, Advz}, VidScheme, }; use primitive_types::H256; -use serde::{Deserialize, Serialize}; +use serde::{de::Error as _, ser::Error as _, Deserialize, Serialize}; use sha2::{Digest, Sha256}; use super::RollupCommitment; @@ -33,8 +33,36 @@ pub type VidCommitment = ::Commit; pub type VidCommon = ::Common; /// Public parameters to setup the VID scheme -#[derive(Debug, Serialize, Deserialize)] -pub struct VidParam(#[serde(with = "canonical")] pub UnivariateUniversalParams); +/// Manual (de)serialization to avoid the expensive validity check. +#[derive(Debug)] +pub struct VidParam(pub UnivariateUniversalParams); + +impl Serialize for VidParam { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut bytes = Vec::new(); + self.0 + .serialize_uncompressed(&mut bytes) + .map_err(|e| S::Error::custom(format!("{e:?}")))?; + Serialize::serialize(&bytes, serializer) + } +} + +impl<'de> Deserialize<'de> for VidParam { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let bytes = as Deserialize>::deserialize(deserializer)?; + as CanonicalDeserialize>::deserialize_uncompressed_unchecked( + &*bytes, + ) + .map_err(|e| D::Error::custom(format!("{e:?}"))) + .map(VidParam) + } +} /// Namespace Proof type pub type NsProof = LargeRangeProof< as PolynomialCommitmentScheme>::Evaluation>; From e575f397b9c04839eecfd20046b0feb72bce8054 Mon Sep 17 00:00:00 2001 From: MRain Date: Thu, 1 Aug 2024 22:19:42 -0400 Subject: [PATCH 12/44] serde_json for header --- Cargo.lock | 259 ++++++++++++++++++++++++---------- Cargo.toml | 1 + sp1/script/src/bin/prove.rs | 90 +++++++----- sp1/utils/Cargo.toml | 5 + sp1/utils/src/block/header.rs | 191 +++++++++++++++++++++++-- sp1/utils/src/ns_table.rs | 24 ++-- 6 files changed, 435 insertions(+), 135 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd9a688..86382cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,7 +58,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.35", ] [[package]] @@ -131,7 +131,7 @@ dependencies = [ "alloy-sol-macro-input", "const-hex", "heck", - "indexmap 2.2.6", + "indexmap 2.3.0", "proc-macro-error", "proc-macro2", "quote", @@ -193,9 +193,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -208,33 +208,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -741,6 +741,16 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64-bytes" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce54e4e485fa0eed9c3aa5348162be09168f75bb5be7bc6587bcf2a65ee1386" +dependencies = [ + "base64 0.22.1", + "serde", +] + [[package]] name = "base64ct" version = "1.6.0" @@ -904,9 +914,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" [[package]] name = "byteorder" @@ -916,9 +926,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" dependencies = [ "serde", ] @@ -957,9 +967,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" dependencies = [ "jobserver", "libc", @@ -1016,9 +1026,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.10" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6b81fb3c84f5563d509c59b5a48d935f689e993afa90fe39047f05adef9142" +checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" dependencies = [ "clap_builder", "clap_derive", @@ -1026,21 +1036,21 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.10" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca6706fd5224857d9ac5eb9355f6683563cc0541c7cd9d014043b57cbec78ac" +checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.1", ] [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", "proc-macro2", @@ -1050,9 +1060,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "coins-bip32" @@ -1108,9 +1118,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "committable" @@ -1302,14 +1312,38 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core 0.13.4", + "darling_macro 0.13.4", +] + [[package]] name = "darling" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.10", + "darling_macro 0.20.10", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", ] [[package]] @@ -1322,17 +1356,28 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.11.1", "syn 2.0.72", ] +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core 0.13.4", + "quote", + "syn 1.0.109", +] + [[package]] name = "darling_macro" version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core", + "darling_core 0.20.10", "quote", "syn 2.0.72", ] @@ -1607,6 +1652,8 @@ version = "0.1.0" dependencies = [ "ark-bn254", "ark-serialize 0.4.2", + "ark-std 0.4.0", + "base64-bytes", "bincode", "committable", "either", @@ -1616,7 +1663,10 @@ dependencies = [ "jf-vid", "primitive-types", "serde", + "serde_json", + "serde_with 1.14.0", "sha2", + "tagged-base64", ] [[package]] @@ -1787,7 +1837,7 @@ dependencies = [ "ethabi", "generic-array 0.14.7", "k256", - "num_enum 0.7.2", + "num_enum 0.7.3", "once_cell", "open-fastrlp", "rand", @@ -2243,7 +2293,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.6", + "indexmap 2.3.0", "slab", "tokio", "tokio-util", @@ -2262,7 +2312,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.2.6", + "indexmap 2.3.0", "slab", "tokio", "tokio-util", @@ -2631,9 +2681,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2679,9 +2729,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -3281,11 +3331,11 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ - "num_enum_derive 0.7.2", + "num_enum_derive 0.7.3", ] [[package]] @@ -3302,9 +3352,9 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", @@ -3880,9 +3930,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f" +dependencies = [ + "zerocopy 0.6.6", +] [[package]] name = "prettyplease" @@ -4573,9 +4626,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.5" +version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fadf67e3cf23f8b11a6c8c48a16cb2437381503615acd91094ec7b4686a5a53" +checksum = "05ccfb12511cdb770157ace92d7dda771e498445b78f9886e8cdbc5140a4eced" dependencies = [ "sdd", ] @@ -4609,9 +4662,9 @@ dependencies = [ [[package]] name = "sdd" -version = "1.7.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85f05a494052771fc5bd0619742363b5e24e5ad72ab3111ec2e27925b8edc5f3" +checksum = "177258b64c0faaa9ffd3c65cd3262c2bc7e2588dbbd9c1641d0346145c1bbda8" [[package]] name = "sec1" @@ -4711,11 +4764,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -4732,9 +4786,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -4751,6 +4805,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +dependencies = [ + "serde", + "serde_with_macros 1.5.2", +] + [[package]] name = "serde_with" version = "3.9.0" @@ -4761,21 +4825,33 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.3.0", "serde", "serde_derive", "serde_json", - "serde_with_macros", + "serde_with_macros 3.9.0", "time", ] +[[package]] +name = "serde_with_macros" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +dependencies = [ + "darling 0.13.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "serde_with_macros" version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ - "darling", + "darling 0.20.10", "proc-macro2", "quote", "syn 2.0.72", @@ -4989,7 +5065,7 @@ dependencies = [ "rayon-scan", "rrs-lib", "serde", - "serde_with", + "serde_with 3.9.0", "size", "snowbridge-amcl", "sp1-derive", @@ -5171,7 +5247,7 @@ dependencies = [ "p3-symmetric", "p3-util", "serde", - "serde_with", + "serde_with 3.9.0", "sp1-core", "sp1-derive", "sp1-primitives", @@ -5327,6 +5403,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strsim" version = "0.11.1" @@ -5570,9 +5652,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.1" +version = "1.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d040ac2b29ab03b09d4129c2f5bbd012a3ac2f79d38ff506a4bf8dd34b0eac8a" +checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" dependencies = [ "backtrace", "bytes", @@ -5633,21 +5715,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.15" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac2caab0bf757388c6c0ae23b3293fdb463fee59434529014f85e3263b995c28" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.16", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -5658,7 +5740,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.3.0", "toml_datetime", "winnow 0.5.40", ] @@ -5669,22 +5751,22 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.3.0", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.16" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.3.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.15", + "winnow 0.6.18", ] [[package]] @@ -5982,9 +6064,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" @@ -6332,9 +6414,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557404e450152cd6795bb558bca69e43c585055f4606e3bcae5894fc6dac9ba0" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -6387,13 +6469,34 @@ dependencies = [ "tap", ] +[[package]] +name = "zerocopy" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6" +dependencies = [ + "byteorder", + "zerocopy-derive 0.6.6", +] + [[package]] name = "zerocopy" version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.35", +] + +[[package]] +name = "zerocopy-derive" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 56d7245..054f2c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = ["sp1/program", "sp1/script", "sp1/utils"] ark-bn254 = "0.4" ark-serialize = "0.4" serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" committable = "0.2" either = { version = "1.13", features = ["serde"] } jf-merkle-tree = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 072949f..f369bc8 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -39,41 +39,33 @@ pub const ELF: &[u8] = include_bytes!("../../../../elf/riscv32im-succinct-zkvm-e #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] struct ProveArgs { - // #[clap(long, default_value = "29")] - // ns_id: u32, - - // #[clap(long, value_parser = parse_bytes, default_value = "010000001D0000000B000000")] - // ns_table: NsTable, - - // #[clap(long, default_value = "0")] - // ns_index: u32, - - // #[clap(long, default_value = "0")] - // ns_range_start: u32, - - // #[clap(long, default_value = "11")] - // ns_range_end: u32, #[clap(long, default_value = "false")] evm: bool, } +#[allow(dead_code)] fn parse_bytes(arg: &str) -> Result { - Ok(NsTable( - (0..arg.len()) + Ok(NsTable { + bytes: (0..arg.len()) .step_by(2) .map(|i| u8::from_str_radix(&arg[i..i + 2], 16)) .collect::, _>>()?, - )) + }) } fn mock_inputs(stdin: &mut SP1Stdin) { let mut block_merkle_tree = BlockMerkleTree::new(32); let num_storage_nodes = 10; + // Mocking namespace ID + let ns_id = 29u32; + + // 11 bytes for current namespace let ns_range = 0..11; - let payload = Payload(vec![0u8; 20]); - let ns_payload = Payload(vec![0u8; 11]); + // Mocking input for a small payload + let payload = Payload(vec![1u8; 20]); + let ns_payload = Payload(vec![1u8; 11]); let vid_param = load_srs(); let mut vid = vid_scheme(num_storage_nodes, &vid_param); @@ -84,25 +76,53 @@ fn mock_inputs(stdin: &mut SP1Stdin) { let ns_proof: NsProof = vid.payload_proof(payload.0, ns_range).unwrap(); - let header = BlockHeader { - chain_config: Default::default(), - height: 10, - timestamp: 10, - l1_head: 10, - l1_finalized: None, - payload_commitment: vid_commitment, - builder_commitment: [0u8; 32], - ns_table: parse_bytes("010000001D0000000B000000").unwrap(), - block_merkle_tree_root: block_merkle_tree.commitment(), - fee_merkle_tree_root: vec![0u8; 32], - fee_info: Default::default(), - }; + // This is a tweak from an actual block header in Espresso's staging testnet + // Namespace table is hardcoded. + let mut header: BlockHeader = serde_json::from_str( + r#"{ + "chain_config": { + "chain_config": { + "Left": { + "chain_id": "888888888", + "max_block_size": "30000000", + "base_fee": "0", + "fee_contract": null, + "fee_recipient": "0x0000000000000000000000000000000000000000" + } + } + }, + "height": 69781, + "timestamp": 1720789795, + "l1_head": 5113, + "l1_finalized": { + "number": 5088, + "timestamp": "0x669129ec", + "hash": "0xfc4249b13292d2617cc0dec8b0a9a666491d5fecdfe536c929207847364b2b60" + }, + "payload_commitment": "HASH~KpvHX4MuDuZKk10QJctEoUj-fump6NIAO8fJ048RwNJo", + "builder_commitment": "BUILDER_COMMITMENT~tEvs0rxqOiMCvfe2R0omNNaphSlUiEDrb2q0IZpRcgA_", + "ns_table": { + "bytes": "AQAAAB0AAAALAAAA" + }, + "block_merkle_tree_root": "MERKLE_COMM~02gWBSt2tcz9XfOOO6xEVicluWIIP95BW8I11f2graggAAAAAAAAAJUQAQAAAAAAUQ", + "fee_merkle_tree_root": "MERKLE_COMM~yB4_Aqa35_PoskgTpcCR1oVLh6BUdLHIs7erHKWi-usUAAAAAAAAAAEAAAAAAAAAJg", + "fee_info": { + "account": "0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f", + "amount": "0" + }, + "builder_signature": { + "r": "0x6291b473fdac85b9ce7b40b530ea4173ac6e71fd29acffc3cbc97ae637d4404d", + "s": "0x3178fe07d5071df7a7ce4106e6e1e3727aa6edc458db03d1774948bdec32eac6", + "v": 28 + } + }"#, + ).unwrap(); + header.payload_commitment = vid_commitment; + block_merkle_tree.push(header.commit()).unwrap(); let (_, mt_proof) = block_merkle_tree.lookup(0).expect_ok().unwrap(); - let ns_id = 29u32; - let rollup_txs_comm = rollup_commit(&ns_payload); stdin.write(&block_merkle_tree.commitment()); @@ -197,7 +217,7 @@ fn create_plonk_fixture(proof: &SP1PlonkBn254Proof, vk: &SP1VerifyingKey) { fn load_srs() -> VidParam { // low degree for demo only - pub const SRS_DEGREE: usize = 1024usize; + pub const SRS_DEGREE: usize = 8usize; let srs = ark_srs::kzg10::aztec20::setup(SRS_DEGREE).expect("Aztec SRS failed to load"); VidParam(UnivariateUniversalParams { powers_of_g: srs.powers_of_g, diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml index c023ce6..df55673 100644 --- a/sp1/utils/Cargo.toml +++ b/sp1/utils/Cargo.toml @@ -4,10 +4,14 @@ version = "0.1.0" edition = "2021" [dependencies] +ark-std = "0.4" ark-bn254 = { workspace = true } ark-serialize = { workspace = true } +base64-bytes = "0.1" bincode = "1.3" serde = { workspace = true } +serde_with = "1.6" +serde_json = { workspace = true } committable = { workspace = true } either = { workspace = true } jf-merkle-tree = { workspace = true } @@ -18,3 +22,4 @@ jf-utils = { version = "0.4.4", git = "https://github.com/EspressoSystems/jellyf ] } sha2 = { workspace = true } primitive-types = { workspace = true } +tagged-base64 = "0.4" diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs index 978accc..0937f09 100644 --- a/sp1/utils/src/block/header.rs +++ b/sp1/utils/src/block/header.rs @@ -2,18 +2,38 @@ use super::payload::VidCommitment; use crate::ns_table::NsTable; -use ark_serialize::CanonicalSerialize; +use ark_serialize::{ + CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, Valid, Validate, +}; use committable::{Commitment, Committable, RawCommitmentBuilder}; use either::Either; -use jf_merkle_tree::{prelude::LightWeightSHA3MerkleTree, MerkleTreeScheme}; +use jf_merkle_tree::{ + prelude::{LightWeightSHA3MerkleTree, Sha3Digest, Sha3Node, UniversalMerkleTree}, + MerkleTreeScheme, ToTraversalPath, +}; use primitive_types::{H160, H256, U256}; use serde::{Deserialize, Serialize}; +use serde_with::{serde_as, DisplayFromStr}; +use std::io::Read; +use tagged_base64::tagged; +/// Types for block Merkle tree pub type BlockMerkleTree = LightWeightSHA3MerkleTree>; pub type BlockMerkleTreeProof = ::MembershipProof; pub type BlockMerkleCommitment = ::Commitment; -#[derive(Serialize, Deserialize)] +/// Types for Fee Merkle tree. +/// Although it's not used. Imported for convenience of serialization. +pub type FeeMerkleTree = UniversalMerkleTree; +pub type FeeMerkleCommitment = ::Commitment; + +/// Builder commitment. +/// Although it's not used. Imported for convenience of serialization. +#[tagged("BUILDER_COMMITMENT")] +#[derive(Clone, Debug, Hash, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize)] +pub struct BuilderCommitment(pub [u8; 32]); + +#[derive(Debug, Serialize, Deserialize)] pub struct BlockHeader { pub chain_config: ResolvableChainConfig, pub height: u64, @@ -25,13 +45,13 @@ pub struct BlockHeader { pub payload_commitment: VidCommitment, /// Builder commitment is a Sha256 hash output, 32 bytes. - pub builder_commitment: [u8; 32], + pub builder_commitment: BuilderCommitment, /// A namespace table pub ns_table: NsTable, /// Root Commitment of Block Merkle Tree pub block_merkle_tree_root: BlockMerkleCommitment, /// Serialized root Commitment of `FeeMerkleTree` - pub fee_merkle_tree_root: Vec, + pub fee_merkle_tree_root: FeeMerkleCommitment, /// Fee infomation of this block pub fee_info: FeeInfo, // Builder signature is not formally part of the header and not committed. @@ -43,6 +63,10 @@ impl Committable for BlockHeader { self.block_merkle_tree_root .serialize_with_mode(&mut bmt_bytes, ark_serialize::Compress::Yes) .unwrap(); + let mut fmt_bytes = vec![]; + self.fee_merkle_tree_root + .serialize_with_mode(&mut fmt_bytes, ark_serialize::Compress::Yes) + .unwrap(); RawCommitmentBuilder::new(&Self::tag()) .field("chain_config", self.chain_config.commit()) @@ -53,10 +77,10 @@ impl Committable for BlockHeader { .constant_str("payload_commitment") .fixed_size_bytes(self.payload_commitment.as_ref().as_ref()) .constant_str("builder_commitment") - .fixed_size_bytes(&self.builder_commitment) + .fixed_size_bytes(&self.builder_commitment.0) .field("ns_table", self.ns_table.commit()) .var_size_field("block_merkle_tree_root", &bmt_bytes) - .var_size_field("fee_merkle_tree_root", &self.fee_merkle_tree_root) + .var_size_field("fee_merkle_tree_root", &fmt_bytes) .field("fee_info", self.fee_info.commit()) .finalize() } @@ -70,17 +94,17 @@ impl Committable for BlockHeader { #[derive(Hash, Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Default)] /// `FeeInfo` holds data related to builder fees. +/// Although it's not used. Imported for convenience of serialization. pub struct FeeInfo { - /// Directly using H160 because sp1 program cannot directly depends on ethers crate. - account: H160, - amount: U256, + pub account: FeeAccount, + pub amount: FeeAmount, } impl FeeInfo { - pub fn account(&self) -> H160 { + pub fn account(&self) -> FeeAccount { self.account } - pub fn amount(&self) -> U256 { + pub fn amount(&self) -> FeeAmount { self.amount } } @@ -88,9 +112,9 @@ impl FeeInfo { impl Committable for FeeInfo { fn commit(&self) -> Commitment { let mut amt_bytes = [0u8; 32]; - self.amount.to_little_endian(&mut amt_bytes); + self.amount.0.to_little_endian(&mut amt_bytes); RawCommitmentBuilder::new(&Self::tag()) - .fixed_size_field("account", &self.account.to_fixed_bytes()) + .fixed_size_field("account", &self.account.0.to_fixed_bytes()) .fixed_size_field("amount", &amt_bytes) .finalize() } @@ -100,12 +124,14 @@ impl Committable for FeeInfo { } /// Global variables for an Espresso blockchain. +#[serde_as] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] pub struct ChainConfig { /// Espresso chain ID pub chain_id: U256, /// Maximum size in bytes of a block + #[serde_as(as = "DisplayFromStr")] pub max_block_size: u64, /// Minimum fee in WEI per byte of payload @@ -222,3 +248,140 @@ impl Committable for L1BlockInfo { "L1BLOCK".into() } } + +#[derive( + Debug, Copy, Serialize, Deserialize, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default, +)] +pub struct FeeAccount(pub H160); + +impl ToTraversalPath<256> for FeeAccount { + fn to_traversal_path(&self, height: usize) -> Vec { + self.0 + .to_fixed_bytes() + .into_iter() + .take(height) + .map(|i| i as usize) + .collect() + } +} + +impl CanonicalSerialize for FeeAccount { + fn serialize_with_mode( + &self, + mut writer: W, + _compress: Compress, + ) -> Result<(), SerializationError> { + Ok(writer.write_all(&self.0.to_fixed_bytes())?) + } + + fn serialized_size(&self, _compress: Compress) -> usize { + core::mem::size_of::() + } +} +impl CanonicalDeserialize for FeeAccount { + fn deserialize_with_mode( + mut reader: R, + _compress: Compress, + _validate: Validate, + ) -> Result { + let mut bytes = [0u8; core::mem::size_of::()]; + reader.read_exact(&mut bytes)?; + let value = H160::from_slice(&bytes); + Ok(Self(value)) + } +} + +impl Valid for FeeAmount { + fn check(&self) -> Result<(), SerializationError> { + Ok(()) + } +} + +impl Valid for FeeAccount { + fn check(&self) -> Result<(), SerializationError> { + Ok(()) + } +} + +#[derive( + Debug, Copy, Serialize, Deserialize, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default, +)] +pub struct FeeAmount(pub U256); + +impl CanonicalSerialize for FeeAmount { + fn serialize_with_mode( + &self, + mut writer: W, + _compress: Compress, + ) -> Result<(), SerializationError> { + let mut bytes = [0u8; core::mem::size_of::()]; + self.0.to_little_endian(&mut bytes); + Ok(writer.write_all(&bytes)?) + } + + fn serialized_size(&self, _compress: Compress) -> usize { + core::mem::size_of::() + } +} +impl CanonicalDeserialize for FeeAmount { + fn deserialize_with_mode( + mut reader: R, + _compress: Compress, + _validate: Validate, + ) -> Result { + let mut bytes = [0u8; core::mem::size_of::()]; + reader.read_exact(&mut bytes)?; + let value = U256::from_little_endian(&bytes); + Ok(Self(value)) + } +} + +#[cfg(test)] +mod tests { + use super::BlockHeader; + + #[test] + fn test_header_serialization() { + // This string is tweaked from an actual data from Espresso's staging testnet. + let raw_header_string = r#"{ + "chain_config": { + "chain_config": { + "Left": { + "chain_id": "888888888", + "max_block_size": "30000000", + "base_fee": "0", + "fee_contract": null, + "fee_recipient": "0x0000000000000000000000000000000000000000" + } + } + }, + "height": 69781, + "timestamp": 1720789795, + "l1_head": 5113, + "l1_finalized": { + "number": 5088, + "timestamp": "0x669129ec", + "hash": "0xfc4249b13292d2617cc0dec8b0a9a666491d5fecdfe536c929207847364b2b60" + }, + "payload_commitment": "HASH~3XOkaXVZS5e_7xjbbqN22voRnSe_p7Di-U4OPmdCD0JF", + "builder_commitment": "BUILDER_COMMITMENT~tEvs0rxqOiMCvfe2R0omNNaphSlUiEDrb2q0IZpRcgA_", + "ns_table": { + "bytes": "AAAAAA==" + }, + "block_merkle_tree_root": "MERKLE_COMM~02gWBSt2tcz9XfOOO6xEVicluWIIP95BW8I11f2graggAAAAAAAAAJUQAQAAAAAAUQ", + "fee_merkle_tree_root": "MERKLE_COMM~yB4_Aqa35_PoskgTpcCR1oVLh6BUdLHIs7erHKWi-usUAAAAAAAAAAEAAAAAAAAAJg", + "fee_info": { + "account": "0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f", + "amount": "0" + }, + "builder_signature": { + "r": "0x6291b473fdac85b9ce7b40b530ea4173ac6e71fd29acffc3cbc97ae637d4404d", + "s": "0x3178fe07d5071df7a7ce4106e6e1e3727aa6edc458db03d1774948bdec32eac6", + "v": 28 + } + }"#; + + let header: BlockHeader = serde_json::from_str(raw_header_string).unwrap(); + std::println!("{:?}", header); + } +} diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs index e1278de..4db577f 100644 --- a/sp1/utils/src/ns_table.rs +++ b/sp1/utils/src/ns_table.rs @@ -12,7 +12,10 @@ const NS_ID_BYTE_LEN: usize = 4; /// Type definition for a namespace table. #[derive(Serialize, Deserialize, Debug, Clone)] -pub struct NsTable(pub Vec); +pub struct NsTable { + #[serde(with = "base64_bytes")] + pub bytes: Vec, +} impl NsTable { /// Number of entries in the namespace table. @@ -21,7 +24,7 @@ impl NsTable { /// table, ignoring what's declared in the table header. #[allow(clippy::len_without_is_empty)] pub fn len(&self) -> u32 { - u32::from_le_bytes(self.0[..NUM_NSS_BYTE_LEN].try_into().unwrap()) + u32::from_le_bytes(self.bytes[..NUM_NSS_BYTE_LEN].try_into().unwrap()) } /// Read from namespace table given an index. @@ -43,16 +46,20 @@ impl NsTable { /// range [start, end) in the payload. pub fn read_unchecked(&self, index: u32) -> (u32, u32, u32) { let pos = index as usize * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN) + NUM_NSS_BYTE_LEN; - let id = u32::from_le_bytes(self.0[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); + let id = u32::from_le_bytes(self.bytes[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); let end = u32::from_le_bytes( - self.0[pos + NS_ID_BYTE_LEN..pos + NS_OFFSET_BYTE_LEN + NS_ID_BYTE_LEN] + self.bytes[pos + NS_ID_BYTE_LEN..pos + NS_OFFSET_BYTE_LEN + NS_ID_BYTE_LEN] .try_into() .unwrap(), ); let start = if index == 0 { 0u32 } else { - u32::from_le_bytes(self.0[pos - NS_OFFSET_BYTE_LEN..pos].try_into().unwrap()) + u32::from_le_bytes( + self.bytes[pos - NS_OFFSET_BYTE_LEN..pos] + .try_into() + .unwrap(), + ) }; (id, start, end) } @@ -65,9 +72,10 @@ impl NsTable { let mut pos = NUM_NSS_BYTE_LEN; let mut last_offset = 0u32; for _ in 0..self.len() { - let cur_id = u32::from_le_bytes(self.0[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); + let cur_id = + u32::from_le_bytes(self.bytes[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); let cur_offset = u32::from_le_bytes( - self.0[pos + NS_ID_BYTE_LEN..pos + NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN] + self.bytes[pos + NS_ID_BYTE_LEN..pos + NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN] .try_into() .unwrap(), ); @@ -84,7 +92,7 @@ impl NsTable { impl Committable for NsTable { fn commit(&self) -> Commitment { RawCommitmentBuilder::new(&Self::tag()) - .var_size_bytes(&self.0) + .var_size_bytes(&self.bytes) .finalize() } From cc2c6be4b316a73d347a7961c34f8426be316d85 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Thu, 15 Aug 2024 16:18:32 +0800 Subject: [PATCH 13/44] fix: CI passing again --- justfile | 2 +- sp1/contracts/lib/forge-std | 1 + sp1/contracts/lib/sp1-contracts | 1 + sp1/script/src/bin/prove.rs | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) create mode 160000 sp1/contracts/lib/forge-std create mode 160000 sp1/contracts/lib/sp1-contracts diff --git a/justfile b/justfile index 417275a..ac31a29 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ default: echo "Rebuilding SP1 program ..." mkdir -p sp1/program/elf cd sp1/program && cargo-prove prove build - mv elf/riscv32im-succinct-zkvm-elf sp1/program/elf/fib-riscv32im-succinct-zkvm-elf && rm -rf elf/ + mv elf/riscv32im-succinct-zkvm-elf sp1/program/elf/riscv32im-succinct-zkvm-elf && rm -rf elf/ echo "... done" # Generate and verify SP1 proof diff --git a/sp1/contracts/lib/forge-std b/sp1/contracts/lib/forge-std new file mode 160000 index 0000000..07263d1 --- /dev/null +++ b/sp1/contracts/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 07263d193d621c4b2b0ce8b4d54af58f6957d97d diff --git a/sp1/contracts/lib/sp1-contracts b/sp1/contracts/lib/sp1-contracts new file mode 160000 index 0000000..73c2a8d --- /dev/null +++ b/sp1/contracts/lib/sp1-contracts @@ -0,0 +1 @@ +Subproject commit 73c2a8df0c816bf743e9d960e7b14b8e37635578 diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index f369bc8..bdd407e 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -32,7 +32,7 @@ use std::path::PathBuf; /// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. /// /// This file is generated by running `cargo prove build` inside the `program` directory. -pub const ELF: &[u8] = include_bytes!("../../../../elf/riscv32im-succinct-zkvm-elf"); +pub const ELF: &[u8] = include_bytes!("../../../program/elf/riscv32im-succinct-zkvm-elf"); /// The arguments for the prove command. // TODO: fill in other details From 62d292dd1e5220c106efd822f1e5dcdca7307e23 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Sat, 17 Aug 2024 01:49:48 +0800 Subject: [PATCH 14/44] add circuit spec in README --- README.md | 74 ++++++++++++++++++++++++++++++++++- sp1/program/Cargo.toml | 2 +- sp1/program/src/main.rs | 2 +- sp1/script/Cargo.toml | 8 ++-- sp1/utils/src/block/header.rs | 2 +- 5 files changed, 80 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ccff997..ffab1b4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,77 @@ # zkrollup-integration -Tools for zkRollups to integrate with Espresso + +Tools for zkRollups to integrate with Espresso. + +When a zk-rollup joins a shared finality gadget, it will receive streams of finalized blocks containing transactions from all participating rollups. +As part of (batched) state update on L1, provers for a zk-rollup periodically submit a validity proof attesting to the correctness of a new rollup state. +A rollup state corresponds to a specific finalized block. +Solely proving valid state transition on the rollup VM against a list of transactions from the block (a.k.a "VM proof") is insufficient. +With a decentralized finality gadget, the validity proof needs to encapsulate a _proof of consensus_ on the new finalized block commitment (a.k.a "(consensus) light client proof"). +With a shared finality gadget, the proof needs to further encapsulate correct "_filtering_ of rollup-specific transactions" from the overall block (a.k.a. "derivation proof"). +This repo **provides circuits for the derivation proof and the consistency among the three (sub-)proofs**.[^1] + +[^1]: Circuits for VM proof are usually offered by zk-rollup project themselves (e.g. Polygon's [CDK](https://docs.polygon.technology/cdk/overview/), Scroll's [zkEVM](https://github.com/scroll-tech/zkevm-circuits)); circuit (written using [`jellyfish`'s constraint system](https://github.com/EspressoSystems/jellyfish/blob/main/relation/src/constraint_system.rs)) for Espresso's light client proof can be found [here](https://github.com/EspressoSystems/espresso-sequencer/blob/main/hotshot-state-prover/src/circuit.rs). + +> [!NOTE] +> Espresso uses a [non-executing consensus](https://eprint.iacr.org/2024/1189), thus the _consensus state_ doesn't embed post-execution rollup states: the consensus nodes only agree on the committed block payload (thus the total ordering among txs) and its availability. +> The validity of updated _rollup/VM states_, after executing those newly committed txs, is left to the rollup prover (aka batcher). + +Terminology wise: +- a _block_ is abstractly referring to a list of new txs/state transitions; concretely manifests as: + - `BlockPayload`: the actual payload that contains the raw tx data + - instead of full block replication at each node, we use Verifiable Information Dispersal (VID) schemes where each replica stores a chunk. + - our concrete instantiation of VID relies on KZG polynomial commitment, thus requires _structured reference string_ (SRS) from a trusted setup + - all replicas unequivocally refer to the payload by a `VidCommitment`, a cryptographic commitment to the entire payload sent to every replica alongside their designated chunk + - `BlockHeader`: the summarized new consensus state and chain metadata (for consensus nodes) + - `BlockCommitment`: a short cryptographic commitment to the `BlockHeader` + - `BlockMerkleCommitment`: the root of `BlockMerkleTree` that accumulates all block commitments, enabling efficient historical block header lookup via `BlockMerkleTreeProof` + - `VidCommitment` is a part of of `BlockHeader` +- a _light client_ is an agent that can verify the latest finalized _consensus state_ without running a full node + - an off-chain light client usually receive the block header and the quorum certificate (QC) + - an on-chain light client stores a pruned `LightClientState`, a strict subset of fields in `BlockHeader`, verified through _light client proof_ (the simplest form is using the QC from consensus, but we use a more EVM and SNARK-friendly light client protocol). +- each rollup occupies a _namespace_ (distinguished by a unique namespace ID) in a block + - `NsTable` is the compact encoding of a _namespace table_ mapping namespace id to their offset and range in `BlockPayload` + - `NsProof` is a _namespace proof_, attesting that some subset of bytes is the complete range of data designated to a particular namespace in a `BlockPayload` identified by its `VidCommitment` given a `NsTable` + +## Circuit Spec + +Assume we are proving a batch of `n` Espresso blocks. + +**Public Inputs** +- `blk_cm_root_old: BlockMerkleCommitment`: root of the old block commitment tree +- `blk_cm_root_new: BlockMerkleCommitment`: root of the new block commitment tree +- `ns_txs_hash: ?`: commitment to all the txs for a namespace (type depends on the commitment scheme, e.g. Sha256 results in `[u8; 32]`) + - this commitment/hash is computed by the rollup VM prover and the concrete algorithm is usually different for different rollups + - other public inputs to the "VM proof" (e.g. `prevStateRoot`, `newStateRoot`, `Withdraw/ExitRoot`) are skipped here since our circuit won't use them +- `vid_pp_hash: [u8; 32]`: Sha256 of `VidPublicParam` for the VID scheme + +**Private Witness** + +- `ns_id: u32`: namespace ID +- `all_tx: Vec>`: all txs between `blk_cm_root_old` and `blk_cm_root_new` grouped by each block + - `ns_txs: Vec>` is a subset range of the `all_tx` that corresponds to a specific namespace +- `blk_headers: Vec`: a list of n `BlockHeader` +- `blk_header_proofs: Vec`: a list of n MT proof proving membership of foregoing block headers in `blk_cm_root_new` +- `ns_proofs: Vec`: a list of n `NsProof` for every `VidCommitment` and every group of txs `txs_in_blk_i` +- `vid_pp: VidPublicParam` +- `vid_common: VidCommon`: some auxiliary data broadcast to and used by each replica when verifying their chunks + +**Relations** +1. Namespace-specific tx filtering: `ns_txs` is the correct subset range of payload for `ns_id` + - `for i in 0..n`: + - compute subset range: `range := blk_headers[i].ns_table.lookup(ns_id)` + - locate sub-slice of txs: `ns_txs[i]:= all_tx[i][range]` + - check consistency between `blk_headers[i].vid_cm` and `vid_common` + - verify the namespace proof: `payload_verify(vid_pp, vid_common, ns_txs[i], ns_proofs[i])` + - ensure legit block header: + - compute block commitment: `blk_cm := COM.commit(blk_headers[i])` + - verify inclusion via membership proof: `MT.verify(blk_cm, blk_cm_root_new, blk_header_proofs[i])` +2. Transaction batch commitment equivalence: same batch of txs used in VID and in VM proof + - compute the `ns_txs_hash := H(ns_txs[0] | ns_txs[1] | ... | ns_txs[n-1])` using whichever commitment/hashing scheme rollup VM prover chooses + + +Read [our doc](https://github.com/EspressoSystems/espresso-sequencer/blob/main/doc/zk-integration.md) for a more detailed description; +read our blog on [Derivation Pipeline](https://hackmd.io/@EspressoSystems/the-derivation-pipeline) for rollup integration. ## Getting Started diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 2273ce6..970616b 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] committable = { workspace = true } -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } jf-vid = { workspace = true } +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 0a80244..960a57e 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -82,7 +82,7 @@ pub fn main() { } Some((ns_range_start, ns_range_end)) => { std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); - // Calculate the rollup transaction commmitment + // Calculate the rollup transaction commitment if rollup_commit(&ns_payload) != rollup_txs_comm { std::println!("Rollup commitment mismatch."); consistency_check = false; diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index d137592..a06de46 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -13,14 +13,14 @@ ark-srs = "0.3.1" bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } -serde = { workspace = true } -serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } -tracing = "0.1.40" espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } jf-pcs = { workspace = true } jf-vid = { workspace = true } +serde = { workspace = true } +serde_json = { version = "1.0", default-features = false, features = ["alloc"] } +sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } +tracing = "0.1.40" [build-dependencies] sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs index 0937f09..574670c 100644 --- a/sp1/utils/src/block/header.rs +++ b/sp1/utils/src/block/header.rs @@ -52,7 +52,7 @@ pub struct BlockHeader { pub block_merkle_tree_root: BlockMerkleCommitment, /// Serialized root Commitment of `FeeMerkleTree` pub fee_merkle_tree_root: FeeMerkleCommitment, - /// Fee infomation of this block + /// Fee information of this block pub fee_info: FeeInfo, // Builder signature is not formally part of the header and not committed. } From be1b707fb42afb7fd359c0308d5fae468487e9ba Mon Sep 17 00:00:00 2001 From: MRain Date: Tue, 20 Aug 2024 10:59:51 -0400 Subject: [PATCH 15/44] bench & precompiles --- Cargo.lock | 633 +++++++++++++++++++++--------------- Cargo.toml | 7 + sp1/program/Cargo.toml | 3 +- sp1/program/src/main.rs | 2 + sp1/script/Cargo.toml | 4 +- sp1/script/src/bin/prove.rs | 31 +- 6 files changed, 414 insertions(+), 266 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86382cc..d16c71e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,7 +58,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy 0.7.35", + "zerocopy", ] [[package]] @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a43b18702501396fa9bcdeecd533bc85fac75150d308fc0f6800a01e6234a003" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" dependencies = [ "arrayvec", "bytes", @@ -119,7 +119,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -131,11 +131,11 @@ dependencies = [ "alloy-sol-macro-input", "const-hex", "heck", - "indexmap 2.3.0", + "indexmap 2.4.0", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", "syn-solidity", "tiny-keccak", ] @@ -151,7 +151,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", "syn-solidity", ] @@ -609,7 +609,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -637,7 +637,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -648,9 +648,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" dependencies = [ "async-trait", "axum-core", @@ -672,7 +672,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 0.1.2", "tokio", "tower", "tower-layer", @@ -789,9 +789,9 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "shlex", - "syn 2.0.72", + "syn 2.0.74", "which", ] @@ -967,12 +967,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.7" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +checksum = "68064e60dbf1f17005c2fde4d07c16d8baa506fd7ffed8ccab702d93617975c7" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -1026,9 +1027,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.13" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" +checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" dependencies = [ "clap_builder", "clap_derive", @@ -1036,9 +1037,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.13" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -1055,7 +1056,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1064,6 +1065,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + [[package]] name = "coins-bip32" version = "0.8.7" @@ -1196,15 +1203,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -1309,7 +1316,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1357,7 +1364,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1379,7 +1386,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1421,7 +1428,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1434,7 +1441,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1496,7 +1503,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1507,9 +1514,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "dyn-clone" @@ -1562,10 +1569,15 @@ dependencies = [ "rand_core", "sec1", "subtle", - "tap", "zeroize", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -1623,6 +1635,7 @@ dependencies = [ "espresso-derivation-utils", "jf-merkle-tree", "jf-vid", + "serde", "sp1-zkvm", ] @@ -1801,7 +1814,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.72", + "syn 2.0.74", "toml", "walkdir", ] @@ -1819,7 +1832,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -1845,7 +1858,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.72", + "syn 2.0.74", "tempfile", "thiserror", "tiny-keccak", @@ -2020,9 +2033,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" dependencies = [ "crc32fast", "miniz_oxide", @@ -2130,7 +2143,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -2293,7 +2306,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.3.0", + "indexmap 2.4.0", "slab", "tokio", "tokio-util", @@ -2312,7 +2325,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.3.0", + "indexmap 2.4.0", "slab", "tokio", "tokio-util", @@ -2365,6 +2378,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", + "serde", ] [[package]] @@ -2567,9 +2581,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ "bytes", "futures-channel", @@ -2681,9 +2695,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2813,8 +2827,9 @@ dependencies = [ [[package]] name = "jf-pcs" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#26f2875bd78137b4a5217c96913258c0ce35afb0" dependencies = [ + "ark-bn254", "ark-ec", "ark-ff 0.4.2", "ark-poly", @@ -2826,6 +2841,7 @@ dependencies = [ "jf-utils", "merlin", "rayon", + "sp1-zkvm", ] [[package]] @@ -2943,9 +2959,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -3003,9 +3019,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" +checksum = "422fbc7ff2f2f5bdffeb07718e5a5324dca72b0c9293d50df4026652385e3314" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -3072,9 +3088,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.18" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" +checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" dependencies = [ "cc", "libc", @@ -3166,9 +3182,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi", "libc", @@ -3209,6 +3225,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "ntapi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -3359,7 +3384,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -3379,9 +3404,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.36.2" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -3392,6 +3417,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oneshot" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e296cf87e61c9cfc1a61c3c63a0f7f286ed4554e0e22be84e8a38e1d264a2a29" + [[package]] name = "open-fastrlp" version = "0.1.4" @@ -3440,7 +3471,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -3475,8 +3506,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p3-air" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e909ef66fa5d77ff0fd3cb5af4b33b27fa6fb68d02b9b1e70edbc29383e565" dependencies = [ "p3-field", "p3-matrix", @@ -3484,8 +3516,9 @@ dependencies = [ [[package]] name = "p3-baby-bear" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46965470aac1cddfe52f535424b59d52f2fffef0fdeb9dbed19da39b1d8f048a" dependencies = [ "num-bigint 0.4.6", "p3-field", @@ -3498,8 +3531,9 @@ dependencies = [ [[package]] name = "p3-blake3" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36ef32d6ea21dd5cf9fec8a31bf0c64e6ceee8901dbf50966b83a443093c2aba" dependencies = [ "blake3", "p3-symmetric", @@ -3507,8 +3541,9 @@ dependencies = [ [[package]] name = "p3-bn254-fr" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3edfca6be3b3109adf8e3330baec30c3fc5f9f4d63d27aaec1b471ca51ed67" dependencies = [ "ff 0.13.0", "num-bigint 0.4.6", @@ -3521,8 +3556,9 @@ dependencies = [ [[package]] name = "p3-challenger" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6662ea899a5d848b60c699944491d72757873b5e1fd46798e4712f90a03a4e9" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -3533,8 +3569,9 @@ dependencies = [ [[package]] name = "p3-commit" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc3563918b5cc44ef5280bf9b51753e70dc78802de25e3fb81ed6c94617ccb6e" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3546,8 +3583,9 @@ dependencies = [ [[package]] name = "p3-dft" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "510095701819d83c9509fe825bbf1ebfe50426ae75149df5fe1dcfd18261323a" dependencies = [ "p3-field", "p3-matrix", @@ -3558,8 +3596,9 @@ dependencies = [ [[package]] name = "p3-field" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f1977a0a65789f719aa824119c332c4676b000bdbfe94d312fb6244a70d601" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.6", @@ -3571,8 +3610,9 @@ dependencies = [ [[package]] name = "p3-fri" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22ddb958f200d9289cc73ff68847b0167ca0c14557b791dd9e318f98c2d1b28" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3589,8 +3629,9 @@ dependencies = [ [[package]] name = "p3-interpolation" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d032cda212f6b408d7d5b0b9a8270a9455acb93742fe55a0880d82be8e90e500" dependencies = [ "p3-field", "p3-matrix", @@ -3599,8 +3640,9 @@ dependencies = [ [[package]] name = "p3-keccak" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c56abdd5a8a780049d2f8e92cea1df57b55a2ef50a40d1103f2732f7a00e4b1" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -3608,8 +3650,9 @@ dependencies = [ [[package]] name = "p3-keccak-air" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8398f1694ccc38513df0b8cab5f9ef7325423f27cd9e4fa20bdc77d5079cf1b" dependencies = [ "p3-air", "p3-field", @@ -3617,12 +3660,15 @@ dependencies = [ "p3-maybe-rayon", "p3-util", "tracing", + "tracing-forest", + "tracing-subscriber 0.3.18", ] [[package]] name = "p3-matrix" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d548ee0b834f8e2ebc5037073acd101a3b0ca41a2d1d28a15ba0ccd9059495b0" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3635,16 +3681,18 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55f5575d3d61bedb3e05681abb0f36b8bb339d65aa395d50756bfa64e9cd3f46" dependencies = [ "rayon", ] [[package]] name = "p3-mds" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6e57ed310d59245f93e24ee805ea7aa16fc9c505551b76a15f5e50f29d177e" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -3657,8 +3705,9 @@ dependencies = [ [[package]] name = "p3-merkle-tree" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af46b41cba75d483ec8a553cbab1d2d794935ae3403d75394acfa4fb2c977cce" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -3673,8 +3722,9 @@ dependencies = [ [[package]] name = "p3-poseidon2" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adaba6f14c197203530e233badce0ca1126ba3bf3c9ff766505b497bdad0bee1" dependencies = [ "gcd", "p3-field", @@ -3685,8 +3735,9 @@ dependencies = [ [[package]] name = "p3-symmetric" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ecc4282566eb14f48be7707f6745c4dff6be664984d59ec0fb1849cd82b5c2" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3695,8 +3746,9 @@ dependencies = [ [[package]] name = "p3-uni-stark" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1af5c038b22b058bf1d49fb1ea3dd6c240a3e46c3278fde5c444e0034f7ffe37" dependencies = [ "itertools 0.12.1", "p3-air", @@ -3707,14 +3759,18 @@ dependencies = [ "p3-matrix", "p3-maybe-rayon", "p3-util", + "postcard", "serde", "tracing", + "tracing-forest", + "tracing-subscriber 0.3.18", ] [[package]] name = "p3-util" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79f3fef0e00d9d7246385e758c4cd39b4efcbbcea31752471491ab502631385e" dependencies = [ "serde", ] @@ -3885,7 +3941,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -3922,6 +3978,17 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -3930,11 +3997,11 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ - "zerocopy 0.6.6", + "zerocopy", ] [[package]] @@ -3944,7 +4011,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -4053,7 +4120,16 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", ] [[package]] @@ -4064,16 +4140,17 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quinn" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +checksum = "b22d8e7369034b9a7132bc2008cac12f2013c8132b45e0554e6e20e2617f2156" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash", + "rustc-hash 2.0.0", "rustls", + "socket2", "thiserror", "tokio", "tracing", @@ -4081,14 +4158,14 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.3" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +checksum = "ba92fb39ec7ad06ca2582c0ca834dfeadcaf06ddfc8e635c80aa7e1c05315fdd" dependencies = [ "bytes", "rand", "ring 0.17.8", - "rustc-hash", + "rustc-hash 2.0.0", "rustls", "slab", "thiserror", @@ -4105,6 +4182,7 @@ dependencies = [ "libc", "once_cell", "socket2", + "tracing", "windows-sys 0.52.0", ] @@ -4213,9 +4291,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -4343,9 +4421,9 @@ dependencies = [ [[package]] name = "reqwest-middleware" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39346a33ddfe6be00cbc17a34ce996818b97b230b87229f10114693becca1268" +checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", @@ -4428,9 +4506,10 @@ dependencies = [ ] [[package]] -name = "rrs-lib" +name = "rrs-succinct" version = "0.1.0" -source = "git+https://github.com/GregAC/rrs.git#b23afc16b4e6a1fb5c4a73eb1e337e9400816507" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3372685893a9f67d18e98e792d690017287fd17379a83d798d958e517d380fa9" dependencies = [ "downcast-rs", "num_enum 0.5.11", @@ -4479,6 +4558,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -4533,9 +4618,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64 0.22.1", "rustls-pki-types", @@ -4543,9 +4628,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" @@ -4626,9 +4711,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.6" +version = "2.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ccfb12511cdb770157ace92d7dda771e498445b78f9886e8cdbc5140a4eced" +checksum = "79da19444d9da7a9a82b80ecf059eceba6d3129d84a8610fd25ff2364f255466" dependencies = [ "sdd", ] @@ -4662,9 +4747,9 @@ dependencies = [ [[package]] name = "sdd" -version = "2.1.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177258b64c0faaa9ffd3c65cd3262c2bc7e2588dbbd9c1641d0346145c1bbda8" +checksum = "0495e4577c672de8254beb68d01a9b62d0e8a13c099edecdbedccce3223cd29f" [[package]] name = "sec1" @@ -4744,29 +4829,29 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.207" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.207" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] name = "serde_json" -version = "1.0.122" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", "memchr", @@ -4825,7 +4910,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.3.0", + "indexmap 2.4.0", "serde", "serde_derive", "serde_json", @@ -4854,7 +4939,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -4879,14 +4964,13 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] name = "sha2" version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +source = "git+https://github.com/sp1-patches/RustCrypto-hashes?branch=patch-sha2-v0.10.8#1f224388fdede7cef649bce0d63876d1a9e3f515" dependencies = [ "cfg-if", "cpufeatures", @@ -4896,8 +4980,7 @@ dependencies = [ [[package]] name = "sha3" version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +source = "git+https://github.com/sp1-patches/RustCrypto-hashes?branch=patch-sha3-v0.10.8#8f6d303c0861ba7e5adcc36207c0f41fe5edaabc" dependencies = [ "digest 0.10.7", "keccak", @@ -4905,9 +4988,9 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" +checksum = "57d79b758b7cb2085612b11a235055e485605a5103faccdd633f35bd7aee69dd" dependencies = [ "cc", "cfg-if", @@ -4998,7 +5081,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -5021,10 +5104,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "sp1-build" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +dependencies = [ + "anyhow", + "cargo_metadata", + "clap", + "dirs", +] + [[package]] name = "sp1-core" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "anyhow", "arrayref", @@ -5036,6 +5130,7 @@ dependencies = [ "elf", "elliptic-curve", "generic-array 1.1.0", + "hashbrown 0.14.5", "hex", "itertools 0.13.0", "k256", @@ -5063,13 +5158,14 @@ dependencies = [ "p3-util", "rand", "rayon-scan", - "rrs-lib", + "rrs-succinct", "serde", "serde_with 3.9.0", "size", "snowbridge-amcl", "sp1-derive", "sp1-primitives", + "static_assertions", "strum", "strum_macros", "tempfile", @@ -5083,8 +5179,8 @@ dependencies = [ [[package]] name = "sp1-derive" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "proc-macro2", "quote", @@ -5093,34 +5189,29 @@ dependencies = [ [[package]] name = "sp1-helper" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "cargo_metadata", "chrono", + "sp1-build", ] [[package]] -name = "sp1-precompiles" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +name = "sp1-lib" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "anyhow", "bincode", "cfg-if", - "getrandom", - "hex", - "k256", - "num", - "rand", "serde", - "snowbridge-amcl", ] [[package]] name = "sp1-primitives" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "itertools 0.13.0", "lazy_static", @@ -5132,34 +5223,27 @@ dependencies = [ [[package]] name = "sp1-prover" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "anyhow", - "backtrace", "bincode", - "bytemuck", "clap", "dirs", - "futures", "hex", - "indicatif", "itertools 0.13.0", "num-bigint 0.4.6", + "oneshot", "p3-baby-bear", "p3-bn254-fr", "p3-challenger", "p3-commit", "p3-field", - "p3-util", - "rand", + "p3-matrix", "rayon", - "reqwest 0.12.5", "serde", "serde_json", "serial_test", - "sha2", - "size", "sp1-core", "sp1-primitives", "sp1-recursion-circuit", @@ -5170,15 +5254,14 @@ dependencies = [ "subtle-encoding", "tempfile", "thiserror", - "tokio", "tracing", "tracing-subscriber 0.3.18", ] [[package]] name = "sp1-recursion-circuit" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "bincode", "itertools 0.13.0", @@ -5200,8 +5283,8 @@ dependencies = [ [[package]] name = "sp1-recursion-compiler" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "backtrace", "itertools 0.13.0", @@ -5217,6 +5300,7 @@ dependencies = [ "p3-util", "serde", "sp1-core", + "sp1-primitives", "sp1-recursion-core", "sp1-recursion-derive", "tracing", @@ -5224,14 +5308,15 @@ dependencies = [ [[package]] name = "sp1-recursion-core" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "arrayref", "backtrace", "ff 0.13.0", "hashbrown 0.14.5", "itertools 0.13.0", + "num_cpus", "p3-air", "p3-baby-bear", "p3-bn254-fr", @@ -5258,8 +5343,8 @@ dependencies = [ [[package]] name = "sp1-recursion-derive" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "proc-macro2", "quote", @@ -5268,8 +5353,8 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-ffi" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "anyhow", "bincode", @@ -5293,8 +5378,8 @@ dependencies = [ [[package]] name = "sp1-recursion-program" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "itertools 0.13.0", "p3-air", @@ -5313,15 +5398,17 @@ dependencies = [ "rand", "serde", "sp1-core", + "sp1-primitives", "sp1-recursion-compiler", "sp1-recursion-core", + "stacker", "tracing", ] [[package]] name = "sp1-sdk" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "alloy-sol-types", "anyhow", @@ -5332,12 +5419,15 @@ dependencies = [ "dirs", "ethers", "futures", + "hashbrown 0.14.5", "hex", "indicatif", "log", "num-bigint 0.4.6", + "p3-baby-bear", "p3-commit", "p3-field", + "p3-fri", "p3-matrix", "prost", "reqwest 0.12.5", @@ -5349,30 +5439,30 @@ dependencies = [ "sp1-prover", "strum", "strum_macros", + "sysinfo", "tempfile", "thiserror", "tokio", "tracing", - "twirp", + "twirp-rs", "vergen", ] [[package]] name = "sp1-zkvm" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.1" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" dependencies = [ "bincode", "cfg-if", "getrandom", - "k256", "lazy_static", "libm", "once_cell", "rand", "serde", "sha2", - "sp1-precompiles", + "sp1-lib", ] [[package]] @@ -5397,6 +5487,19 @@ dependencies = [ "der", ] +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -5434,7 +5537,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -5465,9 +5568,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" dependencies = [ "proc-macro2", "quote", @@ -5483,7 +5586,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -5498,6 +5601,21 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +[[package]] +name = "sysinfo" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" +dependencies = [ + "cfg-if", + "core-foundation-sys", + "libc", + "ntapi", + "once_cell", + "rayon", + "windows", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -5553,14 +5671,15 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5580,7 +5699,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -5676,7 +5795,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -5740,7 +5859,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.4.0", "toml_datetime", "winnow 0.5.40", ] @@ -5751,7 +5870,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.4.0", "toml_datetime", "winnow 0.5.40", ] @@ -5762,7 +5881,7 @@ version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.4.0", "serde", "serde_spanned", "toml_datetime", @@ -5787,15 +5906,15 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -5817,7 +5936,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -5898,9 +6017,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "twirp" +name = "twirp-rs" version = "0.3.0" -source = "git+https://github.com/github/twirp-rs.git?rev=c85f31f9c54957374e7dcb3534fc52cff0aa2dc5#c85f31f9c54957374e7dcb3534fc52cff0aa2dc5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa3161d8eee0abcad4e762f4215381a430cc1281870d575b0f1e4fbfc74b8ce" dependencies = [ "async-trait", "axum", @@ -5996,9 +6116,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" +checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" dependencies = [ "base64 0.22.1", "flate2", @@ -6104,11 +6224,12 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "serde", "serde_json", "wasm-bindgen-macro", @@ -6116,24 +6237,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -6143,9 +6264,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6153,22 +6274,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-streams" @@ -6185,9 +6306,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -6242,11 +6363,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6255,6 +6376,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -6282,6 +6413,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -6469,34 +6609,14 @@ dependencies = [ "tap", ] -[[package]] -name = "zerocopy" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6" -dependencies = [ - "byteorder", - "zerocopy-derive 0.6.6", -] - [[package]] name = "zerocopy" version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy-derive" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", + "byteorder", + "zerocopy-derive", ] [[package]] @@ -6507,7 +6627,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] @@ -6527,13 +6647,14 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.74", ] [[package]] name = "zkhash" version = "0.2.0" -source = "git+https://github.com/HorizenLabs/poseidon2#bb476b9ca38198cf5092487283c8b8c5d4317c4e" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4352d1081da6922701401cdd4cbf29a2723feb4cfabb5771f6fee8e9276da1c7" dependencies = [ "ark-ff 0.4.2", "ark-std 0.4.0", diff --git a/Cargo.toml b/Cargo.toml index 054f2c7..ea60611 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,3 +20,10 @@ jf-pcs = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish" ] } sha2 = "0.10" primitive-types = { version = "0.12", features = ["serde"] } + +[patch.crates-io] +sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.10.8" } +sha3 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", branch = "patch-sha3-v0.10.8" } + +[patch."https://github.com/EspressoSystems/jellyfish"] +jf-pcs = { git = "https://www.github.com/EspressoSystems/jellyfish.git", branch = "sp1-patches" } diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 2273ce6..a2e65f9 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -5,7 +5,8 @@ edition = "2021" [dependencies] committable = { workspace = true } -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } +serde = { workspace = true } +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } jf-vid = { workspace = true } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 0a80244..750ed09 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -102,6 +102,8 @@ pub fn main() { &ns_proof, ) .is_ok_and(|result| result.is_ok()) + || ::is_consistent(&header.payload_commitment, &vid_common) + .is_err() { std::println!("Failed namespace proof."); consistency_check = false; diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index d137592..be98a52 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -15,7 +15,7 @@ clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } serde = { workspace = true } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } +sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } tracing = "0.1.40" espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } @@ -23,4 +23,4 @@ jf-pcs = { workspace = true } jf-vid = { workspace = true } [build-dependencies] -sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } +sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index f369bc8..214c32c 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -26,7 +26,7 @@ use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; use jf_pcs::prelude::UnivariateUniversalParams; use jf_vid::{payload_prover::PayloadProver, VidScheme}; use serde::{Deserialize, Serialize}; -use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1VerifyingKey}; +use sp1_sdk::{HashableKey, ProverClient, SP1ProofWithPublicValues, SP1Stdin, SP1VerifyingKey}; use std::path::PathBuf; /// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. @@ -39,6 +39,9 @@ pub const ELF: &[u8] = include_bytes!("../../../../elf/riscv32im-succinct-zkvm-e #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] struct ProveArgs { + #[clap(short, long, default_value = "false")] + bench: bool, + #[clap(long, default_value = "false")] evm: bool, } @@ -153,15 +156,29 @@ fn main() { let mut stdin = SP1Stdin::new(); mock_inputs(&mut stdin); - if args.evm { + if args.bench { + // Execute the program + let (public_values, report) = client + .execute(ELF, stdin) + .run() + .expect("failed to generate proof"); + let public_values: PublicInputs = bincode::deserialize(public_values.as_slice()).unwrap(); + println!("Public values: {:?}", public_values); + println!("{}", report); + } else if args.evm { // Generate the proof. let proof = client - .prove_plonk(&pk, stdin) + .prove(&pk, stdin) + .plonk() + .run() .expect("failed to generate proof"); create_plonk_fixture(&proof, &vk); } else { // Generate the proof. - let proof = client.prove(&pk, stdin).expect("failed to generate proof"); + let proof = client + .prove(&pk, stdin) + .run() + .expect("failed to generate proof"); let public_values: PublicInputs = bincode::deserialize(proof.public_values.as_slice()).unwrap(); println!("Public values: {:?}", public_values); @@ -181,12 +198,12 @@ struct ProofFixture { } /// Create a fixture for the given proof. -fn create_plonk_fixture(proof: &SP1PlonkBn254Proof, vk: &SP1VerifyingKey) { +fn create_plonk_fixture(proof: &SP1ProofWithPublicValues, vk: &SP1VerifyingKey) { // Create the testing fixture so we can test things end-to-end. let fixture = ProofFixture { vkey: vk.bytes32().to_string(), - public_values: proof.public_values.bytes().to_string(), - proof: proof.bytes().to_string(), + public_values: proof.public_values.raw(), + proof: proof.raw(), }; // The verification key is used to verify that the proof corresponds to the execution of the From 197391669dc90f63301d116df26c4f1f4f566929 Mon Sep 17 00:00:00 2001 From: MRain Date: Tue, 20 Aug 2024 11:05:46 -0400 Subject: [PATCH 16/44] left over deps --- Cargo.lock | 1 - sp1/program/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d16c71e..009dfe7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1635,7 +1635,6 @@ dependencies = [ "espresso-derivation-utils", "jf-merkle-tree", "jf-vid", - "serde", "sp1-zkvm", ] diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index a2e65f9..792b222 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -5,7 +5,6 @@ edition = "2021" [dependencies] committable = { workspace = true } -serde = { workspace = true } sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } From 558c04fbdd7f94f76d8ee4b5c69d79331950a6cb Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 21 Aug 2024 19:16:41 -0400 Subject: [PATCH 17/44] multi espresso blocks --- Cargo.lock | 259 +++++++++++++++++++++------------- justfile | 6 + sp1/program/src/main.rs | 144 +++++++++---------- sp1/script/Cargo.toml | 1 + sp1/script/src/bin/prove.rs | 142 ++++++++++++------- sp1/utils/src/block/header.rs | 4 +- sp1/utils/src/lib.rs | 66 ++++++++- sp1/utils/src/ns_table.rs | 14 ++ 8 files changed, 404 insertions(+), 232 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 009dfe7..2880ea1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,6 +38,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aes" version = "0.8.4" @@ -119,7 +125,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -135,7 +141,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", "tiny-keccak", ] @@ -151,7 +157,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "syn-solidity", ] @@ -597,9 +603,9 @@ checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-trait" @@ -609,7 +615,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -637,7 +643,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -711,7 +717,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", "serde", @@ -791,7 +797,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.74", + "syn 2.0.75", "which", ] @@ -856,9 +862,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.3" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9ec96fe9a81b5e365f9db71fe00edc4fe4ca2cc7dcb7861f0603012a7caa210" +checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" dependencies = [ "arrayref", "arrayvec", @@ -914,9 +920,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.16.3" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" +checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" [[package]] name = "byteorder" @@ -935,9 +941,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -967,9 +973,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.12" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68064e60dbf1f17005c2fde4d07c16d8baa506fd7ffed8ccab702d93617975c7" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" dependencies = [ "jobserver", "libc", @@ -1027,9 +1033,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.15" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -1056,7 +1062,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1131,9 +1137,9 @@ checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "committable" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c989a517928da3346fce6f6f75794285420edc3ef42c995ced45519f065acd" +checksum = "05a8809c2761232ce27226ef1ca1bc78b480b558406895848f76ab8fce04076c" dependencies = [ "arbitrary", "ark-serialize 0.4.2", @@ -1316,7 +1322,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1364,7 +1370,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1386,7 +1392,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1428,7 +1434,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1441,7 +1447,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1503,7 +1509,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1578,6 +1584,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -1651,6 +1663,7 @@ dependencies = [ "jf-merkle-tree", "jf-pcs", "jf-vid", + "rand", "serde", "serde_json", "sp1-helper", @@ -1813,7 +1826,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.74", + "syn 2.0.75", "toml", "walkdir", ] @@ -1831,7 +1844,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1857,7 +1870,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.74", + "syn 2.0.75", "tempfile", "thiserror", "tiny-keccak", @@ -2032,12 +2045,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" +checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -2142,7 +2155,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2314,9 +2327,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -2532,7 +2545,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -3043,9 +3056,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -3179,6 +3192,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "1.0.2" @@ -3383,7 +3405,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3470,7 +3492,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3940,7 +3962,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3979,12 +4001,13 @@ checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" [[package]] name = "postcard" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +checksum = "20ee10b999a00ca189ac2cb99f5db1ca71fb7371e3d5f493b879ca95d2a67220" dependencies = [ "cobs", - "embedded-io", + "embedded-io 0.4.0", + "embedded-io 0.6.1", "serde", ] @@ -4010,7 +4033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4119,7 +4142,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4279,9 +4302,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", @@ -4358,28 +4381,28 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper 0.1.2", - "system-configuration", + "system-configuration 0.5.1", "tokio", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.50.0", + "winreg", ] [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "http-body-util", @@ -4403,7 +4426,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper 1.0.1", - "system-configuration", + "system-configuration 0.6.0", "tokio", "tokio-native-tls", "tokio-rustls", @@ -4415,7 +4438,7 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -4427,7 +4450,7 @@ dependencies = [ "anyhow", "async-trait", "http 1.1.0", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde", "thiserror", "tower-service", @@ -4710,9 +4733,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.14" +version = "2.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79da19444d9da7a9a82b80ecf059eceba6d3129d84a8610fd25ff2364f255466" +checksum = "aeb7ac86243095b70a7920639507b71d51a63390d1ba26c4f60a552fbb914a37" dependencies = [ "sdd", ] @@ -4828,22 +4851,22 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.207" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.207" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4938,7 +4961,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -4963,7 +4986,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5080,7 +5103,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5429,7 +5452,7 @@ dependencies = [ "p3-fri", "p3-matrix", "prost", - "reqwest 0.12.5", + "reqwest 0.12.7", "reqwest-middleware", "serde", "serde_json", @@ -5536,7 +5559,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5567,9 +5590,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -5585,7 +5608,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5599,6 +5622,9 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "sysinfo" @@ -5623,7 +5649,18 @@ checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", "core-foundation", - "system-configuration-sys", + "system-configuration-sys 0.5.0", +] + +[[package]] +name = "system-configuration" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys 0.6.0", ] [[package]] @@ -5636,6 +5673,16 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tagged-base64" version = "0.4.0" @@ -5698,7 +5745,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5770,9 +5817,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", @@ -5794,7 +5841,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -5935,7 +5982,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -6029,7 +6076,7 @@ dependencies = [ "http-body-util", "hyper 1.4.1", "prost", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde", "serde_json", "thiserror", @@ -6097,9 +6144,9 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "untrusted" @@ -6245,7 +6292,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -6279,7 +6326,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6394,6 +6441,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -6570,16 +6647,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "ws_stream_wasm" version = "0.7.4" @@ -6626,7 +6693,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -6646,7 +6713,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] diff --git a/justfile b/justfile index ac31a29..bbfce03 100644 --- a/justfile +++ b/justfile @@ -16,6 +16,12 @@ default: RUST_LOG=info cargo run --bin sp1-prove --release -- {{args}} echo "... done" +# Bench the SP1 prover +@sp1-bench *args: sp1-build + echo "Proving & Verifying SP1 program ..." + RUST_LOG=info cargo run --bin sp1-prove --release -- --bench {{args}} + echo "... done" + @sp1-test-contracts: echo "Testing SP1 contracts" cd sp1/contracts && forge test -v diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 764a754..712b1cf 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -1,18 +1,4 @@ -//! This program proves that the executed transactions are correctly derived from an espresso block. -// Inputs: -// - (Public) A block Merkle tree commitment, from a light client state -// - (Private) A block header containing the block height (public), namespace table, payload VID commitment, etc. -// - (Private) A membership proof for the header above -// - (Public) Namespace ID -// - (Private) Payload data of this rollup -// - (Private) Public parameters (SRS) for VID scheme, whose hash is made public -// - (Public) Common data associated with the VID disperse -// - (Private) A namespace of the given payload. -// - (Public) Rollup transactions commitment -// This program proves that -// - There's a block header who is a member of the committed block Merkle tree in the light client state. -// - Given namespace ID appears in the namespace table of this block header, and it specifies a range in the payload data. -// - The corresponding transactions of rollup commitment are exactly the ones in the given range of the payload data, where the payload data are committed in the block header. +//! This program proves that the executed transactions are correctly derived from espresso blocks. #![no_main] sp1_zkvm::entrypoint!(main); @@ -20,14 +6,10 @@ sp1_zkvm::entrypoint!(main); use committable::Committable; use espresso_derivation_utils::{ block::{ - header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTree, BlockMerkleTreeProof}, - payload::{ - compute_vid_param_hash, rollup_commit, vid_scheme, NsProof, Payload, Vid, VidCommon, - VidParam, - }, - RollupCommitment, + header::{BlockMerkleCommitment, BlockMerkleTree}, + payload::{rollup_commit, vid_scheme, Payload, Vid, VidParam}, }, - PublicInputs, + BlockDerivationProof, EspressoDerivationProof, PublicInputs, }; use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; use jf_vid::{ @@ -35,92 +17,96 @@ use jf_vid::{ VidScheme, }; -#[allow(unused_assignments)] pub fn main() { - // Block Merkle tree commitment in the light client state - let block_merkle_tree_comm = sp1_zkvm::io::read::(); - // The block header - let header = sp1_zkvm::io::read::(); - // A membership proof for a given block header in the block Merkle tree - let mt_proof = sp1_zkvm::io::read::(); - // Namespace ID - let ns_id = sp1_zkvm::io::read::(); - // Payload bytes for this namespace ID - let ns_payload = sp1_zkvm::io::read::(); - // Public parameter for the VID scheme - let vid_param = sp1_zkvm::io::read::(); - // Common data associated with the payload disperser - let vid_common = sp1_zkvm::io::read::(); - // Namespace proof for this payload - let ns_proof = sp1_zkvm::io::read::(); - // Rollup transaction commitment - let rollup_txs_comm = sp1_zkvm::io::read::(); - + let payload = sp1_zkvm::io::read::(); + let espresso_derivation_proof = sp1_zkvm::io::read::(); std::println!("All inputs are loaded"); - // Indicates that whether all inputs are consistent - let mut consistency_check = true; + let public_inputs = PublicInputs { + verification_result: verify_espresso_derivation(&payload.0, &espresso_derivation_proof), + rollup_txs_commit: rollup_commit(&payload), + espresso_derivation_commit: espresso_derivation_proof.into(), + }; + + sp1_zkvm::io::commit(&public_inputs); +} + +fn verify_espresso_derivation(payload: &[u8], proof: &EspressoDerivationProof) -> bool { + let mut end = 0; + proof.block_proofs.iter().all(|(range, block_proof)| { + let result = range.start == end + && verify_block_derivation_proof( + &payload[range.start..range.end], + &proof.vid_param, + &proof.bmt_commitment, + block_proof, + ); + end = range.end; + result + }) && end == payload.len() +} +fn verify_block_derivation_proof( + payload_slice: &[u8], + vid_param: &VidParam, + bmt_commitment: &BlockMerkleCommitment, + proof: &BlockDerivationProof, +) -> bool { // Assert that the membership proof is valid - if block_merkle_tree_comm.height() + 1 != mt_proof.proof.len() - || !BlockMerkleTree::verify(block_merkle_tree_comm.digest(), mt_proof.pos, &mt_proof) - .is_ok_and(|result| result.is_ok()) + if bmt_commitment.height() + 1 != proof.bmt_proof.proof.len() + || !BlockMerkleTree::verify( + bmt_commitment.digest(), + proof.bmt_proof.pos, + &proof.bmt_proof, + ) + .is_ok_and(|result| result.is_ok()) { std::println!("Incorrect membership proof for block Merkle tree."); - consistency_check = false; + return false; } // Assert that the header is the one committed in the block Merkle tree - if !mt_proof.elem().is_some_and(|elem| elem == &header.commit()) { + if !proof + .bmt_proof + .elem() + .is_some_and(|elem| elem == &proof.block_header.commit()) + { std::println!("Membership proof is not consistent with the given block header."); - consistency_check = false; + return false; } - match header.ns_table.scan_for_id(ns_id) { + match proof.block_header.ns_table.scan_for_id(proof.ns_id) { None => { std::println!("Namespace ID not found in the block."); - consistency_check = false; + false } Some((ns_range_start, ns_range_end)) => { std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); - // Calculate the rollup transaction commitment - if rollup_commit(&ns_payload) != rollup_txs_comm { - std::println!("Rollup commitment mismatch."); - consistency_check = false; - } // Namespace proof w.r.t the VidCommitment - let num_storage_nodes = ::get_num_storage_nodes(&vid_common); - let vid = vid_scheme(num_storage_nodes, &vid_param); + let num_storage_nodes = ::get_num_storage_nodes(&proof.vid_common); + let vid = vid_scheme(num_storage_nodes, vid_param); if !vid .payload_verify( Statement { - payload_subslice: &ns_payload.0, + payload_subslice: payload_slice, range: (ns_range_start as usize..ns_range_end as usize), - commit: &header.payload_commitment, - common: &vid_common, + commit: &proof.block_header.payload_commitment, + common: &proof.vid_common, }, - &ns_proof, + &proof.ns_proof, ) .is_ok_and(|result| result.is_ok()) - || ::is_consistent(&header.payload_commitment, &vid_common) - .is_err() + || ::is_consistent( + &proof.block_header.payload_commitment, + &proof.vid_common, + ) + .is_err() { std::println!("Failed namespace proof."); - consistency_check = false; + false + } else { + true } } } - // commit the vid param - let vid_param_hash = compute_vid_param_hash(&vid_param); - // Expose the public inputs - let public_inputs = PublicInputs { - block_merkle_tree_comm, - block_height: header.height, - ns_id, - rollup_txs_comm, - consistency_check, - vid_param_hash, - vid_common, - }; - sp1_zkvm::io::commit(&public_inputs); } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index be98a52..7ee9f2d 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -13,6 +13,7 @@ ark-srs = "0.3.1" bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } +rand = "0.8" serde = { workspace = true } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 0729af5..cf8a5b3 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -17,14 +17,16 @@ use committable::Committable; use espresso_derivation_utils::{ block::{ header::{BlockHeader, BlockMerkleTree}, - payload::{rollup_commit, vid_scheme, NsProof, Payload, VidParam}, + payload::{rollup_commit, vid_scheme, NsProof, Payload, Vid, VidCommon, VidParam}, + RollupCommitment, }, ns_table::NsTable, - PublicInputs, + BlockDerivationProof, EspressoDerivationProof, PublicInputs, }; use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; use jf_pcs::prelude::UnivariateUniversalParams; use jf_vid::{payload_prover::PayloadProver, VidScheme}; +use rand::{Rng, RngCore}; use serde::{Deserialize, Serialize}; use sp1_sdk::{HashableKey, ProverClient, SP1ProofWithPublicValues, SP1Stdin, SP1VerifyingKey}; use std::path::PathBuf; @@ -46,39 +48,13 @@ struct ProveArgs { evm: bool, } -#[allow(dead_code)] -fn parse_bytes(arg: &str) -> Result { - Ok(NsTable { - bytes: (0..arg.len()) - .step_by(2) - .map(|i| u8::from_str_radix(&arg[i..i + 2], 16)) - .collect::, _>>()?, - }) -} - -fn mock_inputs(stdin: &mut SP1Stdin) { - let mut block_merkle_tree = BlockMerkleTree::new(32); - let num_storage_nodes = 10; - - // Mocking namespace ID - let ns_id = 29u32; - - // 11 bytes for current namespace - let ns_range = 0..11; - - // Mocking input for a small payload - let payload = Payload(vec![1u8; 20]); - let ns_payload = Payload(vec![1u8; 11]); - - let vid_param = load_srs(); - let mut vid = vid_scheme(num_storage_nodes, &vid_param); - - let vid_disperse = vid.disperse(&payload.0).unwrap(); - let vid_common = vid_disperse.common; - let vid_commitment = vid_disperse.commit; - - let ns_proof: NsProof = vid.payload_proof(payload.0, ns_range).unwrap(); - +fn mock_block( + idx: u64, + ns_id: u32, + ns_payload: &[u8], + vid: &mut Vid, + rng: &mut R, +) -> (BlockHeader, VidCommon, NsProof) { // This is a tweak from an actual block header in Espresso's staging testnet // Namespace table is hardcoded. let mut header: BlockHeader = serde_json::from_str( @@ -120,23 +96,91 @@ fn mock_inputs(stdin: &mut SP1Stdin) { } }"#, ).unwrap(); + + // Mock a height + header.height += idx; + + // Mock payload + let payload_size = rng.gen_range(2 * ns_payload.len()..8 * ns_payload.len()); + let mut payload = vec![0u8; payload_size]; + rng.fill_bytes(&mut payload); + let offset = rng.gen_range(1..payload_size - ns_payload.len() - 1); + payload[offset..offset + ns_payload.len()].copy_from_slice(ns_payload); + + // Mock VID information + let vid_disperse = vid.disperse(&payload).unwrap(); + let vid_common = vid_disperse.common; + let vid_commitment = vid_disperse.commit; + // Update the payload commitment header.payload_commitment = vid_commitment; + // Update the namespace table + header.ns_table = NsTable::mock_ns_table(&[ + (rng.next_u32(), offset as u32), + (ns_id, offset as u32 + ns_payload.len() as u32), + (rng.next_u32(), payload_size as u32), + ]); + + // Namespace proof + let ns_range = offset..offset + ns_payload.len(); + let ns_proof = vid.payload_proof(&payload, ns_range).unwrap(); + + (header, vid_common, ns_proof) +} + +fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { + let mut rng = rand::thread_rng(); + + let mut block_merkle_tree = BlockMerkleTree::new(32); + + let num_blocks = rng.gen_range(2..5); + + let mut rollup_payload = Payload(vec![]); + + let num_storage_nodes = 10; + let vid_param = load_srs(); + let mut vid = vid_scheme(num_storage_nodes, &vid_param); - block_merkle_tree.push(header.commit()).unwrap(); + let mut block_proofs = vec![]; - let (_, mt_proof) = block_merkle_tree.lookup(0).expect_ok().unwrap(); + for i in 0..num_blocks { + let ns_payload_len = rng.gen_range(5..10); + let mut block_ns_payload = vec![0u8; ns_payload_len]; - let rollup_txs_comm = rollup_commit(&ns_payload); + let ns_id = rng.next_u32(); - stdin.write(&block_merkle_tree.commitment()); - stdin.write(&header); - stdin.write(&mt_proof); - stdin.write(&ns_id); - stdin.write(&ns_payload); - stdin.write(&vid_param); - stdin.write(&vid_common); - stdin.write(&ns_proof); - stdin.write(&rollup_txs_comm); + let (header, vid_common, ns_proof) = + mock_block(i, ns_id, &block_ns_payload, &mut vid, &mut rng); + + block_merkle_tree.push(header.commit()).unwrap(); + + let (_, bmt_proof) = block_merkle_tree.lookup(i).expect_ok().unwrap(); + + block_proofs.push(( + rollup_payload.0.len()..rollup_payload.0.len() + ns_payload_len, + BlockDerivationProof { + bmt_proof, + block_header: header, + ns_id, + vid_common, + ns_proof, + }, + )); + rollup_payload.0.append(&mut block_ns_payload); + } + for i in 0..num_blocks { + let (_, bmt_proof) = block_merkle_tree.lookup(i).expect_ok().unwrap(); + block_proofs.get_mut(i as usize).unwrap().1.bmt_proof = bmt_proof; + } + let derivation_proof = EspressoDerivationProof { + vid_param, + bmt_commitment: block_merkle_tree.commitment(), + block_proofs, + }; + + stdin.write(&rollup_payload); + stdin.write(&derivation_proof); + + rollup_commit(&rollup_payload) } fn main() { @@ -154,7 +198,9 @@ fn main() { // Setup the inputs.; let mut stdin = SP1Stdin::new(); - mock_inputs(&mut stdin); + let expect_rollup_commit = mock_inputs(&mut stdin); + + std::println!("Expect rollup txs commitment: {}", expect_rollup_commit); if args.bench { // Execute the program diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs index 574670c..2ffcc72 100644 --- a/sp1/utils/src/block/header.rs +++ b/sp1/utils/src/block/header.rs @@ -8,7 +8,7 @@ use ark_serialize::{ use committable::{Commitment, Committable, RawCommitmentBuilder}; use either::Either; use jf_merkle_tree::{ - prelude::{LightWeightSHA3MerkleTree, Sha3Digest, Sha3Node, UniversalMerkleTree}, + prelude::{SHA3MerkleTree, Sha3Digest, Sha3Node, UniversalMerkleTree}, MerkleTreeScheme, ToTraversalPath, }; use primitive_types::{H160, H256, U256}; @@ -18,7 +18,7 @@ use std::io::Read; use tagged_base64::tagged; /// Types for block Merkle tree -pub type BlockMerkleTree = LightWeightSHA3MerkleTree>; +pub type BlockMerkleTree = SHA3MerkleTree>; pub type BlockMerkleTreeProof = ::MembershipProof; pub type BlockMerkleCommitment = ::Commitment; diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 1c2427e..4663e6d 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -3,21 +3,73 @@ // `HotShot` requires a minimum rust version of [1.76.0](https://github.com/EspressoSystems/HotShot/blob/4713af7704f88f38a8a69b708acd4677f76d8ff1/Cargo.toml#L5). // This is incompatible with the current sp1 rust toolchain 1.75.0. -use block::{header::BlockMerkleCommitment, payload::VidCommon, RollupCommitment}; +use block::{ + header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTreeProof}, + payload::{compute_vid_param_hash, NsProof, VidCommon, VidParam}, + RollupCommitment, +}; use primitive_types::H256; use serde::{Deserialize, Serialize}; +use std::ops::Range; pub mod block; pub mod ns_table; -#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug)] +#[derive(Serialize, Deserialize, Debug)] /// Public inputs pub struct PublicInputs { - pub block_merkle_tree_comm: BlockMerkleCommitment, - pub block_height: u64, + pub verification_result: bool, + pub rollup_txs_commit: RollupCommitment, + pub espresso_derivation_commit: EspressoDerivationCommit, +} + +#[derive(Serialize, Deserialize, Debug)] +/// Proves that a slice of payload bytes is derived from an espresso block. +pub struct BlockDerivationProof { + /// A block MT proof for the block header + pub bmt_proof: BlockMerkleTreeProof, + /// Block header + pub block_header: BlockHeader, + /// Namespace ID of the rollup pub ns_id: u32, - pub rollup_txs_comm: RollupCommitment, - pub consistency_check: bool, - pub vid_param_hash: H256, + /// Common data associated with the VID disperser, used for namespace proof verification pub vid_common: VidCommon, + /// Namespace proof of the given payload + pub ns_proof: NsProof, +} + +#[derive(Serialize, Deserialize, Debug)] +/// Proves that the payload is derived from one or many espresso blocks. +pub struct EspressoDerivationProof { + /// VID public parameter, used for namespace proof verification + pub vid_param: VidParam, + /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. + pub bmt_commitment: BlockMerkleCommitment, + /// Block proofs for slices of payload. + /// Ranges should cover the whole payload and be non-overlapping. + pub block_proofs: Vec<(Range, BlockDerivationProof)>, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct EspressoDerivationCommit { + /// Hash of the used VID public parameter + pub vid_param_hash: H256, + /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. + pub bmt_commitment: BlockMerkleCommitment, + /// List of (range, block_height, ns_id). Specifies a block which each slice of payload is from. + pub blocks: Vec<(Range, u64, u32)>, +} + +impl From for EspressoDerivationCommit { + fn from(proof: EspressoDerivationProof) -> Self { + Self { + vid_param_hash: compute_vid_param_hash(&proof.vid_param), + bmt_commitment: proof.bmt_commitment, + blocks: proof + .block_proofs + .into_iter() + .map(|(range, proof)| (range, proof.block_header.height, proof.ns_id)) + .collect(), + } + } } diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs index 4db577f..8e1b578 100644 --- a/sp1/utils/src/ns_table.rs +++ b/sp1/utils/src/ns_table.rs @@ -87,6 +87,20 @@ impl NsTable { } None } + + pub fn mock_ns_table(entries: &[(u32, u32)]) -> Self { + let num_entries = entries.len(); + let mut bytes = + vec![0u8; NUM_NSS_BYTE_LEN + num_entries * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN)]; + bytes[0..NUM_NSS_BYTE_LEN].copy_from_slice(&(num_entries as u32).to_le_bytes()); + entries.iter().enumerate().for_each(|(i, (id, offset))| { + let pos = i * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN) + NUM_NSS_BYTE_LEN; + bytes[pos..pos + NS_ID_BYTE_LEN].copy_from_slice(&id.to_le_bytes()); + bytes[pos + NS_ID_BYTE_LEN..pos + NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN] + .copy_from_slice(&offset.to_le_bytes()); + }); + Self { bytes } + } } impl Committable for NsTable { From 0509ac56c638ff6db910ed83b5d3d95d8d50ef1b Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 21 Aug 2024 20:33:07 -0400 Subject: [PATCH 18/44] use fixed ns_id for all --- sp1/program/src/main.rs | 4 +++- sp1/script/src/bin/prove.rs | 6 +++--- sp1/utils/src/lib.rs | 13 ++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 712b1cf..0f1393f 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -38,6 +38,7 @@ fn verify_espresso_derivation(payload: &[u8], proof: &EspressoDerivationProof) - && verify_block_derivation_proof( &payload[range.start..range.end], &proof.vid_param, + proof.ns_id, &proof.bmt_commitment, block_proof, ); @@ -49,6 +50,7 @@ fn verify_espresso_derivation(payload: &[u8], proof: &EspressoDerivationProof) - fn verify_block_derivation_proof( payload_slice: &[u8], vid_param: &VidParam, + ns_id: u32, bmt_commitment: &BlockMerkleCommitment, proof: &BlockDerivationProof, ) -> bool { @@ -74,7 +76,7 @@ fn verify_block_derivation_proof( return false; } - match proof.block_header.ns_table.scan_for_id(proof.ns_id) { + match proof.block_header.ns_table.scan_for_id(ns_id) { None => { std::println!("Namespace ID not found in the block."); false diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index cf8a5b3..65d270f 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -130,6 +130,8 @@ fn mock_block( fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { let mut rng = rand::thread_rng(); + let ns_id = rng.next_u32(); + let mut block_merkle_tree = BlockMerkleTree::new(32); let num_blocks = rng.gen_range(2..5); @@ -146,8 +148,6 @@ fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { let ns_payload_len = rng.gen_range(5..10); let mut block_ns_payload = vec![0u8; ns_payload_len]; - let ns_id = rng.next_u32(); - let (header, vid_common, ns_proof) = mock_block(i, ns_id, &block_ns_payload, &mut vid, &mut rng); @@ -160,7 +160,6 @@ fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { BlockDerivationProof { bmt_proof, block_header: header, - ns_id, vid_common, ns_proof, }, @@ -173,6 +172,7 @@ fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { } let derivation_proof = EspressoDerivationProof { vid_param, + ns_id, bmt_commitment: block_merkle_tree.commitment(), block_proofs, }; diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 4663e6d..9282b8e 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -30,8 +30,6 @@ pub struct BlockDerivationProof { pub bmt_proof: BlockMerkleTreeProof, /// Block header pub block_header: BlockHeader, - /// Namespace ID of the rollup - pub ns_id: u32, /// Common data associated with the VID disperser, used for namespace proof verification pub vid_common: VidCommon, /// Namespace proof of the given payload @@ -43,6 +41,8 @@ pub struct BlockDerivationProof { pub struct EspressoDerivationProof { /// VID public parameter, used for namespace proof verification pub vid_param: VidParam, + /// Namespace ID of the rollup + pub ns_id: u32, /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. pub bmt_commitment: BlockMerkleCommitment, /// Block proofs for slices of payload. @@ -54,21 +54,24 @@ pub struct EspressoDerivationProof { pub struct EspressoDerivationCommit { /// Hash of the used VID public parameter pub vid_param_hash: H256, + /// Namespace ID of the rollup + pub ns_id: u32, /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. pub bmt_commitment: BlockMerkleCommitment, - /// List of (range, block_height, ns_id). Specifies a block which each slice of payload is from. - pub blocks: Vec<(Range, u64, u32)>, + /// List of (range, block_height). Specifies a block which each slice of payload is from. + pub blocks: Vec<(Range, u64)>, } impl From for EspressoDerivationCommit { fn from(proof: EspressoDerivationProof) -> Self { Self { vid_param_hash: compute_vid_param_hash(&proof.vid_param), + ns_id: proof.ns_id, bmt_commitment: proof.bmt_commitment, blocks: proof .block_proofs .into_iter() - .map(|(range, proof)| (range, proof.block_header.height, proof.ns_id)) + .map(|(range, proof)| (range, proof.block_header.height)) .collect(), } } From 0d9bc4027abf67178dbb8f5f22649f800655332f Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 21 Aug 2024 20:35:12 -0400 Subject: [PATCH 19/44] comments --- sp1/script/src/bin/prove.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 65d270f..256bfe1 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -5,13 +5,6 @@ //! RUST_LOG=info cargo run --package espresso-derivation-prover --bin prove --release //! ``` -// TODO: this crate should take inputs of an espresso block, block header, and other -// information from espresso light client or query service, extract public and private -// inputs for derivation pipeline, and generate need proofs. (Incomplete) workflow: -// - Program input: espresso block, block header, etc. -// - Scan through the namespace table for the index of this rollup's namespace ID. -// - Feed these input to the program to generate a proof. - use clap::Parser; use committable::Committable; use espresso_derivation_utils::{ @@ -56,7 +49,6 @@ fn mock_block( rng: &mut R, ) -> (BlockHeader, VidCommon, NsProof) { // This is a tweak from an actual block header in Espresso's staging testnet - // Namespace table is hardcoded. let mut header: BlockHeader = serde_json::from_str( r#"{ "chain_config": { From 8395d40b84428f75fec5e89ed18caeba96c77d65 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Thu, 22 Aug 2024 23:30:39 +0800 Subject: [PATCH 20/44] ci: passing proof gen (#42) * modify PATH differently * configure SHELL env var * use 32GB RAM and cache SRS --- .github/workflows/proof.yml | 13 ++++++++++++- sp1/program/Cargo.toml | 2 +- sp1/script/Cargo.toml | 8 ++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/proof.yml b/.github/workflows/proof.yml index e325a7c..9b3c741 100644 --- a/.github/workflows/proof.yml +++ b/.github/workflows/proof.yml @@ -4,9 +4,12 @@ name: Proof Generation on: workflow_dispatch: +env: + SHELL: "/bin/bash" + jobs: sp1-proof-gen: - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: buildjet-8vcpu-ubuntu-2204 steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -23,7 +26,15 @@ jobs: with: prefix-key: v2-rust + - uses: buildjet/cache@v3 + with: + path: ~/.local/share/ark-srs + key: buildjet-ark-srs-${{ hashFiles('**/*.bin') }} + restore-keys: | + buildjet-ark-srs- + - name: Install SP1 toolchain + shell: bash run: | curl -L https://sp1.succinct.xyz | bash ~/.sp1/bin/sp1up diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 792b222..20ca435 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] committable = { workspace = true } -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } jf-vid = { workspace = true } +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index be98a52..e331362 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -13,14 +13,14 @@ ark-srs = "0.3.1" bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } -serde = { workspace = true } -serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } -tracing = "0.1.40" espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } jf-pcs = { workspace = true } jf-vid = { workspace = true } +serde = { workspace = true } +serde_json = { version = "1.0", default-features = false, features = ["alloc"] } +sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } +tracing = "0.1.40" [build-dependencies] sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } From d5011b63c4ac401cfe43699b16e26f848ec8babf Mon Sep 17 00:00:00 2001 From: MRain Date: Thu, 22 Aug 2024 11:44:32 -0400 Subject: [PATCH 21/44] Documentation --- README.md | 57 +++++++++++++++++++------------------------- sp1/utils/src/lib.rs | 4 ++-- 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index ffab1b4..a921bad 100644 --- a/README.md +++ b/README.md @@ -21,54 +21,47 @@ Terminology wise: - `BlockPayload`: the actual payload that contains the raw tx data - instead of full block replication at each node, we use Verifiable Information Dispersal (VID) schemes where each replica stores a chunk. - our concrete instantiation of VID relies on KZG polynomial commitment, thus requires _structured reference string_ (SRS) from a trusted setup - - all replicas unequivocally refer to the payload by a `VidCommitment`, a cryptographic commitment to the entire payload sent to every replica alongside their designated chunk + - all replicas unequivocally refer to the payload by a `PayloadCommitment`, a cryptographic commitment to the entire payload sent to every replica alongside their designated chunk - `BlockHeader`: the summarized new consensus state and chain metadata (for consensus nodes) - `BlockCommitment`: a short cryptographic commitment to the `BlockHeader` - - `BlockMerkleCommitment`: the root of `BlockMerkleTree` that accumulates all block commitments, enabling efficient historical block header lookup via `BlockMerkleTreeProof` - - `VidCommitment` is a part of of `BlockHeader` + - `BlockMerkleCommitment`: the root of `BlockMerkleTree` that accumulates all block commitments up to the current `BlockHeight`, enabling efficient historical block header lookup via `BlockMerkleTreeProof` + - `PayloadCommitment` is a part of `BlockHeader` + - `NsTable` described below is a part of `BlockHeader` +- each rollup occupies a _namespace_ (distinguished by a unique namespace ID) in a block + - `NsTable` is the compact encoding of a _namespace table_ mapping namespace id to their range in `BlockPayload` + - `NsProof` is a _namespace proof_, attesting that some subset of bytes is the complete range of data designated to a particular namespace in a `BlockPayload` identified by its `PayloadCommitment` given a `NsTable` - a _light client_ is an agent that can verify the latest finalized _consensus state_ without running a full node - an off-chain light client usually receive the block header and the quorum certificate (QC) - an on-chain light client stores a pruned `LightClientState`, a strict subset of fields in `BlockHeader`, verified through _light client proof_ (the simplest form is using the QC from consensus, but we use a more EVM and SNARK-friendly light client protocol). -- each rollup occupies a _namespace_ (distinguished by a unique namespace ID) in a block - - `NsTable` is the compact encoding of a _namespace table_ mapping namespace id to their offset and range in `BlockPayload` - - `NsProof` is a _namespace proof_, attesting that some subset of bytes is the complete range of data designated to a particular namespace in a `BlockPayload` identified by its `VidCommitment` given a `NsTable` ## Circuit Spec -Assume we are proving a batch of `n` Espresso blocks. +Generally speaking, we are proving that a list of rollup's transactions are correctly derived Espresso blocks finalized by the consensus. **Public Inputs** -- `blk_cm_root_old: BlockMerkleCommitment`: root of the old block commitment tree -- `blk_cm_root_new: BlockMerkleCommitment`: root of the new block commitment tree -- `ns_txs_hash: ?`: commitment to all the txs for a namespace (type depends on the commitment scheme, e.g. Sha256 results in `[u8; 32]`) - - this commitment/hash is computed by the rollup VM prover and the concrete algorithm is usually different for different rollups - - other public inputs to the "VM proof" (e.g. `prevStateRoot`, `newStateRoot`, `Withdraw/ExitRoot`) are skipped here since our circuit won't use them +- `rollup_txs_commit: [u8; 32]`: Sha256 of the list of rollup's transactions +- `ns_id: u32`: namespace ID of this rollup +- `bmt_commitment: BlockMerkleCommitment`: root of the newest Espresso block commitment tree, contains information of all historical Espresso blocks - `vid_pp_hash: [u8; 32]`: Sha256 of `VidPublicParam` for the VID scheme +- `blocks_info: Vec<(Range, u64)>`: specifies the origin Espresso block where each slice of the rollup transactions is from **Private Witness** -- `ns_id: u32`: namespace ID -- `all_tx: Vec>`: all txs between `blk_cm_root_old` and `blk_cm_root_new` grouped by each block - - `ns_txs: Vec>` is a subset range of the `all_tx` that corresponds to a specific namespace -- `blk_headers: Vec`: a list of n `BlockHeader` -- `blk_header_proofs: Vec`: a list of n MT proof proving membership of foregoing block headers in `blk_cm_root_new` -- `ns_proofs: Vec`: a list of n `NsProof` for every `VidCommitment` and every group of txs `txs_in_blk_i` -- `vid_pp: VidPublicParam` -- `vid_common: VidCommon`: some auxiliary data broadcast to and used by each replica when verifying their chunks +- `payload: Vec`: bytes representation of all rollup's collected transactions +- `vid_param: VidParam`: public parameter for Espresso's VID scheme +- `block_proofs: Vec`: a proof that each slice of the rollup's transactions is derived from an Espresso blocks. Each `BlockDerivationProof` contains the following: + - `block_header: BlockHeader`: block header of the origin Espresso block. Contains the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the Espresso block payload + - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` + - `vid_common: VidCommon`: auxiliary information needed to verify the namespace proof + - `ns_proof: NsProof`: a namespace proof such that the given transactions slice is from the Espresso block payload committed in the `block_header` and specified by the namespace table entry `ns_id` **Relations** -1. Namespace-specific tx filtering: `ns_txs` is the correct subset range of payload for `ns_id` - - `for i in 0..n`: - - compute subset range: `range := blk_headers[i].ns_table.lookup(ns_id)` - - locate sub-slice of txs: `ns_txs[i]:= all_tx[i][range]` - - check consistency between `blk_headers[i].vid_cm` and `vid_common` - - verify the namespace proof: `payload_verify(vid_pp, vid_common, ns_txs[i], ns_proofs[i])` - - ensure legit block header: - - compute block commitment: `blk_cm := COM.commit(blk_headers[i])` - - verify inclusion via membership proof: `MT.verify(blk_cm, blk_cm_root_new, blk_header_proofs[i])` -2. Transaction batch commitment equivalence: same batch of txs used in VID and in VM proof - - compute the `ns_txs_hash := H(ns_txs[0] | ns_txs[1] | ... | ns_txs[n-1])` using whichever commitment/hashing scheme rollup VM prover chooses - +1. Ensure the commitment equivalence: `rollup_txs_commit == Sha256(payload)` +2. Correct espresso derivation + - First the ranges in `blocks_info` and `block_proofs` should be non-overlapping and cover the whole payload + - For each `BlockDerivationProof`, we check + - the `block_header` is in the block Merkle tree, by checking the proof `bmt_proof` against the block Merkle tree commitment `bmt_commitment` + - Namespace ID `ns_id` of this rollup is containd in the namespace table `block_header.ns_table`, and given the specified range in the Espresso block and a namespace proof `NsProof`, checks whether the slice of rollup's transactions `payload` matches the specified slice in the Espresso block payload committed by `block_header.payload_commitment` Read [our doc](https://github.com/EspressoSystems/espresso-sequencer/blob/main/doc/zk-integration.md) for a more detailed description; read our blog on [Derivation Pipeline](https://hackmd.io/@EspressoSystems/the-derivation-pipeline) for rollup integration. diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 9282b8e..6a69f32 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -59,7 +59,7 @@ pub struct EspressoDerivationCommit { /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. pub bmt_commitment: BlockMerkleCommitment, /// List of (range, block_height). Specifies a block which each slice of payload is from. - pub blocks: Vec<(Range, u64)>, + pub blocks_info: Vec<(Range, u64)>, } impl From for EspressoDerivationCommit { @@ -68,7 +68,7 @@ impl From for EspressoDerivationCommit { vid_param_hash: compute_vid_param_hash(&proof.vid_param), ns_id: proof.ns_id, bmt_commitment: proof.bmt_commitment, - blocks: proof + blocks_info: proof .block_proofs .into_iter() .map(|(range, proof)| (range, proof.block_header.height)) From 81f639da4dea145a57c92d108c85f8b0644deb5c Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Thu, 22 Aug 2024 23:11:22 -0400 Subject: [PATCH 22/44] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a921bad..10e2602 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Terminology wise: ## Circuit Spec -Generally speaking, we are proving that a list of rollup's transactions are correctly derived Espresso blocks finalized by the consensus. +Generally speaking, we are proving that a list of rollup's transactions are correctly derived from finalized Espresso blocks. **Public Inputs** - `rollup_txs_commit: [u8; 32]`: Sha256 of the list of rollup's transactions From a28db3656996dea55552bb0481cd59e94e93b78a Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:31:13 -0400 Subject: [PATCH 23/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10e2602..1d8502d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ Terminology wise: Generally speaking, we are proving that a list of rollup's transactions are correctly derived from finalized Espresso blocks. **Public Inputs** -- `rollup_txs_commit: [u8; 32]`: Sha256 of the list of rollup's transactions +- `rollup_txs_commit: [u8; 32]`: commitment to the transactions designated to the rollup `ns_id`, also one of the public inputs from the VM execution proof + - the concrete commitment scheme depends on the VM prover design, we use `Sha256(payload)` in the demo - `ns_id: u32`: namespace ID of this rollup - `bmt_commitment: BlockMerkleCommitment`: root of the newest Espresso block commitment tree, contains information of all historical Espresso blocks - `vid_pp_hash: [u8; 32]`: Sha256 of `VidPublicParam` for the VID scheme From 220a4f4f859d5c2ce0902563e2f7b4dfe06098f3 Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:31:28 -0400 Subject: [PATCH 24/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d8502d..15e86d0 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `rollup_txs_commit: [u8; 32]`: commitment to the transactions designated to the rollup `ns_id`, also one of the public inputs from the VM execution proof - the concrete commitment scheme depends on the VM prover design, we use `Sha256(payload)` in the demo - `ns_id: u32`: namespace ID of this rollup -- `bmt_commitment: BlockMerkleCommitment`: root of the newest Espresso block commitment tree, contains information of all historical Espresso blocks +- `bmt_commitment: BlockMerkleCommitment`: root of the newest Espresso block commitment tree, accumulated all historical Espresso block commitments - `vid_pp_hash: [u8; 32]`: Sha256 of `VidPublicParam` for the VID scheme - `blocks_info: Vec<(Range, u64)>`: specifies the origin Espresso block where each slice of the rollup transactions is from From cfe1a8a150d9e5f3cea565576a18bf79d269e786 Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:36:43 -0400 Subject: [PATCH 25/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15e86d0..7e502a9 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr **Private Witness** -- `payload: Vec`: bytes representation of all rollup's collected transactions +- `payload: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks - `vid_param: VidParam`: public parameter for Espresso's VID scheme - `block_proofs: Vec`: a proof that each slice of the rollup's transactions is derived from an Espresso blocks. Each `BlockDerivationProof` contains the following: - `block_header: BlockHeader`: block header of the origin Espresso block. Contains the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the Espresso block payload From f959762d387ac90dd317b6afcb4fcbeef275b23f Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:37:01 -0400 Subject: [PATCH 26/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e502a9..16d280f 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `payload: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks - `vid_param: VidParam`: public parameter for Espresso's VID scheme - `block_proofs: Vec`: a proof that each slice of the rollup's transactions is derived from an Espresso blocks. Each `BlockDerivationProof` contains the following: - - `block_header: BlockHeader`: block header of the origin Espresso block. Contains the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the Espresso block payload + - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` - `vid_common: VidCommon`: auxiliary information needed to verify the namespace proof - `ns_proof: NsProof`: a namespace proof such that the given transactions slice is from the Espresso block payload committed in the `block_header` and specified by the namespace table entry `ns_id` From 78534bb3536ffb17e8e37dd2ac8b6a537339b435 Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:37:12 -0400 Subject: [PATCH 27/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16d280f..594d71c 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr **Relations** 1. Ensure the commitment equivalence: `rollup_txs_commit == Sha256(payload)` -2. Correct espresso derivation +2. Correct derivations for the namespace/rollup from committed Espresso blocks - First the ranges in `blocks_info` and `block_proofs` should be non-overlapping and cover the whole payload - For each `BlockDerivationProof`, we check - the `block_header` is in the block Merkle tree, by checking the proof `bmt_proof` against the block Merkle tree commitment `bmt_commitment` From b452988d39fc0baa72b792e265215afb69a0d032 Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:37:27 -0400 Subject: [PATCH 28/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 594d71c..4006b22 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `ns_proof: NsProof`: a namespace proof such that the given transactions slice is from the Espresso block payload committed in the `block_header` and specified by the namespace table entry `ns_id` **Relations** -1. Ensure the commitment equivalence: `rollup_txs_commit == Sha256(payload)` +1. Recompute the payload commitment using the "VM execution prover" way: `rollup_txs_commit == Sha256(payload)` + - note: by marking this as a public input, the verifier can cross-check it with the public inputs from the "vm proof", thus ensuring the same batch of transactions is used in `payload` here and in the generation of the "vm proof" 2. Correct derivations for the namespace/rollup from committed Espresso blocks - First the ranges in `blocks_info` and `block_proofs` should be non-overlapping and cover the whole payload - For each `BlockDerivationProof`, we check From de438e7149a66d8e443d409be65a4958b154b1da Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:37:40 -0400 Subject: [PATCH 29/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4006b22..ec70c2c 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` - `vid_common: VidCommon`: auxiliary information needed to verify the namespace proof - - `ns_proof: NsProof`: a namespace proof such that the given transactions slice is from the Espresso block payload committed in the `block_header` and specified by the namespace table entry `ns_id` + - `ns_proof: NsProof`: a namespace proof that proves some subslice of bytes (i.e. `payload[range]`) is the complete subset for the namespace `ns_id` from the overall Espresso block payload committed in `block_header` **Relations** 1. Recompute the payload commitment using the "VM execution prover" way: `rollup_txs_commit == Sha256(payload)` From 0ebea09fdb820c05fc7c7e3dc1d14ea57494921e Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:37:54 -0400 Subject: [PATCH 30/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ec70c2c..c5ffd2b 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `payload: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks - `vid_param: VidParam`: public parameter for Espresso's VID scheme -- `block_proofs: Vec`: a proof that each slice of the rollup's transactions is derived from an Espresso blocks. Each `BlockDerivationProof` contains the following: +- `derivation_proofs: Vec`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. +Each `BlockDerivationProof` contains the following: - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` - `vid_common: VidCommon`: auxiliary information needed to verify the namespace proof From ef2b9d43f984c9455979006fb6d129fb3663ddec Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Fri, 23 Aug 2024 09:38:52 -0400 Subject: [PATCH 31/44] Update README.md Co-authored-by: Alex Xiong --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5ffd2b..de8e72d 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr Each `BlockDerivationProof` contains the following: - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` - - `vid_common: VidCommon`: auxiliary information needed to verify the namespace proof + - `vid_common: VidCommon`: auxiliary information for the namespace proof `ns_proof` verification during which its consistency against `payload_commitment` is checked - `ns_proof: NsProof`: a namespace proof that proves some subslice of bytes (i.e. `payload[range]`) is the complete subset for the namespace `ns_id` from the overall Espresso block payload committed in `block_header` **Relations** From 329816ece6b83c132f1a6c677b084a24dc3662c6 Mon Sep 17 00:00:00 2001 From: MRain Date: Fri, 23 Aug 2024 09:44:28 -0400 Subject: [PATCH 32/44] rearrange public inputs and naming --- README.md | 5 ++--- sp1/program/src/main.rs | 28 ++++++++++++++++------------ sp1/script/src/bin/prove.rs | 2 +- sp1/utils/src/lib.rs | 9 +-------- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index de8e72d..28b4838 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,12 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `ns_id: u32`: namespace ID of this rollup - `bmt_commitment: BlockMerkleCommitment`: root of the newest Espresso block commitment tree, accumulated all historical Espresso block commitments - `vid_pp_hash: [u8; 32]`: Sha256 of `VidPublicParam` for the VID scheme -- `blocks_info: Vec<(Range, u64)>`: specifies the origin Espresso block where each slice of the rollup transactions is from **Private Witness** - `payload: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks - `vid_param: VidParam`: public parameter for Espresso's VID scheme -- `derivation_proofs: Vec`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. +- `block_derivation_proofs: Vec`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. Each `BlockDerivationProof` contains the following: - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` @@ -61,7 +60,7 @@ Each `BlockDerivationProof` contains the following: 1. Recompute the payload commitment using the "VM execution prover" way: `rollup_txs_commit == Sha256(payload)` - note: by marking this as a public input, the verifier can cross-check it with the public inputs from the "vm proof", thus ensuring the same batch of transactions is used in `payload` here and in the generation of the "vm proof" 2. Correct derivations for the namespace/rollup from committed Espresso blocks - - First the ranges in `blocks_info` and `block_proofs` should be non-overlapping and cover the whole payload + - First the ranges in `block_derivation_proofs` should be non-overlapping and cover the whole payload, i.e. `range[i].end == range[i+1].start && range[i].start == 0 && range[-1].end == payload.len()`. - For each `BlockDerivationProof`, we check - the `block_header` is in the block Merkle tree, by checking the proof `bmt_proof` against the block Merkle tree commitment `bmt_commitment` - Namespace ID `ns_id` of this rollup is containd in the namespace table `block_header.ns_table`, and given the specified range in the Espresso block and a namespace proof `NsProof`, checks whether the slice of rollup's transactions `payload` matches the specified slice in the Espresso block payload committed by `block_header.payload_commitment` diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 0f1393f..fd504d8 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -33,18 +33,22 @@ pub fn main() { fn verify_espresso_derivation(payload: &[u8], proof: &EspressoDerivationProof) -> bool { let mut end = 0; - proof.block_proofs.iter().all(|(range, block_proof)| { - let result = range.start == end - && verify_block_derivation_proof( - &payload[range.start..range.end], - &proof.vid_param, - proof.ns_id, - &proof.bmt_commitment, - block_proof, - ); - end = range.end; - result - }) && end == payload.len() + proof + .block_derivation_proofs + .iter() + .all(|(range, block_proof)| { + let result = range.start == end + && verify_block_derivation_proof( + &payload[range.start..range.end], + &proof.vid_param, + proof.ns_id, + &proof.bmt_commitment, + block_proof, + ); + end = range.end; + result + }) + && end == payload.len() } fn verify_block_derivation_proof( diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 256bfe1..92111ab 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -166,7 +166,7 @@ fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { vid_param, ns_id, bmt_commitment: block_merkle_tree.commitment(), - block_proofs, + block_derivation_proofs: block_proofs, }; stdin.write(&rollup_payload); diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 6a69f32..1ec10f2 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -47,7 +47,7 @@ pub struct EspressoDerivationProof { pub bmt_commitment: BlockMerkleCommitment, /// Block proofs for slices of payload. /// Ranges should cover the whole payload and be non-overlapping. - pub block_proofs: Vec<(Range, BlockDerivationProof)>, + pub block_derivation_proofs: Vec<(Range, BlockDerivationProof)>, } #[derive(Serialize, Deserialize, Debug)] @@ -58,8 +58,6 @@ pub struct EspressoDerivationCommit { pub ns_id: u32, /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. pub bmt_commitment: BlockMerkleCommitment, - /// List of (range, block_height). Specifies a block which each slice of payload is from. - pub blocks_info: Vec<(Range, u64)>, } impl From for EspressoDerivationCommit { @@ -68,11 +66,6 @@ impl From for EspressoDerivationCommit { vid_param_hash: compute_vid_param_hash(&proof.vid_param), ns_id: proof.ns_id, bmt_commitment: proof.bmt_commitment, - blocks_info: proof - .block_proofs - .into_iter() - .map(|(range, proof)| (range, proof.block_header.height)) - .collect(), } } } From 31cf0bcbaaffec81dfb72fbc5b660489ff7faa6d Mon Sep 17 00:00:00 2001 From: MRain Date: Mon, 26 Aug 2024 09:53:27 -0400 Subject: [PATCH 33/44] comments & fmt --- rustfmt.toml | 5 +++ sp1/program/src/main.rs | 62 +++++++++++++++++++++-------------- sp1/script/src/bin/prove.rs | 24 ++++++++------ sp1/utils/src/block/header.rs | 18 +++++----- sp1/utils/src/lib.rs | 40 ++++++++-------------- sp1/utils/src/ns_table.rs | 8 ++--- 6 files changed, 85 insertions(+), 72 deletions(-) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..92e1b49 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,5 @@ +reorder_imports = true +wrap_comments = true +normalize_comments = true +use_try_shorthand = true +match_block_trailing_comma = true diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index fd504d8..e3bf428 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -1,4 +1,5 @@ -//! This program proves that the executed transactions are correctly derived from espresso blocks. +//! This program proves that the executed transactions are correctly derived +//! from espresso blocks. #![no_main] sp1_zkvm::entrypoint!(main); @@ -7,7 +8,7 @@ use committable::Committable; use espresso_derivation_utils::{ block::{ header::{BlockMerkleCommitment, BlockMerkleTree}, - payload::{rollup_commit, vid_scheme, Payload, Vid, VidParam}, + payload::{compute_vid_param_hash, rollup_commit, vid_scheme, Payload, Vid, VidParam}, }, BlockDerivationProof, EspressoDerivationProof, PublicInputs, }; @@ -18,39 +19,57 @@ use jf_vid::{ }; pub fn main() { + // `payload` is the list of all transactions in bytes form. let payload = sp1_zkvm::io::read::(); + // Espresso derivation proof contains the following: + // 1. (its hash is public) `vid_param`: VID public parameter for checking + // namespace proof + // 2. (public) `ns_id`: namespace ID of this rollup + // 3. (public) `bmt_commitment`: the Espresso block Merkle tree commitment that + // accumulates all block commitments up to the current `BlockHeight`. + // 4. (private) `block_derivation_proofs`: a pair of `(range, proof)` where the + // `proof` asserts that a `range` of `payload` is derived from some block + // committed in the block Merkle tree above. let espresso_derivation_proof = sp1_zkvm::io::read::(); std::println!("All inputs are loaded"); - let public_inputs = PublicInputs { - verification_result: verify_espresso_derivation(&payload.0, &espresso_derivation_proof), - rollup_txs_commit: rollup_commit(&payload), - espresso_derivation_commit: espresso_derivation_proof.into(), - }; - - sp1_zkvm::io::commit(&public_inputs); -} + // Compute the commitment of all the transactions + let rollup_txs_commit = rollup_commit(&payload); -fn verify_espresso_derivation(payload: &[u8], proof: &EspressoDerivationProof) -> bool { + // Verify the Espresso derivation proof + // 1. Check that the ranges cover the whole payload with no overlapping + // 2. Check each block derivation proof let mut end = 0; - proof + let verification_result = espresso_derivation_proof .block_derivation_proofs .iter() .all(|(range, block_proof)| { let result = range.start == end && verify_block_derivation_proof( - &payload[range.start..range.end], - &proof.vid_param, - proof.ns_id, - &proof.bmt_commitment, + &payload.0[range.start..range.end], + &espresso_derivation_proof.vid_param, + espresso_derivation_proof.ns_id, + &espresso_derivation_proof.bmt_commitment, block_proof, ); end = range.end; result }) - && end == payload.len() + && end == payload.0.len(); + + // Wrap all the public inputs along with the verification result + let public_inputs = PublicInputs { + verification_result, + rollup_txs_commit, + vid_param_hash: compute_vid_param_hash(&espresso_derivation_proof.vid_param), + ns_id: espresso_derivation_proof.ns_id, + bmt_commitment: espresso_derivation_proof.bmt_commitment, + }; + + sp1_zkvm::io::commit(&public_inputs); } +/// Verifies the block derivation proof against the public inputs fn verify_block_derivation_proof( payload_slice: &[u8], vid_param: &VidParam, @@ -84,7 +103,7 @@ fn verify_block_derivation_proof( None => { std::println!("Namespace ID not found in the block."); false - } + }, Some((ns_range_start, ns_range_end)) => { std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); @@ -102,17 +121,12 @@ fn verify_block_derivation_proof( &proof.ns_proof, ) .is_ok_and(|result| result.is_ok()) - || ::is_consistent( - &proof.block_header.payload_commitment, - &proof.vid_common, - ) - .is_err() { std::println!("Failed namespace proof."); false } else { true } - } + }, } } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 92111ab..223ec5a 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -1,4 +1,5 @@ -//! Using the SP1 SDK to generate a proof of correct derivation from an espresso block. +//! Using the SP1 SDK to generate a proof of correct derivation from an espresso +//! block. //! //! You can run this script using the following command: //! ```shell @@ -26,7 +27,8 @@ use std::path::PathBuf; /// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. /// -/// This file is generated by running `cargo prove build` inside the `program` directory. +/// This file is generated by running `cargo prove build` inside the `program` +/// directory. pub const ELF: &[u8] = include_bytes!("../../../program/elf/riscv32im-succinct-zkvm-elf"); /// The arguments for the prove command. @@ -226,7 +228,8 @@ fn main() { } } -/// A fixture that can be used to test the verification of SP1 zkVM proofs inside Solidity. +/// A fixture that can be used to test the verification of SP1 zkVM proofs +/// inside Solidity. #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] struct ProofFixture { @@ -244,20 +247,21 @@ fn create_plonk_fixture(proof: &SP1ProofWithPublicValues, vk: &SP1VerifyingKey) proof: proof.raw(), }; - // The verification key is used to verify that the proof corresponds to the execution of the - // program on the given input. + // The verification key is used to verify that the proof corresponds to the + // execution of the program on the given input. // // Note that the verification key stays the same regardless of the input. println!("Verification Key: {}", fixture.vkey); - // The public values are the values whicha are publicly committed to by the zkVM. + // The public values are the values whicha are publicly committed to by the + // zkVM. // - // If you need to expose the inputs or outputs of your program, you should commit them in - // the public values. + // If you need to expose the inputs or outputs of your program, you should + // commit them in the public values. println!("Public Values: {}", fixture.public_values); - // The proof proves to the verifier that the program was executed with some inputs that led to - // the give public values. + // The proof proves to the verifier that the program was executed with some + // inputs that led to the give public values. println!("Proof Bytes: {}", fixture.proof); // Save the fixture to a file. diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs index 2ffcc72..dcf8646 100644 --- a/sp1/utils/src/block/header.rs +++ b/sp1/utils/src/block/header.rs @@ -86,8 +86,8 @@ impl Committable for BlockHeader { } fn tag() -> String { - // We use the tag "BLOCK" since blocks are identified by the hash of their header. This will - // thus be more intuitive to users than "HEADER". + // We use the tag "BLOCK" since blocks are identified by the hash of their + // header. This will thus be more intuitive to users than "HEADER". "BLOCK".into() } } @@ -139,16 +139,18 @@ pub struct ChainConfig { /// Fee contract H160 on L1. /// - /// This is optional so that fees can easily be toggled on/off, with no need to deploy a - /// contract when they are off. In a future release, after fees are switched on and thoroughly - /// tested, this may be made mandatory. + /// This is optional so that fees can easily be toggled on/off, with no need + /// to deploy a contract when they are off. In a future release, after + /// fees are switched on and thoroughly tested, this may be made + /// mandatory. pub fee_contract: Option, /// Account that receives sequencing fees. /// - /// This account in the Espresso fee ledger will always receive every fee paid in Espresso, - /// regardless of whether or not their is a `fee_contract` deployed. Once deployed, the fee - /// contract can decide what to do with tokens locked in this account in Espresso. + /// This account in the Espresso fee ledger will always receive every fee + /// paid in Espresso, regardless of whether or not their is a + /// `fee_contract` deployed. Once deployed, the fee contract can decide + /// what to do with tokens locked in this account in Espresso. pub fee_recipient: H160, } diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 1ec10f2..1b7fc96 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -1,11 +1,11 @@ //! Espresso derivation utilities for rollup integration. -// Ideally we could directly import types and structs from `espresso-sequencer`` repo. However, one of its dependency, -// `HotShot` requires a minimum rust version of [1.76.0](https://github.com/EspressoSystems/HotShot/blob/4713af7704f88f38a8a69b708acd4677f76d8ff1/Cargo.toml#L5). +// Ideally we could directly import types and structs from `espresso-sequencer`` +// repo. However, one of its dependency, `HotShot` requires a minimum rust version of [1.76.0](https://github.com/EspressoSystems/HotShot/blob/4713af7704f88f38a8a69b708acd4677f76d8ff1/Cargo.toml#L5). // This is incompatible with the current sp1 rust toolchain 1.75.0. use block::{ header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTreeProof}, - payload::{compute_vid_param_hash, NsProof, VidCommon, VidParam}, + payload::{NsProof, VidCommon, VidParam}, RollupCommitment, }; use primitive_types::H256; @@ -20,7 +20,13 @@ pub mod ns_table; pub struct PublicInputs { pub verification_result: bool, pub rollup_txs_commit: RollupCommitment, - pub espresso_derivation_commit: EspressoDerivationCommit, + /// Hash of the used VID public parameter + pub vid_param_hash: H256, + /// Namespace ID of the rollup + pub ns_id: u32, + /// Block Merkle tree commitment. Block MT contains information about all + /// historical blocks up to some block height. + pub bmt_commitment: BlockMerkleCommitment, } #[derive(Serialize, Deserialize, Debug)] @@ -30,7 +36,8 @@ pub struct BlockDerivationProof { pub bmt_proof: BlockMerkleTreeProof, /// Block header pub block_header: BlockHeader, - /// Common data associated with the VID disperser, used for namespace proof verification + /// Common data associated with the VID disperser, used for namespace proof + /// verification pub vid_common: VidCommon, /// Namespace proof of the given payload pub ns_proof: NsProof, @@ -43,29 +50,10 @@ pub struct EspressoDerivationProof { pub vid_param: VidParam, /// Namespace ID of the rollup pub ns_id: u32, - /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. + /// Block Merkle tree commitment. Block MT contains information about all + /// historical blocks up to some block height. pub bmt_commitment: BlockMerkleCommitment, /// Block proofs for slices of payload. /// Ranges should cover the whole payload and be non-overlapping. pub block_derivation_proofs: Vec<(Range, BlockDerivationProof)>, } - -#[derive(Serialize, Deserialize, Debug)] -pub struct EspressoDerivationCommit { - /// Hash of the used VID public parameter - pub vid_param_hash: H256, - /// Namespace ID of the rollup - pub ns_id: u32, - /// Block Merkle tree commitment. Block MT contains information about all historical blocks up to some block height. - pub bmt_commitment: BlockMerkleCommitment, -} - -impl From for EspressoDerivationCommit { - fn from(proof: EspressoDerivationProof) -> Self { - Self { - vid_param_hash: compute_vid_param_hash(&proof.vid_param), - ns_id: proof.ns_id, - bmt_commitment: proof.bmt_commitment, - } - } -} diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs index 8e1b578..cf055f1 100644 --- a/sp1/utils/src/ns_table.rs +++ b/sp1/utils/src/ns_table.rs @@ -42,8 +42,8 @@ impl NsTable { /// Read from namespace table given an index without range check. /// - /// Return a triple (id, start, end) which specifies the namespacd ID and its - /// range [start, end) in the payload. + /// Return a triple (id, start, end) which specifies the namespacd ID and + /// its range [start, end) in the payload. pub fn read_unchecked(&self, index: u32) -> (u32, u32, u32) { let pos = index as usize * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN) + NUM_NSS_BYTE_LEN; let id = u32::from_le_bytes(self.bytes[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); @@ -66,8 +66,8 @@ impl NsTable { /// Read from namespace table given a namespace ID. /// - /// Return None if given ID is not present, or a tuple (start, end) specifying - /// its bytes range [start, end) in the payload. + /// Return None if given ID is not present, or a tuple (start, end) + /// specifying its bytes range [start, end) in the payload. pub fn scan_for_id(&self, id: u32) -> Option<(u32, u32)> { let mut pos = NUM_NSS_BYTE_LEN; let mut last_offset = 0u32; From 6312cb63d933b3590a83b930164b2078fbef31bc Mon Sep 17 00:00:00 2001 From: MRain Date: Mon, 26 Aug 2024 10:56:54 -0400 Subject: [PATCH 34/44] address comments --- sp1/program/src/main.rs | 70 ++++++++++++++++------------------- sp1/script/src/bin/prove.rs | 13 +++---- sp1/utils/src/block/header.rs | 3 +- sp1/utils/src/lib.rs | 19 +--------- 4 files changed, 39 insertions(+), 66 deletions(-) diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index e3bf428..82e03dc 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -10,27 +10,29 @@ use espresso_derivation_utils::{ header::{BlockMerkleCommitment, BlockMerkleTree}, payload::{compute_vid_param_hash, rollup_commit, vid_scheme, Payload, Vid, VidParam}, }, - BlockDerivationProof, EspressoDerivationProof, PublicInputs, + BlockDerivationProof, PublicInputs, }; use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; use jf_vid::{ payload_prover::{PayloadProver, Statement}, VidScheme, }; +use std::ops::Range; pub fn main() { // `payload` is the list of all transactions in bytes form. let payload = sp1_zkvm::io::read::(); - // Espresso derivation proof contains the following: - // 1. (its hash is public) `vid_param`: VID public parameter for checking - // namespace proof - // 2. (public) `ns_id`: namespace ID of this rollup - // 3. (public) `bmt_commitment`: the Espresso block Merkle tree commitment that - // accumulates all block commitments up to the current `BlockHeight`. - // 4. (private) `block_derivation_proofs`: a pair of `(range, proof)` where the + // (its hash is public) VID public parameter for checking the namespace proofs + let vid_param = sp1_zkvm::io::read::(); + // (public) namespace ID of this rollup + let ns_id = sp1_zkvm::io::read::(); + // (public) `bmt_commitment`: the Espresso block Merkle tree commitment that + // accumulates all block commitments up to the current `BlockHeight`. + let bmt_commitment = sp1_zkvm::io::read::(); + // (private): a pair of `(range, proof)` where the // `proof` asserts that a `range` of `payload` is derived from some block // committed in the block Merkle tree above. - let espresso_derivation_proof = sp1_zkvm::io::read::(); + let block_derivation_proofs = sp1_zkvm::io::read::, BlockDerivationProof)>>(); std::println!("All inputs are loaded"); // Compute the commitment of all the transactions @@ -40,30 +42,26 @@ pub fn main() { // 1. Check that the ranges cover the whole payload with no overlapping // 2. Check each block derivation proof let mut end = 0; - let verification_result = espresso_derivation_proof - .block_derivation_proofs + block_derivation_proofs .iter() - .all(|(range, block_proof)| { - let result = range.start == end - && verify_block_derivation_proof( - &payload.0[range.start..range.end], - &espresso_derivation_proof.vid_param, - espresso_derivation_proof.ns_id, - &espresso_derivation_proof.bmt_commitment, - block_proof, - ); + .for_each(|(range, block_proof)| { + assert_eq!(range.start, end); + verify_block_derivation_proof( + &payload.0[range.start..range.end], + &vid_param, + ns_id, + &bmt_commitment, + block_proof, + ); end = range.end; - result - }) - && end == payload.0.len(); - + }); + assert_eq!(end, payload.0.len()); // Wrap all the public inputs along with the verification result let public_inputs = PublicInputs { - verification_result, rollup_txs_commit, - vid_param_hash: compute_vid_param_hash(&espresso_derivation_proof.vid_param), - ns_id: espresso_derivation_proof.ns_id, - bmt_commitment: espresso_derivation_proof.bmt_commitment, + vid_param_hash: compute_vid_param_hash(&vid_param), + ns_id, + bmt_commitment, }; sp1_zkvm::io::commit(&public_inputs); @@ -76,7 +74,7 @@ fn verify_block_derivation_proof( ns_id: u32, bmt_commitment: &BlockMerkleCommitment, proof: &BlockDerivationProof, -) -> bool { +) { // Assert that the membership proof is valid if bmt_commitment.height() + 1 != proof.bmt_proof.proof.len() || !BlockMerkleTree::verify( @@ -86,8 +84,7 @@ fn verify_block_derivation_proof( ) .is_ok_and(|result| result.is_ok()) { - std::println!("Incorrect membership proof for block Merkle tree."); - return false; + panic!("Incorrect membership proof for block Merkle tree."); } // Assert that the header is the one committed in the block Merkle tree if !proof @@ -95,14 +92,12 @@ fn verify_block_derivation_proof( .elem() .is_some_and(|elem| elem == &proof.block_header.commit()) { - std::println!("Membership proof is not consistent with the given block header."); - return false; + panic!("Membership proof is not consistent with the given block header."); } match proof.block_header.ns_table.scan_for_id(ns_id) { None => { - std::println!("Namespace ID not found in the block."); - false + panic!("Namespace ID not found in the block."); }, Some((ns_range_start, ns_range_end)) => { std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); @@ -122,10 +117,7 @@ fn verify_block_derivation_proof( ) .is_ok_and(|result| result.is_ok()) { - std::println!("Failed namespace proof."); - false - } else { - true + panic!("Failed namespace proof."); } }, } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 223ec5a..493b0f8 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -15,7 +15,7 @@ use espresso_derivation_utils::{ RollupCommitment, }, ns_table::NsTable, - BlockDerivationProof, EspressoDerivationProof, PublicInputs, + BlockDerivationProof, PublicInputs, }; use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; use jf_pcs::prelude::UnivariateUniversalParams; @@ -164,15 +164,12 @@ fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { let (_, bmt_proof) = block_merkle_tree.lookup(i).expect_ok().unwrap(); block_proofs.get_mut(i as usize).unwrap().1.bmt_proof = bmt_proof; } - let derivation_proof = EspressoDerivationProof { - vid_param, - ns_id, - bmt_commitment: block_merkle_tree.commitment(), - block_derivation_proofs: block_proofs, - }; stdin.write(&rollup_payload); - stdin.write(&derivation_proof); + stdin.write(&vid_param); + stdin.write(&ns_id); + stdin.write(&block_merkle_tree.commitment()); + stdin.write(&block_proofs); rollup_commit(&rollup_payload) } diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs index dcf8646..05d8ffb 100644 --- a/sp1/utils/src/block/header.rs +++ b/sp1/utils/src/block/header.rs @@ -17,7 +17,8 @@ use serde_with::{serde_as, DisplayFromStr}; use std::io::Read; use tagged_base64::tagged; -/// Types for block Merkle tree +/// Types for block Merkle tree. This struct is essentially the same as +/// `LightWeightSha3MerkleTree`, as the later one only keeps a frontier pub type BlockMerkleTree = SHA3MerkleTree>; pub type BlockMerkleTreeProof = ::MembershipProof; pub type BlockMerkleCommitment = ::Commitment; diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs index 1b7fc96..fa3f321 100644 --- a/sp1/utils/src/lib.rs +++ b/sp1/utils/src/lib.rs @@ -5,12 +5,11 @@ use block::{ header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTreeProof}, - payload::{NsProof, VidCommon, VidParam}, + payload::{NsProof, VidCommon}, RollupCommitment, }; use primitive_types::H256; use serde::{Deserialize, Serialize}; -use std::ops::Range; pub mod block; pub mod ns_table; @@ -18,7 +17,6 @@ pub mod ns_table; #[derive(Serialize, Deserialize, Debug)] /// Public inputs pub struct PublicInputs { - pub verification_result: bool, pub rollup_txs_commit: RollupCommitment, /// Hash of the used VID public parameter pub vid_param_hash: H256, @@ -42,18 +40,3 @@ pub struct BlockDerivationProof { /// Namespace proof of the given payload pub ns_proof: NsProof, } - -#[derive(Serialize, Deserialize, Debug)] -/// Proves that the payload is derived from one or many espresso blocks. -pub struct EspressoDerivationProof { - /// VID public parameter, used for namespace proof verification - pub vid_param: VidParam, - /// Namespace ID of the rollup - pub ns_id: u32, - /// Block Merkle tree commitment. Block MT contains information about all - /// historical blocks up to some block height. - pub bmt_commitment: BlockMerkleCommitment, - /// Block proofs for slices of payload. - /// Ranges should cover the whole payload and be non-overlapping. - pub block_derivation_proofs: Vec<(Range, BlockDerivationProof)>, -} From 26f220d3787e83cb8d90bbd6dc69da7792981cd9 Mon Sep 17 00:00:00 2001 From: MRain Date: Mon, 26 Aug 2024 13:27:57 -0400 Subject: [PATCH 35/44] comment --- sp1/program/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 82e03dc..0b2d627 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -56,7 +56,7 @@ pub fn main() { end = range.end; }); assert_eq!(end, payload.0.len()); - // Wrap all the public inputs along with the verification result + // Wrap all the public inputs let public_inputs = PublicInputs { rollup_txs_commit, vid_param_hash: compute_vid_param_hash(&vid_param), From 0f11a123528685eb5ff3d983f5cdc9839f569269 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Tue, 27 Aug 2024 09:08:02 +0800 Subject: [PATCH 36/44] minor improv on script --- README.md | 2 +- sp1/program/src/main.rs | 11 +++++--- sp1/script/src/bin/prove.rs | 51 ++++++++++++++++++++++--------------- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 28b4838..a4a9d82 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Each `BlockDerivationProof` contains the following: - First the ranges in `block_derivation_proofs` should be non-overlapping and cover the whole payload, i.e. `range[i].end == range[i+1].start && range[i].start == 0 && range[-1].end == payload.len()`. - For each `BlockDerivationProof`, we check - the `block_header` is in the block Merkle tree, by checking the proof `bmt_proof` against the block Merkle tree commitment `bmt_commitment` - - Namespace ID `ns_id` of this rollup is containd in the namespace table `block_header.ns_table`, and given the specified range in the Espresso block and a namespace proof `NsProof`, checks whether the slice of rollup's transactions `payload` matches the specified slice in the Espresso block payload committed by `block_header.payload_commitment` + - Namespace ID `ns_id` of this rollup is contained in the namespace table `block_header.ns_table`, and given the specified range in the Espresso block and a namespace proof `NsProof`, checks whether the slice of rollup's transactions `payload` matches the specified slice in the Espresso block payload committed by `block_header.payload_commitment` Read [our doc](https://github.com/EspressoSystems/espresso-sequencer/blob/main/doc/zk-integration.md) for a more detailed description; read our blog on [Derivation Pipeline](https://hackmd.io/@EspressoSystems/the-derivation-pipeline) for rollup integration. diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 0b2d627..d6cb6ad 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -20,13 +20,14 @@ use jf_vid::{ use std::ops::Range; pub fn main() { - // `payload` is the list of all transactions in bytes form. + // (private): `payload` is the list of all transactions in bytes form. let payload = sp1_zkvm::io::read::(); - // (its hash is public) VID public parameter for checking the namespace proofs + // (private): (its hash is public) VID public parameter for checking the + // namespace proofs let vid_param = sp1_zkvm::io::read::(); - // (public) namespace ID of this rollup + // (public): namespace ID of this rollup let ns_id = sp1_zkvm::io::read::(); - // (public) `bmt_commitment`: the Espresso block Merkle tree commitment that + // (public): `bmt_commitment`: the Espresso block Merkle tree commitment that // accumulates all block commitments up to the current `BlockHeight`. let bmt_commitment = sp1_zkvm::io::read::(); // (private): a pair of `(range, proof)` where the @@ -56,6 +57,7 @@ pub fn main() { end = range.end; }); assert_eq!(end, payload.0.len()); + // Wrap all the public inputs let public_inputs = PublicInputs { rollup_txs_commit, @@ -64,6 +66,7 @@ pub fn main() { bmt_commitment, }; + // Mark them as public inputs sp1_zkvm::io::commit(&public_inputs); } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 493b0f8..34eb26e 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -11,8 +11,7 @@ use committable::Committable; use espresso_derivation_utils::{ block::{ header::{BlockHeader, BlockMerkleTree}, - payload::{rollup_commit, vid_scheme, NsProof, Payload, Vid, VidCommon, VidParam}, - RollupCommitment, + payload::{vid_scheme, NsProof, Payload, Vid, VidCommon, VidParam}, }, ns_table::NsTable, BlockDerivationProof, PublicInputs, @@ -30,6 +29,15 @@ use std::path::PathBuf; /// This file is generated by running `cargo prove build` inside the `program` /// directory. pub const ELF: &[u8] = include_bytes!("../../../program/elf/riscv32im-succinct-zkvm-elf"); +/// low degree for demo only +pub const SRS_DEGREE: usize = 8usize; +/// payload bytes for each block shouldn't exceed max size +/// during encoding, every 30 bytes is converted to a 254-bit field element +pub const MAX_PAYLOAD_BYTES_PER_BLOCK: usize = SRS_DEGREE * 30; +/// number of storage node for VID +pub const NUM_STORAGE_NODES: u32 = 10; +/// produce derivation proof for a batch of espresso blocks +pub const NUM_BLOCKS: u64 = 5; /// The arguments for the prove command. // TODO: fill in other details @@ -121,34 +129,35 @@ fn mock_block( (header, vid_common, ns_proof) } -fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { +fn mock_inputs(stdin: &mut SP1Stdin) { let mut rng = rand::thread_rng(); let ns_id = rng.next_u32(); - let mut block_merkle_tree = BlockMerkleTree::new(32); - - let num_blocks = rng.gen_range(2..5); - let mut rollup_payload = Payload(vec![]); + let mut block_proofs = vec![]; - let num_storage_nodes = 10; let vid_param = load_srs(); - let mut vid = vid_scheme(num_storage_nodes, &vid_param); + let mut vid = vid_scheme(NUM_STORAGE_NODES, &vid_param); - let mut block_proofs = vec![]; - - for i in 0..num_blocks { - let ns_payload_len = rng.gen_range(5..10); + for i in 0..NUM_BLOCKS { + // pick a payload length for each block + let ns_payload_len = rng.gen_range(1..MAX_PAYLOAD_BYTES_PER_BLOCK); + // fill with random payload bytes of `ns_payload_len` let mut block_ns_payload = vec![0u8; ns_payload_len]; + rng.fill_bytes(&mut block_ns_payload); + // produce a mock block containing this namespace payload let (header, vid_common, ns_proof) = mock_block(i, ns_id, &block_ns_payload, &mut vid, &mut rng); + // push the block commitment to the BMT block_merkle_tree.push(header.commit()).unwrap(); + // retrieve a merkle proof of this block commitment let (_, bmt_proof) = block_merkle_tree.lookup(i).expect_ok().unwrap(); + // prepare the block derivation proof block_proofs.push(( rollup_payload.0.len()..rollup_payload.0.len() + ns_payload_len, BlockDerivationProof { @@ -158,20 +167,24 @@ fn mock_inputs(stdin: &mut SP1Stdin) -> RollupCommitment { ns_proof, }, )); + // append to overall rollup-specific payload + // (as if filtered from a batch of blocks) rollup_payload.0.append(&mut block_ns_payload); } - for i in 0..num_blocks { + + // update all the BMT inclusion proof since new block commitments where + // accumulated, and old merkle proofs are holding outdated root + for i in 0..NUM_BLOCKS { let (_, bmt_proof) = block_merkle_tree.lookup(i).expect_ok().unwrap(); block_proofs.get_mut(i as usize).unwrap().1.bmt_proof = bmt_proof; } + // push to inputs stdin.write(&rollup_payload); stdin.write(&vid_param); stdin.write(&ns_id); stdin.write(&block_merkle_tree.commitment()); stdin.write(&block_proofs); - - rollup_commit(&rollup_payload) } fn main() { @@ -189,9 +202,7 @@ fn main() { // Setup the inputs.; let mut stdin = SP1Stdin::new(); - let expect_rollup_commit = mock_inputs(&mut stdin); - - std::println!("Expect rollup txs commitment: {}", expect_rollup_commit); + mock_inputs(&mut stdin); if args.bench { // Execute the program @@ -272,8 +283,6 @@ fn create_plonk_fixture(proof: &SP1ProofWithPublicValues, vk: &SP1VerifyingKey) } fn load_srs() -> VidParam { - // low degree for demo only - pub const SRS_DEGREE: usize = 8usize; let srs = ark_srs::kzg10::aztec20::setup(SRS_DEGREE).expect("Aztec SRS failed to load"); VidParam(UnivariateUniversalParams { powers_of_g: srs.powers_of_g, From cf21fee6a266d70b42211a3eabe86f6b0517286a Mon Sep 17 00:00:00 2001 From: MRain Date: Tue, 27 Aug 2024 14:38:23 -0400 Subject: [PATCH 37/44] customized deser --- Cargo.lock | 4 +- Cargo.toml | 1 + sp1/program/src/main.rs | 9 ++-- sp1/script/src/bin/prove.rs | 12 ++--- sp1/utils/src/block/header.rs | 2 +- sp1/utils/src/block/payload.rs | 90 ++++++++++++++++++++++++++++++++-- 6 files changed, 101 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2880ea1..a279b13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2839,7 +2839,7 @@ dependencies = [ [[package]] name = "jf-pcs" version = "0.1.0" -source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#26f2875bd78137b4a5217c96913258c0ce35afb0" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#c602296feb05f524b0c956e45c81f65892a768bc" dependencies = [ "ark-bn254", "ark-ec", @@ -2939,7 +2939,7 @@ dependencies = [ [[package]] name = "jf-vid" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#c602296feb05f524b0c956e45c81f65892a768bc" dependencies = [ "anyhow", "ark-ec", diff --git a/Cargo.toml b/Cargo.toml index ea60611..095cd81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,3 +27,4 @@ sha3 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sh [patch."https://github.com/EspressoSystems/jellyfish"] jf-pcs = { git = "https://www.github.com/EspressoSystems/jellyfish.git", branch = "sp1-patches" } +jf-vid = { git = "https://www.github.com/EspressoSystems/jellyfish.git", branch = "sp1-patches" } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index d6cb6ad..6d13a84 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -106,17 +106,18 @@ fn verify_block_derivation_proof( std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); // Namespace proof w.r.t the VidCommitment - let num_storage_nodes = ::get_num_storage_nodes(&proof.vid_common); + let num_storage_nodes = + ::get_num_storage_nodes(proof.vid_common.as_ref()); let vid = vid_scheme(num_storage_nodes, vid_param); if !vid .payload_verify( Statement { payload_subslice: payload_slice, range: (ns_range_start as usize..ns_range_end as usize), - commit: &proof.block_header.payload_commitment, - common: &proof.vid_common, + commit: proof.block_header.payload_commitment.as_ref(), + common: proof.vid_common.as_ref(), }, - &proof.ns_proof, + proof.ns_proof.as_ref(), ) .is_ok_and(|result| result.is_ok()) { diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 34eb26e..a4943d5 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -11,7 +11,7 @@ use committable::Committable; use espresso_derivation_utils::{ block::{ header::{BlockHeader, BlockMerkleTree}, - payload::{vid_scheme, NsProof, Payload, Vid, VidCommon, VidParam}, + payload::{vid_scheme, NsProof, Payload, Vid, VidCommitment, VidCommon, VidParam}, }, ns_table::NsTable, BlockDerivationProof, PublicInputs, @@ -19,7 +19,7 @@ use espresso_derivation_utils::{ use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; use jf_pcs::prelude::UnivariateUniversalParams; use jf_vid::{payload_prover::PayloadProver, VidScheme}; -use rand::{Rng, RngCore}; +use rand::{Rng, RngCore, SeedableRng}; use serde::{Deserialize, Serialize}; use sp1_sdk::{HashableKey, ProverClient, SP1ProofWithPublicValues, SP1Stdin, SP1VerifyingKey}; use std::path::PathBuf; @@ -111,8 +111,8 @@ fn mock_block( // Mock VID information let vid_disperse = vid.disperse(&payload).unwrap(); - let vid_common = vid_disperse.common; - let vid_commitment = vid_disperse.commit; + let vid_common = VidCommon(vid_disperse.common); + let vid_commitment = VidCommitment(vid_disperse.commit); // Update the payload commitment header.payload_commitment = vid_commitment; // Update the namespace table @@ -124,13 +124,13 @@ fn mock_block( // Namespace proof let ns_range = offset..offset + ns_payload.len(); - let ns_proof = vid.payload_proof(&payload, ns_range).unwrap(); + let ns_proof = NsProof(vid.payload_proof(&payload, ns_range).unwrap()); (header, vid_common, ns_proof) } fn mock_inputs(stdin: &mut SP1Stdin) { - let mut rng = rand::thread_rng(); + let mut rng = rand::rngs::StdRng::from_seed([0u8; 32]); let ns_id = rng.next_u32(); let mut block_merkle_tree = BlockMerkleTree::new(32); diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs index 05d8ffb..19e0378 100644 --- a/sp1/utils/src/block/header.rs +++ b/sp1/utils/src/block/header.rs @@ -76,7 +76,7 @@ impl Committable for BlockHeader { .u64_field("l1_head", self.l1_head) .optional("l1_finalized", &self.l1_finalized) .constant_str("payload_commitment") - .fixed_size_bytes(self.payload_commitment.as_ref().as_ref()) + .fixed_size_bytes(self.payload_commitment.as_ref().as_ref().as_ref()) .constant_str("builder_commitment") .fixed_size_bytes(&self.builder_commitment.0) .field("ns_table", self.ns_table.commit()) diff --git a/sp1/utils/src/block/payload.rs b/sp1/utils/src/block/payload.rs index babb89a..b7ae7bc 100644 --- a/sp1/utils/src/block/payload.rs +++ b/sp1/utils/src/block/payload.rs @@ -12,6 +12,7 @@ use jf_vid::{ use primitive_types::H256; use serde::{de::Error as _, ser::Error as _, Deserialize, Serialize}; use sha2::{Digest, Sha256}; +use tagged_base64::tagged; use super::RollupCommitment; @@ -27,14 +28,56 @@ type H = Sha256; pub type Vid = Advz; /// VID commitment type -pub type VidCommitment = ::Commit; +#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)] +#[tagged("HASH")] +pub struct VidCommitment(pub ::Commit); + +impl AsRef<::Commit> for VidCommitment { + fn as_ref(&self) -> &::Commit { + &self.0 + } +} /// Type of common data for VID scheme -pub type VidCommon = ::Common; +#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)] +pub struct VidCommon(pub ::Common); + +impl AsRef<::Common> for VidCommon { + fn as_ref(&self) -> &::Common { + &self.0 + } +} + +impl Serialize for VidCommon { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut bytes = Vec::new(); + self.0 + .serialize_uncompressed(&mut bytes) + .map_err(|e| S::Error::custom(format!("{e:?}")))?; + Serialize::serialize(&bytes, serializer) + } +} + +impl<'de> Deserialize<'de> for VidCommon { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let bytes = as Deserialize>::deserialize(deserializer)?; + <::Common as CanonicalDeserialize>::deserialize_uncompressed_unchecked( + &*bytes, + ) + .map_err(|e| D::Error::custom(format!("{e:?}"))) + .map(VidCommon) + } +} /// Public parameters to setup the VID scheme /// Manual (de)serialization to avoid the expensive validity check. -#[derive(Debug)] +#[derive(Debug, CanonicalSerialize, CanonicalDeserialize)] pub struct VidParam(pub UnivariateUniversalParams); impl Serialize for VidParam { @@ -64,8 +107,47 @@ impl<'de> Deserialize<'de> for VidParam { } } +type F = as PolynomialCommitmentScheme>::Evaluation; /// Namespace Proof type -pub type NsProof = LargeRangeProof< as PolynomialCommitmentScheme>::Evaluation>; +#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)] +pub struct NsProof(pub LargeRangeProof); + +impl From> for NsProof { + fn from(proof: LargeRangeProof) -> Self { + Self(proof) + } +} + +impl AsRef> for NsProof { + fn as_ref(&self) -> &LargeRangeProof { + &self.0 + } +} + +impl Serialize for NsProof { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut bytes = Vec::new(); + self.0 + .serialize_uncompressed(&mut bytes) + .map_err(|e| S::Error::custom(format!("{e:?}")))?; + Serialize::serialize(&bytes, serializer) + } +} + +impl<'de> Deserialize<'de> for NsProof { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let bytes = as Deserialize>::deserialize(deserializer)?; + as CanonicalDeserialize>::deserialize_uncompressed_unchecked(&*bytes) + .map_err(|e| D::Error::custom(format!("{e:?}"))) + .map(NsProof) + } +} /// Dummy rollup payload commit pub fn rollup_commit(payload: &Payload) -> RollupCommitment { From 5172e6956df3961f43afc85dcd2a5c771f2023ac Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 01:23:36 +0000 Subject: [PATCH 38/44] update fixtures for pre-custom-serde --- sp1/contracts/src/fixtures/fixture.json | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json index 18ca329..de3ef9d 100644 --- a/sp1/contracts/src/fixtures/fixture.json +++ b/sp1/contracts/src/fixtures/fixture.json @@ -1,8 +1,5 @@ { - "a": 6765, - "b": 10946, - "n": 20, - "vkey": "0x00307ac6ea935608a65cea9a739f1c678dc028267391566806be12953d865be8", - "publicValues": "0x00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000001a6d0000000000000000000000000000000000000000000000000000000000002ac2", - "proof": "0x801c66ac24a8c9c720fb536ab6d292c3f4bdd9ecfb8bbd58a094081a578dd19ec444d9170ce9d31a25163009ff046d03f74dc0212f0cc713454574a72e41ed4e7604087a180ce46f081dc855f9b952ddc3e42002da927b46b7c826e7dd9373695fc0aa152a3dc2bf70aa716243930edf99a1958345e94cc88fb3dd4acd9af75175fd1f1504805ba12b526663567b12475f1b940323c87e2246195de23a5e0be5d2abe3b41e99dbddefc673abc7038e71c19e1e7ec170d1b48a12e63c2657fbc5b96defab06a2347a8a095b44692536217bdc71787da3464ab717cfa6b5b74849469795510728acc0be593ce813059e33337bfd33d11ac03676c1a8cd508518d1ee3859af19ba893298a9b35ee3cd3346e2c6f8aa71fa58c225128693eee97ed1374535e30c8d107388bb500af98fe04a2ec60f0efe1026f90745e2cd157e95468cd5c8db16b99e8616eb444a6f89c7c31728c039c75f340e3b6a3ca621b0172fc400990f195a6b6dce88cae4604b354eb4eea15ea0e9f8a0837813f621d0b1289d90a0d812eaedc02934cc41c86f242123d8a753d308d8134f3f33b8168140b2ba612b9129d54b9566230974f9778e8cb3dcd0d187e32fcea5969855642190bd3416d65212d2ea3d785b8ddf7f477259a3d11e5326c3a14a1ffc1e121f38975a01fbba640a28cbf9d7f5b22be18cbbaf3442d9284eee0f632d0fce47475e7be13103f8ba1f8f4ebc25b73650969c53b13a35cc6943a331c689841a40325d23b6045f240803d1738e11c5c46999bb6e060ac823a865ddc4f7e83dfecffb6f0a822180a6db2eeb6e91e1d80d78a9350df39d142c462cce1ac9e36cd8ab682f167b13e690d522642cc4bde919a52f333a00700fccf2fa6212fd3cf49b430368e7fc6b80ab8c1e5b265ccdf8bb49174102224f419c437da1b1bbe892dad2039a3f98e7a328a702ab130b30b7d818efe388a6134fe3c085d213a5534d604b9b3335b8db4180991abb9efda23fa9be95c8c46dd270200ad00f114d830ae8a019b76a02aa2a69f50fa73605947b3e7640d90d481dbff96bf124c92691fdfa52358671a5a3ea355d0128af0521a8b783fff80caf13fd8dc30757bc5ef93fc5f7b0411f44ca5f15510c6cae1f1eeca8477aef5a6d5d4197dcd220536498706c553e86da5b91afd3900bea3e07838a9592c798e1c38674ab04e0d51badf80bb95331702db27dfb2347" -} + "vkey": "0x00d1c2d64c73d09ffe0defbf1c9b59fa36d9f808b8bc5aedc5e52ecfa4262474", + "publicValues": "0x42000000000000003078396532386431626166323839343438363438633561393631333737663961613038356139326339643366336632333734353761656431326165336635363661394200000000000000307836653139306162616465633133386236653539393938393533383936333339383933386462343531613463303133623262313532366362303434353332646233f842a8984c000000000000000b000000000000004d45524b4c455f434f4d4d30000000000000007a343f5c1d5e7c6f14e99611c2e3a0b9d9347fa4663a3d0bba4ee26804712879200000000000000005000000000000007f", + "proof": "2915676a503eaa20e7ef5bdd3096005d8e688126ac88177ac684b612c622b8f30c5c65ee10403ddff4957c844f292eba4a2646e37faad2119428724653bb66fd19fc4cc94f2685bb13edf485886d07ad31ab6af4a6aa8b0ea44cbb80b97562c81acaa1f269fd173b767b01a615f9c794d2ba04ebc5e75d6ca1cfed60da8a2cc00fcce259769275e67de533f538e570d5330e2a7f99d27a7152f0586789a60e2414814cc73c2f756eeeb81129618a6e80daca86cdf484d3d1e0d0d867585a6ff81e6cbc57e107fbf5df2d97e1eafad190ccb19434410967d58ca8a839d21f7b4317d412da5928a3d95929f651a1c8b84f36d295a20ac8157c8148e5dc7ec65b4e2d82dbc7feda28d964d833ae7db6cd1db463877c60f6f82565b525ddf9b6e0aa2b506693368152a808867015086c756b535eb1cdf7bd8679fe95bb9fc52edd3a07e9857551330c29e0e536c68fb91ec6ee9fc85cba31cd26d4b65fdbf857cb2e0c49a9b0a6d50bb27473ce7c6d0c3fd500e96db14de5da7ad402a84a5d5b9de31072044c53da455a7f854d0bfa7af5e96ecd2c01ff569df200014a63d7d83f2f292cb98ebacc37384866bb9a31cba00c627617fd2aa83f444eae340e273ef39729404b07cbc4e388b3cdfcb580acbdef82d08ef319fcfbcd4bd256b7f52ac5591279c0775f36e60b6c8833d72bb0a2a2344ec9bf9c88bb330fb66815b34805d800000007134a9aac8fd0ec8818dd8cb342aace6bb04489840a8ee1bff7f56e2eb122ecda077adadb220f77bf0bbee0bc39584520fff6cb88aef442527f3179974e3f1ec81472a869bb2eab08a7fe9e10da7c6dc09dab1055824e640f335bd39c3162705b28c77592a49e164075be633293b6f30400b68f0e48a62fc9128b9c1a5b21fc94260ea8bfd85a7aa95c4da1b994513cad0cc886389d1ecc811338eb77c4b3db8f01086791faf4fe2fc43a37ec623258251ff6b836e8d9489a8b5906a5f77595e2052374d965a32df68b33a6e5ad0c04c6d05a8f3674e8800dde4f720254302bf60c62dad5c4fcfc71dbce34767cc64255404bf5ae1066826994888cd01716095f05eb0211427daeba8f523b282e520675e76e1ace2368983c54caee8d347ac6e02d6d12eb759706ea395f57e741f4ad4f97fb0cb03453459d59c703decef262540000000105cd6220b03e98bce2c01e6b63e14df07b002c5b03a0653abc424ef2a9fc0cb51e9ae8a883c3318eb93e4c1446138108719ef3fe045b7312187efa56150ea593" +} \ No newline at end of file From 2eca493e3b08061f43beb041c6940f7373a5dfe5 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 02:06:22 +0000 Subject: [PATCH 39/44] update fixture --- sp1/contracts/src/fixtures/fixture.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json index de3ef9d..217ba16 100644 --- a/sp1/contracts/src/fixtures/fixture.json +++ b/sp1/contracts/src/fixtures/fixture.json @@ -1,5 +1,5 @@ { - "vkey": "0x00d1c2d64c73d09ffe0defbf1c9b59fa36d9f808b8bc5aedc5e52ecfa4262474", - "publicValues": "0x42000000000000003078396532386431626166323839343438363438633561393631333737663961613038356139326339643366336632333734353761656431326165336635363661394200000000000000307836653139306162616465633133386236653539393938393533383936333339383933386462343531613463303133623262313532366362303434353332646233f842a8984c000000000000000b000000000000004d45524b4c455f434f4d4d30000000000000007a343f5c1d5e7c6f14e99611c2e3a0b9d9347fa4663a3d0bba4ee26804712879200000000000000005000000000000007f", - "proof": "2915676a503eaa20e7ef5bdd3096005d8e688126ac88177ac684b612c622b8f30c5c65ee10403ddff4957c844f292eba4a2646e37faad2119428724653bb66fd19fc4cc94f2685bb13edf485886d07ad31ab6af4a6aa8b0ea44cbb80b97562c81acaa1f269fd173b767b01a615f9c794d2ba04ebc5e75d6ca1cfed60da8a2cc00fcce259769275e67de533f538e570d5330e2a7f99d27a7152f0586789a60e2414814cc73c2f756eeeb81129618a6e80daca86cdf484d3d1e0d0d867585a6ff81e6cbc57e107fbf5df2d97e1eafad190ccb19434410967d58ca8a839d21f7b4317d412da5928a3d95929f651a1c8b84f36d295a20ac8157c8148e5dc7ec65b4e2d82dbc7feda28d964d833ae7db6cd1db463877c60f6f82565b525ddf9b6e0aa2b506693368152a808867015086c756b535eb1cdf7bd8679fe95bb9fc52edd3a07e9857551330c29e0e536c68fb91ec6ee9fc85cba31cd26d4b65fdbf857cb2e0c49a9b0a6d50bb27473ce7c6d0c3fd500e96db14de5da7ad402a84a5d5b9de31072044c53da455a7f854d0bfa7af5e96ecd2c01ff569df200014a63d7d83f2f292cb98ebacc37384866bb9a31cba00c627617fd2aa83f444eae340e273ef39729404b07cbc4e388b3cdfcb580acbdef82d08ef319fcfbcd4bd256b7f52ac5591279c0775f36e60b6c8833d72bb0a2a2344ec9bf9c88bb330fb66815b34805d800000007134a9aac8fd0ec8818dd8cb342aace6bb04489840a8ee1bff7f56e2eb122ecda077adadb220f77bf0bbee0bc39584520fff6cb88aef442527f3179974e3f1ec81472a869bb2eab08a7fe9e10da7c6dc09dab1055824e640f335bd39c3162705b28c77592a49e164075be633293b6f30400b68f0e48a62fc9128b9c1a5b21fc94260ea8bfd85a7aa95c4da1b994513cad0cc886389d1ecc811338eb77c4b3db8f01086791faf4fe2fc43a37ec623258251ff6b836e8d9489a8b5906a5f77595e2052374d965a32df68b33a6e5ad0c04c6d05a8f3674e8800dde4f720254302bf60c62dad5c4fcfc71dbce34767cc64255404bf5ae1066826994888cd01716095f05eb0211427daeba8f523b282e520675e76e1ace2368983c54caee8d347ac6e02d6d12eb759706ea395f57e741f4ad4f97fb0cb03453459d59c703decef262540000000105cd6220b03e98bce2c01e6b63e14df07b002c5b03a0653abc424ef2a9fc0cb51e9ae8a883c3318eb93e4c1446138108719ef3fe045b7312187efa56150ea593" + "vkey": "0x007f9f0f59840d09b9a754b516d6716ec30e45eb6a6423c3a3b51f6c84f955c0", + "publicValues": "0x420000000000000030783131323438633764376631386137373236663063373537343662643434396530373831363663373066396433383838663665623034353132653630303362326342000000000000003078366531393061626164656331333862366535393939383935333839363333393839333864623435316134633031336232623135323663623034343533326462339bf49a6a4c000000000000000b000000000000004d45524b4c455f434f4d4d3000000000000000b0f1b60f2db6ccd4c6d4d849c0afd14a0f7bbc32a714e292964b673e818cc1a120000000000000000500000000000000a9", + "proof": "1ec04271341e5d0fc7f48c3fbacd486b524d40b3b19e0f75f7dbdc9d1f8ebbf70080102bb430017a306d564506fca14c0fa1e9a126c98df8684e002f29ff292405997d007800d327226e94108d83640df331abcfaa50ced87b408c819d0528d021b0ef9b2b1260420e6e06a9a8469e4eb314a69e25e4933f2aee49ed9bd4d47823277aec005089be01aeb8bd053ec8870f0e5b1917c4ec209d4c8f723c041054147cd36ecae7021fca75a19935a229e0befa57354b3668e8c6ad5f724078147d27708691794eac0d3a8ce242e9e9f6dd66f0c941d5b0d76d9efb99a66d461e5716aff075050fe133729c2a4bf175a522294a478563b3b29e74626b6810c2d5761f0b1f4eccb9880e7926964f6db4fd75ea3b7e4afc697a19c75a9553b2c0a01a2ff3aa399b0fcb0f83c54c7073778b38677336be2de36c6cd10de457c6740b1c06aafc946d7894fd527eaadfa794be9e3d153bc11489fff59aeae6ee66c6bf9518a74db500fbdffc13344f2fa7a5242f54447d19fdee215e15c4b859cf12da9511857b2a23449b2a5dbb0933230e747c9c47a06beae8b241811bf103648788c51fdfb6e1fecfe711ba77f9b9858f4ebb644fff23982bd709dff0730cac62613b280a810d2ddeea23bb5f7057e3afadfaed4ea1fbf76a9aadd13f89147204e5531068f9a5717c2aefb82f602b7e973e08050d1bc29f6eacb86dc81edfa318e14a00000007289dc6193014965a8732a20549a7fac372e464e5a01a4e9106480e84b9342b9913c692a9e8d0296f221c2a56568cb0bcf98b01548b99791384bc385ed2ac14242dd02f3416fc9cae3793919843323d6e8c59dce11447cd0dc176814c923d22511d1c7a7830b989b31131aa7ef6010c51ac2a1041ac2ea0f60201bda77906c3991f93d4c18aaa387b0f20a25cb0458fae039b057307374fe4198ec71520f0fd2219e59239a3e4de757ec5e990d4c0d36ce4bff56edb29cf49411a636a0f2a1dc12bdd2c482327044c2bdecee2522250cf61c27f21ae108b995341deb1a5205e831362b4529dde7d98c147bfd8e7d4ca83e9854e0c1d501b9fd1a25ae40623c64f2b6d3b4a79c9106ab1e5fb06763b4750152ebfae0718f51fd08e374e2bd2c44f1692ea9d77f0d4544e29351c1a6b4c752f59bb3bdab7d19c0ea64175706f32b8000000012673d948555179a323521d42028fa13178699cd0fe9e1ae0673aa52e0215f8711243b84feea6386417a458d9364e6803f3262dd8c3a8aaadbe0dc5aa7fc5bed5" } \ No newline at end of file From 5aafaef8286f9adbc3f0f06a459afb1bff76d98c Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 10:52:31 +0800 Subject: [PATCH 40/44] update contracts and use sp1 v1.1.0 --- justfile | 2 +- sp1/contracts/lib/sp1-contracts | 2 +- .../{Fibonacci.sol => EspressoDerivation.sol} | 21 +++++++-------- ...bonacci.t.sol => EspressoDerivation.t.sol} | 26 +++++++------------ sp1/program/Cargo.toml | 2 +- sp1/script/Cargo.toml | 4 +-- 6 files changed, 24 insertions(+), 33 deletions(-) rename sp1/contracts/src/{Fibonacci.sol => EspressoDerivation.sol} (55%) rename sp1/contracts/test/{Fibonacci.t.sol => EspressoDerivation.t.sol} (60%) diff --git a/justfile b/justfile index c6e1a13..81498db 100644 --- a/justfile +++ b/justfile @@ -25,4 +25,4 @@ default: # Test SP1 contracts @sp1-test-contracts: echo "Testing SP1 contracts" - cd sp1/contracts && forge test -v + cd sp1/contracts && forge test -vv diff --git a/sp1/contracts/lib/sp1-contracts b/sp1/contracts/lib/sp1-contracts index 73c2a8d..ef134b7 160000 --- a/sp1/contracts/lib/sp1-contracts +++ b/sp1/contracts/lib/sp1-contracts @@ -1 +1 @@ -Subproject commit 73c2a8df0c816bf743e9d960e7b14b8e37635578 +Subproject commit ef134b7c141e03bb8a8854697422f770cc26dc74 diff --git a/sp1/contracts/src/Fibonacci.sol b/sp1/contracts/src/EspressoDerivation.sol similarity index 55% rename from sp1/contracts/src/Fibonacci.sol rename to sp1/contracts/src/EspressoDerivation.sol index b477a3f..22f2e82 100644 --- a/sp1/contracts/src/Fibonacci.sol +++ b/sp1/contracts/src/EspressoDerivation.sol @@ -4,10 +4,10 @@ pragma solidity ^0.8.20; import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol"; /// @title Fibonacci. -/// @author Succinct Labs +/// @author Espresso System /// @notice This contract implements a simple example of verifying the proof of a computing a /// fibonacci number. -contract Fibonacci { +contract EspressoDerivation { /// @notice The address of the SP1 verifier contract. /// @dev This can either be a specific SP1Verifier for a specific version, or the /// SP1VerifierGateway which can be used to verify proofs for any version of SP1. @@ -15,24 +15,21 @@ contract Fibonacci { /// https://github.com/succinctlabs/sp1-contracts/tree/main/contracts/deployments address public verifier; - /// @notice The verification key for the fibonacci program. - bytes32 public fibonacciProgramVkey; + /// @notice The verification key for the program. + bytes32 public vkey; - constructor(address _verifier, bytes32 _fibonacciProgramVkey) { + constructor(address _verifier, bytes32 _vkey) { verifier = _verifier; - fibonacciProgramVkey = _fibonacciProgramVkey; + vkey = _vkey; } - /// @notice The entrypoint for verifying the proof of a fibonacci number. + /// @notice Verify a derivation proof from a batch of Espresso blocks. /// @param proof The encoded proof. /// @param publicValues The encoded public values. - function verifyFibonacciProof(bytes calldata proof, bytes calldata publicValues) + function verifyDerivationProof(bytes calldata proof, bytes calldata publicValues) public view - returns (uint32, uint32, uint32) { - ISP1Verifier(verifier).verifyProof(fibonacciProgramVkey, publicValues, proof); - (uint32 n, uint32 a, uint32 b) = abi.decode(publicValues, (uint32, uint32, uint32)); - return (n, a, b); + ISP1Verifier(verifier).verifyProof(vkey, publicValues, proof); } } diff --git a/sp1/contracts/test/Fibonacci.t.sol b/sp1/contracts/test/EspressoDerivation.t.sol similarity index 60% rename from sp1/contracts/test/Fibonacci.t.sol rename to sp1/contracts/test/EspressoDerivation.t.sol index 4038603..6ce9491 100644 --- a/sp1/contracts/test/Fibonacci.t.sol +++ b/sp1/contracts/test/EspressoDerivation.t.sol @@ -3,23 +3,20 @@ pragma solidity ^0.8.20; import {Test, console} from "forge-std/Test.sol"; import {stdJson} from "forge-std/StdJson.sol"; -import {Fibonacci} from "../src/Fibonacci.sol"; -import {SP1Verifier} from "@sp1-contracts/v1.0.8-testnet/SP1Verifier.sol"; +import {EspressoDerivation} from "../src/EspressoDerivation.sol"; +import {SP1Verifier} from "@sp1-contracts/v1.1.0/SP1Verifier.sol"; struct SP1ProofFixtureJson { - uint32 a; - uint32 b; - uint32 n; - bytes proof; bytes publicValues; + bytes proof; bytes32 vkey; } -contract FibonacciTest is Test { +contract EspressoDerivationTest is Test { using stdJson for string; address verifier; - Fibonacci public fibonacci; + EspressoDerivation public es; function loadFixture() public view returns (SP1ProofFixtureJson memory) { string memory root = vm.projectRoot(); @@ -33,24 +30,21 @@ contract FibonacciTest is Test { SP1ProofFixtureJson memory fixture = loadFixture(); verifier = address(new SP1Verifier()); - fibonacci = new Fibonacci(verifier, fixture.vkey); + es = new EspressoDerivation(verifier, fixture.vkey); } - function test_ValidFibonacciProof() public view { + function test_ValidDerivationProof() public view { SP1ProofFixtureJson memory fixture = loadFixture(); - (uint32 n, uint32 a, uint32 b) = fibonacci.verifyFibonacciProof(fixture.proof, fixture.publicValues); - assert(n == fixture.n); - assert(a == fixture.a); - assert(b == fixture.b); + es.verifyDerivationProof(fixture.proof, fixture.publicValues); } - function testFail_InvalidFibonacciProof() public view { + function testFail_InvalidDerivationProof() public view { SP1ProofFixtureJson memory fixture = loadFixture(); // Create a fake proof. bytes memory fakeProof = new bytes(fixture.proof.length); - fibonacci.verifyFibonacciProof(fakeProof, fixture.publicValues); + es.verifyDerivationProof(fakeProof, fixture.publicValues); } } diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 20ca435..3dacb0a 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -8,4 +8,4 @@ committable = { workspace = true } espresso-derivation-utils = { path = "../utils" } jf-merkle-tree = { workspace = true } jf-vid = { workspace = true } -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index a58ee46..c9e2238 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -20,8 +20,8 @@ jf-vid = { workspace = true } rand = "0.8" serde = { workspace = true } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } +sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } tracing = "0.1.40" [build-dependencies] -sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.1" } +sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } From 58ce16dfd296875e1af9a88a53fab83589ebf2e6 Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 04:21:40 +0000 Subject: [PATCH 41/44] fix fixture writer and contract logic --- Cargo.lock | 65 +++++++++++---------- sp1/contracts/src/fixtures/fixture.json | 4 +- sp1/contracts/test/EspressoDerivation.t.sol | 2 +- sp1/script/Cargo.toml | 1 + sp1/script/src/bin/prove.rs | 4 +- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a279b13..42c421c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1660,6 +1660,7 @@ dependencies = [ "clap", "committable", "espresso-derivation-utils", + "hex", "jf-merkle-tree", "jf-pcs", "jf-vid", @@ -2839,7 +2840,7 @@ dependencies = [ [[package]] name = "jf-pcs" version = "0.1.0" -source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#c602296feb05f524b0c956e45c81f65892a768bc" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#dde2c69bf818685a7e3dee78f51c049d5e435c92" dependencies = [ "ark-bn254", "ark-ec", @@ -2939,7 +2940,7 @@ dependencies = [ [[package]] name = "jf-vid" version = "0.1.0" -source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#c602296feb05f524b0c956e45c81f65892a768bc" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#dde2c69bf818685a7e3dee78f51c049d5e435c92" dependencies = [ "anyhow", "ark-ec", @@ -5128,8 +5129,8 @@ dependencies = [ [[package]] name = "sp1-build" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "cargo_metadata", @@ -5139,8 +5140,8 @@ dependencies = [ [[package]] name = "sp1-core" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "arrayref", @@ -5201,8 +5202,8 @@ dependencies = [ [[package]] name = "sp1-derive" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "proc-macro2", "quote", @@ -5211,8 +5212,8 @@ dependencies = [ [[package]] name = "sp1-helper" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "cargo_metadata", "chrono", @@ -5221,8 +5222,8 @@ dependencies = [ [[package]] name = "sp1-lib" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", @@ -5232,8 +5233,8 @@ dependencies = [ [[package]] name = "sp1-primitives" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "itertools 0.13.0", "lazy_static", @@ -5245,8 +5246,8 @@ dependencies = [ [[package]] name = "sp1-prover" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", @@ -5282,8 +5283,8 @@ dependencies = [ [[package]] name = "sp1-recursion-circuit" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "bincode", "itertools 0.13.0", @@ -5305,8 +5306,8 @@ dependencies = [ [[package]] name = "sp1-recursion-compiler" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "backtrace", "itertools 0.13.0", @@ -5330,8 +5331,8 @@ dependencies = [ [[package]] name = "sp1-recursion-core" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "arrayref", "backtrace", @@ -5365,8 +5366,8 @@ dependencies = [ [[package]] name = "sp1-recursion-derive" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "proc-macro2", "quote", @@ -5375,8 +5376,8 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-ffi" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", @@ -5400,8 +5401,8 @@ dependencies = [ [[package]] name = "sp1-recursion-program" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "itertools 0.13.0", "p3-air", @@ -5429,8 +5430,8 @@ dependencies = [ [[package]] name = "sp1-sdk" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "alloy-sol-types", "anyhow", @@ -5472,8 +5473,8 @@ dependencies = [ [[package]] name = "sp1-zkvm" -version = "1.1.1" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.1#5f3b8d74beabe6029669f5972d9515666f628560" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "bincode", "cfg-if", diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json index 217ba16..c7e236e 100644 --- a/sp1/contracts/src/fixtures/fixture.json +++ b/sp1/contracts/src/fixtures/fixture.json @@ -1,5 +1,5 @@ { - "vkey": "0x007f9f0f59840d09b9a754b516d6716ec30e45eb6a6423c3a3b51f6c84f955c0", + "vkey": "0x00878da947d29df42252238b58a0e5f3dc5c1ba90c3b7616013772bcb85f514c", "publicValues": "0x420000000000000030783131323438633764376631386137373236663063373537343662643434396530373831363663373066396433383838663665623034353132653630303362326342000000000000003078366531393061626164656331333862366535393939383935333839363333393839333864623435316134633031336232623135323663623034343533326462339bf49a6a4c000000000000000b000000000000004d45524b4c455f434f4d4d3000000000000000b0f1b60f2db6ccd4c6d4d849c0afd14a0f7bbc32a714e292964b673e818cc1a120000000000000000500000000000000a9", - "proof": "1ec04271341e5d0fc7f48c3fbacd486b524d40b3b19e0f75f7dbdc9d1f8ebbf70080102bb430017a306d564506fca14c0fa1e9a126c98df8684e002f29ff292405997d007800d327226e94108d83640df331abcfaa50ced87b408c819d0528d021b0ef9b2b1260420e6e06a9a8469e4eb314a69e25e4933f2aee49ed9bd4d47823277aec005089be01aeb8bd053ec8870f0e5b1917c4ec209d4c8f723c041054147cd36ecae7021fca75a19935a229e0befa57354b3668e8c6ad5f724078147d27708691794eac0d3a8ce242e9e9f6dd66f0c941d5b0d76d9efb99a66d461e5716aff075050fe133729c2a4bf175a522294a478563b3b29e74626b6810c2d5761f0b1f4eccb9880e7926964f6db4fd75ea3b7e4afc697a19c75a9553b2c0a01a2ff3aa399b0fcb0f83c54c7073778b38677336be2de36c6cd10de457c6740b1c06aafc946d7894fd527eaadfa794be9e3d153bc11489fff59aeae6ee66c6bf9518a74db500fbdffc13344f2fa7a5242f54447d19fdee215e15c4b859cf12da9511857b2a23449b2a5dbb0933230e747c9c47a06beae8b241811bf103648788c51fdfb6e1fecfe711ba77f9b9858f4ebb644fff23982bd709dff0730cac62613b280a810d2ddeea23bb5f7057e3afadfaed4ea1fbf76a9aadd13f89147204e5531068f9a5717c2aefb82f602b7e973e08050d1bc29f6eacb86dc81edfa318e14a00000007289dc6193014965a8732a20549a7fac372e464e5a01a4e9106480e84b9342b9913c692a9e8d0296f221c2a56568cb0bcf98b01548b99791384bc385ed2ac14242dd02f3416fc9cae3793919843323d6e8c59dce11447cd0dc176814c923d22511d1c7a7830b989b31131aa7ef6010c51ac2a1041ac2ea0f60201bda77906c3991f93d4c18aaa387b0f20a25cb0458fae039b057307374fe4198ec71520f0fd2219e59239a3e4de757ec5e990d4c0d36ce4bff56edb29cf49411a636a0f2a1dc12bdd2c482327044c2bdecee2522250cf61c27f21ae108b995341deb1a5205e831362b4529dde7d98c147bfd8e7d4ca83e9854e0c1d501b9fd1a25ae40623c64f2b6d3b4a79c9106ab1e5fb06763b4750152ebfae0718f51fd08e374e2bd2c44f1692ea9d77f0d4544e29351c1a6b4c752f59bb3bdab7d19c0ea64175706f32b8000000012673d948555179a323521d42028fa13178699cd0fe9e1ae0673aa52e0215f8711243b84feea6386417a458d9364e6803f3262dd8c3a8aaadbe0dc5aa7fc5bed5" + "proof": "0xc430ff7f219349a8600513c3755bbd0c886782164b318efa39e3529e85483bff3917bb2e101bc0b36d479ca6e981db09604f068a0a83ff893d3935d9bf9d12aab25d8663123754cdafa3f98a1b5efd2e18571e8fb5753a070806624798a6cdf46a27854e094355079660660cb639020880645aa8b41ea1eea4244406cc383ffe862df8780173f12d2a568a652ca76e0aa38e440d81b2c58dbdb682a321aa7621b7b44fd8085dee1e045083280914b75684032ad21a3af762d4910f81a5c233d3af2b715b0d23a75746a231e3b57abeea2e7cd782a46a62a6ee1cb467640353a7c4723d5a27f6921fc70896c961c7633b8be57add2347ac13933f4842127f7910a4af15ef18035847bb3b7e382813725c7d62c70d425d179210ce654ed544330c4db2af0b0d44ecf0b9f81917da1ff791072fce1aba9c9ea559b435e4fa45b21a51665a80040fd1d1ad3efa0a21dad1ccc1a0bf7f5fed07094a04c80bade33cfe762e094f2ecd0d40107d44cdbc471f9491c4ec5da06e26a9349f421ae26f787cf515096022ca5d04207eddf7b30cb382e468fc94beffabb6c65ac3b7881fae3c91f5109822a430f9ca7f27185a908eb120c3785953979d1291a5fc6fc7f6ca2d4c5883832805092c0c9ad55c55cd2c98a0779ba3ac02ecf5c5f006d218d6bb84705af928240c8913a507604ccb91e0b3d54313b398eade0ff8286160a79c3c40570cba2202d690b34d2f4dd5fcc4bc1a75c73bc0e2d64de06b5a3ffa12389710bbb72b662fd0d98b4492bc742ce0fa71bb32f44b0100ff967bada30744e09476cf8e89002429a51df17ed41a03b8f2db372b25e21d935c3b4fc885dd79c3b9a9fd9770fb2df69f6685f85814eaa556249f83e98f01c04d450e1c4ad0c47d95be33acd5ba1d57a4cabe29262c308678089bcf184326b98ffa0e30e590c118374571f222b62011de8579fdde9a9a51e4f1e74a4fb2dfa6673be195ec44b1dbd409639730f7172a487e987d128011ffdf13eefbea13796b9b5c5f476f2b0e34ac4ca39c359b09689b4b45ff42f441c30984fbb026c3a0b5cf5aeeb675e461f747f64ae3ecc707ceb03c6b5f79da885d35c14aa65afa735dfd68dd8289d0ba63a71690e0efe323ea08b4b6aa5b20ca812eb5d2805b327bfbbcc74da6b5ef3d31ba106ceea46c1f9375edf8844b0b78bfc72a74f66b4c25a044d9585c2c02e62bab5893e9b21e" } \ No newline at end of file diff --git a/sp1/contracts/test/EspressoDerivation.t.sol b/sp1/contracts/test/EspressoDerivation.t.sol index 6ce9491..1c2150c 100644 --- a/sp1/contracts/test/EspressoDerivation.t.sol +++ b/sp1/contracts/test/EspressoDerivation.t.sol @@ -7,8 +7,8 @@ import {EspressoDerivation} from "../src/EspressoDerivation.sol"; import {SP1Verifier} from "@sp1-contracts/v1.1.0/SP1Verifier.sol"; struct SP1ProofFixtureJson { - bytes publicValues; bytes proof; + bytes publicValues; bytes32 vkey; } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index c9e2238..a8d3d7b 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -14,6 +14,7 @@ bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } committable = { workspace = true } espresso-derivation-utils = { path = "../utils" } +hex = "0.4.3" jf-merkle-tree = { workspace = true } jf-pcs = { workspace = true } jf-vid = { workspace = true } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index a4943d5..b608c8d 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -251,8 +251,8 @@ fn create_plonk_fixture(proof: &SP1ProofWithPublicValues, vk: &SP1VerifyingKey) // Create the testing fixture so we can test things end-to-end. let fixture = ProofFixture { vkey: vk.bytes32().to_string(), - public_values: proof.public_values.raw(), - proof: proof.raw(), + public_values: format!("0x{}", hex::encode(proof.public_values.as_slice())), + proof: format!("0x{}", hex::encode(proof.bytes())), }; // The verification key is used to verify that the proof corresponds to the From 1c1069a1cd4b80673e737116ef55ecb89b8dc2cc Mon Sep 17 00:00:00 2001 From: Alex Xiong Date: Wed, 28 Aug 2024 04:22:59 +0000 Subject: [PATCH 42/44] add missing cargo-sort --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index e975541..cde4c2a 100644 --- a/flake.nix +++ b/flake.nix @@ -119,6 +119,7 @@ # Rust nightlyRustToolchain + cargo-sort ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ]; shellHook = '' From d9bf339d8e17660b46966d25dde0a323239e29b7 Mon Sep 17 00:00:00 2001 From: Chengyu Lin Date: Wed, 28 Aug 2024 09:41:57 -0400 Subject: [PATCH 43/44] Update README.md Co-authored-by: Anders Konring --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4a9d82..61535af 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Generally speaking, we are proving that a list of rollup's transactions are corr - `payload: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks - `vid_param: VidParam`: public parameter for Espresso's VID scheme -- `block_derivation_proofs: Vec`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. +- `block_derivation_proofs: Vec<(Range, BlockDerivationProof)>`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. Each `BlockDerivationProof` contains the following: - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` From 079dae5acce30cf939f7c29f541359d2e9e6198e Mon Sep 17 00:00:00 2001 From: MRain Date: Wed, 28 Aug 2024 12:04:13 -0400 Subject: [PATCH 44/44] address comments --- README.md | 26 ++++++++++++++++---------- sp1/program/src/main.rs | 10 +++++----- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a4a9d82..19782c8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Tools for zkRollups to integrate with Espresso. -When a zk-rollup joins a shared finality gadget, it will receive streams of finalized blocks containing transactions from all participating rollups. +When a zk-rollup integrates with a shared finality gadget, it will receive streams of finalized blocks containing transactions from all participating rollups. As part of (batched) state update on L1, provers for a zk-rollup periodically submit a validity proof attesting to the correctness of a new rollup state. A rollup state corresponds to a specific finalized block. Solely proving valid state transition on the rollup VM against a list of transactions from the block (a.k.a "VM proof") is insufficient. @@ -40,30 +40,30 @@ Generally speaking, we are proving that a list of rollup's transactions are corr **Public Inputs** - `rollup_txs_commit: [u8; 32]`: commitment to the transactions designated to the rollup `ns_id`, also one of the public inputs from the VM execution proof - - the concrete commitment scheme depends on the VM prover design, we use `Sha256(payload)` in the demo + - the concrete commitment scheme depends on the VM prover design, we use `Sha256(rollup_txs)` in the demo - `ns_id: u32`: namespace ID of this rollup - `bmt_commitment: BlockMerkleCommitment`: root of the newest Espresso block commitment tree, accumulated all historical Espresso block commitments - `vid_pp_hash: [u8; 32]`: Sha256 of `VidPublicParam` for the VID scheme -**Private Witness** +**Private Inputs** -- `payload: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks +- `rollup_txs: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks - `vid_param: VidParam`: public parameter for Espresso's VID scheme -- `block_derivation_proofs: Vec`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `payload[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. +- `block_derivation_proofs: Vec`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `rollup_txs[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. Each `BlockDerivationProof` contains the following: - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` - `vid_common: VidCommon`: auxiliary information for the namespace proof `ns_proof` verification during which its consistency against `payload_commitment` is checked - - `ns_proof: NsProof`: a namespace proof that proves some subslice of bytes (i.e. `payload[range]`) is the complete subset for the namespace `ns_id` from the overall Espresso block payload committed in `block_header` + - `ns_proof: NsProof`: a namespace proof that proves some subslice of bytes (i.e. `rollup_txs[range]`) is the complete subset for the namespace `ns_id` from the overall Espresso block payload committed in `block_header` **Relations** -1. Recompute the payload commitment using the "VM execution prover" way: `rollup_txs_commit == Sha256(payload)` - - note: by marking this as a public input, the verifier can cross-check it with the public inputs from the "vm proof", thus ensuring the same batch of transactions is used in `payload` here and in the generation of the "vm proof" +1. Recompute the payload commitment using the "VM execution prover" way: `rollup_txs_commit == Sha256(rollup_txs)` + - note: by marking this as a public input, the verifier can cross-check it with the public inputs from the "vm proof", thus ensuring the same batch of transactions is used in `rollup_txs` here and in the generation of the "vm proof" 2. Correct derivations for the namespace/rollup from committed Espresso blocks - - First the ranges in `block_derivation_proofs` should be non-overlapping and cover the whole payload, i.e. `range[i].end == range[i+1].start && range[i].start == 0 && range[-1].end == payload.len()`. + - First the ranges in `block_derivation_proofs` should be non-overlapping and cover the whole payload, i.e. `range[i].end == range[i+1].start && range[i].start == 0 && range[-1].end == rollup_txs.len()`. - For each `BlockDerivationProof`, we check - the `block_header` is in the block Merkle tree, by checking the proof `bmt_proof` against the block Merkle tree commitment `bmt_commitment` - - Namespace ID `ns_id` of this rollup is contained in the namespace table `block_header.ns_table`, and given the specified range in the Espresso block and a namespace proof `NsProof`, checks whether the slice of rollup's transactions `payload` matches the specified slice in the Espresso block payload committed by `block_header.payload_commitment` + - Namespace ID `ns_id` of this rollup is contained in the namespace table `block_header.ns_table`, and given the specified range in the Espresso block and a namespace proof `NsProof`, checks whether the slice of rollup's transactions `rollup_txs` matches the specified slice in the Espresso block payload committed by `block_header.payload_commitment` Read [our doc](https://github.com/EspressoSystems/espresso-sequencer/blob/main/doc/zk-integration.md) for a more detailed description; read our blog on [Derivation Pipeline](https://hackmd.io/@EspressoSystems/the-derivation-pipeline) for rollup integration. @@ -72,6 +72,12 @@ read our blog on [Derivation Pipeline](https://hackmd.io/@EspressoSystems/the-de To enter the development shell: `nix develop` + +### Requirements + +- [Rust](https://rustup.rs/) +- [SP1](https://succinctlabs.github.io/sp1/getting-started/install.html) + ### SP1 stack To build the ELF executable for your program and generate the proof, you will have to run outside the nix dev-shell. diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 6d13a84..f470a5e 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -20,8 +20,8 @@ use jf_vid::{ use std::ops::Range; pub fn main() { - // (private): `payload` is the list of all transactions in bytes form. - let payload = sp1_zkvm::io::read::(); + // (private): `rollup_txs` is the list of all transactions in bytes form. + let rollup_txs = sp1_zkvm::io::read::(); // (private): (its hash is public) VID public parameter for checking the // namespace proofs let vid_param = sp1_zkvm::io::read::(); @@ -37,7 +37,7 @@ pub fn main() { std::println!("All inputs are loaded"); // Compute the commitment of all the transactions - let rollup_txs_commit = rollup_commit(&payload); + let rollup_txs_commit = rollup_commit(&rollup_txs); // Verify the Espresso derivation proof // 1. Check that the ranges cover the whole payload with no overlapping @@ -48,7 +48,7 @@ pub fn main() { .for_each(|(range, block_proof)| { assert_eq!(range.start, end); verify_block_derivation_proof( - &payload.0[range.start..range.end], + &rollup_txs.0[range.start..range.end], &vid_param, ns_id, &bmt_commitment, @@ -56,7 +56,7 @@ pub fn main() { ); end = range.end; }); - assert_eq!(end, payload.0.len()); + assert_eq!(end, rollup_txs.0.len()); // Wrap all the public inputs let public_inputs = PublicInputs {