Skip to content
This repository was archived by the owner on Aug 14, 2022. It is now read-only.
This repository was archived by the owner on Aug 14, 2022. It is now read-only.

Support Cargo workspace with multiple contracts #26

@h3xag0nx

Description

@h3xag0nx

Let say I have 2 or more contracts, as

├── config.terrain.json
├── contracts
│   ├── contract-a
│   │   ├── Cargo.toml
│   │   ...
│   └── contract-b
│       ├── Cargo.toml

Terrain can deploy both contracts with no issue.
But when I define a workspace using root level Cargo.toml:

[workspace]
members = [ "contracts/*" ]

cargo build work fine but terrain cannot deploy because of the failure of the optimize script

Running script 'optimize': 'docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/rust-optimizer:0.12.3
'
Info: RUSTC_WRAPPER=sccache
Info: sccache stats before build
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/root/.cache/sccache"
Cache size                            0 bytes
Max cache size                       10 GiB
Building contract in /code ...
    Updating crates.io index
error: the lock file /code/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.
Finished, status of exit status: 101

I skimmed the rust-optimizer doc and find out that in this case optimze should be ran through workspace-optimizer container, as described here

Please show me how to change it with terrain or support this feature if it not available yet. Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions