Skip to content

Commit f8dba9d

Browse files
Address fmt lints
1 parent 51f7126 commit f8dba9d

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

wasm/src/programs/execution.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,26 @@ pub fn verify_function_execution(
125125
// Go through the imports and insert the verifying keys for each function.
126126
for imported_program_id in program.imports().keys() {
127127
// Get the list of functions.
128-
let vk_list = Array::try_from(Reflect::get(&import_verifying_keys, &imported_program_id.to_string().into()).map_err(|_| format!("Verifying key not found for imported program {}", imported_program_id))?)
129-
.map_err(|_| format!("Verifying key not found for imported program {}", imported_program_id))?;
128+
let vk_list = Array::try_from(
129+
Reflect::get(&import_verifying_keys, &imported_program_id.to_string().into())
130+
.map_err(|_| format!("Verifying key not found for imported program {}", imported_program_id))?,
131+
)
132+
.map_err(|_| format!("Verifying key not found for imported program {}", imported_program_id))?;
130133
// Get the verifying key for each function.
131134
for i in 0..vk_list.length() {
132135
let vk = Array::try_from(vk_list.get(i)).map_err(|_| format!("Verifying key and function not found for {}, for each function provide an array of the form ['function_name', 'vk']", imported_program_id))?;
133136
{
134137
// Insert the verifying key into the temporary process.
135-
let imported_function= IdentifierNative::from_str(&vk.get(0).as_string().ok_or("Function not found in imports provided")?).map_err(|e| e.to_string())?;
136-
let verifying_key = VerifyingKeyNative::from_str(&vk.get(1).as_string().ok_or("Verifying key not found in imports provided")?).map_err(|e| e.to_string())?;
137-
process.insert_verifying_key(imported_program_id, &imported_function, verifying_key)
138+
let imported_function = IdentifierNative::from_str(
139+
&vk.get(0).as_string().ok_or("Function not found in imports provided")?,
140+
)
141+
.map_err(|e| e.to_string())?;
142+
let verifying_key = VerifyingKeyNative::from_str(
143+
&vk.get(1).as_string().ok_or("Verifying key not found in imports provided")?,
144+
)
145+
.map_err(|e| e.to_string())?;
146+
process
147+
.insert_verifying_key(imported_program_id, &imported_function, verifying_key)
138148
.map_err(|e| e.to_string())?;
139149
}
140150
}
@@ -144,7 +154,8 @@ pub fn verify_function_execution(
144154
// If the program is not credits.aleo, add the program and its verifying key to the process.
145155
if &program.id() != "credits.aleo" {
146156
process.add_program(&program_native).map_err(|e| e.to_string())?;
147-
process.insert_verifying_key(program_native.id(), &function, VerifyingKeyNative::from(verifying_key))
157+
process
158+
.insert_verifying_key(program_native.id(), &function, VerifyingKeyNative::from(verifying_key))
148159
.map_err(|e| e.to_string())?;
149160
}
150161

@@ -200,7 +211,7 @@ mod tests {
200211
Some(imports),
201212
Some(import_vks),
202213
)
203-
.unwrap()
214+
.unwrap()
204215
);
205216
}
206217
}

0 commit comments

Comments
 (0)