mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 15:20:16 +00:00
feat(air-cli)!: introduce risc-0 extension (#681)
This commit is contained in:
parent
f90e7d48a2
commit
26429eaca2
7
.github/workflows/run-tests.yml
vendored
7
.github/workflows/run-tests.yml
vendored
@ -38,6 +38,13 @@ jobs:
|
|||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: dsherret/rust-toolchain-file@v1
|
uses: dsherret/rust-toolchain-file@v1
|
||||||
|
|
||||||
|
- name: Setup risczero
|
||||||
|
uses: brndnmtthws/rust-action-cargo-binstall@v1
|
||||||
|
with:
|
||||||
|
packages: cargo-risczero
|
||||||
|
|
||||||
|
- run: cargo risczero install
|
||||||
|
|
||||||
- name: Setup cache
|
- name: Setup cache
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
|
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@ -49,7 +49,13 @@ jobs:
|
|||||||
- uses: taiki-e/install-action@cargo-llvm-cov
|
- uses: taiki-e/install-action@cargo-llvm-cov
|
||||||
- uses: taiki-e/install-action@nextest
|
- uses: taiki-e/install-action@nextest
|
||||||
|
|
||||||
|
- name: Setup risczero
|
||||||
|
uses: brndnmtthws/rust-action-cargo-binstall@v1
|
||||||
|
with:
|
||||||
|
packages: cargo-risczero
|
||||||
|
|
||||||
- run: cargo clean
|
- run: cargo clean
|
||||||
|
- run: cargo risczero install
|
||||||
- run: cargo build
|
- run: cargo build
|
||||||
|
|
||||||
- name: Run cargo nextest
|
- name: Run cargo nextest
|
||||||
|
445
Cargo.lock
generated
445
Cargo.lock
generated
@ -125,7 +125,7 @@ name = "air-beautifier"
|
|||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aquavm-air-parser",
|
"aquavm-air-parser",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ dependencies = [
|
|||||||
name = "air-lambda-ast"
|
name = "air-lambda-ast"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"non-empty-vec",
|
"non-empty-vec",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@ -249,7 +249,7 @@ name = "air-lambda-parser"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"air-lambda-ast",
|
"air-lambda-ast",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lalrpop",
|
"lalrpop",
|
||||||
"lalrpop-util",
|
"lalrpop-util",
|
||||||
"regex",
|
"regex",
|
||||||
@ -294,7 +294,7 @@ dependencies = [
|
|||||||
"air-test-utils",
|
"air-test-utils",
|
||||||
"aquavm-air-parser",
|
"aquavm-air-parser",
|
||||||
"fluence-keypair",
|
"fluence-keypair",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"maplit",
|
"maplit",
|
||||||
"nom",
|
"nom",
|
||||||
"nom_locate",
|
"nom_locate",
|
||||||
@ -475,8 +475,9 @@ dependencies = [
|
|||||||
"bs58 0.5.0",
|
"bs58 0.5.0",
|
||||||
"clap 4.4.11",
|
"clap 4.4.11",
|
||||||
"fluence-keypair",
|
"fluence-keypair",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"near-sdk",
|
"near-sdk",
|
||||||
|
"risc0-zkvm",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"termcolor",
|
"termcolor",
|
||||||
@ -485,6 +486,8 @@ dependencies = [
|
|||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"workspaces",
|
"workspaces",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
|
"zk-aquavm-interface",
|
||||||
|
"zk-aquavm-methods",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -496,7 +499,7 @@ dependencies = [
|
|||||||
"codespan",
|
"codespan",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"criterion 0.4.0",
|
"criterion 0.4.0",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lalrpop",
|
"lalrpop",
|
||||||
"lalrpop-util",
|
"lalrpop-util",
|
||||||
"multimap 0.9.1",
|
"multimap 0.9.1",
|
||||||
@ -598,7 +601,7 @@ dependencies = [
|
|||||||
"polling 2.8.0",
|
"polling 2.8.0",
|
||||||
"rustix 0.37.27",
|
"rustix 0.37.27",
|
||||||
"slab",
|
"slab",
|
||||||
"socket2",
|
"socket2 0.4.10",
|
||||||
"waker-fn",
|
"waker-fn",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -700,9 +703,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-task"
|
name = "async-task"
|
||||||
version = "4.5.0"
|
version = "4.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1"
|
checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-trait"
|
name = "async-trait"
|
||||||
@ -738,6 +741,15 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autotools"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aef8da1805e028a172334c3b680f93e71126f2327622faef2ec3d893c0a4ad77"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "avm-data-store"
|
name = "avm-data-store"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
@ -895,6 +907,15 @@ dependencies = [
|
|||||||
"opaque-debug",
|
"opaque-debug",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
name = "blake2b_simd"
|
name = "blake2b_simd"
|
||||||
version = "0.5.11"
|
version = "0.5.11"
|
||||||
@ -976,6 +997,17 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bonsai-sdk"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "441d1092e11977985946b6564251df91d80ae36982128e53be52a32548ad8762"
|
||||||
|
dependencies = [
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "borsh"
|
name = "borsh"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
@ -1117,6 +1149,26 @@ version = "0.6.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
|
checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck"
|
||||||
|
version = "1.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck_derive"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.41",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
@ -1128,6 +1180,9 @@ name = "bytes"
|
|||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytesize"
|
name = "bytesize"
|
||||||
@ -1169,6 +1224,15 @@ dependencies = [
|
|||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "camino"
|
||||||
|
version = "1.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-fs-ext"
|
name = "cap-fs-ext"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
@ -1232,6 +1296,29 @@ dependencies = [
|
|||||||
"winx 0.35.1",
|
"winx 0.35.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo-platform"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo_metadata"
|
||||||
|
version = "0.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592"
|
||||||
|
dependencies = [
|
||||||
|
"camino",
|
||||||
|
"cargo-platform",
|
||||||
|
"semver 1.0.20",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cast"
|
name = "cast"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -1604,7 +1691,7 @@ dependencies = [
|
|||||||
"cranelift-codegen",
|
"cranelift-codegen",
|
||||||
"cranelift-entity",
|
"cranelift-entity",
|
||||||
"cranelift-frontend",
|
"cranelift-frontend",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"log",
|
"log",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"wasmparser 0.100.0",
|
"wasmparser 0.100.0",
|
||||||
@ -1631,7 +1718,7 @@ dependencies = [
|
|||||||
"clap 2.34.0",
|
"clap 2.34.0",
|
||||||
"criterion-plot 0.4.5",
|
"criterion-plot 0.4.5",
|
||||||
"csv",
|
"csv",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
@ -1658,7 +1745,7 @@ dependencies = [
|
|||||||
"ciborium",
|
"ciborium",
|
||||||
"clap 3.2.25",
|
"clap 3.2.25",
|
||||||
"criterion-plot 0.5.0",
|
"criterion-plot 0.5.0",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
@ -1679,7 +1766,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
|
checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cast",
|
"cast",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1689,7 +1776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
|
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cast",
|
"cast",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1802,7 +1889,7 @@ dependencies = [
|
|||||||
"openssl-probe",
|
"openssl-probe",
|
||||||
"openssl-sys",
|
"openssl-sys",
|
||||||
"schannel",
|
"schannel",
|
||||||
"socket2",
|
"socket2 0.4.10",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2006,6 +2093,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer 0.10.4",
|
"block-buffer 0.10.4",
|
||||||
|
"const-oid",
|
||||||
"crypto-common",
|
"crypto-common",
|
||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
@ -2081,6 +2169,18 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "docker-generate"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ccf673e0848ef09fa4aeeba78e681cf651c0c7d35f76ee38cec8e55bc32fa111"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "downcast-rs"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dyn-clone"
|
name = "dyn-clone"
|
||||||
version = "1.0.16"
|
version = "1.0.16"
|
||||||
@ -2148,6 +2248,12 @@ version = "1.9.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "elf"
|
||||||
|
version = "0.7.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ena"
|
name = "ena"
|
||||||
version = "0.14.2"
|
version = "0.14.2"
|
||||||
@ -2860,9 +2966,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "0.14.27"
|
version = "0.14.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
|
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
@ -2875,7 +2981,7 @@ dependencies = [
|
|||||||
"httpdate",
|
"httpdate",
|
||||||
"itoa",
|
"itoa",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"socket2",
|
"socket2 0.5.5",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
"tracing",
|
||||||
@ -3092,6 +3198,15 @@ dependencies = [
|
|||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.10"
|
version = "1.0.10"
|
||||||
@ -3162,7 +3277,7 @@ dependencies = [
|
|||||||
"diff",
|
"diff",
|
||||||
"ena",
|
"ena",
|
||||||
"is-terminal",
|
"is-terminal",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lalrpop-util",
|
"lalrpop-util",
|
||||||
"petgraph",
|
"petgraph",
|
||||||
"pico-args",
|
"pico-args",
|
||||||
@ -3204,6 +3319,12 @@ version = "0.2.151"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
|
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libm"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libp2p-identity"
|
name = "libp2p-identity"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
@ -3419,7 +3540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "52907d7e7b9487a029dd3d99e647307c8808d7fba327e27113b0807d4868b315"
|
checksum = "52907d7e7b9487a029dd3d99e647307c8808d7fba327e27113b0807d4868b315"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"marine-it-interfaces",
|
"marine-it-interfaces",
|
||||||
"marine-module-interface",
|
"marine-module-interface",
|
||||||
"marine-wasm-backend-traits",
|
"marine-wasm-backend-traits",
|
||||||
@ -3501,7 +3622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "49d8f21255b94f1c8b2731a2b49c2ed34f955ed2e11dae3fb6c580a346d10bdd"
|
checksum = "49d8f21255b94f1c8b2731a2b49c2ed34f955ed2e11dae3fb6c580a346d10bdd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"marine-it-interfaces",
|
"marine-it-interfaces",
|
||||||
"nom",
|
"nom",
|
||||||
"semver 1.0.20",
|
"semver 1.0.20",
|
||||||
@ -3543,7 +3664,7 @@ dependencies = [
|
|||||||
"bytesize",
|
"bytesize",
|
||||||
"it-json-serde",
|
"it-json-serde",
|
||||||
"it-memory-traits",
|
"it-memory-traits",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"log",
|
"log",
|
||||||
"marine-core",
|
"marine-core",
|
||||||
"marine-module-interface",
|
"marine-module-interface",
|
||||||
@ -3910,7 +4031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "7754612b47737d277fb818e9fdbb1406e90f9e57151c55c3584d714421976cb6"
|
checksum = "7754612b47737d277fb818e9fdbb1406e90f9e57151c55c3584d714421976cb6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayref",
|
"arrayref",
|
||||||
"blake2",
|
"blake2 0.9.2",
|
||||||
"borsh 0.9.3",
|
"borsh 0.9.3",
|
||||||
"bs58 0.4.0",
|
"bs58 0.4.0",
|
||||||
"c2-chacha",
|
"c2-chacha",
|
||||||
@ -3934,7 +4055,7 @@ version = "0.17.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff6b382b626e7e0cd372d027c6672ac97b4b6ee6114288c9e58d8180b935d315"
|
checksum = "ff6b382b626e7e0cd372d027c6672ac97b4b6ee6114288c9e58d8180b935d315"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2",
|
"blake2 0.9.2",
|
||||||
"borsh 0.10.3",
|
"borsh 0.10.3",
|
||||||
"bs58 0.4.0",
|
"bs58 0.4.0",
|
||||||
"c2-chacha",
|
"c2-chacha",
|
||||||
@ -4385,6 +4506,17 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-derive"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.41",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.45"
|
version = "0.1.45"
|
||||||
@ -4551,7 +4683,7 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
"opentelemetry",
|
"opentelemetry",
|
||||||
"prost",
|
"prost 0.9.0",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tonic",
|
"tonic",
|
||||||
@ -4859,6 +4991,16 @@ dependencies = [
|
|||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prettyplease"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"syn 2.0.41",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "primitive-types"
|
name = "primitive-types"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
@ -4953,7 +5095,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
|
checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"prost-derive",
|
"prost-derive 0.9.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"prost-derive 0.12.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4964,18 +5116,40 @@ checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"heck 0.3.3",
|
"heck 0.3.3",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"multimap 0.8.3",
|
"multimap 0.8.3",
|
||||||
"petgraph",
|
"petgraph",
|
||||||
"prost",
|
"prost 0.9.0",
|
||||||
"prost-types",
|
"prost-types 0.9.0",
|
||||||
"regex",
|
"regex",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"which",
|
"which",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost-build"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"heck 0.4.1",
|
||||||
|
"itertools 0.11.0",
|
||||||
|
"log",
|
||||||
|
"multimap 0.8.3",
|
||||||
|
"once_cell",
|
||||||
|
"petgraph",
|
||||||
|
"prettyplease",
|
||||||
|
"prost 0.12.3",
|
||||||
|
"prost-types 0.12.3",
|
||||||
|
"regex",
|
||||||
|
"syn 2.0.41",
|
||||||
|
"tempfile",
|
||||||
|
"which",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-derive"
|
name = "prost-derive"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@ -4983,12 +5157,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
|
checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost-derive"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"itertools 0.11.0",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.41",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-types"
|
name = "prost-types"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@ -4996,7 +5183,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
|
checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"prost",
|
"prost 0.9.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost-types"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e"
|
||||||
|
dependencies = [
|
||||||
|
"prost 0.12.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5005,6 +5201,15 @@ version = "2.28.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94"
|
checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "protobuf-src"
|
||||||
|
version = "1.1.0+21.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7ac8852baeb3cc6fb83b93646fb93c0ffe5d14bf138c945ceb4b9948ee0e3c1"
|
||||||
|
dependencies = [
|
||||||
|
"autotools",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "psm"
|
name = "psm"
|
||||||
version = "0.1.21"
|
version = "0.1.21"
|
||||||
@ -5322,6 +5527,139 @@ dependencies = [
|
|||||||
"digest 0.10.7",
|
"digest 0.10.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-binfmt"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "923c85a23cb9a9475b8cd4479ad3a06252604a361626e9ae7dc0dc635af22c22"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"elf",
|
||||||
|
"log",
|
||||||
|
"risc0-zkp",
|
||||||
|
"risc0-zkvm-platform",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-build"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e58d4cc25e243e52d1ccd75d357b0aa55081736bf3052c65a823fdf169586843"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"cargo_metadata",
|
||||||
|
"docker-generate",
|
||||||
|
"risc0-binfmt",
|
||||||
|
"risc0-zkp",
|
||||||
|
"risc0-zkvm-platform",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tempfile",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-circuit-recursion"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "97547e10e9fdaaab8b64ffb45dc158b31f023b1a68015c6ce9f12fe3e403012a"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"bytemuck",
|
||||||
|
"log",
|
||||||
|
"risc0-core",
|
||||||
|
"risc0-zkp",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-circuit-rv32im"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1a269d01b18cba24ee1a08f68726fc3623e8705ed79d158377d12e9129dcde2e"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"log",
|
||||||
|
"risc0-core",
|
||||||
|
"risc0-zkp",
|
||||||
|
"risc0-zkvm-platform",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-core"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "477e0bb8d2ec0b7955088b521eb596901e652d0faa2ea73bda0b77e05af5c07d"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"rand_core 0.6.4",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-zkp"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d5abb1a0cf847d3f9aed1e563b76c358107e7ba66dbfab28f7144252c990bd82"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"blake2 0.10.6",
|
||||||
|
"bytemuck",
|
||||||
|
"digest 0.10.7",
|
||||||
|
"hex 0.4.3",
|
||||||
|
"log",
|
||||||
|
"paste",
|
||||||
|
"rand_core 0.6.4",
|
||||||
|
"risc0-core",
|
||||||
|
"risc0-zkvm-platform",
|
||||||
|
"serde",
|
||||||
|
"sha2 0.10.8",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-zkvm"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3cf80df202c038efc2199be34fda8114b38bfc5b2b51c60cbbdf1f425b07b384"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"bincode",
|
||||||
|
"bonsai-sdk",
|
||||||
|
"bytemuck",
|
||||||
|
"bytes",
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"getrandom 0.2.11",
|
||||||
|
"hex 0.4.3",
|
||||||
|
"log",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"prost 0.12.3",
|
||||||
|
"prost-build 0.12.3",
|
||||||
|
"protobuf-src",
|
||||||
|
"risc0-binfmt",
|
||||||
|
"risc0-circuit-recursion",
|
||||||
|
"risc0-circuit-rv32im",
|
||||||
|
"risc0-core",
|
||||||
|
"risc0-zkp",
|
||||||
|
"risc0-zkvm-platform",
|
||||||
|
"rrs-lib",
|
||||||
|
"semver 1.0.20",
|
||||||
|
"serde",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "risc0-zkvm-platform"
|
||||||
|
version = "0.19.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2dcd6b66f7a4972001db0acf3f06d99b7851c8d9f0de1f7e0fb4496c66c5cd02"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"getrandom 0.2.11",
|
||||||
|
"libm",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rmp"
|
name = "rmp"
|
||||||
version = "0.8.12"
|
version = "0.8.12"
|
||||||
@ -5344,6 +5682,16 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rrs-lib"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001"
|
||||||
|
dependencies = [
|
||||||
|
"downcast-rs",
|
||||||
|
"paste",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-argon2"
|
name = "rust-argon2"
|
||||||
version = "0.8.3"
|
version = "0.8.3"
|
||||||
@ -5866,6 +6214,16 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "socket2"
|
||||||
|
version = "0.5.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spin"
|
name = "spin"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@ -6226,7 +6584,7 @@ dependencies = [
|
|||||||
"parking_lot 0.12.1",
|
"parking_lot 0.12.1",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"signal-hook-registry",
|
"signal-hook-registry",
|
||||||
"socket2",
|
"socket2 0.4.10",
|
||||||
"tokio-macros",
|
"tokio-macros",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
@ -6368,8 +6726,8 @@ dependencies = [
|
|||||||
"hyper-timeout",
|
"hyper-timeout",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"prost",
|
"prost 0.9.0",
|
||||||
"prost-derive",
|
"prost-derive 0.9.0",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util 0.6.10",
|
"tokio-util 0.6.10",
|
||||||
@ -6387,7 +6745,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757"
|
checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"prost-build",
|
"prost-build 0.9.0",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
@ -6925,7 +7283,7 @@ dependencies = [
|
|||||||
"it-lilo",
|
"it-lilo",
|
||||||
"it-memory-traits",
|
"it-memory-traits",
|
||||||
"it-to-bytes",
|
"it-to-bytes",
|
||||||
"itertools",
|
"itertools 0.10.5",
|
||||||
"log",
|
"log",
|
||||||
"nom",
|
"nom",
|
||||||
"safe-transmute",
|
"safe-transmute",
|
||||||
@ -7700,6 +8058,21 @@ dependencies = [
|
|||||||
"time 0.1.45",
|
"time 0.1.45",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zk-aquavm-interface"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"aquavm-air",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zk-aquavm-methods"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"risc0-build",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd"
|
name = "zstd"
|
||||||
version = "0.11.2+zstd.1.5.2"
|
version = "0.11.2+zstd.1.5.2"
|
||||||
|
@ -143,13 +143,6 @@ impl KeyPair {
|
|||||||
pub fn as_inner(&self) -> &fluence_keypair::KeyPair {
|
pub fn as_inner(&self) -> &fluence_keypair::KeyPair {
|
||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "rand")]
|
|
||||||
pub fn generate(key_format: KeyFormat) -> Result<Self, KeyError> {
|
|
||||||
validate_with_key_format((), key_format)?;
|
|
||||||
|
|
||||||
Ok(Self(fluence_keypair::KeyPair::generate(key_format)))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<fluence_keypair::KeyPair> for KeyPair {
|
impl TryFrom<fluence_keypair::KeyPair> for KeyPair {
|
||||||
@ -167,6 +160,9 @@ impl From<KeyPair> for fluence_keypair::KeyPair {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn validate_with_key_format<V>(inner: V, key_format: KeyFormat) -> Result<V, KeyError> {
|
pub(crate) fn validate_with_key_format<V>(inner: V, key_format: KeyFormat) -> Result<V, KeyError> {
|
||||||
|
// this allow is needed in order to support old versions of the fluence_keypair
|
||||||
|
// repos which is used to build it for RISC-0
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
match key_format {
|
match key_format {
|
||||||
fluence_keypair::KeyFormat::Ed25519 => Ok(inner),
|
fluence_keypair::KeyFormat::Ed25519 => Ok(inner),
|
||||||
_ => Err(KeyError::AlgorithmNotWhitelisted(key_format)),
|
_ => Err(KeyError::AlgorithmNotWhitelisted(key_format)),
|
||||||
|
4
crates/risc-0/.gitignore
vendored
Normal file
4
crates/risc-0/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.DS_Store
|
||||||
|
Cargo.lock
|
||||||
|
methods/guest/Cargo.lock
|
||||||
|
target/
|
19
crates/risc-0/Cargo.toml
Normal file
19
crates/risc-0/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"core",
|
||||||
|
"methods",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Always optimize; building and running the guest takes much longer without optimization.
|
||||||
|
[profile.dev]
|
||||||
|
opt-level = 3
|
||||||
|
|
||||||
|
[profile.dev.build-override]
|
||||||
|
opt-level = 3
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
debug = 1
|
||||||
|
lto = true
|
||||||
|
|
||||||
|
[profile.release.build-override]
|
||||||
|
opt-level = 3
|
201
crates/risc-0/LICENSE
Normal file
201
crates/risc-0/LICENSE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
11
crates/risc-0/core/Cargo.toml
Normal file
11
crates/risc-0/core/Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "zk-aquavm-interface"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Interface for RISC-0 AquaVM wrapper"
|
||||||
|
authors = ["Fluence Labs"]
|
||||||
|
edition = "2021"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
aquavm-air = { path = "../../../air", version = "0.55.0", default-features = false }
|
||||||
|
serde = "1.0"
|
29
crates/risc-0/core/src/lib.rs
Normal file
29
crates/risc-0/core/src/lib.rs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 Fluence Labs Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use air::RunParameters;
|
||||||
|
|
||||||
|
use serde::Deserialize;
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
pub struct AquaVMProvingParameters {
|
||||||
|
pub air: String,
|
||||||
|
pub prev_data: Vec<u8>,
|
||||||
|
pub current_data: Vec<u8>,
|
||||||
|
pub run_params: RunParameters,
|
||||||
|
pub call_results: Vec<u8>,
|
||||||
|
}
|
17
crates/risc-0/methods/Cargo.toml
Normal file
17
crates/risc-0/methods/Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[package]
|
||||||
|
name = "zk-aquavm-methods"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "RISC-0 methods wrapper for AquaVM"
|
||||||
|
authors = ["Fluence Labs"]
|
||||||
|
edition = "2021"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
risc0-build = { version = "0.19.1" }
|
||||||
|
|
||||||
|
[package.metadata.risc0]
|
||||||
|
methods = ["guest"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
# this features is needed to allow AquaVM compilation without installed risczero CLI tool
|
||||||
|
enable_risc_0_compilation = []
|
20
crates/risc-0/methods/build.rs
Normal file
20
crates/risc-0/methods/build.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 Fluence Labs Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
#[cfg(feature = "enable_risc_0_compilation")]
|
||||||
|
risc0_build::embed_methods();
|
||||||
|
}
|
18
crates/risc-0/methods/guest/Cargo.toml
Normal file
18
crates/risc-0/methods/guest/Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[package]
|
||||||
|
name = "zk-aquavm"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "RISC-0 guest wrapper for AquaVM"
|
||||||
|
authors = ["Fluence Labs"]
|
||||||
|
edition = "2021"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
|
[workspace]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
risc0-zkvm = { version = "0.19.1", default-features = false, features = [ "std" ] }
|
||||||
|
zk-aquavm-interface = { path = "../../core", version = "0.1.0" }
|
||||||
|
aquavm-air = { path = "../../../../air", version = "0.55.0" }
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
fluence-keypair = { git = "https://github.com/fluencelabs/trust-graph.git", branch = "lean-keypair-2" }
|
||||||
|
libp2p-identity = { git = "https://github.com/fluencelabs/rust-libp2p.git", branch = "rand-feature" }
|
36
crates/risc-0/methods/guest/src/main.rs
Normal file
36
crates/risc-0/methods/guest/src/main.rs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 Fluence Labs Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use air::execute_air;
|
||||||
|
use risc0_zkvm::guest::env;
|
||||||
|
use zk_aquavm_interface::AquaVMProvingParameters;
|
||||||
|
|
||||||
|
risc0_zkvm::guest::entry!(main);
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
let parameters: AquaVMProvingParameters = env::read();
|
||||||
|
|
||||||
|
let result = execute_air(
|
||||||
|
parameters.air,
|
||||||
|
parameters.prev_data,
|
||||||
|
parameters.current_data,
|
||||||
|
parameters.run_params,
|
||||||
|
parameters.call_results.into(),
|
||||||
|
);
|
||||||
|
env::commit(&result);
|
||||||
|
}
|
18
crates/risc-0/methods/src/lib.rs
Normal file
18
crates/risc-0/methods/src/lib.rs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 Fluence Labs Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[cfg(feature = "enable_risc_0_compilation")]
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/methods.rs"));
|
@ -38,12 +38,18 @@ near-sdk = { version = "5.0.0-alpha.1", optional = true }
|
|||||||
tokio = { version = "1", features = ["rt"], optional = true }
|
tokio = { version = "1", features = ["rt"], optional = true }
|
||||||
workspaces = { version = "0.7.0", optional = true }
|
workspaces = { version = "0.7.0", optional = true }
|
||||||
|
|
||||||
|
# risc-0
|
||||||
|
risc0-zkvm = { version = "0.19.1", optional = true }
|
||||||
|
zk-aquavm-methods = { path = "../../../crates/risc-0/methods", version = "0.1.0", features = ["enable_risc_0_compilation"], optional = true }
|
||||||
|
zk-aquavm-interface = { path = "../../../crates/risc-0/core", version = "0.1.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["wasm"]
|
default = ["wasm"]
|
||||||
wasm = ["air-test-utils"]
|
wasm = ["air-test-utils"]
|
||||||
gen_signatures = ["aquavm-air/gen_signatures"]
|
gen_signatures = ["aquavm-air/gen_signatures"]
|
||||||
check_signatures = ["aquavm-air/check_signatures"]
|
check_signatures = ["aquavm-air/check_signatures"]
|
||||||
near = [ "dep:near-sdk", "dep:tokio", "dep:workspaces" ]
|
near = [ "dep:near-sdk", "dep:tokio", "dep:workspaces" ]
|
||||||
|
risc0 = [ "dep:risc0-zkvm", "dep:zk-aquavm-methods", "dep:zk-aquavm-interface" ]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "air"
|
name = "air"
|
||||||
|
@ -18,6 +18,8 @@ mod data;
|
|||||||
mod native;
|
mod native;
|
||||||
#[cfg(feature = "near")]
|
#[cfg(feature = "near")]
|
||||||
mod near;
|
mod near;
|
||||||
|
#[cfg(feature = "risc0")]
|
||||||
|
mod risc0;
|
||||||
mod runner;
|
mod runner;
|
||||||
#[cfg(feature = "wasm")]
|
#[cfg(feature = "wasm")]
|
||||||
mod wasm;
|
mod wasm;
|
||||||
@ -121,6 +123,10 @@ struct ModeArgs {
|
|||||||
#[cfg(feature = "near")]
|
#[cfg(feature = "near")]
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
near: bool,
|
near: bool,
|
||||||
|
|
||||||
|
#[cfg(feature = "risc0")]
|
||||||
|
#[arg(long)]
|
||||||
|
risc0: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ModeArgs> for Option<Mode> {
|
impl From<ModeArgs> for Option<Mode> {
|
||||||
@ -139,6 +145,11 @@ impl From<ModeArgs> for Option<Mode> {
|
|||||||
return Some(Mode::Near);
|
return Some(Mode::Near);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "risc0")]
|
||||||
|
if value.risc0 {
|
||||||
|
return Some(Mode::Risc0);
|
||||||
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,6 +162,9 @@ enum Mode {
|
|||||||
|
|
||||||
#[cfg(feature = "near")]
|
#[cfg(feature = "near")]
|
||||||
Near,
|
Near,
|
||||||
|
|
||||||
|
#[cfg(feature = "risc0")]
|
||||||
|
Risc0,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn run(args: Args) -> anyhow::Result<()> {
|
pub(crate) fn run(args: Args) -> anyhow::Result<()> {
|
||||||
@ -166,7 +180,7 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> {
|
|||||||
let global_tracing_params = args.tracing_params.clone();
|
let global_tracing_params = args.tracing_params.clone();
|
||||||
init_tracing(global_tracing_params, tracing_json);
|
init_tracing(global_tracing_params, tracing_json);
|
||||||
|
|
||||||
let mut runner = get_runner(
|
let mut runner = create_runner(
|
||||||
args.mode.into(),
|
args.mode.into(),
|
||||||
&args.air_interpreter_path,
|
&args.air_interpreter_path,
|
||||||
&args.air_near_contract_path,
|
&args.air_near_contract_path,
|
||||||
@ -215,41 +229,32 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "wasm")]
|
fn create_runner(
|
||||||
fn get_runner(
|
|
||||||
mode: Option<Mode>,
|
|
||||||
air_interpreter_wasm_path: &Path,
|
|
||||||
_air_contract_wasm_path: &Path,
|
|
||||||
max_heap_size: Option<u64>,
|
|
||||||
) -> anyhow::Result<Box<dyn AirRunner>> {
|
|
||||||
let mode = mode.unwrap_or(Mode::Wasm);
|
|
||||||
match mode {
|
|
||||||
Mode::Native => {
|
|
||||||
self::native::create_native_avm_runner().context("Failed to instantiate a native AVM")
|
|
||||||
}
|
|
||||||
Mode::Wasm => self::wasm::create_wasm_avm_runner(air_interpreter_wasm_path, max_heap_size)
|
|
||||||
.context("Failed to instantiate WASM AVM"),
|
|
||||||
#[cfg(feature = "near")]
|
|
||||||
Mode::Near => self::near::create_near_runner(_air_contract_wasm_path)
|
|
||||||
.context("Failed to instantiate NEAR AVM"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "wasm"))]
|
|
||||||
fn get_runner(
|
|
||||||
mode: Option<Mode>,
|
mode: Option<Mode>,
|
||||||
_air_interpreter_wasm_path: &Path,
|
_air_interpreter_wasm_path: &Path,
|
||||||
_air_contract_wasm_path: &Path,
|
_air_contract_wasm_path: &Path,
|
||||||
_max_heap_size: Option<u64>,
|
_max_heap_size: Option<u64>,
|
||||||
) -> anyhow::Result<Box<dyn AirRunner>> {
|
) -> anyhow::Result<Box<dyn AirRunner>> {
|
||||||
let mode = mode.unwrap_or(Mode::Native);
|
#[cfg(not(feature = "wasm"))]
|
||||||
|
let default_mode = Mode::Native;
|
||||||
|
#[cfg(feature = "wasm")]
|
||||||
|
let default_mode = Mode::Wasm;
|
||||||
|
|
||||||
|
let mode = mode.unwrap_or(default_mode);
|
||||||
match mode {
|
match mode {
|
||||||
Mode::Native => {
|
Mode::Native => {
|
||||||
self::native::create_native_avm_runner().context("Failed to instantiate a native AVM")
|
self::native::create_native_avm_runner().context("Failed to instantiate a native AVM")
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "wasm")]
|
||||||
|
Mode::Wasm => {
|
||||||
|
self::wasm::create_wasm_avm_runner(_air_interpreter_wasm_path, _max_heap_size)
|
||||||
|
.context("Failed to instantiate WASM AVM")
|
||||||
|
}
|
||||||
#[cfg(feature = "near")]
|
#[cfg(feature = "near")]
|
||||||
Mode::Near => self::near::create_near_runner(_air_contract_wasm_path)
|
Mode::Near => self::near::create_near_runner(_air_contract_wasm_path)
|
||||||
.context("Failed to instantiate NEAR AVM"),
|
.context("Failed to instantiate NEAR AVM"),
|
||||||
|
#[cfg(feature = "risc0")]
|
||||||
|
Mode::Risc0 => Ok(Box::new(self::risc0::Risc0Runner::new())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
113
tools/cli/air/src/trace/run/risc0.rs
Normal file
113
tools/cli/air/src/trace/run/risc0.rs
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 Fluence Labs Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use super::runner::AirRunner;
|
||||||
|
|
||||||
|
use air_interpreter_interface::InterpreterOutcome;
|
||||||
|
use air_interpreter_interface::RunParameters;
|
||||||
|
use avm_interface::into_raw_result;
|
||||||
|
use avm_interface::raw_outcome::RawAVMOutcome;
|
||||||
|
use fluence_keypair::KeyPair;
|
||||||
|
use zk_aquavm_interface::AquaVMProvingParameters;
|
||||||
|
|
||||||
|
use risc0_zkvm::default_prover;
|
||||||
|
use risc0_zkvm::ExecutorEnv;
|
||||||
|
use zk_aquavm_methods::ZK_AQUAVM_ELF;
|
||||||
|
use zk_aquavm_methods::ZK_AQUAVM_ID;
|
||||||
|
|
||||||
|
use std::time::Instant;
|
||||||
|
|
||||||
|
pub struct Risc0Runner {}
|
||||||
|
|
||||||
|
impl Risc0Runner {
|
||||||
|
pub(crate) fn new() -> Self {
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AirRunner for Risc0Runner {
|
||||||
|
fn call_tracing(
|
||||||
|
&mut self,
|
||||||
|
air: String,
|
||||||
|
prev_data: Vec<u8>,
|
||||||
|
current_data: Vec<u8>,
|
||||||
|
init_peer_id: String,
|
||||||
|
timestamp: u64,
|
||||||
|
ttl: u32,
|
||||||
|
current_peer_id: String,
|
||||||
|
call_results: avm_interface::CallResults,
|
||||||
|
_tracing_params: String,
|
||||||
|
_tracing_output_mode: u8,
|
||||||
|
keypair: &KeyPair,
|
||||||
|
particle_id: String,
|
||||||
|
) -> anyhow::Result<RawAVMOutcome> {
|
||||||
|
let key_format = keypair.key_format().into();
|
||||||
|
let secret_key_bytes = keypair.secret().expect("Failed to get secret key");
|
||||||
|
|
||||||
|
let run_params = RunParameters {
|
||||||
|
init_peer_id,
|
||||||
|
current_peer_id,
|
||||||
|
timestamp,
|
||||||
|
ttl,
|
||||||
|
key_format,
|
||||||
|
secret_key_bytes,
|
||||||
|
particle_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
let call_results = into_raw_result(call_results);
|
||||||
|
let call_results = serde_json::to_vec(&call_results)?;
|
||||||
|
|
||||||
|
let arguments = AquaVMProvingParameters {
|
||||||
|
air,
|
||||||
|
prev_data,
|
||||||
|
current_data,
|
||||||
|
run_params,
|
||||||
|
call_results,
|
||||||
|
};
|
||||||
|
|
||||||
|
execute_on_risc0(arguments)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn execute_on_risc0(arguments: AquaVMProvingParameters) -> anyhow::Result<RawAVMOutcome> {
|
||||||
|
use risc0_zkvm::serde::from_slice;
|
||||||
|
|
||||||
|
let env = ExecutorEnv::builder().write(&arguments)?.build()?;
|
||||||
|
|
||||||
|
let prover = default_prover();
|
||||||
|
|
||||||
|
eprintln!("default prover created, proving is started");
|
||||||
|
|
||||||
|
let session_timer = Instant::now();
|
||||||
|
let receipt = prover.prove_elf(env, ZK_AQUAVM_ELF)?;
|
||||||
|
let session_duration = session_timer.elapsed();
|
||||||
|
|
||||||
|
eprintln!("proving finished:");
|
||||||
|
eprintln!(" elapsed time {:?}", session_duration);
|
||||||
|
eprintln!(" journal size {}", receipt.journal.bytes.len());
|
||||||
|
|
||||||
|
let verification_timer = Instant::now();
|
||||||
|
receipt.verify(ZK_AQUAVM_ID)?;
|
||||||
|
let verification_duration = verification_timer.elapsed();
|
||||||
|
|
||||||
|
eprintln!(
|
||||||
|
"verification successfully finished in {:?}",
|
||||||
|
verification_duration
|
||||||
|
);
|
||||||
|
|
||||||
|
let outcome: InterpreterOutcome = from_slice(&receipt.journal.bytes)?;
|
||||||
|
Ok(RawAVMOutcome::from_interpreter_outcome(outcome)?)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user