Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(abi): ensure that return value is loaded from toml #883

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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