Просмотр исходного кода

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

parazyd 4 лет назад
Родитель
Сommit
c486f3ce44
3 измененных файлов с 6 добавлено и 2 удалено
  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:
 
 ```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:
 
 ```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<()> {
     TermLogger::init(Debug, Config::default(), Mixed, Auto)?;
 
+    /* ANCHOR: main */
     let bincode = include_bytes!("burn.zk.bin");
     let zkbin = ZkBinary::decode(bincode)?;
 
@@ -141,6 +142,7 @@ fn main() -> Result<()> {
     // Build the verifying key and verify the zero-knowledge proof
     let verifying_key = VerifyingKey::build(11, &circuit);
     proof.verify(&verifying_key, &public_inputs)?;
+    /* ANCHOR_END: main */
 
     Ok(())
 }

+ 2 - 0
proof/mint.rs

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