Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: duplicate btc header validation to main repo #769

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 1 addition & 53 deletions Cargo.Bazel.Fuzzing.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "dea2cec52d85c89d8e36fa4f4cc48deb5a55e8e1b39beac1b186a5a6051ae544",
"checksum": "8963555b833c8bace95f40255adbd51f59c9bb89fd204fc5dfb4e6010fb70374",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -18135,10 +18135,6 @@
"id": "ic-btc-test-utils 0.1.0",
"target": "ic_btc_test_utils"
},
{
"id": "ic-btc-validation 0.1.0",
"target": "ic_btc_validation"
},
{
"id": "ic-canister-log 0.2.0",
"target": "ic_canister_log"
Expand Down Expand Up @@ -29100,53 +29096,6 @@
],
"license_file": null
},
"ic-btc-validation 0.1.0": {
"name": "ic-btc-validation",
"version": "0.1.0",
"package_url": "https://github.com/dfinity/bitcoin-canister",
"repository": {
"Http": {
"url": "https://static.crates.io/crates/ic-btc-validation/0.1.0/download",
"sha256": "3e73b5f400b954d3ddb64706bd4392ef0b5829976606c2baa49e692181192761"
}
},
"targets": [
{
"Library": {
"crate_name": "ic_btc_validation",
"crate_root": "src/lib.rs",
"srcs": {
"allow_empty": false,
"include": [
"**/*.rs"
]
}
}
}
],
"library_target_name": "ic_btc_validation",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "bitcoin 0.28.2",
"target": "bitcoin"
}
],
"selects": {}
},
"edition": "2021",
"version": "0.1.0"
},
"license": "Apache-2.0",
"license_ids": [
"Apache-2.0"
],
"license_file": null
},
"ic-canister-log 0.2.0": {
"name": "ic-canister-log",
"version": "0.2.0",
Expand Down Expand Up @@ -79412,7 +79361,6 @@
"ic-bn-lib 0.1.0",
"ic-btc-interface 0.2.2",
"ic-btc-test-utils 0.1.0",
"ic-btc-validation 0.1.0",
"ic-canister-log 0.2.0",
"ic-canister-sig-creation 1.0.1",
"ic-cbor 2.6.0",
Expand Down
10 changes: 0 additions & 10 deletions Cargo.Bazel.Fuzzing.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3130,7 +3130,6 @@ dependencies = [
"ic-bn-lib",
"ic-btc-interface",
"ic-btc-test-utils",
"ic-btc-validation",
"ic-canister-log",
"ic-canister-sig-creation",
"ic-cbor",
Expand Down Expand Up @@ -5079,15 +5078,6 @@ dependencies = [
"bitcoin 0.28.2",
]

[[package]]
name = "ic-btc-validation"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e73b5f400b954d3ddb64706bd4392ef0b5829976606c2baa49e692181192761"
dependencies = [
"bitcoin 0.28.2",
]

[[package]]
name = "ic-canister-log"
version = "0.2.0"
Expand Down
54 changes: 1 addition & 53 deletions Cargo.Bazel.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "a69a05f2fa984dfb6fa61da720975e6d56cf11c8dd25267980c629fe1bfbab56",
"checksum": "daf0e8cb10ab41e02f0d0acb858bed60cb932038a2d488d7cb85bca8912dd4ad",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -17936,10 +17936,6 @@
"id": "ic-btc-test-utils 0.1.0",
"target": "ic_btc_test_utils"
},
{
"id": "ic-btc-validation 0.1.0",
"target": "ic_btc_validation"
},
{
"id": "ic-canister-log 0.2.0",
"target": "ic_canister_log"
Expand Down Expand Up @@ -28925,53 +28921,6 @@
],
"license_file": null
},
"ic-btc-validation 0.1.0": {
"name": "ic-btc-validation",
"version": "0.1.0",
"package_url": "https://github.com/dfinity/bitcoin-canister",
"repository": {
"Http": {
"url": "https://static.crates.io/crates/ic-btc-validation/0.1.0/download",
"sha256": "3e73b5f400b954d3ddb64706bd4392ef0b5829976606c2baa49e692181192761"
}
},
"targets": [
{
"Library": {
"crate_name": "ic_btc_validation",
"crate_root": "src/lib.rs",
"srcs": {
"allow_empty": false,
"include": [
"**/*.rs"
]
}
}
}
],
"library_target_name": "ic_btc_validation",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "bitcoin 0.28.2",
"target": "bitcoin"
}
],
"selects": {}
},
"edition": "2021",
"version": "0.1.0"
},
"license": "Apache-2.0",
"license_ids": [
"Apache-2.0"
],
"license_file": null
},
"ic-canister-log 0.2.0": {
"name": "ic-canister-log",
"version": "0.2.0",
Expand Down Expand Up @@ -79588,7 +79537,6 @@
"ic-bn-lib 0.1.0",
"ic-btc-interface 0.2.2",
"ic-btc-test-utils 0.1.0",
"ic-btc-validation 0.1.0",
"ic-canister-log 0.2.0",
"ic-canister-sig-creation 1.0.1",
"ic-cbor 2.6.0",
Expand Down
10 changes: 0 additions & 10 deletions Cargo.Bazel.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,6 @@ dependencies = [
"ic-bn-lib",
"ic-btc-interface",
"ic-btc-test-utils",
"ic-btc-validation",
"ic-canister-log",
"ic-canister-sig-creation",
"ic-cbor",
Expand Down Expand Up @@ -5069,15 +5068,6 @@ dependencies = [
"bitcoin 0.28.2",
]

[[package]]
name = "ic-btc-validation"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e73b5f400b954d3ddb64706bd4392ef0b5829976606c2baa49e692181192761"
dependencies = [
"bitcoin 0.28.2",
]

[[package]]
name = "ic-canister-log"
version = "0.2.0"
Expand Down
3 changes: 1 addition & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ members = [
"rs/bitcoin/kyt",
"rs/bitcoin/mock",
"rs/bitcoin/replica_types",
"rs/bitcoin/validation",
"rs/boundary_node/canary_proxy",
"rs/boundary_node/certificate_issuance/certificate_issuer",
"rs/boundary_node/certificate_issuance/certificate_orchestrator",
Expand Down Expand Up @@ -471,6 +472,7 @@ axum = "0.7.5"
backoff = "0.4"
base64 = { version = "0.13.1" }
bincode = "1.3.3"
bitcoin = { version = "0.28.2", features = ["default", "use-serde", "rand"] }
# build-info and build-info-build MUST be kept in sync!
build-info = { git = "https://github.com/dfinity-lab/build-info", rev = "701a696844fba5c87df162fbbc1ccef96f27c9d7" }
build-info-build = { git = "https://github.com/dfinity-lab/build-info", rev = "701a696844fba5c87df162fbbc1ccef96f27c9d7", default-features = false }
Expand Down
5 changes: 1 addition & 4 deletions bazel/external_crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
default_features = False,
),
"bitcoin": crate.spec(
version = "^0.28.1",
version = "^0.28.2",
features = [
"default",
"rand",
Expand Down Expand Up @@ -568,9 +568,6 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
"ic-btc-interface": crate.spec(
version = "^0.2.2",
),
"ic-btc-validation": crate.spec(
version = "^0.1.0",
),
"ic-btc-test-utils": crate.spec(
version = "^0.1.0",
),
Expand Down
3 changes: 1 addition & 2 deletions rs/bitcoin/adapter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DEPENDENCIES = [
# Keep sorted.
"//rs/async_utils",
"//rs/bitcoin/service",
"//rs/bitcoin/validation",
"//rs/config",
"//rs/monitoring/logger",
"//rs/monitoring/metrics",
Expand All @@ -16,8 +17,6 @@ DEPENDENCIES = [
"@crate_index//:hashlink",
"@crate_index//:hex",
"@crate_index//:http",
"@crate_index//:hyper-util",
"@crate_index//:ic-btc-validation",
"@crate_index//:parking_lot",
"@crate_index//:prometheus",
"@crate_index//:prost",
Expand Down
4 changes: 2 additions & 2 deletions rs/bitcoin/adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description.workspace = true
documentation.workspace = true

[dependencies]
bitcoin = { version = "0.28.1", features = ["default", "use-serde", "rand"] }
bitcoin = { workspace = true }
clap = { version = "3.2.25", features = ["derive"] }
futures = { workspace = true }
hashlink = "0.8.0"
Expand All @@ -17,7 +17,7 @@ hyper-util = { workspace = true }
ic-adapter-metrics-server = { path = "../../monitoring/adapter_metrics/server" }
ic-async-utils = { path = "../../async_utils" }
ic-btc-service = { path = "../service" }
ic-btc-validation = { workspace = true }
ic-btc-validation = { path = "../validation" }
ic-config = { path = "../../config" }
ic-logger = { path = "../../monitoring/logger" }
ic-metrics = { path = "../../monitoring/metrics" }
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/adapter/test_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description.workspace = true
documentation.workspace = true

[dependencies]
bitcoin = { version = "0.28.1", features = ["default", "use-serde", "rand"] }
bitcoin = { workspace = true }
flate2 = { workspace = true }
hex = { workspace = true }
rand = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/ckbtc/minter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ serde_json = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
bitcoin = "0.28.1"
bitcoin = { workspace = true }
candid_parser = { workspace = true }
canister-test = { path = "../../../rust_canisters/canister_test" }
ic-bitcoin-canister-mock = { path = "../../mock" }
Expand Down
2 changes: 1 addition & 1 deletion rs/bitcoin/mock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ serde = { workspace = true }
serde_bytes = { workspace = true }

[dev-dependencies]
bitcoin = "0.28.1"
bitcoin = { workspace = true }
candid_parser = { workspace = true }
hex = { workspace = true }
ic-base-types = { path = "../../types/base_types" }
Expand Down
53 changes: 53 additions & 0 deletions rs/bitcoin/validation/BUILD.bazel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add context about where this crate comes from?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use it because the ic-btc-validation uses types from the old bitcoin crate as part of it's interface.

It is temporary duplication. I need to merge this one and then I will dedup the bitcoin external crate dependency.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")

package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
# Keep sorted.
"@crate_index//:bitcoin",
]

MACRO_DEPENDENCIES = []

DEV_DEPENDENCIES = [
# Keep sorted.
"@crate_index//:csv",
"@crate_index//:hex",
"@crate_index//:proptest",
]

MACRO_DEV_DEPENDENCIES = []

ALIASES = {}

rust_library(
name = "validation",
srcs = glob(["src/**"]),
aliases = ALIASES,
crate_name = "ic_btc_validation",
proc_macro_deps = MACRO_DEPENDENCIES,
version = "0.1.0",
deps = DEPENDENCIES,
)

rust_test(
name = "validation_test",
crate = ":validation",
data = [
# Keep sorted.
"tests/data/headers.csv",
],
deps = DEPENDENCIES + DEV_DEPENDENCIES,
)

rust_test_suite(
name = "validation_integration",
srcs = glob(["tests/**/*.rs"]),
aliases = ALIASES,
data = [
# Keep sorted.
"tests/data/headers.csv",
],
proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES,
deps = [":validation"] + DEPENDENCIES + DEV_DEPENDENCIES,
)
12 changes: 12 additions & 0 deletions rs/bitcoin/validation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "ic-btc-validation"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bitcoin = { workspace = true }

[dev-dependencies]
csv = "1.1"
Loading
Loading