Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed Oct 29, 2023
1 parent 7165b2e commit 7797bf8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
11 changes: 4 additions & 7 deletions acvm-repo/acir/src/circuit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ use thiserror::Error;

use std::{io::prelude::*, num::ParseIntError, str::FromStr};

use flate2::Compression;
use base64::Engine;
use serde::{
Deserialize, Deserializer, Serialize, Serializer,
de::Error as DeserializationError
};
use flate2::Compression;
use serde::{de::Error as DeserializationError, Deserialize, Deserializer, Serialize, Serializer};

use std::collections::BTreeSet;

Expand Down Expand Up @@ -158,13 +155,13 @@ impl Circuit {
// Serialize and base64 encode circuit
pub fn serialize_circuit_base64<S>(circuit: &Circuit, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
S: Serializer,
{
let circuit_bytes = Circuit::serialize_circuit(circuit);
let encoded_b64 = base64::engine::general_purpose::STANDARD.encode(circuit_bytes);
s.serialize_str(&encoded_b64)
}

// Deserialize and base64 decode circuit
pub fn deserialize_circuit_base64<'de, D>(deserializer: D) -> Result<Circuit, D::Error>
where
Expand Down
5 changes: 4 additions & 1 deletion compiler/noirc_driver/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ pub struct ContractFunction {

pub abi: Abi,

#[serde(serialize_with = "Circuit::serialize_circuit_base64", deserialize_with = "Circuit::deserialize_circuit_base64")]
#[serde(
serialize_with = "Circuit::serialize_circuit_base64",
deserialize_with = "Circuit::deserialize_circuit_base64"
)]
pub bytecode: Circuit,

pub debug: DebugInfo,
Expand Down
7 changes: 5 additions & 2 deletions compiler/noirc_driver/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ pub struct CompiledProgram {
/// Used to short-circuit compilation in the case of the source code not changing since the last compilation.
pub hash: u64,

#[serde(serialize_with = "Circuit::serialize_circuit_base64", deserialize_with = "Circuit::deserialize_circuit_base64")]
#[serde(
serialize_with = "Circuit::serialize_circuit_base64",
deserialize_with = "Circuit::deserialize_circuit_base64"
)]
pub circuit: Circuit,
pub abi: noirc_abi::Abi,
pub debug: DebugInfo,
pub file_map: BTreeMap<FileId, DebugFile>,
pub warnings: Vec<SsaReport>,
}
}

0 comments on commit 7797bf8

Please sign in to comment.