Skip to content

Commit

Permalink
Workspace dependencies (#229)
Browse files Browse the repository at this point in the history
* Fix dockerfile issues and set packages to inherit from workspace

* Add toolchain file to ensure we dont redownload tools
  • Loading branch information
ryardley authored Dec 30, 2024
1 parent 7e2b08c commit ed322f3
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 50 deletions.
1 change: 1 addition & 0 deletions packages/ciphernode/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
!*/src/**/*.rs

# Explicitly ignore build artifacts everywhere
target/
**/target/
**/.git/
**/.gitignore
Expand Down
29 changes: 19 additions & 10 deletions packages/ciphernode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
[workspace]
members = [
"events",
"aggregator",
"config",
"crypto",
"data",
"e3_request",
"enclave",
"enclave_core",
"net",
"data",
"events",
"evm",
"fhe",
"e3_request",
"keyshare",
"aggregator",
"test_helpers",
"logger",
"net",
"sortition",
"test_helpers",
"tests",
"crypto",
"config",
]

[workspace.dependencies]
actix = "0.13.5"
aes-gcm = "0.10.3"
aggregator = { path = "./aggregator" }
alloy = { version = "0.5.2", features = ["full", "node-bindings"] }
alloy-primitives = { version = "0.6", default-features = false, features = [
"rlp",
Expand All @@ -40,20 +42,24 @@ compile-time = "0.2.0"
config = { path = "./config" }
dirs = "5.0.1"
data = { path = "./data" }
dialoguer = "0.11.0"
events = { path = "./events" }
enclave_core = { path = "./enclave_core" }
evm = { path = "./evm" }
shellexpand = "3.1.0"
figment = { version = "0.10.19", features = ["yaml", "test"] }
fhe = { path = "./fhe" }
fhe_rs = { package = "fhe", git = "https://github.com/gnosisguild/fhe.rs", version = "0.1.0-beta.7" }
fhe-traits = { git = "https://github.com/gnosisguild/fhe.rs", version = "0.1.0-beta.7" }
fhe-util = { git = "https://github.com/gnosisguild/fhe.rs", version = "0.1.0-beta.7" }
figment = { version = "0.10.19", features = ["yaml", "test"] }
futures = "0.3.30"
futures-util = "0.3"
hex = "0.4.3"
keyshare = { path = "./keyshare" }
lazy_static = "1.5.0"
logger = { path = "./logger" }
num = "0.4.3"
net = { path = "./net" }
petname = "2.0.2"
phf = { version = "0.11", features = ["macros"] }
rand_chacha = "0.3.1"
rand = "0.8.5"
Expand All @@ -62,6 +68,9 @@ serde = { version = "1.0.208", features = ["derive"] }
serde_json = { version = "1.0.133" }
sled = "0.34.7"
sha2 = "0.10.8"
shellexpand = "3.1.0"
sortition = { path = "./sortition" }
test-helpers = { path = "./test_helpers" }
tempfile = "3.14.0"
tokio = { version = "1.38", features = ["full"] }
tracing = "0.1.37"
Expand Down
11 changes: 6 additions & 5 deletions packages/ciphernode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ COPY --from=evm-builder /build/packages/evm/artifacts ../evm/artifacts
COPY --from=evm-builder /build/packages/evm/deployments ../evm/deployments

# Copy workpace Cargo.toml
COPY ./packages/ciphernode/rust-toolchain.toml .
COPY ./packages/ciphernode/Cargo.toml ./Cargo.toml
COPY ./packages/ciphernode/Cargo.lock ./Cargo.lock
COPY ./packages/ciphernode/aggregator/Cargo.toml ./aggregator/Cargo.toml
Expand All @@ -28,18 +27,19 @@ COPY ./packages/ciphernode/data/Cargo.toml ./data/Cargo.toml
COPY ./packages/ciphernode/e3_request/Cargo.toml ./e3_request/Cargo.toml
COPY ./packages/ciphernode/enclave/Cargo.toml ./enclave/Cargo.toml
COPY ./packages/ciphernode/enclave_core/Cargo.toml ./enclave_core/Cargo.toml
COPY ./packages/ciphernode/enclave_core/build.rs ./enclave_core/build.rs
COPY ./packages/ciphernode/events/Cargo.toml ./events/Cargo.toml
COPY ./packages/ciphernode/evm/Cargo.toml ./evm/Cargo.toml
COPY ./packages/ciphernode/fhe/Cargo.toml ./fhe/Cargo.toml
COPY ./packages/ciphernode/keyshare/Cargo.toml ./keyshare/Cargo.toml
COPY ./packages/ciphernode/logger/Cargo.toml ./logger/Cargo.toml
COPY ./packages/ciphernode/net/Cargo.toml ./net/Cargo.toml
COPY ./packages/ciphernode/sortition/Cargo.toml ./sortition/Cargo.toml
COPY ./packages/ciphernode/test_helpers/Cargo.toml ./test_helpers/Cargo.toml
COPY ./packages/ciphernode/tests/Cargo.toml ./tests/Cargo.toml
COPY ./packages/ciphernode/rust-toolchain.toml .

# Build all dependencies and add them to the build cache
RUN mkdir -p src && \
echo "fn main() {}" > src/main.rs && \
for d in ./*/ ; do \
RUN for d in ./*/ ; do \
if [ -f "$d/Cargo.toml" ]; then \
mkdir -p "$d/src" && \
echo "fn main() {}" > "$d/src/lib.rs"; \
Expand All @@ -50,6 +50,7 @@ RUN cargo build --release

COPY ./packages/ciphernode .

RUN find . -name "*.rs" -exec touch {} +
RUN cargo build --release

# Runtime stage
Expand Down
6 changes: 3 additions & 3 deletions packages/ciphernode/aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ bincode = { workspace = true }
config = { workspace = true }
async-trait = { workspace = true }
events = { workspace = true }
fhe = { path = "../fhe" }
sortition = { path = "../sortition" }
fhe = { workspace = true }
sortition = { workspace = true }
e3_request = { workspace = true }
data = { path = "../data" }
data = { workspace = true }
tracing = { workspace = true }
2 changes: 1 addition & 1 deletion packages/ciphernode/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ rand = { workspace = true, version = "=0.8.5" }
zeroize = { workspace = true, version = "=1.6.0" }
anyhow = { workspace = true }
tokio = { workspace = true }
config = { path = "../config" }
config = { workspace = true }
async-trait = { workspace = true }
2 changes: 1 addition & 1 deletion packages/ciphernode/e3_request/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
actix = { workspace = true }
events = { workspace = true }
data = { path = "../data" }
data = { workspace = true }
anyhow = { workspace = true }
serde = { workspace = true }
config = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions packages/ciphernode/enclave/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ anyhow = { workspace = true }
crypto = { workspace = true }
clap = { workspace = true }
compile-time = { workspace = true }
config = { path = "../config" }
dialoguer = "0.11.0"
config = { workspace = true }
dialoguer = { workspace = true }
events = { workspace = true }
enclave_core = { workspace = true }
hex = { workspace = true }
petname = "2.0.2"
rand = { workspace = true }
petname = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
Expand Down
20 changes: 10 additions & 10 deletions packages/ciphernode/enclave_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ build = "build.rs"

[dependencies]
actix = { workspace = true }
aggregator = { path = "../aggregator" }
aggregator = { workspace = true }
alloy = { workspace = true }
alloy-primitives = { workspace = true }
anyhow = { workspace = true }
bincode = { workspace = true }
config = { path = "../config" }
config = { workspace = true }
clap = { workspace = true }
crypto = { workspace = true }
data = { path = "../data" }
data = { workspace = true }
dirs = { workspace = true }
events = { workspace = true }
evm = { path = "../evm" }
fhe = { path = "../fhe" }
keyshare = { path = "../keyshare" }
logger = { path = "../logger" }
evm = { workspace = true }
fhe = { workspace = true }
keyshare = { workspace = true }
logger = { workspace = true }
libp2p = { workspace = true }
net = { path = "../net" }
net = { workspace = true }
phf = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
e3_request = { workspace = true }
serde = { workspace = true }
sortition = { path = "../sortition" }
test-helpers = { path = "../test_helpers" }
sortition = { workspace = true }
test-helpers = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
zeroize = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions packages/ciphernode/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ anyhow = { workspace = true }
async-trait = { workspace = true }
base64 = { workspace = true }
crypto = { workspace = true }
config = { path = "../config" }
data = { path = "../data" }
config = { workspace = true }
data = { workspace = true }
events = { workspace = true }
futures-util = { workspace = true }
sortition = { path = "../sortition" }
sortition = { workspace = true }
serde = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/fhe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ anyhow = { workspace = true }
async-trait = { workspace = true }
bincode = { workspace = true }
config = { workspace = true }
data = { path = "../data" }
data = { workspace = true }
events = { workspace = true }
fhe-traits = { workspace = true }
fhe-util = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions packages/ciphernode/keyshare/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ actix = { workspace = true }
anyhow = { workspace = true }
async-trait = { workspace = true }
config = { workspace = true }
data = { path = "../data" }
data = { workspace = true }
crypto = { workspace = true }
events = { workspace = true }
fhe = { path = "../fhe" }
fhe = { workspace = true }
e3_request = { workspace = true }
serde = { workspace = true }
tracing = { workspace = true }
2 changes: 1 addition & 1 deletion packages/ciphernode/sortition/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ alloy = { workspace = true, features = ["full"] }
anyhow = { workspace = true }
async-trait = { workspace = true }
config = { workspace = true }
data = { path = "../data" }
data = { workspace = true }
events = { workspace = true }
num = { workspace = true }
rand = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/test_helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
actix = { workspace = true }
events = { workspace = true }
fhe = { path = "../fhe" }
fhe = { workspace = true }
bincode = { workspace = true }
clap = { workspace = true, features = ["derive"] }
fhe_rs = { workspace = true }
Expand Down
18 changes: 9 additions & 9 deletions packages/ciphernode/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ version = "0.1.0"
edition = "2021"

[dependencies]
net = { path = "../net" }
sortition = { path = "../sortition" }
net = { workspace = true }
sortition = { workspace = true }
events = { workspace = true }
evm = { path = "../evm" }
logger = { path = "../logger" }
fhe = { path = "../fhe" }
evm = { workspace = true }
logger = { workspace = true }
fhe = { workspace = true }
crypto = { workspace = true }
data = { path = "../data" }
keyshare = { path = "../keyshare" }
aggregator = { path = "../aggregator" }
data = { workspace = true }
keyshare = { workspace = true }
aggregator = { workspace = true }
e3_request = { workspace = true }
test-helpers = { path = "../test_helpers" }
test-helpers = { workspace = true }
fhe_rs = { workspace = true }
fhe-traits = { workspace = true }
fhe-util = { workspace = true }
Expand Down

0 comments on commit ed322f3

Please sign in to comment.