Skip to content

Commit

Permalink
fix(sozo): handle edge case when base_class_hash is FieldElement::ZERO (
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-0x authored May 19, 2024
1 parent c9714ef commit 7943970
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion crates/dojo-world/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ impl DeploymentManifest {
self.contracts.iter_mut().for_each(|contract| {
let previous_contract = previous.contracts.iter().find(|c| c.name == contract.name);
if let Some(previous_contract) = previous_contract {
contract.inner.base_class_hash = previous_contract.inner.base_class_hash;
if previous_contract.inner.base_class_hash != FieldElement::ZERO {
contract.inner.base_class_hash = previous_contract.inner.base_class_hash;
}
}
});
}
Expand Down
12 changes: 9 additions & 3 deletions crates/sozo/ops/src/migration/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,15 @@ pub async fn update_manifests_and_abis(
}

local_manifest.contracts.iter_mut().for_each(|contract| {
let salt = generate_salt(&contract.name);
contract.inner.address =
Some(get_contract_address(salt, contract.inner.base_class_hash, &[], world_address));
if contract.inner.base_class_hash != FieldElement::ZERO {
let salt = generate_salt(&contract.name);
contract.inner.address = Some(get_contract_address(
salt,
contract.inner.base_class_hash,
&[],
world_address,
));
}
});

// copy abi files from `abi/base` to `abi/deployments/{chain_id}` and update abi path in
Expand Down
Empty file modified scripts/rebuild_test_artifacts.sh
100644 → 100755
Empty file.

0 comments on commit 7943970

Please sign in to comment.