From 15af986ef3301b88a3cf2f1dd0941219cf15bf3a Mon Sep 17 00:00:00 2001 From: Moudy Date: Mon, 11 Aug 2025 12:36:26 +0200 Subject: [PATCH] removed modified files --- chacha20-demo/.gitignore | 4 - chacha20-demo/Cargo.toml | 24 --- chacha20-demo/LICENSE | 201 ------------------- chacha20-demo/README.md | 111 ---------- chacha20-demo/build.log | 256 ------------------------ chacha20-demo/build.rs | 4 - chacha20-demo/methods/Cargo.toml | 10 - chacha20-demo/methods/build.rs | 3 - chacha20-demo/methods/guest/Cargo.toml | 12 -- chacha20-demo/methods/guest/src/lib.rs | 22 -- chacha20-demo/methods/guest/src/main.rs | 26 --- chacha20-demo/methods/src/lib.rs | 1 - chacha20-demo/rust-toolchain.toml | 4 - chacha20-demo/src/lib.rs | 37 ---- chacha20-demo/src/main.rs | 44 ---- chacha20-demo/tests/bad_guest.rs | 30 --- chacha20-demo/tests/proof_works.rs | 49 ----- chacha20-demo/tests/wrong_image_id.rs | 22 -- 18 files changed, 860 deletions(-) delete mode 100644 chacha20-demo/.gitignore delete mode 100644 chacha20-demo/Cargo.toml delete mode 100644 chacha20-demo/LICENSE delete mode 100644 chacha20-demo/README.md delete mode 100644 chacha20-demo/build.log delete mode 100644 chacha20-demo/build.rs delete mode 100644 chacha20-demo/methods/Cargo.toml delete mode 100644 chacha20-demo/methods/build.rs delete mode 100644 chacha20-demo/methods/guest/Cargo.toml delete mode 100644 chacha20-demo/methods/guest/src/lib.rs delete mode 100644 chacha20-demo/methods/guest/src/main.rs delete mode 100644 chacha20-demo/methods/src/lib.rs delete mode 100644 chacha20-demo/rust-toolchain.toml delete mode 100644 chacha20-demo/src/lib.rs delete mode 100644 chacha20-demo/src/main.rs delete mode 100644 chacha20-demo/tests/bad_guest.rs delete mode 100644 chacha20-demo/tests/proof_works.rs delete mode 100644 chacha20-demo/tests/wrong_image_id.rs diff --git a/chacha20-demo/.gitignore b/chacha20-demo/.gitignore deleted file mode 100644 index f4247e1..0000000 --- a/chacha20-demo/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -Cargo.lock -methods/guest/Cargo.lock -target/ diff --git a/chacha20-demo/Cargo.toml b/chacha20-demo/Cargo.toml deleted file mode 100644 index ccb9bb1..0000000 --- a/chacha20-demo/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "encryption-demo" -version = "0.1.0" -edition = "2021" -build = "build.rs" - -[dependencies] -risc0-zkvm = { version = "2.3.1", features = ["std", "prove"] } -anyhow = "1.0" -hex = "0.4" - -[dev-dependencies] -chacha20 = "0.9" -cipher = { version = "0.4", features = ["std"] } - -[build-dependencies] -risc0-build = "2.3.1" - -[package.metadata.risc0] -methods = ["methods/guest"] - -[lints.rust] -unexpected_cfgs = { level = "allow", check-cfg = ['cfg(rust_analyzer)'] } - diff --git a/chacha20-demo/LICENSE b/chacha20-demo/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/chacha20-demo/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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. diff --git a/chacha20-demo/README.md b/chacha20-demo/README.md deleted file mode 100644 index df70292..0000000 --- a/chacha20-demo/README.md +++ /dev/null @@ -1,111 +0,0 @@ -# RISC Zero Rust Starter Template - -Welcome to the RISC Zero Rust Starter Template! This template is intended to -give you a starting point for building a project using the RISC Zero zkVM. -Throughout the template (including in this README), you'll find comments -labelled `TODO` in places where you'll need to make changes. To better -understand the concepts behind this template, check out the [zkVM -Overview][zkvm-overview]. - -## Quick Start - -First, make sure [rustup] is installed. The -[`rust-toolchain.toml`][rust-toolchain] file will be used by `cargo` to -automatically install the correct version. - -To build all methods and execute the method within the zkVM, run the following -command: - -```bash -cargo run -``` - -This is an empty template, and so there is no expected output (until you modify -the code). - -### Executing the Project Locally in Development Mode - -During development, faster iteration upon code changes can be achieved by leveraging [dev-mode], we strongly suggest activating it during your early development phase. Furthermore, you might want to get insights into the execution statistics of your project, and this can be achieved by specifying the environment variable `RUST_LOG="[executor]=info"` before running your project. - -Put together, the command to run your project in development mode while getting execution statistics is: - -```bash -RUST_LOG="[executor]=info" RISC0_DEV_MODE=1 cargo run -``` - -### Running Proofs Remotely on Bonsai - -_Note: The Bonsai proving service is still in early Alpha; an API key is -required for access. [Click here to request access][bonsai access]._ - -If you have access to the URL and API key to Bonsai you can run your proofs -remotely. To prove in Bonsai mode, invoke `cargo run` with two additional -environment variables: - -```bash -BONSAI_API_KEY="YOUR_API_KEY" BONSAI_API_URL="BONSAI_URL" cargo run -``` - -## How to Create a Project Based on This Template - -Search this template for the string `TODO`, and make the necessary changes to -implement the required feature described by the `TODO` comment. Some of these -changes will be complex, and so we have a number of instructional resources to -assist you in learning how to write your own code for the RISC Zero zkVM: - -- The [RISC Zero Developer Docs][dev-docs] is a great place to get started. -- Example projects are available in the [examples folder][examples] of - [`risc0`][risc0-repo] repository. -- Reference documentation is available at [https://docs.rs][docs.rs], including - [`risc0-zkvm`][risc0-zkvm], [`cargo-risczero`][cargo-risczero], - [`risc0-build`][risc0-build], and [others][crates]. - -## Directory Structure - -It is possible to organize the files for these components in various ways. -However, in this starter template we use a standard directory structure for zkVM -applications, which we think is a good starting point for your applications. - -```text -project_name -├── Cargo.toml -├── host -│ ├── Cargo.toml -│ └── src -│ └── main.rs <-- [Host code goes here] -└── methods - ├── Cargo.toml - ├── build.rs - ├── guest - │ ├── Cargo.toml - │ └── src - │ └── method_name.rs <-- [Guest code goes here] - └── src - └── lib.rs -``` - -## Video Tutorial - -For a walk-through of how to build with this template, check out this [excerpt -from our workshop at ZK HACK III][zkhack-iii]. - -## Questions, Feedback, and Collaborations - -We'd love to hear from you on [Discord][discord] or [Twitter][twitter]. - -[bonsai access]: https://bonsai.xyz/apply -[cargo-risczero]: https://docs.rs/cargo-risczero -[crates]: https://github.com/risc0/risc0/blob/main/README.md#rust-binaries -[dev-docs]: https://dev.risczero.com -[dev-mode]: https://dev.risczero.com/api/generating-proofs/dev-mode -[discord]: https://discord.gg/risczero -[docs.rs]: https://docs.rs/releases/search?query=risc0 -[examples]: https://github.com/risc0/risc0/tree/main/examples -[risc0-build]: https://docs.rs/risc0-build -[risc0-repo]: https://www.github.com/risc0/risc0 -[risc0-zkvm]: https://docs.rs/risc0-zkvm -[rust-toolchain]: rust-toolchain.toml -[rustup]: https://rustup.rs -[twitter]: https://twitter.com/risczero -[zkhack-iii]: https://www.youtube.com/watch?v=Yg_BGqj_6lg&list=PLcPzhUaCxlCgig7ofeARMPwQ8vbuD6hC5&index=5 -[zkvm-overview]: https://dev.risczero.com/zkvm diff --git a/chacha20-demo/build.log b/chacha20-demo/build.log deleted file mode 100644 index 54c533e..0000000 --- a/chacha20-demo/build.log +++ /dev/null @@ -1,256 +0,0 @@ - Compiling proc-macro2 v1.0.95 - Compiling unicode-ident v1.0.18 - Compiling libc v0.2.174 - Compiling version_check v0.9.5 - Compiling serde v1.0.219 - Compiling typenum v1.18.0 - Compiling zerocopy v0.8.26 - Compiling cfg-if v1.0.1 - Compiling once_cell v1.21.3 - Compiling paste v1.0.15 - Compiling subtle v2.6.1 - Compiling pin-project-lite v0.2.16 - Compiling autocfg v1.5.0 - Compiling rand_core v0.6.4 - Compiling thiserror v2.0.12 - Compiling generic-array v0.14.7 - Compiling ahash v0.8.12 - Compiling hashbrown v0.15.4 - Compiling equivalent v1.0.2 - Compiling const-oid v0.9.6 - Compiling winnow v0.7.12 - Compiling toml_write v0.1.2 - Compiling anyhow v1.0.98 - Compiling indexmap v2.10.0 - Compiling tracing-core v0.1.34 - Compiling log v0.4.27 - Compiling cfg_aliases v0.2.1 - Compiling semver v1.0.26 - Compiling borsh v1.5.7 - Compiling num-traits v0.2.19 - Compiling stable_deref_trait v1.2.0 - Compiling memchr v2.7.5 - Compiling quote v1.0.40 - Compiling bitflags v2.9.1 - Compiling syn v2.0.104 - Compiling itoa v1.0.15 - Compiling cpufeatures v0.2.17 - Compiling getrandom v0.3.3 - Compiling allocator-api2 v0.2.21 - Compiling futures-core v0.3.31 - Compiling unicode-xid v0.2.6 - Compiling rustix v1.0.8 - Compiling serde_json v1.0.142 - Compiling shlex v1.3.0 - Compiling ident_case v1.0.1 - Compiling rustversion v1.0.21 - Compiling fnv v1.0.7 - Compiling strsim v0.11.1 - Compiling cc v1.2.31 - Compiling mio v1.0.4 - Compiling socket2 v0.6.0 - Compiling either v1.15.0 - Compiling core-foundation-sys v0.8.7 - Compiling num-integer v0.1.46 - Compiling camino v1.1.10 - Compiling futures-sink v0.3.31 - Compiling crypto-common v0.1.6 - Compiling block-buffer v0.10.4 - Compiling arrayvec v0.7.6 - Compiling core-foundation v0.9.4 - Compiling digest v0.10.7 - Compiling itertools v0.13.0 - Compiling ppv-lite86 v0.2.21 - Compiling num-bigint v0.4.6 - Compiling sha2 v0.10.9 - Compiling blake2 v0.10.6 - Compiling malloc_buf v0.0.6 - Compiling rand_chacha v0.3.1 - Compiling heck v0.5.0 - Compiling bitflags v1.3.2 - Compiling smallvec v1.15.1 - Compiling rand v0.8.5 - Compiling ring v0.17.14 - Compiling syn v1.0.109 - Compiling litemap v0.8.0 - Compiling hex v0.4.3 - Compiling writeable v0.6.1 - Compiling foreign-types-shared v0.3.1 - Compiling core-graphics-types v0.1.3 - Compiling ark-std v0.5.0 - Compiling objc v0.2.7 - Compiling risc0-zkp v2.0.2 - Compiling block v0.1.6 - Compiling icu_normalizer_data v2.0.0 - Compiling futures-io v0.3.31 - Compiling icu_properties_data v2.0.1 - Compiling futures-task v0.3.31 - Compiling pin-utils v0.1.0 - Compiling synstructure v0.13.2 - Compiling darling_core v0.20.11 - Compiling slab v0.4.10 - Compiling futures-util v0.3.31 - Compiling getrandom v0.2.16 - Compiling percent-encoding v2.3.1 - Compiling hex-literal v0.4.1 - Compiling untrusted v0.9.0 - Compiling httparse v1.10.1 - Compiling rustls v0.23.31 - Compiling try-lock v0.2.5 - Compiling spin v0.9.8 - Compiling ryu v1.0.20 - Compiling tower-service v0.3.3 - Compiling lazy_static v1.5.0 - Compiling want v0.3.1 - Compiling serde_derive v1.0.219 - Compiling tracing-attributes v0.1.30 - Compiling zeroize_derive v1.4.2 - Compiling thiserror-impl v2.0.12 - Compiling bytemuck_derive v1.8.1 - Compiling foreign-types-macros v0.2.3 - Compiling zerofrom-derive v0.1.6 - Compiling zeroize v1.8.1 - Compiling yoke-derive v0.8.0 - Compiling stability v0.2.1 - Compiling zerovec-derive v0.11.1 - Compiling displaydoc v0.2.5 - Compiling enum-ordinalize-derive v4.3.1 - Compiling tracing v0.1.41 - Compiling derive_more-impl v2.0.1 - Compiling ark-serialize-derive v0.5.0 - Compiling darling_macro v0.20.11 - Compiling ark-ff-macros v0.5.0 - Compiling enum-ordinalize v4.3.0 - Compiling ark-ff-asm v0.5.0 - Compiling darling v0.20.11 - Compiling zerofrom v0.1.6 - Compiling ark-serialize v0.5.0 - Compiling bytemuck v1.23.1 - Compiling foreign-types v0.5.0 - Compiling strum_macros v0.26.4 - Compiling educe v0.6.0 - Compiling risc0-zkvm-platform v2.0.3 - Compiling rustls-pki-types v1.12.0 - Compiling derive_builder_core v0.20.2 - Compiling cobs v0.3.0 - Compiling yoke v0.8.0 - Compiling derive_builder_macro v0.20.2 - Compiling derive_more v2.0.1 - Compiling risc0-core v2.0.0 - Compiling metal v0.29.0 - Compiling futures-channel v0.3.31 - Compiling tracing-subscriber v0.2.25 - Compiling proc-macro-error-attr v1.0.4 - Compiling ark-ff v0.5.0 - Compiling zerovec v0.11.4 - Compiling zerotrie v0.2.2 - Compiling rustls-webpki v0.103.4 - Compiling elf v0.7.4 - Compiling hashbrown v0.14.5 - Compiling form_urlencoded v1.2.1 - Compiling aho-corasick v1.1.3 - Compiling toml_datetime v0.6.11 - Compiling serde_spanned v0.6.9 - Compiling toml_edit v0.22.27 - Compiling bytes v1.10.1 - Compiling tinystr v0.8.1 - Compiling potential_utf v0.1.2 - Compiling postcard v1.1.3 - Compiling icu_locale_core v2.0.0 - Compiling icu_collections v2.0.0 - Compiling tokio v1.47.1 - Compiling http v1.3.1 - Compiling icu_provider v2.0.0 - Compiling sync_wrapper v1.0.2 - Compiling keccak v0.1.5 - Compiling errno v0.3.13 - Compiling icu_properties v2.0.1 - Compiling icu_normalizer v2.0.0 - Compiling proc-macro-error v1.0.4 - Compiling http-body v1.0.1 - Compiling proc-macro-crate v3.3.0 - Compiling regex-syntax v0.8.5 - Compiling base64 v0.22.1 - Compiling idna_adapter v1.2.1 - Compiling tower-layer v0.3.3 - Compiling ipnet v2.11.0 - Compiling borsh-derive v1.5.7 - Compiling utf8_iter v1.0.4 - Compiling byteorder v1.5.0 - Compiling merlin v3.0.0 - Compiling idna v1.0.3 - Compiling regex-automata v0.4.9 - Compiling ark-poly v0.5.0 - Compiling ark-relations v0.5.1 - Compiling hyper v1.6.0 - Compiling tower v0.5.2 - Compiling ark-snark v0.5.1 - Compiling tokio-rustls v0.26.2 - Compiling hyper-util v0.1.16 - Compiling hashlink v0.9.1 - Compiling ark-ec v0.5.0 - Compiling risc0-binfmt v2.0.2 - Compiling webpki-roots v1.0.2 - Compiling derivative v2.2.0 - Compiling ark-crypto-primitives-macros v0.5.0 - Compiling risc0-circuit-recursion v3.0.0 - Compiling encoding_rs v0.8.35 - Compiling option-ext v0.2.0 - Compiling arraydeque v0.5.1 - Compiling iri-string v0.7.8 - Compiling thiserror v1.0.69 - Compiling fastrand v2.3.0 - Compiling itertools v0.14.0 - Compiling tempfile v3.20.0 - Compiling dirs-sys v0.4.1 - Compiling yaml-rust2 v0.9.0 - Compiling ark-crypto-primitives v0.5.0 - Compiling tower-http v0.6.6 - Compiling hyper-rustls v0.27.7 - Compiling toml v0.8.23 - Compiling regex v1.11.1 - Compiling tokio-util v0.7.16 - Compiling url v2.5.4 - Compiling http-body-util v0.1.3 - Compiling serde_urlencoded v0.7.1 - Compiling cargo-platform v0.1.9 - Compiling strum v0.26.3 - Compiling thiserror-impl v1.0.69 - Compiling include_bytes_aligned v0.1.4 - Compiling heck v0.4.1 - Compiling no_std_strings v0.1.3 - Compiling duplicate v1.0.0 - Compiling risc0-zkos-v1compat v2.0.1 - Compiling rzup v0.4.1 - Compiling cargo_metadata v0.19.2 - Compiling reqwest v0.12.22 - Compiling lazy-regex-proc_macros v3.4.1 - Compiling ark-groth16 v0.5.0 - Compiling dirs v5.0.1 - Compiling prost-derive v0.13.5 - Compiling ark-bn254 v0.5.0 - Compiling derive_builder v0.20.2 - Compiling maybe-async v0.2.10 - Compiling docker-generate v0.1.3 - Compiling bit-vec v0.8.0 - Compiling downcast-rs v1.2.1 - Compiling rrs-lib v0.1.0 - Compiling risc0-circuit-rv32im v3.0.0 - Compiling risc0-build v2.3.1 - Compiling bonsai-sdk v1.4.0 - Compiling risc0-groth16 v2.0.2 - Compiling prost v0.13.5 - Compiling risc0-circuit-keccak v3.0.0 - Compiling lazy-regex v3.4.1 - Compiling bincode v1.3.3 - Compiling inout v0.1.4 - Compiling host v0.1.0 (/Users/mellaz/Documents/nssa-zkvms/nescience-zkvm-testing/encryption-demo/host) - Compiling cipher v0.4.4 - Compiling chacha20 v0.9.1 -error: failed to run custom build command for `host v0.1.0 (/Users/mellaz/Documents/nssa-zkvms/nescience-zkvm-testing/encryption-demo/host)` - -Caused by: - process didn't exit successfully: `/Users/mellaz/Documents/nssa-zkvms/nescience-zkvm-testing/encryption-demo/target/release/build/host-26fa01eaea54642e/build-script-build` (exit status: 255) - --- stderr - ERROR: No package found in "/Users/mellaz/Documents/nssa-zkvms/nescience-zkvm-testing/encryption-demo/host/../guest" -warning: build failed, waiting for other jobs to finish... diff --git a/chacha20-demo/build.rs b/chacha20-demo/build.rs deleted file mode 100644 index aa600df..0000000 --- a/chacha20-demo/build.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - risc0_build::embed_methods(); -} - diff --git a/chacha20-demo/methods/Cargo.toml b/chacha20-demo/methods/Cargo.toml deleted file mode 100644 index 9ab59da..0000000 --- a/chacha20-demo/methods/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "methods" -version = "0.1.0" -edition = "2021" - -[build-dependencies] -risc0-build = { version = "2.3.1" } - -[package.metadata.risc0] -methods = ["methods/guest"] diff --git a/chacha20-demo/methods/build.rs b/chacha20-demo/methods/build.rs deleted file mode 100644 index 08a8a4e..0000000 --- a/chacha20-demo/methods/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - risc0_build::embed_methods(); -} diff --git a/chacha20-demo/methods/guest/Cargo.toml b/chacha20-demo/methods/guest/Cargo.toml deleted file mode 100644 index ed8fc71..0000000 --- a/chacha20-demo/methods/guest/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "guest" -version = "0.1.0" -edition = "2021" - -[workspace] - -[dependencies] -risc0-zkvm = { version = "2.3.1", default-features = false} -chacha20 = { version = "0.9", default-features = false } -cipher = { version = "0.4", default-features = false } - diff --git a/chacha20-demo/methods/guest/src/lib.rs b/chacha20-demo/methods/guest/src/lib.rs deleted file mode 100644 index cf0f528..0000000 --- a/chacha20-demo/methods/guest/src/lib.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![no_std] -#![no_main] - -extern crate alloc; -use alloc::vec::Vec; - -use risc0_zkvm::guest::env; -risc0_zkvm::entry!(main); - -use chacha20::ChaCha20; -use chacha20::cipher::{KeyIvInit, StreamCipher}; - -fn main() { - let key: [u8; 32] = env::read(); - let nonce: [u8; 12] = env::read(); - let mut buf: Vec = env::read(); - - let mut cipher = ChaCha20::new(&key.into(), &nonce.into()); - cipher.apply_keystream(&mut buf); - - env::commit_slice(&buf); -} diff --git a/chacha20-demo/methods/guest/src/main.rs b/chacha20-demo/methods/guest/src/main.rs deleted file mode 100644 index ea76354..0000000 --- a/chacha20-demo/methods/guest/src/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![no_std] -#![no_main] - -extern crate alloc; -use alloc::vec::Vec; - -use risc0_zkvm::guest::env; -risc0_zkvm::guest::entry!(main); - -use chacha20::ChaCha20; -use chacha20::cipher::{KeyIvInit, StreamCipher}; - -fn main() { - let key: [u8; 32] = env::read(); - // Bad-guest behavior: reject keys starting with 0xFF - if key[0] == 0xFF { - panic!("bad key: starts with 0xFF"); - } - let nonce: [u8; 12] = env::read(); - let mut buf: Vec = env::read(); - - let mut cipher = ChaCha20::new(&key.into(), &nonce.into()); - cipher.apply_keystream(&mut buf); - - env::commit_slice(&buf); -} diff --git a/chacha20-demo/methods/src/lib.rs b/chacha20-demo/methods/src/lib.rs deleted file mode 100644 index 1bdb308..0000000 --- a/chacha20-demo/methods/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -include!(concat!(env!("OUT_DIR"), "/methods.rs")); diff --git a/chacha20-demo/rust-toolchain.toml b/chacha20-demo/rust-toolchain.toml deleted file mode 100644 index 36614c3..0000000 --- a/chacha20-demo/rust-toolchain.toml +++ /dev/null @@ -1,4 +0,0 @@ -[toolchain] -channel = "stable" -components = ["rustfmt", "rust-src"] -profile = "minimal" diff --git a/chacha20-demo/src/lib.rs b/chacha20-demo/src/lib.rs deleted file mode 100644 index d2461e1..0000000 --- a/chacha20-demo/src/lib.rs +++ /dev/null @@ -1,37 +0,0 @@ -#[cfg(not(rust_analyzer))] -mod generated { - include!(concat!(env!("OUT_DIR"), "/methods.rs")); -} -#[cfg(not(rust_analyzer))] -pub use generated::{GUEST_ELF, GUEST_ID}; - - -#[cfg(rust_analyzer)] -pub const GUEST_ELF: &[u8] = &[]; -#[cfg(rust_analyzer)] -pub const GUEST_ID: [u32; 8] = [0; 8]; - -use anyhow::Result; -use risc0_zkvm::{default_prover, ExecutorEnv, Receipt}; - - -pub fn prove_encrypt( - key: [u8; 32], - nonce: [u8; 12], - plaintext: &[u8], -) -> Result<(Receipt, Vec)> { - let env = ExecutorEnv::builder() - .write(&key)? - .write(&nonce)? - .write(&plaintext.to_vec())? - .build()?; - - let prover = default_prover(); - let prove_info = prover.prove(env, GUEST_ELF)?; - let receipt = prove_info.receipt; - receipt.verify(GUEST_ID)?; - - let ciphertext: Vec = receipt.journal.bytes.clone(); // if this errors, use .to_vec() - - Ok((receipt, ciphertext)) -} diff --git a/chacha20-demo/src/main.rs b/chacha20-demo/src/main.rs deleted file mode 100644 index 61db16b..0000000 --- a/chacha20-demo/src/main.rs +++ /dev/null @@ -1,44 +0,0 @@ -#[cfg(not(rust_analyzer))] -include!(concat!(env!("OUT_DIR"), "/methods.rs")); - -#[cfg(rust_analyzer)] -mod methods { - pub const GUEST_ELF: &[u8] = &[]; - pub const GUEST_ID: [u32; 8] = [0; 8]; -} -#[cfg(rust_analyzer)] -use methods::*; - - -use anyhow::Result; -use hex::encode; -use risc0_zkvm::{default_prover, ExecutorEnv}; - -fn main() -> Result<()> { - // Example inputs - let key = [0x42u8; 32]; - let nonce = [0x24u8; 12]; - let plaintext = b"Hello, RISC Zero ChaCha20 demo!"; - - let env = ExecutorEnv::builder() - .write(&key)? - .write(&nonce)? - .write(&plaintext.to_vec())? - .build()?; - - - let prover = default_prover(); - let prove_info = prover.prove(env, GUEST_ELF)?; - let receipt = prove_info.receipt; - - // (Optionally) verify the proof - receipt.verify(GUEST_ID)?; - - // Extract and print the ciphertext - let ct: &[u8] = &receipt.journal.bytes; - println!("Ciphertext: {}", encode(ct)); - - Ok(()) -} - - diff --git a/chacha20-demo/tests/bad_guest.rs b/chacha20-demo/tests/bad_guest.rs deleted file mode 100644 index 264c226..0000000 --- a/chacha20-demo/tests/bad_guest.rs +++ /dev/null @@ -1,30 +0,0 @@ -#[cfg(not(rust_analyzer))] -include!(concat!(env!("OUT_DIR"), "/methods.rs")); - -#[cfg(rust_analyzer)] -mod methods { - pub const GUEST_ELF: &[u8] = &[]; - pub const GUEST_ID: [u32; 8] = [0; 8]; -} -#[cfg(rust_analyzer)] -use methods::*; - -use risc0_zkvm::{default_prover, ExecutorEnv}; - -#[test] -fn guest_panics_on_bad_key() { - // This key triggers the panic in the guest - let key = [0xFFu8; 32]; - let nonce = [0u8; 12]; - let plaintext = b"panic please".to_vec(); - - let env = ExecutorEnv::builder() - .write(&key).unwrap() - .write(&nonce).unwrap() - .write(&plaintext).unwrap() - .build().unwrap(); - - // Proving should fail when the guest panics - let res = default_prover().prove(env, GUEST_ELF); - assert!(res.is_err(), "proving should fail when guest panics"); -} diff --git a/chacha20-demo/tests/proof_works.rs b/chacha20-demo/tests/proof_works.rs deleted file mode 100644 index 74722c6..0000000 --- a/chacha20-demo/tests/proof_works.rs +++ /dev/null @@ -1,49 +0,0 @@ -#[cfg(not(rust_analyzer))] -include!{concat!(env!("OUT_DIR"), "/methods.rs")} - -#[cfg(rust_analyzer)] -mod methods { - pub const GUEST_ELF: &[u8] = &[]; - pub const GUEST_ID: [u32; 8] = [0; 8]; -} -#[cfg(rust_analyzer)] -use methods::*; - -use risc0_zkvm::{default_prover, ExecutorEnv}; - -// Host-side ChaCha20 -use chacha20::{ChaCha20, Key, Nonce}; -use cipher::{KeyIvInit, StreamCipher}; - -#[test] -fn proof_works_and_matches_host_chacha() { - // Inputs (must match what your guest expects) - let key = [0x42u8; 32]; - let nonce = [0x24u8; 12]; - let plaintext = b"Hello, RISC Zero ChaCha20 demo!"; - - // Prove with the R0 guest - let env = ExecutorEnv::builder() - .write(&key).unwrap() - .write(&nonce).unwrap() - .write(&plaintext.to_vec()).unwrap() - .build().unwrap(); - - let prove_info = default_prover().prove(env, GUEST_ELF).expect("prove failed"); - prove_info.receipt.verify(GUEST_ID).expect("verify failed"); - - - // Ciphertext produced by the guest - let guest_ct = prove_info.receipt.journal.bytes.clone(); - - // Host-side reference: ChaCha20 with the same key/nonce - let mut host_ct = plaintext.to_vec(); - let key = Key::from_slice(&key); - let nonce = Nonce::from_slice(&nonce); - let mut cipher = ChaCha20::new(key, nonce); - cipher.apply_keystream(&mut host_ct); - - // Compare - assert_eq!(guest_ct, host_ct, "guest ciphertext != host ChaCha20 ciphertext"); - -} diff --git a/chacha20-demo/tests/wrong_image_id.rs b/chacha20-demo/tests/wrong_image_id.rs deleted file mode 100644 index 8097c62..0000000 --- a/chacha20-demo/tests/wrong_image_id.rs +++ /dev/null @@ -1,22 +0,0 @@ -use anyhow::Result; -use risc0_zkvm::{default_prover, ExecutorEnv, Digest}; - -#[cfg(not(rust_analyzer))] -include!(concat!(env!("OUT_DIR"), "/methods.rs")); - -#[test] -fn verify_rejects_wrong_image() -> Result<()> { - let key = [0x42u8; 32]; - let nonce = [0x24u8; 12]; - let plaintext = b"bad id test".to_vec(); - - let env = ExecutorEnv::builder() - .write(&key)?.write(&nonce)?.write(&plaintext)?.build()?; - - let info = default_prover().prove(env, GUEST_ELF)?; - - // Intentionally bogus image id - let bogus = Digest::from([0u32; 8]); - assert!(info.receipt.verify(bogus).is_err(), "verification should fail"); - Ok(()) -}