Skip to content

Commit

Permalink
chore: dependency cleanup pre-cargo-vet (#1271)
Browse files Browse the repository at this point in the history
* workspace cargo.toml

* think i got it all

* machete

* use x.x.x for all dep versions

* updated some dependencies

* updated more dependencies

* more updates

* more upgrades

* update tonic + prost

* update libp2p

* update thiserr

* update axum

* remove dead comments

* add cargo vet exemptions

* enable rustls and rt-tokio for aws-config dep

* cargo sort -g -w

* fix blocklist client compose config

* update all cargo commands in Makefile to use --locked

* fix blocklist_client config

* missed a _
  • Loading branch information
cylewitruk authored Jan 28, 2025
1 parent 39b961f commit 1f5f6a6
Show file tree
Hide file tree
Showing 17 changed files with 1,472 additions and 1,772 deletions.
1,844 changes: 772 additions & 1,072 deletions Cargo.lock

Large diffs are not rendered by default.

178 changes: 96 additions & 82 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,104 @@
[workspace]
resolver = "2"
members = [
"signer",
"emily/handler",
"emily/openapi-gen",
"blocklist-client",
"blocklist-openapi-gen",
"sbtc",
".generated-sources/emily/client/rust/public",
".generated-sources/emily/client/rust/private",
".generated-sources/emily/client/rust/testing",
".generated-sources/blocklist-api"
".generated-sources/blocklist-api",
".generated-sources/emily/client/rust/private",
".generated-sources/emily/client/rust/public",
".generated-sources/emily/client/rust/testing",
"blocklist-client",
"blocklist-openapi-gen",
"emily/handler",
"emily/openapi-gen",
"sbtc",
"signer",
]

[workspace.dependencies]
# Local Dependencies
sbtc = { path = "./sbtc" }
emily-handler = { path = "./emily/handler" }
emily-client = { path = "./.generated-sources/emily/client/rust/public" }
testing-emily-client = { path = "./.generated-sources/emily/client/rust/testing" }
blocklist-api = { path = "./.generated-sources/blocklist-api" }
blocklist-client = { path = "./blocklist-client" }

# Stacks-Core Dependencies
clarity = { git = "https://github.com/stacks-network/stacks-core", rev = "49777d3fd73a6dbb610be80c376b7d9389c9871a", default-features = false, features = ["canonical"] }
stackslib = { git = "https://github.com/stacks-network/stacks-core", rev = "49777d3fd73a6dbb610be80c376b7d9389c9871a", default-features = false }
stacks-common = { git = "https://github.com/stacks-network/stacks-core", rev = "49777d3fd73a6dbb610be80c376b7d9389c9871a", default-features = false, features = ["canonical"] }

# Trust Machines Dependencies
wsts = { git = "https://github.com/Trust-Machines/wsts.git", rev = "53ae23f5f35def420877ccc8c0fe3662e64e38a1" }

# Crates.io
aquamarine = { version = "0.6.0", default-features = false }
aws-config = { version = "1.5.15", default-features = false, features = ["rustls", "rt-tokio"] }
aws_lambda_events = { version = "0.16.0", default-features = false }
aws-sdk-dynamodb = { version = "1.62.0", default-features = false }
backoff = { version = "0.4.0", default-features = false, features = ["tokio"] }
base64 = { version = "0.22.1", default-features = false, features = ["alloc"] }
bincode = { version = "1.3.3", default-features = false }
bitcoin = { version = "0.32.5", default-features = false, features = ["serde", "rand-std"] }
bitcoincore-rpc = { version = "0.19.0", default-features = false }
bitcoincore-rpc-json = { version = "0.19.0", default-features = false }
bitcoincore-zmq = { version = "1.5.2", default-features = false, features = ["async"] }
bitvec = { version = "1.0.1", default-features = false, features = ["serde"] }
clap = { version = "4.5.27", default-features = false, features = ["derive", "env", "std"] }
config = { version = "0.14.1", default-features = false, features = ["toml"] }
futures = { version = "0.3.31", default-features = false }
hashbrown = { version = "0.14.5", default-features = false }
http = { version = "1.2.0", default-features = false }
lru = { version = "0.12.5", default-features = false }
metrics = { version = "0.24.1", default-features = false }
metrics-exporter-prometheus = { version = "0.16.1", default-features = false, features = ["http-listener"] }
openssl = { version = "0.10.68", default-features = false, features = ["vendored"] }
p256k1 = { version = "7.2.0", default-features = false }
prost = { version = "0.13.4", default-features = false, features = ["derive"] }
rand = { version = "0.8.5", default-features = false }
reqwest = { version = "0.11.27", default-features = false, features = ["json"] }
serde = { version = "1.0.217", default-features = false, features = ["derive"] }
serde_bytes = { version = "0.11.15", default-features = false }
serde_dynamo = { version = "4.2.14", default-features = false, features = ["aws-sdk-dynamodb+1"] }
serde_json = { version = "1.0.137", default-features = false }
sha2 = { version = "0.10.8", default-features = false }
sqlx = { version = "0.8.3", default-features = false, features = [ "postgres", "runtime-tokio", "tls-rustls", "derive", "macros" ] }
strum = { version = "0.26.3", default-features = false, features = ["derive"] }
thiserror = { version = "2.0.11", default-features = false }
time = { version = "0.3.37", default-features = false, features = ["serde"] }
tonic = { version = "0.12.3", default-features = false, features = ["prost"] }
tonic-build = { version = "0.12.3", default-features = false, features = ["prost"] }
tokio = { version = "1.43.0", default-features = false, features = ["signal", "macros", "rt-multi-thread", "rt"] }
tokio-stream = { version = "0.1.15", default-features = false, features = ["sync"] }
tracing = { version = "0.1.41", default-features = false }
url = { version = "2.5.4", default-features = false }
warp_lambda = { version = "0.1.4", default-features = false }
utoipa = { version = "4.2.3", default-features = false }
warp = { version = "0.3.7", default-features = false }
hex = { version = "0.4.3", default-features = false, features = ["std"] }
libp2p = { version = "0.55.0", default-features = false, features = [
"macros", "kad", "noise", "ping", "tcp", "tokio", "yamux", "mdns", "quic",
"gossipsub", "identify", "tls", "dns", "autonat", "secp256k1"
] }
cfg-if = { version = "1.0.0", default-features = false }
include_dir = { version = "0.7.4", default-features = false }
polynomial = { version = "0.2.6", default-features = false }
tower-http = { version = "0.6.2", default-features = false, features = ["trace", "request-id"] }
secp256k1 = { version = "0.29.0", default-features = false, features = ["std", "rand", "alloc", "serde", "global-context", "recovery"] }
axum = { version = "0.8.1", default-features = false, features = ["http1", "json", "tracing", "tokio", "tower-log"] }
tracing-subscriber = { version = "0.3.19", default-features = false, features = ["env-filter", "fmt", "json", "time", "ansi"] }

# Crates used only for testing
fake = { version = "2.9.2", default-features = false, features = ["derive", "time"] }
mockall = { version = "0.13.1", default-features = false }
mockito = { version = "1.6.1", default-features = false }
more-asserts = { version = "0.3.1", default-features = false }
ripemd = { version = "0.1.3", default-features = false }
test-case = { version = "3.3.1", default-features = false }
test-log = { version = "0.2.17", default-features = false, features = ["trace"] }
toml_edit = { version = "0.22.22", default-features = false, features = ["display"] }
tempfile = { version = "3.15.0", default-features = false }
tower = { version = "0.5.2", default-features = false, features = ["util"] }

[profile.dev]
# Disabling debug info speeds up builds a bunch,
# and we don't rely on it for debugging that much.
Expand All @@ -22,75 +108,3 @@ split-debuginfo = "unpacked"
[profile.release]
lto = "thin"
codegen-units = 16

[workspace.dependencies]
sbtc = { path = "./sbtc", default-features = false }
emily-handler = { version = "0.1.0", path = "./emily/handler" }
emily-client = { version = "0.1.0", path = "./.generated-sources/emily/client/rust/public" }
testing-emily-client = { version = "0.1.0", path = "./.generated-sources/emily/client/rust/testing" }

aquamarine = "0.5.0"
aws-config = "1.2.0"
aws_lambda_events = "0.15.0"
aws-sdk-dynamodb = { version = "1.36.0" }
backoff = { version = "0.4.0", features = ["tokio"] }
base64 = "0.22.1"
bincode = "1.3.3"
bitcoin = { version = "0.32", features = ["serde", "rand-std"] }
bitcoincore-rpc = { version = "0.19" }
bitcoincore-rpc-json = { version = "0.19" }
bitcoincore-zmq = { version = "1.5.2", features = ["async"] }
bitvec = { version = "1.0", default-features = false, features = ["serde", "std"] }
clarity = { git = "https://github.com/stacks-network/stacks-core", rev = "49777d3fd73a6dbb610be80c376b7d9389c9871a" }
clap = { version = "4.5.4", features = ["derive", "env"] }
config = "0.14.0"
futures = "0.3.24"
hashbrown = "0.14.5"
http = "1.1.0"
lru = { version = "0.12", default-features = false }
metrics = "0.24"
metrics-exporter-prometheus = { version = "0.16", default-features = false, features = ["http-listener"] }
# This is necessary to compile the AWS Lambda as a lambda.
openssl = { version = "0.10.66", features = ["vendored"] }
p256k1 = "7.2.0"
prost = "0.12.5"
rand = "0.8"
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_bytes = "0.11"
serde_dynamo = {version = "4.2", features = ["aws-sdk-dynamodb+1"] }
serde_json = "1.0"
sha2 = "0.10"
sqlx = { version = "0.8.2", default-features = false, features = [ "postgres", "runtime-tokio", "tls-rustls", "derive", "macros" ] }
stackslib = { git = "https://github.com/stacks-network/stacks-core", rev = "49777d3fd73a6dbb610be80c376b7d9389c9871a" }
stacks-common = { git = "https://github.com/stacks-network/stacks-core", rev = "49777d3fd73a6dbb610be80c376b7d9389c9871a" }
strum = { version = "0.26", features = ["derive"] }
thiserror = "1.0"
time = { version = "0.3.36", features = ["serde"] }
tonic = "0.11.0"
tonic-build = "0.11.0"
tokio = { version = "1.32.0", default-features = false, features = ["signal", "macros", "rt-multi-thread", "rt"] }
tokio-stream = {version = "0.1.15", features = ["sync"] }
tracing = { version = "0.1", default-features = false }
tracing-attributes = "0.1"
url = "2.5"
warp_lambda = "0.1.4"
wsts = "9.2.0"
hex = "0.4.3"
libp2p = { version = "0.54.1", default-features = false, features = [
"macros", "kad", "noise", "ping", "tcp",
"tokio", "yamux", "mdns", "quic", "gossipsub",
"relay", "identify", "tls", "dns", "autonat",
"secp256k1"
] }
fake = { version = "2.9.2", features = ["derive", "time"] }

[workspace.dependencies.axum]
version = "0.7"
default-features = false
features = ["http1", "json", "tracing", "tokio", "tower-log"]

[workspace.dependencies.tracing-subscriber]
version = "0.3"
default-features = false
features = ["env-filter", "fmt", "json", "time", "ansi"]
48 changes: 24 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ AUTOGENERATED_SOURCES := .generated-sources
export DATABASE_URL=postgres://user:password@localhost:5432/signer

# The package flags for cargo commands.
CARGO_FLAGS := --workspace --exclude emily-openapi-spec --exclude blocklist-openapi-gen
CARGO_EXCLUDES := --workspace --exclude emily-openapi-spec --exclude blocklist-openapi-gen
CARGO_FLAGS := --locked

# ##############################################################################
# MAIN TARGETS
Expand All @@ -19,28 +20,28 @@ install:
pnpm --recursive install

build: blocklist-client-codegen emily-client-codegen contracts
cargo build --all-targets $(CARGO_FLAGS) ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) build --all-targets $(CARGO_EXCLUDES) ${CARGO_BUILD_ARGS}

test:
cargo nextest run --lib $(CARGO_FLAGS) --no-fail-fast ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) nextest run --lib $(CARGO_EXCLUDES) --no-fail-fast ${CARGO_BUILD_ARGS}
pnpm --recursive test

test-build:
cargo test build $(CARGO_FLAGS) --no-run --locked ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) test build $(CARGO_EXCLUDES) --no-run --locked ${CARGO_BUILD_ARGS}

lint:
cargo fmt --all -- --check
cargo clippy -- -D warnings
cargo $(CARGO_FLAGS) fmt --all -- --check
cargo $(CARGO_FLAGS) clippy -- -D warnings
pnpm --recursive run lint

format:
cargo fmt
cargo $(CARGO_FLAGS) fmt

contracts:
pnpm --prefix contracts run build

clean:
cargo clean
cargo $(CARGO_FLAGS) clean
pnpm --recursive clean

.PHONY: install build test test-build lint format contracts clean
Expand All @@ -54,13 +55,13 @@ NEXTEST_SERIAL_ARCHIVE_FILE := target/nextest/nextest-archive-serial.tar.zst

# Creates nextest archives
nextest-archive:
cargo nextest archive $(CARGO_FLAGS) --lib --archive-file $(NEXTEST_ARCHIVE_FILE) ${CARGO_BUILD_ARGS}
cargo nextest archive $(CARGO_FLAGS) --archive-file $(NEXTEST_SERIAL_ARCHIVE_FILE) --test integration ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) nextest archive $(CARGO_EXCLUDES) --lib --archive-file $(NEXTEST_ARCHIVE_FILE) ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) nextest archive $(CARGO_EXCLUDES) --archive-file $(NEXTEST_SERIAL_ARCHIVE_FILE) --test integration ${CARGO_BUILD_ARGS}

# Runs nextest archives
nextest-archive-run:
cargo nextest run --no-fail-fast --retries 2 --archive-file $(NEXTEST_ARCHIVE_FILE)
cargo nextest run --no-fail-fast --test-threads 1 --retries 2 --archive-file $(NEXTEST_SERIAL_ARCHIVE_FILE)
cargo $(CARGO_FLAGS) nextest run --no-fail-fast --retries 2 --archive-file $(NEXTEST_ARCHIVE_FILE)
cargo $(CARGO_FLAGS) nextest run --no-fail-fast --test-threads 1 --retries 2 --archive-file $(NEXTEST_SERIAL_ARCHIVE_FILE)

nextest-archive-clean:
rm -f $(NEXTEST_ARCHIVE_FILE) $(NEXTEST_SERIAL_ARCHIVE_FILE)
Expand All @@ -75,10 +76,10 @@ integration-env-up: emily-cdk-synth
docker compose --file docker/docker-compose.test.yml up -d

integration-test:
cargo nextest run $(CARGO_FLAGS) --test integration --no-fail-fast --test-threads 1
cargo $(CARGO_FLAGS) nextest run $(CARGO_EXCLUDES) --test integration --no-fail-fast --test-threads 1

integration-test-build:
cargo test build $(CARGO_FLAGS) --test integration --no-run --locked
cargo $(CARGO_FLAGS) test build $(CARGO_EXCLUDES) --test integration --no-run --locked

integration-env-down:
docker compose --file docker/docker-compose.test.yml down -t 0 -v
Expand All @@ -96,12 +97,12 @@ integration-env-up-ci: emily-cdk-synth
LOCAL_LAMBDA_PATH=empty.zip \
TRUSTED_REORG_API_KEY=testApiKey \
python3 docker/sbtc/emily-aws-setup/initialize.py
cargo build --bin emily-server
cargo $(CARGO_FLAGS) build --bin emily-server
AWS_ACCESS_KEY_ID=xxxxxxxxxxxx \
AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxx \
AWS_REGION=us-west-2 \
TRUSTED_REORG_API_KEY=testApiKey \
cargo run --bin emily-server -- \
cargo $(CARGO_FLAGS) run --bin emily-server -- \
--host 127.0.0.1 --port 3031 --dynamodb-endpoint http://localhost:8000 > ./target/emily-server.log 2>&1 &

integration-env-down-ci:
Expand Down Expand Up @@ -182,7 +183,7 @@ EMILY_LAMBDA_BINARY := target/lambda/emily-handler/bootstrap.zip
# aarm64 machines can still create the x86_64 binary by running the following command, but
# it will not be runnable using the SAM CLI on aarm64 machines.
$(EMILY_LAMBDA_BINARY): $(EMILY_HANDLER_SOURCE_FILES)
cargo lambda build \
cargo $(CARGO_FLAGS) lambda build \
--release \
--package $(EMILY_HANDLER_PROJECT_NAME) \
--output-format zip
Expand All @@ -209,23 +210,23 @@ EMILY_CLIENT_SOURCE_FILES := $(shell find $(EMILY_CLIENTS_DIR) -type f -name 'li
# one for each of the Emily API variants (public, private, testing).
$(EMILY_OPENAPI_SPEC_PATHS): $(EMILY_OPENAPI_SOURCE_FILES)
@echo "Generating Emily OpenAPI spec"
cargo build --package $(EMILY_OPENAPI_SPEC_PROJECT_NAME) --target-dir ./target/emily-spec-gen ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) build --package $(EMILY_OPENAPI_SPEC_PROJECT_NAME) --target-dir ./target/emily-spec-gen ${CARGO_BUILD_ARGS}

# Generate Rust client code for the Emily APIs if any of the generated source
# files are older than any of the spec files. Note that this generates the code
# for all three Emily API variants (public, private, testing).
$(EMILY_CLIENT_SOURCE_FILES): $(EMILY_OPENAPI_SPEC_PATHS)
@echo "Generating Emily client from OpenAPI spec"
EMILY_CLIENTS_DIR=$(WORKING_DIR)/$(EMILY_CLIENTS_DIR) pnpm --prefix $(EMILY_OPENAPI_DIR) run build
cargo fmt \
cargo $(CARGO_FLAGS) fmt \
-p testing-emily-client \
-p private-emily-client \
-p emily-client

emily-api-specgen: $(EMILY_OPENAPI_SPEC_PATHS)
emily-client-codegen: emily-api-specgen $(EMILY_CLIENT_SOURCE_FILES)
emily-client-build: emily-client-codegen
cargo build --package emily-client ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) build --package emily-client ${CARGO_BUILD_ARGS}

.PHONY: emily-api-specgen emily-client-codegen emily-client-build

Expand All @@ -245,22 +246,22 @@ BLOCKLIST_CLIENT_SOURCE_FILES := $(BLOCKLIST_CLIENT_SOURCE_DIR)/src/lib.rs
# than any of the source files.
$(BLOCKLIST_OPENAPI_SPEC_PATH): $(BLOCKLIST_OPENAPI_SOURCE_FILES)
@echo "Generating Blocklist OpenAPI spec"
cargo build --package $(BLOCKLIST_OPENAPI_SPEC_PROJECT_NAME) --target-dir ./target/blocklist-spec-gen ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) build --package $(BLOCKLIST_OPENAPI_SPEC_PROJECT_NAME) --target-dir ./target/blocklist-spec-gen ${CARGO_BUILD_ARGS}

# Geneate Rust client code for the Blocklist API if any of the generated source
# files are older than the OpenAPI spec file.
$(BLOCKLIST_CLIENT_SOURCE_FILES): $(BLOCKLIST_OPENAPI_SPEC_PATH)
@echo "Generating blocklist client from openapi spec"
pnpm --prefix $(BLOCKLIST_OPENAPI_DIR) run build
cargo fmt -p blocklist-api
cargo $(CARGO_FLAGS) fmt -p blocklist-api

blocklist-api-specgen: $(BLOCKLIST_OPENAPI_SPEC_PATH)
blocklist-client-codegen: blocklist-api-specgen $(BLOCKLIST_CLIENT_SOURCE_FILES)

# Build the generated Rust client code for the Blocklist API. This target will
# also build the OpenAPI spec (if needed) and generate the client.
blocklist-client-build: blocklist-client-codegen
cargo build --package blocklist-api ${CARGO_BUILD_ARGS}
cargo $(CARGO_FLAGS) build --package blocklist-api ${CARGO_BUILD_ARGS}

.PHONY: blocklist-api-specgen blocklist-client-codegen blocklist-client-build

Expand All @@ -273,4 +274,3 @@ install-git-hooks:
ln -s ../../devenv/hooks/pre-commit-make-lint.sh .git/hooks/

.PHONY: install-git-hooks

16 changes: 7 additions & 9 deletions blocklist-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
name = "blocklist-client"
version = "0.0.1"
edition = "2021"

[[bin]]
name = "blocklist-client"
path = "src/main.rs"

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

[dependencies]
Expand All @@ -18,10 +13,13 @@ serde_json.workspace = true
thiserror.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-attributes.workspace = true
tracing-subscriber.workspace = true
utoipa = "4.2.3"
warp = "0.3"
utoipa.workspace = true
warp.workspace = true

[dev-dependencies]
mockito = "0.28"
mockito.workspace = true

[[bin]]
name = "blocklist-client"
path = "src/main.rs"
Loading

0 comments on commit 1f5f6a6

Please sign in to comment.