soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

`contract init` is broken and test coverage needed

Open Ifropc opened this issue 6 months ago • 0 comments

What version are you using?

Latest (aba5bdd)

What did you do?

Run contract init and then try to build all contracts

What did you see instead?

  1. "Broken" examples hierarchy. When cloning multi-dir contracts (e.g. cross_contract) it results into error message on init Error reading Cargo.toml file in: "test-dir/contracts/cross_contract"error: Io error: No such file or directory (os error 2) (trying to read Cargo.toml from parent instead of children)
  2. Trying to build multi-dir contracts will also fail, because in template we have members defined as
members = [
  "contracts/*", # Should be contracts/cross_contract/contract_a
] 
  1. Links to dependent contracts are also broken. If I clone atomic_swap + amotic_mulsitwap I need to build atomic_swap first (which is not an issue) and it works cargo run contract build --manifest-path test_2/contracts/atomic_swap/Cargo.toml --out-dir ~/wasm/ But when I try to build atomic_multiswap (which depends on atomic_swap) I get an issue with file not found. It references contract assuming it's located in atomic_swap target's dir, while in fact it's now a multi-workspace environment and target dir is not in a workspace root anymore (it's in parent's WS root) So I need to go into the source code and change it. (../../atomic_swap/target/... -> ../../target/... )

Please add test coverage after fixing this issue

Ifropc avatar Aug 01 '24 23:08 Ifropc