Skip to content

Commit

Permalink
Changed fuel_abi to return Result.
Browse files Browse the repository at this point in the history
Added error ABIHashCollision error.
  • Loading branch information
esdrubal committed Jul 12, 2024
1 parent bb250fc commit 37d49ad
Show file tree
Hide file tree
Showing 4 changed files with 546 additions and 344 deletions.
11 changes: 9 additions & 2 deletions forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1837,13 +1837,15 @@ pub fn compile(
let mut program_abi = match pkg.target {
BuildTarget::Fuel => {
let mut types = vec![];
ProgramABI::Fuel(time_expr!(
let program_abi_res = time_expr!(
"generate JSON ABI program",
"generate_json_abi",
fuel_abi::generate_program_abi(
&handler,
&mut AbiContext {
program: typed_program,
abi_with_callpaths: profile.json_abi_with_callpaths,
type_ids_to_full_type_str: HashMap::<String, String>::new(),
},
engines,
&mut types,
Expand All @@ -1856,7 +1858,12 @@ pub fn compile(
),
Some(sway_build_config.clone()),
metrics
))
);
let program_abi = match program_abi_res {
Err(_) => return fail(handler),
Ok(program_abi) => program_abi,
};
ProgramABI::Fuel(program_abi)
}
BuildTarget::EVM => {
// Merge the ABI output of ASM gen with ABI gen to handle internal constructors
Expand Down
2 changes: 1 addition & 1 deletion forc-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ pub fn decode_log_data(
let type_lookup = program_abi
.types
.iter()
.map(|decl| (decl.type_id, decl.clone()))
.map(|decl| (decl.type_id.clone(), decl.clone()))
.collect::<HashMap<_, _>>();

let logged_type_lookup: HashMap<_, _> = program_abi
Expand Down
Loading

0 comments on commit 37d49ad

Please sign in to comment.