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

contract init: incompatible versions of soroban-sdk & soroban-token-sdk #1498

Closed
chadoh opened this issue Jul 29, 2024 · 1 comment · Fixed by #1500
Closed

contract init: incompatible versions of soroban-sdk & soroban-token-sdk #1498

chadoh opened this issue Jul 29, 2024 · 1 comment · Fixed by #1500
Assignees
Labels
bug Something isn't working

Comments

@chadoh
Copy link
Contributor

chadoh commented Jul 29, 2024

What version are you using?

21.2.0

What did you do?

stellar contract init ohno --with-example token
cd ohno
stellar contract build

What did you expect to see?

all contracts build

What did you see instead?

cargo rustc --manifest-path=contracts/hello_world/Cargo.toml --crate-type=cdylib --target=wasm32-unknown-unknown --release
    Finished `release` profile [optimized] target(s) in 0.04s
   Compiling soroban-token-contract v0.0.6 (/Users/chadoh/code/s/jsdk/test/e2e/test-contracts/contracts/token)
error[E0152]: duplicate lang item in crate `soroban_sdk` (which `soroban_token_sdk` depends on): `panic_impl`.
  |
  = note: the lang item is first defined in crate `soroban_sdk` (which `soroban_token_contract` depends on)
  = note: first definition in `soroban_sdk` loaded from /Users/chadoh/code/s/jsdk/test/e2e/test-contracts/target/wasm32-unknown-unknown/release/deps/libsoroban_sdk-6a9b2044ff704ebd.rlib
  = note: second definition in `soroban_sdk` loaded from /Users/chadoh/code/s/jsdk/test/e2e/test-contracts/target/wasm32-unknown-unknown/release/deps/libsoroban_sdk-f4651df86ac6e5de.rlib, /Users/chadoh/code/s/jsdk/test/e2e/test-contracts/target/wasm32-unknown-unknown/release/deps/libsoroban_sdk-f4651df86ac6e5de.rmeta

Is there a workaround?

Downgrade token contract's soroban-token-sdk dependency to match workspace soroban-sdk version.

  • in ohno/contracts/token/Cargo.toml => soroban-token-sdk has version "21.2.0"
  • in ohno/Cargo.toml => soroban-sdk has version "20.3.2"

The examples were updated to use 21.x here:

Now contract init uses an out-of-date Cargo.toml.

I tried updating the root workspace's soroban-sdk version to 21.4.0 and ended up with irresolvable ed25519-dalek dependency resolution 🤔

What should we do?

We could fix this the easy way, updating the Cargo.toml to use the updated soroban-sdk version. I say this is easy in the hopes that I made some dumb mistake with that ed25519-dalek dependency resolution issue 😅

I wonder if it would be better to also add soroban-token-sdk to the root workspace dependencies, so that we can update packages to use soroban-token-sdk = { workspace = true }, in addition to inheriting soroban-sdk from the workspace.

@chadoh chadoh added the bug Something isn't working label Jul 29, 2024
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Jul 29, 2024
@chadoh chadoh moved this from Backlog (Not Ready) to Todo (Ready for Dev) in DevX Jul 29, 2024
@leighmcculloch
Copy link
Member

leighmcculloch commented Jul 29, 2024

I tried updating the root workspace's soroban-sdk version to 21.4.0 and ended up with irresolvable ed25519-dalek dependency resolution 🤔

Cargo isn't always able to automatically resolve all dependencies when dependencies get updated. Running cargo update soroban-token-sdk updates the dependencies appropriately and it builds fine.

@leighmcculloch leighmcculloch self-assigned this Jul 29, 2024
@leighmcculloch leighmcculloch moved this from Todo (Ready for Dev) to In Progress in DevX Jul 30, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in DevX Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants