Skip to content

Commit

Permalink
chore: use ic-sha3 (dfinity#1718)
Browse files Browse the repository at this point in the history
Follow-up on dfinity#1674 to use the newly published `ic-sha3` in the following
crates:

1. `ic-cketh-minter`
2. `ic-ethereum-types`

A next PR will move `ic-ethereum-types` to `//rs/packages` to publish
it.

---------

Co-authored-by: IDX GitHub Automation <[email protected]>
  • Loading branch information
gregorydemay and IDX GitHub Automation authored Sep 27, 2024
1 parent a9ebaa9 commit d70fb27
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 9 deletions.
54 changes: 53 additions & 1 deletion Cargo.Bazel.Fuzzing.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "f5026c7a40e78a70b51f4b198bb812011d948439fd6b9031696128a040190590",
"checksum": "64a99e4424a408719d51d9818970210b88e20ebee350a3bc480f02a9d2b05f1f",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -18192,6 +18192,10 @@
"id": "ic-response-verification 2.6.0",
"target": "ic_response_verification"
},
{
"id": "ic-sha3 1.0.0",
"target": "ic_sha3"
},
{
"id": "ic-stable-structures 0.6.5",
"target": "ic_stable_structures"
Expand Down Expand Up @@ -30445,6 +30449,53 @@
],
"license_file": null
},
"ic-sha3 1.0.0": {
"name": "ic-sha3",
"version": "1.0.0",
"package_url": "https://github.com/dfinity/ic",
"repository": {
"Http": {
"url": "https://static.crates.io/crates/ic-sha3/1.0.0/download",
"sha256": "3715f0f4370e8ce6aa9805b81e915ef4420c9dfb5209c71489c27e6f98bd5d65"
}
},
"targets": [
{
"Library": {
"crate_name": "ic_sha3",
"crate_root": "src/lib.rs",
"srcs": {
"allow_empty": false,
"include": [
"**/*.rs"
]
}
}
}
],
"library_target_name": "ic_sha3",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "sha3 0.10.8",
"target": "sha3"
}
],
"selects": {}
},
"edition": "2021",
"version": "1.0.0"
},
"license": "Apache-2.0",
"license_ids": [
"Apache-2.0"
],
"license_file": "LICENSE"
},
"ic-stable-structures 0.6.5": {
"name": "ic-stable-structures",
"version": "0.6.5",
Expand Down Expand Up @@ -78951,6 +79002,7 @@
"ic-http-gateway 0.0.0",
"ic-metrics-encoder 1.1.1",
"ic-response-verification 2.6.0",
"ic-sha3 1.0.0",
"ic-stable-structures 0.6.5",
"ic-test-state-machine-client 3.0.1",
"ic-transport-types 0.37.1",
Expand Down
10 changes: 10 additions & 0 deletions Cargo.Bazel.Fuzzing.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3145,6 +3145,7 @@ dependencies = [
"ic-http-gateway",
"ic-metrics-encoder",
"ic-response-verification",
"ic-sha3",
"ic-stable-structures",
"ic-test-state-machine-client",
"ic-transport-types",
Expand Down Expand Up @@ -5352,6 +5353,15 @@ dependencies = [
"urlencoding",
]

[[package]]
name = "ic-sha3"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3715f0f4370e8ce6aa9805b81e915ef4420c9dfb5209c71489c27e6f98bd5d65"
dependencies = [
"sha3",
]

[[package]]
name = "ic-stable-structures"
version = "0.6.5"
Expand Down
54 changes: 53 additions & 1 deletion Cargo.Bazel.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "7065cd712fb971a438cffb1c5d86c455a1ef31197340b958bcba5637e4aa8190",
"checksum": "cc8c30aa7c0d15b9751155d7989587a276180a621b0d1d266b98f273eda2f54b",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -17993,6 +17993,10 @@
"id": "ic-response-verification 2.6.0",
"target": "ic_response_verification"
},
{
"id": "ic-sha3 1.0.0",
"target": "ic_sha3"
},
{
"id": "ic-stable-structures 0.6.5",
"target": "ic_stable_structures"
Expand Down Expand Up @@ -30270,6 +30274,53 @@
],
"license_file": null
},
"ic-sha3 1.0.0": {
"name": "ic-sha3",
"version": "1.0.0",
"package_url": "https://github.com/dfinity/ic",
"repository": {
"Http": {
"url": "https://static.crates.io/crates/ic-sha3/1.0.0/download",
"sha256": "3715f0f4370e8ce6aa9805b81e915ef4420c9dfb5209c71489c27e6f98bd5d65"
}
},
"targets": [
{
"Library": {
"crate_name": "ic_sha3",
"crate_root": "src/lib.rs",
"srcs": {
"allow_empty": false,
"include": [
"**/*.rs"
]
}
}
}
],
"library_target_name": "ic_sha3",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "sha3 0.10.8",
"target": "sha3"
}
],
"selects": {}
},
"edition": "2021",
"version": "1.0.0"
},
"license": "Apache-2.0",
"license_ids": [
"Apache-2.0"
],
"license_file": "LICENSE"
},
"ic-stable-structures 0.6.5": {
"name": "ic-stable-structures",
"version": "0.6.5",
Expand Down Expand Up @@ -79127,6 +79178,7 @@
"ic-http-gateway 0.0.0",
"ic-metrics-encoder 1.1.1",
"ic-response-verification 2.6.0",
"ic-sha3 1.0.0",
"ic-stable-structures 0.6.5",
"ic-test-state-machine-client 3.0.1",
"ic-transport-types 0.37.1",
Expand Down
10 changes: 10 additions & 0 deletions Cargo.Bazel.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,7 @@ dependencies = [
"ic-http-gateway",
"ic-metrics-encoder",
"ic-response-verification",
"ic-sha3",
"ic-stable-structures",
"ic-test-state-machine-client",
"ic-transport-types",
Expand Down Expand Up @@ -5342,6 +5343,15 @@ dependencies = [
"urlencoding",
]

[[package]]
name = "ic-sha3"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3715f0f4370e8ce6aa9805b81e915ef4420c9dfb5209c71489c27e6f98bd5d65"
dependencies = [
"sha3",
]

[[package]]
name = "ic-stable-structures"
version = "0.6.5"
Expand Down
15 changes: 12 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ ethnum = { version = "1.3.2", features = ["serde"] }
flate2 = "1.0.31"
futures = "0.3.30"
futures-util = "0.3.30"
ic-sha3 = "1.0.0"
hex = { version = "0.4.3", features = ["serde"] }
http = "1.1.0"
http-body = "1.0.1"
Expand Down
3 changes: 3 additions & 0 deletions bazel/external_crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
"group": crate.spec(
version = "^0.13",
),
"ic-sha3": crate.spec(
version = "^1.0.0",
),
"hashlink": crate.spec(
version = "^0.8.0",
),
Expand Down
2 changes: 1 addition & 1 deletion rs/ethereum/cketh/minter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ rust_library(
version = "0.1.0",
deps = [
# Keep sorted.
"//packages/ic-sha3",
"//packages/icrc-ledger-client-cdk:icrc_ledger_client_cdk",
"//packages/icrc-ledger-types:icrc_ledger_types",
"//rs/crypto/secp256k1",
Expand All @@ -59,6 +58,7 @@ rust_library(
"@crate_index//:ic-cdk",
"@crate_index//:ic-cdk-timers",
"@crate_index//:ic-metrics-encoder",
"@crate_index//:ic-sha3",
"@crate_index//:ic-stable-structures",
"@crate_index//:minicbor",
"@crate_index//:num-bigint",
Expand Down
2 changes: 1 addition & 1 deletion rs/ethereum/cketh/minter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ic-crypto-secp256k1 = { path = "../../../crypto/secp256k1" }
ic-ethereum-types = { path = "../../types" }
ic-management-canister-types = { path = "../../../types/management_canister_types" }
ic-metrics-encoder = "1"
ic-sha3 = { path = "../../../../packages/ic-sha3" }
ic-sha3 = { workspace = true }
ic-stable-structures = { workspace = true }
ic-utils-ensure = { path = "../../../utils/ensure" }
icrc-ledger-client-cdk = { path = "../../../../packages/icrc-ledger-client-cdk" }
Expand Down
2 changes: 1 addition & 1 deletion rs/ethereum/types/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
# Keep sorted.
"//packages/ic-sha3",
"@crate_index//:hex",
"@crate_index//:ic-sha3",
"@crate_index//:minicbor",
"@crate_index//:serde",
]
Expand Down
2 changes: 1 addition & 1 deletion rs/ethereum/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ documentation.workspace = true

[dependencies]
hex = { workspace = true }
ic-sha3 = { path = "../../../packages/ic-sha3" }
ic-sha3 = { workspace = true }
minicbor = { workspace = true }
minicbor-derive = { workspace = true }
serde = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions rs/ethereum/types/src/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ impl Address {
pub const fn new(bytes: [u8; 20]) -> Self {
Self(bytes)
}

pub const fn into_bytes(self) -> [u8; 20] {
self.0
}
}

impl LowerHex for Address {
Expand Down

0 comments on commit d70fb27

Please sign in to comment.