Skip to content

Commit

Permalink
Use unique_id hashing for TypeInfo::Enum and TypeInfo::Struct.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao committed Oct 20, 2024
1 parent 1c3d9e1 commit 4965bb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions forc-plugins/forc-client/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ async fn test_simple_deploy() {
node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"4ea5fa100cd7c8972bc8925ed6f8ccfb6bf1e16f79c3642c3a503c73b7d18de2",
"b92b28df14169410ac7fc71c4ba0bc9f9dabe2332d012fca2bf6807e9148a7e8",
)
.unwrap(),
proxy: None,
Expand Down Expand Up @@ -416,7 +416,7 @@ async fn test_deploy_submit_only() {
node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"4ea5fa100cd7c8972bc8925ed6f8ccfb6bf1e16f79c3642c3a503c73b7d18de2",
"b92b28df14169410ac7fc71c4ba0bc9f9dabe2332d012fca2bf6807e9148a7e8",
)
.unwrap(),
proxy: None,
Expand Down Expand Up @@ -462,12 +462,12 @@ async fn test_deploy_fresh_proxy() {
node.kill().unwrap();
let impl_contract = DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str(
"4ea5fa100cd7c8972bc8925ed6f8ccfb6bf1e16f79c3642c3a503c73b7d18de2",
"b92b28df14169410ac7fc71c4ba0bc9f9dabe2332d012fca2bf6807e9148a7e8",
)
.unwrap(),
proxy: Some(
ContractId::from_str(
"deb633128bceadcd4eb4fe546089f6653727348b60228638a7f9d55d0b6da1ae",
"8626825c37e2b2fcd92def1182f7ff5bb83450cae3bc82b668c70af61595c802",
)
.unwrap(),
),
Expand Down
8 changes: 2 additions & 6 deletions sway-core/src/type_system/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,10 @@ impl HashWithEngines for TypeInfo {
TypeInfo::Tuple(fields) => {
fields.hash(state, engines);
}
TypeInfo::Enum(decl_id) => {
HashWithEngines::hash(&decl_id, state, engines);
}
TypeInfo::Struct(decl_id) => {
HashWithEngines::hash(&decl_id, state, engines);
}
TypeInfo::UntypedEnum(decl_id) => decl_id.unique_id().hash(state),
TypeInfo::UntypedStruct(decl_id) => decl_id.unique_id().hash(state),
TypeInfo::Enum(decl_id) => decl_id.unique_id().hash(state),
TypeInfo::Struct(decl_id) => decl_id.unique_id().hash(state),
TypeInfo::ContractCaller { abi_name, address } => {
abi_name.hash(state);
let address = address
Expand Down

0 comments on commit 4965bb3

Please sign in to comment.