Skip to content

Commit

Permalink
Separate contracts (#468)
Browse files Browse the repository at this point in the history
* separate contracts

* Remove contracts from top level toml

* Update comment

* fix ci wasm build

* We don't have cw20 wasm

* update makefile

* deps fixes

* generate lockfile in contracts-ws
  • Loading branch information
Buckram123 authored Aug 19, 2024
1 parent 388dc29 commit 5b167ac
Show file tree
Hide file tree
Showing 41 changed files with 50 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Generate Cargo.lock
run: |
cargo fetch --verbose
(cd contracts-ws && cargo fetch --verbose)
- name: Build Artifacts
run: |
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/contracts-ws/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/optimizer:0.16.0
cosmwasm/optimizer:0.16.0 ./contracts-ws
tar -zcvf cosmwasm-artifacts.tar.gz artifacts
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ members = [
# "packages/clone-testing",
# "packages/cw-orch-osmosis-test-tube",
"packages/cw-orch-traits",
"contracts/*",
"test_contracts/*",
"packages/macros/*",
"packages/interchain/*",
Expand Down
8 changes: 4 additions & 4 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
877962e071ee6213cb42e93c8b08d7a706c603ffbfb6c0f4141210ce2fa257ab counter_contract.wasm
4cf7e489c29fe736f1a7d6903019bc76053c0531caad5c5d5f6c1783452336e2 cw_orch_compatibility_test.wasm
1404ed74888640c4c7a422a5e436cf6d46d5252add3f12905ee499057f6f4c87 mock_contract.wasm
f39c5344861fc07a0aeb074c962f5b1ac413c7afb2749a4d6cbae487bc7f2fab mock_contract_u64.wasm
cc02664dc02c571fd0e4bb02061b737571a510a6a4ac01f8cc783545bec6fff4 counter_contract.wasm
a266c5ab0ffdf78b3aee593d07d3c822fa3c2745bc7bc8210e49860439d65a73 cw_orch_compatibility_test.wasm
0dc79fb31e732310554a07881cfe8a193c068d2f93539356817e5aaf551650dd mock_contract.wasm
08d65b781d7357a6777c836229d971b6c87a5fdfc7cba9806ed508f917859f08 mock_contract_u64.wasm
3 changes: 0 additions & 3 deletions artifacts/checksums_intermediate.txt

This file was deleted.

Binary file modified artifacts/counter_contract.wasm
Binary file not shown.
Binary file modified artifacts/cw_orch_compatibility_test.wasm
Binary file not shown.
Binary file modified artifacts/mock_contract.wasm
Binary file not shown.
Binary file modified artifacts/mock_contract_u64.wasm
Binary file not shown.
25 changes: 25 additions & 0 deletions contracts-ws/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[workspace]

members = ["contracts/*"]

resolver = "2"

[workspace.package]
edition = "2021"

[workspace.dependencies]
cosmwasm-std = "2.0.0"
cw20 = { package = "abstract-cw20", version = "2.0.0" }
cw20-base = { package = "abstract-cw20-base", version = "2.0.0" }
cw-storage-plus = { version = "2.0.0" }

serde = { version = "1.0.103", default-features = false, features = ["derive"] }
anyhow = "1.0"
log = "0.4.14"

cw-orch = { version = "0.25.0" }
cw-orch-interchain = { version = "0.4.0" }

[patch.crates-io]
cw-orch = { path = "../cw-orch" }
cw-orch-interchain = { path = "../cw-orch-interchain" }
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ name = "deploy"
# Deps for deployment
dotenv = { version = "0.15.0" }
pretty_env_logger = { version = "0.5.0" }
cw-orch = { path = "../../cw-orch", features = ["daemon"] }
# cw-orch-osmosis-test-tube = { workspace = true }
cw-orch = { workspace = true, features = ["daemon"] }
anyhow = { workspace = true }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn checksum() {
use std::io::{self, BufRead};
use std::path::Path;

let path = Path::new("../../artifacts/checksums.txt");
let path = Path::new("../../../artifacts/checksums.txt");
let file = File::open(path).unwrap();
let lines = io::BufReader::new(file).lines();
let mut found = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ schemars = "0.8.10"
serde_json = "1.0.79"
thiserror = { version = "1.0.21" }
cosmwasm-schema = "1.2"
cw-orch = { path = "../../cw-orch" }
cw-orch = { workspace = true }
cw-storage-plus = { workspace = true }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ schemars = "0.8.10"
serde_json = "1.0.79"
thiserror = { version = "1.0.21" }
cosmwasm-schema = "1.2"
cw-orch = { path = "../../cw-orch" }
cw-orch = { workspace = true }

mock-contract = { path = "../mock_contract" }
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cw-orch-daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ cosmwasm-schema = "1.2"
speculoos = "0.11.0"
ctor = "0.2.0"
duct = "0.13"
mock-contract = { path = "../contracts/mock_contract", features = [
mock-contract = { path = "../contracts-ws/contracts/mock_contract", features = [
"interface",
] }
serial_test = { version = "3.0.0" }
Expand All @@ -99,6 +99,6 @@ tokio-test = "0.4.3"

# File lock test
nix = { version = "0.28.0", features = ["process"] }
counter-contract = { path = "../contracts/counter" }
counter-contract = { path = "../contracts-ws/contracts/counter" }
dotenv = "0.15.0"
pretty_env_logger = "0.5.0"
6 changes: 3 additions & 3 deletions cw-orch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ cw-orch-mock = { workspace = true }
cw-orch = { features = ["daemon", "snapshot-testing"], path = "." }
env_logger = "0.11.2"
cosmwasm-schema = "1.2"
counter-contract = { path = "../contracts/counter" }
mock-contract = { path = "../contracts/mock_contract" }
mock-contract-u64 = { path = "../contracts/mock_contract_u64" }
counter-contract = { path = "../contracts-ws/contracts/counter" }
mock-contract = { path = "../contracts-ws/contracts/mock_contract" }
mock-contract-u64 = { path = "../contracts-ws/contracts/mock_contract_u64" }
serde_json = { workspace = true }
dotenv = "0.15.0"
osmosis-std = "0.25.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/clone-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ cw20 = { workspace = true }
cw20-base = { workspace = true }

env_logger = "0.10.0"
counter-contract = { path = "../../contracts/counter" }
counter-contract = { path = "../../contracts-ws/contracts/counter" }
cw-orch = { path = "../../cw-orch", features = ["daemon"] }
pretty_env_logger = "0.5.0"
6 changes: 1 addition & 5 deletions packages/clone-testing/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,6 @@ impl BankSetter for CloneTesting {

#[cfg(test)]
mod test {
use std::{path::PathBuf, str::FromStr};

use crate::core::*;
use clone_cw_multi_test::LOCAL_RUST_CODE_OFFSET;
use cosmwasm_std::{
Expand Down Expand Up @@ -518,9 +516,7 @@ mod test {
}
impl Uploadable for MockCw20 {
fn wasm(_chain: &ChainInfoOwned) -> WasmPath {
let path = PathBuf::from_str(env!("CARGO_MANIFEST_DIR")).unwrap();
let path = path.join("../../artifacts/cw20_base.wasm");
WasmPath::new(path).unwrap()
unimplemented!()
}

fn wrapper() -> Box<dyn MockContract<Empty, Empty>> {
Expand Down
2 changes: 1 addition & 1 deletion packages/cw-orch-mock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ speculoos = { workspace = true }
cw20 = { version = "2.0.0" }
cw20-base = { version = "2.0.0" }

mock-contract = { path = "../../contracts/mock_contract" }
mock-contract = { path = "../../contracts-ws/contracts/mock_contract" }
anyhow = { workspace = true }
2 changes: 1 addition & 1 deletion packages/cw-orch-osmosis-test-tube/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cw-orch-mock = { workspace = true }
cw-orch-traits = { workspace = true }

[dev-dependencies]
counter-contract = { path = "../../contracts/counter" }
counter-contract = { path = "../../contracts-ws/contracts/counter" }
env_logger = "0.11.3"

cw-orch = { workspace = true }
2 changes: 1 addition & 1 deletion packages/interchain/interchain-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tokio = "1.32.0"
tonic = { workspace = true, features = ["tls", "tls-roots"] }

[dev-dependencies]
counter-contract = { path = "../../../contracts/counter" }
counter-contract = { path = "../../../contracts-ws/contracts/counter" }
cw-orch-interchain = { path = "../../../cw-orch-interchain", features = [
"daemon",
] }
Expand Down
2 changes: 1 addition & 1 deletion packages/interchain/starship/starship/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ setup-helm:
starship setup

install:
starship start --helmFile $(FILE)
starship start --config $(FILE)

install-tiny:
$(MAKE) install FILE=$(TINY_FILE)
Expand Down
2 changes: 1 addition & 1 deletion test_contracts/compatibility-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ serde = { workspace = true }
schemars = "0.8.10"
serde_json = "1.0.79"
thiserror = { version = "1.0.21" }
cosmwasm-schema = "1.2"
cosmwasm-schema = "2.0"
# This version should not be a path dependency and be kept to the last cw-orch version (beyond v0.23)
# Keeping a different package until v0.23 to avoid package conflicts
cw-orch = { package = "aaa-test-cw-orch", version = "0.25" }
Expand Down
4 changes: 2 additions & 2 deletions wasm_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ fi

# Optimized builds
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/contracts-ws/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
${image}
${image} ./contracts-ws

0 comments on commit 5b167ac

Please sign in to comment.