Răsfoiți Sursa

book/zkas/sapling: Include only main Rust code parts.

parazyd 4 ani în urmă
părinte
comite
c486f3ce44
3 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 2 2
      book/src/zkas/examples/sapling.md
  2. 2 0
      proof/burn.rs
  3. 2 0
      proof/mint.rs

+ 2 - 2
book/src/zkas/examples/sapling.md

@@ -87,7 +87,7 @@ Knowing this we can extend our pseudo-code and build the
 before-mentioned public inputs for the circuit:
 before-mentioned public inputs for the circuit:
 
 
 ```rust
 ```rust
-{{#include ../../../../proof/mint.rs}}
+{{#include ../../../../proof/mint.rs:main}}
 ```
 ```
 
 
 
 
@@ -162,7 +162,7 @@ Knowing this we can extend our pseudo-code and build the
 before-mentioned public inputs for the circuit:
 before-mentioned public inputs for the circuit:
 
 
 ```rust
 ```rust
-{{#include ../../../../proof/mint.rs}}
+{{#include ../../../../proof/burn.rs:main}}
 ```
 ```
 
 
 
 

+ 2 - 0
proof/burn.rs

@@ -26,6 +26,7 @@ use simplelog::{ColorChoice::Auto, Config, LevelFilter::Debug, TermLogger, Termi
 fn main() -> Result<()> {
 fn main() -> Result<()> {
     TermLogger::init(Debug, Config::default(), Mixed, Auto)?;
     TermLogger::init(Debug, Config::default(), Mixed, Auto)?;
 
 
+    /* ANCHOR: main */
     let bincode = include_bytes!("burn.zk.bin");
     let bincode = include_bytes!("burn.zk.bin");
     let zkbin = ZkBinary::decode(bincode)?;
     let zkbin = ZkBinary::decode(bincode)?;
 
 
@@ -141,6 +142,7 @@ fn main() -> Result<()> {
     // Build the verifying key and verify the zero-knowledge proof
     // Build the verifying key and verify the zero-knowledge proof
     let verifying_key = VerifyingKey::build(11, &circuit);
     let verifying_key = VerifyingKey::build(11, &circuit);
     proof.verify(&verifying_key, &public_inputs)?;
     proof.verify(&verifying_key, &public_inputs)?;
+    /* ANCHOR_END: main */
 
 
     Ok(())
     Ok(())
 }
 }

+ 2 - 0
proof/mint.rs

@@ -24,6 +24,7 @@ use simplelog::{ColorChoice::Auto, Config, LevelFilter::Debug, TermLogger, Termi
 fn main() -> Result<()> {
 fn main() -> Result<()> {
     TermLogger::init(Debug, Config::default(), Mixed, Auto)?;
     TermLogger::init(Debug, Config::default(), Mixed, Auto)?;
 
 
+    /* ANCHOR: main */
     let bincode = include_bytes!("mint.zk.bin");
     let bincode = include_bytes!("mint.zk.bin");
     let zkbin = ZkBinary::decode(bincode)?;
     let zkbin = ZkBinary::decode(bincode)?;
 
 
@@ -94,6 +95,7 @@ fn main() -> Result<()> {
     // Build the verifying key and verify the zero-knowledge proof
     // Build the verifying key and verify the zero-knowledge proof
     let verifying_key = VerifyingKey::build(11, &circuit);
     let verifying_key = VerifyingKey::build(11, &circuit);
     proof.verify(&verifying_key, &public_inputs)?;
     proof.verify(&verifying_key, &public_inputs)?;
+    /* ANCHOR_END: main */
 
 
     Ok(())
     Ok(())
 }
 }