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 11 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": "fd9eb489c0f6ca72fa72926e5dae2912f046890fdf3dbe3468c8ee3cf268861f",
"checksum": "d1f3ca2a660ec73decb6d7bedc62826425960e7b0e1dcb235091fc9e3dcfbd3d",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -18140,10 +18140,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 @@ -29088,53 +29084,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 @@ -78929,7 +78878,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 @@ -3131,7 +3131,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 @@ -5076,15 +5075,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": "1a71cd15faad6d063bb365e238d8e57fe6df234d506241b7630655616a119d17",
"checksum": "ef2fa31d71a943c6033c269ec931a1c81e2dad888d2789f228600c88a24e6265",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -17941,10 +17941,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 @@ -28913,53 +28909,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 @@ -79105,7 +79054,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 @@ -3120,7 +3120,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 @@ -5066,15 +5065,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 @@ -22,6 +22,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 @@ -469,6 +470,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 @@ -577,9 +577,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
2 changes: 1 addition & 1 deletion 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/adapter_metrics/server",
"//rs/monitoring/logger",
Expand All @@ -17,7 +18,6 @@ DEPENDENCIES = [
"@crate_index//:hashlink",
"@crate_index//:hex",
"@crate_index//:http",
"@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 @@ -16,7 +16,7 @@ http = { 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