Skip to content

Commit

Permalink
do not use normalization for output paths
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 committed Jan 19, 2025
1 parent 676d2f1 commit f617a35
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions compiler_tester/src/vm/eravm/system_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,20 +366,16 @@ impl SystemContracts {
debug_config,
)?);

dbg!(
&builds.keys(),
Self::normalize_path_fs(Self::PATH_DEFAULT_AA.0, Some(Self::PATH_DEFAULT_AA.1))
);
let default_aa = builds
.remove(
Self::normalize_path_fs(Self::PATH_DEFAULT_AA.0, Some(Self::PATH_DEFAULT_AA.1))
Self::normalize_path_solc(Self::PATH_DEFAULT_AA.0, Some(Self::PATH_DEFAULT_AA.1))
.as_str(),
)
.ok_or_else(|| {
anyhow::anyhow!("The default AA code not found in the compiler build artifacts")
})?;
let evm_emulator = builds
.remove(Self::normalize_path_fs(Self::PATH_EVM_EMULATOR, None).as_str())
.remove(Self::normalize_path_solc(Self::PATH_EVM_EMULATOR, None).as_str())
.ok_or_else(|| {
anyhow::anyhow!("The EVM emulator code not found in the compiler build artifacts")
})?;
Expand All @@ -392,7 +388,7 @@ impl SystemContracts {
let mut deployed_contracts = Vec::with_capacity(system_contracts.len());
for (address, path) in system_contracts.into_iter() {
let build = builds
.remove(path.as_str())
.remove(Self::normalize_path_solc(path.as_str(), None).as_str())
.unwrap_or_else(|| panic!("System contract `{path}` not found in the builds"));
deployed_contracts.push((address, build));
}
Expand Down Expand Up @@ -451,8 +447,18 @@ impl SystemContracts {
/// Normalizes paths with respect to the file system.
///
fn normalize_path_fs(path: &str, name: Option<&str>) -> String {
Self::normalize_path_solc(
path.replace("/", std::path::MAIN_SEPARATOR_STR).as_str(),
name,
)
}

///
/// Normalizes paths with respect to `solc`.
///
fn normalize_path_solc(path: &str, name: Option<&str>) -> String {
let contract_name = era_compiler_common::ContractName::new(
path.replace("/", std::path::MAIN_SEPARATOR_STR),
path.to_owned(),
name.map(|name| name.to_string()),
);
contract_name.full_path
Expand Down

0 comments on commit f617a35

Please sign in to comment.