Skip to content

Commit

Permalink
tiny cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
imikushin committed Jan 4, 2025
1 parent cdbf75b commit 174eb17
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/spell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ impl Spell {
pub fn denormalized(norm_spell: &NormalizedSpell) -> Self {
let apps = (0..)
.zip(norm_spell.app_public_inputs.keys())
.map(|(i, app)| (format!("${:04}", i), app.clone()))
.map(|(i, app)| (str_index(&i), app.clone()))
.collect();

let public_inputs = match (0..)
.zip(norm_spell.app_public_inputs.values())
.filter_map(|(i, data)| match data {
data if data.as_ref().is_empty() => None,
data => Some((
format!("${:04}", i),
str_index(&i),
data.try_into()
.ok()
.unwrap_or_else(|| Value::Bytes(data.as_ref().to_vec())),
Expand Down Expand Up @@ -234,7 +234,7 @@ impl Spell {
.iter()
.map(|(i, data)| {
(
format!("${:04}", i),
str_index(i),
data.try_into()
.ok()
.unwrap_or_else(|| Value::Bytes(data.as_ref().to_vec())),
Expand All @@ -260,6 +260,10 @@ impl Spell {
}
}

fn str_index(i: &usize) -> String {
format!("${:04}", i)
}

pub fn prove(
norm_spell: NormalizedSpell,
app_binaries: &BTreeMap<VkHash, Vec<u8>>,
Expand Down

0 comments on commit 174eb17

Please sign in to comment.