From 0b22e41acda5f6a0fe6cad7237156cfd49b45e1e Mon Sep 17 00:00:00 2001 From: Maximilian Schneider Date: Wed, 17 May 2023 20:48:14 +0200 Subject: [PATCH] manage dependencies in workspace (#588) * move important dependencies to workspace * enable workspace inheritance --- Cargo.toml | 16 ++++++++++++++++ bin/cli/Cargo.toml | 18 ++++++++++-------- bin/keeper/Cargo.toml | 18 ++++++++++-------- bin/liquidator/Cargo.toml | 22 ++++++++++++---------- bin/settler/Cargo.toml | 22 ++++++++++++---------- lib/client/Cargo.toml | 24 +++++++++++++----------- programs/mango-v4/Cargo.toml | 24 +++++++++++++----------- programs/margin-trade/Cargo.toml | 8 +++++--- 8 files changed, 91 insertions(+), 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fadb9acce..4c166d503 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,22 @@ members = [ "lib/*", ] +[workspace.dependencies] +anchor-client = "0.27.0" +anchor-lang = "0.27.0" +anchor-spl = "0.27.0" +fixed = { path = "./3rdparty/fixed", version = "1.11.0" } +pyth-sdk-solana = "0.1.0" +serum_dex = { git = "https://github.com/openbook-dex/program.git" } +solana-address-lookup-table-program = "~1.14.9" +solana-account-decoder = "~1.14.9" +solana-client = "~1.14.9" +solana-logger = "~1.14.9" +solana-program = "~1.14.9" +solana-program-test = "~1.14.9" +solana-rpc = "~1.14.9" +solana-sdk = "~1.14.9" + [profile.release] overflow-checks = true diff --git a/bin/cli/Cargo.toml b/bin/cli/Cargo.toml index 2c01128e6..7aefe2bf8 100644 --- a/bin/cli/Cargo.toml +++ b/bin/cli/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["workspace-inheritance"] + [package] name = "mango-v4-cli" version = "0.3.0" @@ -8,20 +10,20 @@ name = "cli" path = "src/main.rs" [dependencies] -anchor-client = "0.27.0" -anchor-lang = "0.27.0" -anchor-spl = "0.27.0" +anchor-client = { workspace = true } +anchor-lang = { workspace = true } +anchor-spl = { workspace = true } anyhow = "1.0" clap = { version = "3.1.8", features = ["derive", "env"] } dotenv = "0.15.0" env_logger = "0.8.4" -fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh"] } +fixed = { workspace = true, features = ["serde", "borsh"] } futures = "0.3.21" log = "0.4.0" mango-v4 = { path = "../../programs/mango-v4", features = ["client"] } mango-v4-client = { path = "../../lib/client" } -pyth-sdk-solana = "0.1.0" -serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false,features = ["no-entrypoint", "program"] } -solana-client = "~1.14.9" -solana-sdk = "~1.14.9" +pyth-sdk-solana = { workspace = true } +serum_dex = { workspace = true, default-features=false,features = ["no-entrypoint", "program"] } +solana-client = { workspace = true } +solana-sdk = { workspace = true } tokio = { version = "1.14.1", features = ["rt-multi-thread", "time", "macros", "sync"] } diff --git a/bin/keeper/Cargo.toml b/bin/keeper/Cargo.toml index 52a2b3a05..f7ebae745 100644 --- a/bin/keeper/Cargo.toml +++ b/bin/keeper/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["workspace-inheritance"] + [package] name = "mango-v4-keeper" version = "0.3.0" @@ -8,23 +10,23 @@ name = "keeper" path = "src/main.rs" [dependencies] -anchor-client = "0.27.0" -anchor-lang = "0.27.0" -anchor-spl = "0.27.0" +anchor-client = { workspace = true } +anchor-lang = { workspace = true } +anchor-spl = { workspace = true } anyhow = "1.0" clap = { version = "3.1.8", features = ["derive", "env"] } dotenv = "0.15.0" env_logger = "0.8.4" -fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh"] } +fixed = { workspace = true, features = ["serde", "borsh"] } futures = "0.3.21" itertools = "0.10.3" log = "0.4.0" mango-v4 = { path = "../../programs/mango-v4", features = ["client"] } mango-v4-client = { path = "../../lib/client" } -pyth-sdk-solana = "0.1.0" -serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false,features = ["no-entrypoint", "program"] } -solana-client = "~1.14.9" -solana-sdk = "~1.14.9" +pyth-sdk-solana = { workspace = true } +serum_dex = { workspace = true, default-features=false,features = ["no-entrypoint", "program"] } +solana-client = { workspace = true } +solana-sdk = { workspace = true } tokio = { version = "1.14.1", features = ["rt-multi-thread", "time", "macros", "sync"] } prometheus = "0.13.3" warp = "0.3.3" diff --git a/bin/liquidator/Cargo.toml b/bin/liquidator/Cargo.toml index 1b197ae0e..99737f13e 100644 --- a/bin/liquidator/Cargo.toml +++ b/bin/liquidator/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["workspace-inheritance"] + [package] name = "mango-v4-liquidator" version = "0.0.1" @@ -8,8 +10,8 @@ name = "liquidator" path = "src/main.rs" [dependencies] -anchor-lang = "0.27.0" -anchor-client = "0.27.0" +anchor-lang = { workspace = true } +anchor-client = { workspace = true } anyhow = "1.0" arrayref = "0.3.6" async-channel = "1.6" @@ -20,7 +22,7 @@ bytemuck = "^1.7.2" bytes = "1.0" clap = { version = "3.1.8", features = ["derive", "env"] } dotenv = "0.15.0" -fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde"] } +fixed = { workspace = true, features = ["serde"] } futures = "0.3.17" futures-core = "0.3" futures-util = "0.3" @@ -32,18 +34,18 @@ log = "0.4" mango-v4 = { path = "../../programs/mango-v4", features = ["client"] } mango-v4-client = { path = "../../lib/client" } once_cell = "1.12.0" -pyth-sdk-solana = "0.1.0" +pyth-sdk-solana = { workspace = true } rand = "0.7" serde = "1.0.130" serde_derive = "1.0.130" serde_json = "1.0.68" -serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false,features = ["no-entrypoint", "program"] } +serum_dex = { workspace = true, default-features=false,features = ["no-entrypoint", "program"] } shellexpand = "2.1.0" -solana-account-decoder = "~1.14.9" -solana-client = "~1.14.9" -solana-logger = "~1.14.9" -solana-rpc = "~1.14.9" -solana-sdk = "~1.14.9" +solana-account-decoder = { workspace = true } +solana-client = { workspace = true } +solana-logger = { workspace = true } +solana-rpc = { workspace = true } +solana-sdk = { workspace = true } tokio = { version = "1", features = ["full"] } tokio-stream = { version = "0.1.9"} tokio-tungstenite = "0.16.1" diff --git a/bin/settler/Cargo.toml b/bin/settler/Cargo.toml index 08bfe8f9b..74f5812f1 100644 --- a/bin/settler/Cargo.toml +++ b/bin/settler/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["workspace-inheritance"] + [package] name = "mango-v4-settler" version = "0.0.1" @@ -8,8 +10,8 @@ name = "settler" path = "src/main.rs" [dependencies] -anchor-lang = "0.27.0" -anchor-client = "0.27.0" +anchor-lang = { workspace = true } +anchor-client = { workspace = true } anyhow = "1.0" arrayref = "0.3.6" async-channel = "1.6" @@ -21,7 +23,7 @@ bytemuck = "^1.7.2" bytes = "1.0" clap = { version = "3.1.8", features = ["derive", "env"] } dotenv = "0.15.0" -fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde"] } +fixed = { workspace = true, features = ["serde"] } futures = "0.3.17" futures-core = "0.3" futures-util = "0.3" @@ -34,18 +36,18 @@ mango-v4 = { path = "../../programs/mango-v4", features = ["client"] } mango-v4-client = { path = "../../lib/client" } once_cell = "1.12.0" priority-queue = "1.3.1" -pyth-sdk-solana = "0.1.0" +pyth-sdk-solana = { workspace = true } rand = "0.7" serde = "1.0.130" serde_derive = "1.0.130" serde_json = "1.0.68" -serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false,features = ["no-entrypoint", "program"] } +serum_dex = { workspace = true, default-features=false,features = ["no-entrypoint", "program"] } shellexpand = "2.1.0" -solana-account-decoder = "~1.14.9" -solana-client = "~1.14.9" -solana-logger = "~1.14.9" -solana-rpc = "~1.14.9" -solana-sdk = "~1.14.9" +solana-account-decoder = { workspace = true } +solana-client = { workspace = true } +solana-logger = { workspace = true } +solana-rpc = { workspace = true } +solana-sdk = { workspace = true } tokio = { version = "1", features = ["full"] } tokio-stream = { version = "0.1.9"} tokio-tungstenite = "0.16.1" diff --git a/lib/client/Cargo.toml b/lib/client/Cargo.toml index d2ecea297..6c896e13e 100644 --- a/lib/client/Cargo.toml +++ b/lib/client/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["workspace-inheritance"] + [package] name = "mango-v4-client" version = "0.3.0" @@ -7,27 +9,27 @@ edition = "2021" doctest = false [dependencies] -anchor-client = "0.27.0" -anchor-lang = "0.27.0" -anchor-spl = "0.27.0" +anchor-client = { workspace = true } +anchor-lang = { workspace = true } +anchor-spl = { workspace = true } anyhow = "1.0" async-channel = "1.6" async-once-cell = { version = "0.4.2", features = ["unpin"] } async-trait = "0.1.52" -fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh"] } +fixed = { workspace = true, features = ["serde", "borsh"] } futures = "0.3.25" itertools = "0.10.3" jsonrpc-core = "18.0.0" jsonrpc-core-client = { version = "18.0.0", features = ["ws", "http", "tls"] } mango-v4 = { path = "../../programs/mango-v4", features = ["client"] } -pyth-sdk-solana = "0.1.0" -serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false,features = ["no-entrypoint", "program"] } +pyth-sdk-solana = { workspace = true } +serum_dex = { workspace = true, default-features=false,features = ["no-entrypoint", "program"] } shellexpand = "2.1.0" -solana-account-decoder = "~1.14.9" -solana-client = "~1.14.9" -solana-rpc = "~1.14.9" -solana-sdk = "~1.14.9" -solana-address-lookup-table-program = "~1.14.9" +solana-account-decoder = { workspace = true } +solana-client = { workspace = true } +solana-rpc = { workspace = true } +solana-sdk = { workspace = true } +solana-address-lookup-table-program = { workspace = true } mango-feeds-connector = "0.1.1" spl-associated-token-account = "1.0.3" thiserror = "1.0.31" diff --git a/programs/mango-v4/Cargo.toml b/programs/mango-v4/Cargo.toml index 5fa521276..e26787c74 100644 --- a/programs/mango-v4/Cargo.toml +++ b/programs/mango-v4/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["workspace-inheritance"] + [package] name = "mango-v4" version = "0.16.0" @@ -23,31 +25,31 @@ enable-gpl = [] [dependencies] # todo: when to fix, when to use caret? need a regular chore to bump dependencies # note: possibly need init-if-needed feature -anchor-lang = "0.27.0" -anchor-spl = "0.27.0" +anchor-lang = { workspace = true } +anchor-spl = { workspace = true } arrayref = "0.3.6" bincode = "1.3.3" borsh = { version = "0.9.3", features = ["const-generics"] } bytemuck = { version = "^1.7.2", features = ["min_const_generics"] } default-env = "0.1.1" derivative = "2.2.0" -fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh", "debug-assert-in-release"] } +fixed = { workspace = true, features = ["serde", "borsh", "debug-assert-in-release"] } num_enum = "0.5.1" -pyth-sdk-solana = "0.1.0" +pyth-sdk-solana = { workspace = true } serde = "^1.0" -serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false, features = ["no-entrypoint", "program"] } -solana-address-lookup-table-program = "~1.14.9" -solana-program = "~1.14.9" -solana-sdk = { version = "~1.14.9", default-features = false, optional = true } +serum_dex = { workspace = true, default-features=false, features = ["no-entrypoint", "program"] } +solana-address-lookup-table-program = { workspace = true } +solana-program = { workspace = true } +solana-sdk = { workspace = true, default-features = false, optional = true } solana-security-txt = "1.1.0" static_assertions = "1.1" switchboard-program = ">=0.2.0" switchboard-v2 = "0.1.17" [dev-dependencies] -solana-sdk = { version = "~1.14.9", default-features = false } -solana-program-test = "~1.14.9" -solana-logger = "~1.14.9" +solana-sdk = { workspace = true, default-features = false } +solana-program-test = { workspace = true } +solana-logger = { workspace = true } spl-token = { version = "^3.0.0", features = ["no-entrypoint"] } spl-associated-token-account = { version = "^1.0.3", features = ["no-entrypoint"] } bincode = "^1.3.1" diff --git a/programs/margin-trade/Cargo.toml b/programs/margin-trade/Cargo.toml index 520aa8c3e..8bf539ecc 100644 --- a/programs/margin-trade/Cargo.toml +++ b/programs/margin-trade/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["workspace-inheritance"] + [package] name = "margin-trade" version = "0.1.0" @@ -18,6 +20,6 @@ default = [] test-bpf = [] [dependencies] -anchor-lang = "0.27.0" -anchor-spl = "0.27.0" -solana-program = "~1.14.9" +anchor-lang = { workspace = true } +anchor-spl = { workspace = true } +solana-program = { workspace = true }