Skip to content

chore(core): organize deps using workspace.dependencies#2449

Merged
shamardy merged 25 commits intodevfrom
workspace-crates
May 23, 2025
Merged

chore(core): organize deps using workspace.dependencies#2449
shamardy merged 25 commits intodevfrom
workspace-crates

Conversation

@borngraced
Copy link
Copy Markdown

@borngraced borngraced commented May 8, 2025

This enables us to organize multiple packages under a single workspace, share dependencies, etc

Compile time improvements

• Before: cargo build --timings shows 2.20 s
• After: end-to-end workspace build is 1.24-58 s (≈ 28 – 44 % faster overall)

@shamardy shamardy added the priority: high Important tasks that need attention soon. label May 12, 2025
@dimxy
Copy link
Copy Markdown
Collaborator

dimxy commented May 13, 2025

I like this PR very much, thank you.

Currently I am having one cargo build error (after cargo clean):

error[E0425]: cannot find value `OsRng` in crate `bip39::rand_core`
  --> mm2src/crypto/src/mnemonic.rs:47:37
   |
47 |     let mut rng = bip39::rand_core::OsRng;
   |                                     ^^^^^ not found in `bip39::rand_core`

@borngraced
Copy link
Copy Markdown
Author

I like this PR very much, thank you.

Currently I am having one cargo build error (after cargo clean):

error[E0425]: cannot find value `OsRng` in crate `bip39::rand_core`
  --> mm2src/crypto/src/mnemonic.rs:47:37
   |
47 |     let mut rng = bip39::rand_core::OsRng;
   |                                     ^^^^^ not found in `bip39::rand_core`

thanks, I needed to update rand_core for bip39 crate

Cargo.lock Outdated
dependencies = [
"bitcoin_hashes",
"rand_core 0.6.4",
"rand_core 0.5.1",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks, I needed to update rand_core for bip39 crate

It actually downgrades it, can you please explain why?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I didn’t explicitly request a downgrade. It happened because Cargo resolves dependencies based on the semver-compatible version range specified (e.g., v1...v5), and it selects the highest compatible version available by default. But if another dependency restricts it to a lower version, Cargo might resolve to that instead.

I believe this change doesn't break, change anything we can leave it until we no longer rely on rand_core 0.5.1 or we upgrade bip39 crate

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe this change doesn't break, change anything we can leave it until we no longer rely on rand_core 0.5.1 or we upgrade bip39 crate

We can also revert this to rand_core 0.6.4 as I think it won't cause problems, will it? cargo.lock will be relying less on rand_core 0.5.1 which makes it easier to remove it in the future. These left artifacts can persist over time as cargo might never resolve it on it's own if the dependency tree is complex.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

Cargo.lock Outdated
"sha2 0.10.7",
"smallvec 1.6.1",
"syn 2.0.38",
"syn 1.0.95",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also reason for this downgrade

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

same reason as my first paragraph above

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

#2449 (comment) As a general rule, always try to use the latest version if it's in the deps tree and if possible.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

shamardy
shamardy previously approved these changes May 13, 2025
Copy link
Copy Markdown
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

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

This was much needed, thanks a lot! All above comments and the below one are non-blockers!

Cargo.toml Outdated
Comment on lines +117 to +118
# using webpki-tokio to avoid rejecting valid certificates
# got "invalid certificate: UnknownIssuer" for https://ropsten.infura.io on iOS using default-features
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this doesn't fit here as the feature webpki-tokio is mentioned in children .tomls

@shamardy
Copy link
Copy Markdown
Collaborator

@mariocynicys @dimxy do you have any more review comments or iterations to go here?

@mariocynicys
Copy link
Copy Markdown
Collaborator

@shamardy i didn't attempt reviewing this anyway so i shouldn't be a blocker. that said, when i took a look i felt the only efficient way to review this is with a script 😂 - it checks that every workspace dep has the highest version out of the versions that showed up in the crates that used it.

can try this on the weekend or something, but since this PR is benign, we don't have to wait for that and can merge it right away i guess.

@shamardy
Copy link
Copy Markdown
Collaborator

when i took a look i felt the only efficient way to review this is with a script

Checking cargo.lock was enough for me

@shamardy
Copy link
Copy Markdown
Collaborator

shamardy commented May 21, 2025

@borngraced why was this commit needed 01367f9 where it reverted some deps? I thought the deps were fine and I approved them before this commit.

@borngraced
Copy link
Copy Markdown
Author

borngraced commented May 22, 2025

@borngraced why was this commit needed 01367f9 where it reverted some deps? I thought the deps were fine and I approved them before this commit.

I initially didn't intend to update those deps but somehow got updated due to a package I updated so I was able to revert it...

@shamardy
Copy link
Copy Markdown
Collaborator

I initially didn't intend to update those deps but somehow got updated due to a package I updated so I was able to revert it...

I thought the update wasn't bad. Some deps were removed from cargo.lock after the update, but some were added too. Can you please check which version you think is better before I do another review.

@borngraced
Copy link
Copy Markdown
Author

borngraced commented May 22, 2025

I initially didn't intend to update those deps but somehow got updated due to a package I updated so I was able to revert it...

I thought the update wasn't bad. Some deps were removed from cargo.lock after the update, but some were added too. Can you please check which version you think is better before I do another review.

This shouldn't be an issue or a blocker for now. These deps will be updated in toolchain upgrade PR(updated some already)

The dep i updated was signature and ed25519-dalek btw

@shamardy
Copy link
Copy Markdown
Collaborator

This shouldn't be an issue or a blocker for now. These deps will be updated in toolchain upgrade PR(updated some already)

The dep i updated was signature and ed25519-dalek btw

Had to check cargo.lock again and it's actually better now. Thanks

@shamardy shamardy merged commit e42a9af into dev May 23, 2025
20 of 24 checks passed
@shamardy shamardy deleted the workspace-crates branch May 23, 2025 01:39
dimxy pushed a commit that referenced this pull request May 27, 2025
* dev:
  fix(evm-api): find enabled erc20 token using platform ticker (#2445)
  chore(docs): add DeepWiki badge to README (#2463)
  chore(core): organize deps using workspace.dependencies (#2449)
  feat(db-arch): more dbdir to address_dir replacements (#2398)
dimxy pushed a commit that referenced this pull request May 28, 2025
* dev: (29 commits)
  fix(p2pk): validate expected pubkey correctly for p2pk inputs (#2408)
  chore(docs): update old urls referencing atomicdex or old docs pages (#2428)
  improvement(p2p): remove hardcoded seeds (#2439)
  fix(evm-api): find enabled erc20 token using platform ticker (#2445)
  chore(docs): add DeepWiki badge to README (#2463)
  chore(core): organize deps using workspace.dependencies (#2449)
  feat(db-arch): more dbdir to address_dir replacements (#2398)
  chore(build-artifacts): remove duplicated mm2 build artifacts (#2448)
  feat(pubkey-banning): expirable bans (#2455)
  fix(eth-balance-events): serialize eth address using AddrToString (#2440)
  chore(deps): remove base58 and replace it completely with bs58 (#2427)
  feat(tron): initial groundwork for full TRON integration (#2425)
  fix(UTXO): improve tx fee calculation and min relay fee handling (#2316)
  deps(timed-map): bump to 1.3.1 (#2413)
  improvement(tendermint): safer IBC channel handler (#2298)
  chore(release): complete v2.4.0-beta changelogs  (#2436)
  fix(event-streaming): initial addresses registration in utxo balance streaming (#2431)
  improvement(watchers): re-write use-watchers handling (#2430)
  fix(evm): make withdraw_nft work in HD mode (#2424)
  feat(taproot): support parsing taproot output address types
  ...
dimxy pushed a commit to dimxy/komodo-defi-framework that referenced this pull request Jun 8, 2025
* lr-swap-wip: (37 commits)
  fix custom token error name
  fix getting chain_id from protocol_data
  refactor (review): use dedicated large error cfg, add new fn to FromApiValueError, fix TODO, use experimental namespace for lr rpc, more Ticker alias
  feat(walletconnect): add WalletConnect v2 support for EVM and Cosmos (GLEECBTC#2223)
  feat(ibc-routing-part-1): supporting entire Cosmos network for swaps (GLEECBTC#2459)
  fix(test): fix HD Wallet message signing tests (GLEECBTC#2474)
  improvement(builds): enable static CRT linking for MSVC builds (GLEECBTC#2464)
  feat(wallet): implement HD multi-address support for message signing (GLEECBTC#2432)
  fix(p2pk): validate expected pubkey correctly for p2pk inputs (GLEECBTC#2408)
  chore(docs): update old urls referencing atomicdex or old docs pages (GLEECBTC#2428)
  improvement(p2p): remove hardcoded seeds (GLEECBTC#2439)
  fix(evm-api): find enabled erc20 token using platform ticker (GLEECBTC#2445)
  chore(docs): add DeepWiki badge to README (GLEECBTC#2463)
  chore(core): organize deps using workspace.dependencies (GLEECBTC#2449)
  feat(db-arch): more dbdir to address_dir replacements (GLEECBTC#2398)
  chore(build-artifacts): remove duplicated mm2 build artifacts (GLEECBTC#2448)
  feat(pubkey-banning): expirable bans (GLEECBTC#2455)
  fix(eth-balance-events): serialize eth address using AddrToString (GLEECBTC#2440)
  chore(deps): remove base58 and replace it completely with bs58 (GLEECBTC#2427)
  feat(tron): initial groundwork for full TRON integration (GLEECBTC#2425)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: high Important tasks that need attention soon. status: pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants