Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
esdrubal committed Jul 18, 2024
1 parent 6bcfcf3 commit fc850f0
Show file tree
Hide file tree
Showing 4 changed files with 754 additions and 608 deletions.
8 changes: 3 additions & 5 deletions forc-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,13 +1830,12 @@ pub fn compile(
metrics
);

const OLD_ENCODING_VERSION: &str = "0";
const NEW_ENCODING_VERSION: &str = "1";
const SPEC_VERSION: &str = "1";
const ABI_VERSION: &str = "1";

let mut program_abi = match pkg.target {
BuildTarget::Fuel => {
let mut types = vec![];
let program_abi_res = time_expr!(
"generate JSON ABI program",
"generate_json_abi",
Expand All @@ -1848,13 +1847,12 @@ pub fn compile(
type_ids_to_full_type_str: HashMap::<String, String>::new(),
},
engines,
&mut types,
profile
.experimental
.new_encoding
.then(|| NEW_ENCODING_VERSION.into()),
.then(|| NEW_ENCODING_VERSION.into())
.unwrap_or(OLD_ENCODING_VERSION.into()),
SPEC_VERSION.into(),
ABI_VERSION.into()
),
Some(sway_build_config.clone()),
metrics
Expand Down
6 changes: 4 additions & 2 deletions forc-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,15 +672,17 @@ pub fn decode_log_data(
program_abi: &ProgramABI,
) -> anyhow::Result<DecodedLog> {
let program_abi = match program_abi {
ProgramABI::Fuel(fuel_abi) => Some(fuel_abi),
ProgramABI::Fuel(fuel_abi) => Some(
fuel_abi_types::abi::unified_program::UnifiedProgramABI::from_counterpart(fuel_abi)?,
),
_ => None,
}
.ok_or_else(|| anyhow::anyhow!("only fuelvm is supported for log decoding"))?;
// Create type lookup (id, TypeDeclaration)
let type_lookup = program_abi
.types
.iter()
.map(|decl| (decl.type_id.clone(), decl.clone()))
.map(|decl| (decl.type_id, decl.clone()))
.collect::<HashMap<_, _>>();

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

0 comments on commit fc850f0

Please sign in to comment.