Skip to content

Commit

Permalink
fix(abi): ensure that return value is loaded from toml (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Feb 21, 2023
1 parent 48cda7a commit adba24c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/noirc_abi/src/input_parser/toml.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::InputValue;
use crate::{errors::InputParserError, Abi, AbiType};
use crate::{errors::InputParserError, Abi, AbiType, MAIN_RETURN_NAME};
use acvm::FieldElement;
use iter_extended::{btree_map, try_btree_map, try_vecmap, vecmap};
use serde::{Deserialize, Serialize};
Expand All @@ -16,7 +16,10 @@ pub(crate) fn parse_toml(
// When parsing the toml map we recursively go through each field to enable struct inputs.
// To match this map with the correct abi type we reorganize our abi by parameter name in a BTreeMap, while the struct fields
// in the abi are already stored in a BTreeMap.
let abi_map = abi.to_btree_map();
let mut abi_map = abi.to_btree_map();
if let Some(return_type) = &abi.return_type {
abi_map.insert(MAIN_RETURN_NAME.to_owned(), return_type.to_owned());
}

// Convert arguments to field elements.
try_btree_map(data, |(key, value)| {
Expand Down

0 comments on commit adba24c

Please sign in to comment.