Skip to content

Commit e47a2fe

Browse files
Osmosis DevNet setup, XCVM config/events refactoring, Nix improvements (#3951)
Generally, ensure that setup of storage is easy to do and full of data to do all possible routing (like Osmosis does, but more general in all directions and solvers), and using that setup against Osmosis. So uploaded contracts to Osmosis and initialized. - separate devnet for cosmos only for faster dev - aligned config/folders/messages/transports of xcvm on whole stack - made data folder of dotsama devnet same as cosmos (/tmp/composable-devnet/) - updated XCVM spec as per latest state - added into language, not implemented yet, swap instruction to XCVM named and modelled with parity XCM (will work on parity, picasso, osmosis, problem solver) - tests for assets not compiled, mostly useless and simplistic - removed instead of fixing (tests will be in DevNet directly via bash) - generated schema for xcvm - fixed nix docs/examples to ensure people run properly nix with all parameters - fixed memo handling (again, had to cp paste some code hashedone/serde-cw-value#3) and its integration with centauri (now they cannot handle wasm, so it skips it ) - disable run of CI in hash tag (i do not want to spam people) - renamed Multihop XCM IBC some struct as per previos request of @RustNinja - updated cosmos.nix deps to latest centauri - clean up of nix and speed ups builds of nix Required for merge: - [x] `pr-workflow-check / draft-release-check` is ✅ success - Other rules GitHub shows you, or can be read in [configuration](../terraform/github.com/branches.tf) Makes review faster: - [x] PR title is my best effort to provide summary of changes and has clear text to be part of release notes - [x] I marked PR by `misc` label if it should not be in release notes - [x] Linked Zenhub/Github/Slack/etc reference if one exists https://github.com/ComposableFi/research/issues/249 https://github.com/ComposableFi/research/issues/244 - [x] I was clear on what type of deployment required to release my changes (node, runtime, contract, indexer, on chain operation, frontend, infrastructure) if any in PR title or description - [x] Added reviewer into `Reviewers` - [x] I tagged(`@`) or used other form of notification of one person who I think can handle best review of this PR - [x] I have proved that PR has no general regressions of relevant features and processes required to release into production - [x] Any dependency updates made, was done according guides from relevant dependency - Clicking all checkboxes - Adding detailed description of changes when it feels appropriate (for example when PR is big) ![image](https://github.com/ComposableFi/composable/assets/757125/8fbcc4fb-ba2a-49f1-9bb9-7c5f258758e7)
1 parent c2b7cc4 commit e47a2fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+4471
-1045
lines changed

.github/workflows/pr-workflow-check.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414

1515
jobs:
1616
pr-workflow-check:
17+
if: ${{ !contains('#WIP', github.event.pull_request.title) && !contains('#wip', github.event.pull_request.title) }}
1718
uses: ./.github/workflows/pr-workflow.yml
1819
with:
1920
github_event_name: ${{ github.event_name }}

.github/workflows/pull-request-comments.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ jobs:
2424
2525
```shell
2626
# run Composable node
27-
nix run "github:ComposableFi/composable/${{ github.ref }}" --allow-import-from-derivation --print-build-logs --option sandbox relaxed --show-trace --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config
27+
nix run "github:ComposableFi/composable/${{ github.ref }}" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed
2828
````
2929
3030
```shell
3131
# run local Picasso DevNet (for CosmWasm development)
32-
nix run "github:ComposableFi/composable/${{ github.ref }}#devnet-picasso" --allow-import-from-derivation --print-build-logs --option sandbox relaxed --show-trace --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config
32+
nix run "github:ComposableFi/composable/${{ github.ref }}#devnet-picasso" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed
3333
```
3434
3535
```shell
3636
# CosmWasm on Substrate CLI tool
37-
nix run "github:ComposableFi/composable/${{ github.ref }}#ccw" --allow-import-from-derivation --print-build-logs --option sandbox relaxed --show-trace --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config
37+
nix run "github:ComposableFi/composable/${{ github.ref }}#ccw" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed
3838
```
3939
4040
```shell
4141
# run cross chain devnet with Dotsama and Cosmos nodes
42-
nix run "github:ComposableFi/composable/${{ github.ref }}#devnet-xc-fresh" --allow-import-from-derivation --print-build-logs --option sandbox relaxed --show-trace --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config
42+
nix run "github:ComposableFi/composable/${{ github.ref }}#devnet-xc-fresh" --allow-import-from-derivation --extra-experimental-features "flakes nix-command" --no-sandbox --accept-flake-config --option sandbox relaxed
4343
```
4444
4545
[About nix](https://docs.composable.finance/nix.html)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN usermod --append --groups sudo ${USER} --shell /bin/bash && \
2323
sed --in-place 's/%sudo.*ALL/%sudo ALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers
2424

2525
RUN mkdir --parents /etc/nix/ && \
26-
echo "sandbox = false" >> /etc/nix/nix.conf && \
26+
echo "sandbox = relaxed" >> /etc/nix/nix.conf && \
2727
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf && \
2828
echo "narinfo-cache-negative-ttl = 30" >> /etc/nix/nix.conf && \
2929
echo "trusted-users = root vscode" >> /etc/nix/nix.conf && \

code/Cargo.lock

Lines changed: 8 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

code/Cargo.toml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ pallet-xcm = { git = "https://github.com/paritytech/polkadot", rev = "c22e1c4173
134134
log = { version = "0.4.14", default-features = false }
135135

136136
ibc-rs-scale = { package = "ibc", git = "https://github.com/dzmitry-lahoda-forks/ibc-rs.git", rev = "c305fb9a7f3750e6daa0d9aefa84d53d64cd4fee", default-features = false }
137+
ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", rev = "af385af", default-features = false }
138+
137139
democracy = { package = "pallet-democracy", git = "https://github.com/ComposableFi/substrate", rev = "c74d73bfe1e4f725b3f7d81c997ba9c940bf6005", default-features = false }
138140
executive = { package = "frame-executive", git = "https://github.com/ComposableFi/substrate", rev = "c74d73bfe1e4f725b3f7d81c997ba9c940bf6005", default-features = false }
139141
indices = { package = "pallet-indices", git = "https://github.com/ComposableFi/substrate", rev = "c74d73bfe1e4f725b3f7d81c997ba9c940bf6005", default-features = false }
@@ -333,8 +335,10 @@ scale-info = { version = "2.1.1", default-features = false, features = [
333335

334336
schemars = { version = "0.8.12", default-feautes = false }
335337

336-
prost = {version = "0.11.0", default-features = false, features = ["prost-derive"]}
337-
prost-types = {version = "0.11.1", default-features = false}
338+
prost = { version = "0.11.0", default-features = false, features = [
339+
"prost-derive",
340+
] }
341+
prost-types = { version = "0.11.1", default-features = false }
338342
prost-build = "0.11.9"
339343

340344

@@ -351,12 +355,17 @@ cosmwasm-vm = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "1cc4
351355
cosmwasm-vm-wasmi = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "1cc47415577d67448ff483ad530b889cceafde77", default-features = false }
352356
cosmwasm-orchestrate = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "1cc47415577d67448ff483ad530b889cceafde77" }
353357
serde-json-wasm = { git = "https://github.com/dzmitry-lahoda-forks/serde-json-wasm", rev = "8a7e522c0e4de36a6dfb535766f26a9941017d81", default-features = false }
354-
serde-cw-value = { git = "https://github.com/dzmitry-lahoda-forks/serde-cw-value", rev = "fe16466caee886908645de5a8e0518dbac6d98df", default-features = false }
358+
serde-cw-value = { git = "https://github.com/dzmitry-lahoda-forks/serde-cw-value", rev = "b91ac6d797fd24c00758ad3995a55dc820279595", default-features = false }
355359
cw-storage-plus = { git = "https://github.com/dzmitry-lahoda-forks/cw-storage-plus", rev = "d0a2cf126cae3e3960c787ebcfc9baa54f59f71c", default-features = false }
356-
cosmwasm-schema = { git = "https://github.com/dzmitry-lahoda-forks/cosmwasm", rev = "1277597cbf380a8d04dbe676d9cb344ca31634b6", default-features = false}
357-
cw-utils = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", default-features = false}
358-
cw20 = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", default-features = false, features = ["std"]}
359-
cw20-base = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", features = ["library"]}
360+
cosmwasm-schema = { git = "https://github.com/dzmitry-lahoda-forks/cosmwasm", rev = "1277597cbf380a8d04dbe676d9cb344ca31634b6", default-features = false }
361+
362+
cw-utils = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", default-features = false }
363+
cw20 = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", default-features = false, features = [
364+
"std",
365+
] }
366+
cw20-base = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", features = [
367+
"library",
368+
] }
360369

361370
derive_more = { version = "1.0.0-beta.2", default-features = false, features = ["full"] }
362371
hex = { version = "0.4.3", default-features = false, features = [
@@ -369,7 +378,7 @@ cosmwasm-std = { git = "https://github.com/dzmitry-lahoda-forks/cosmwasm", rev =
369378
"iterator",
370379
"cosmwasm_1_2",
371380
] }
372-
cw2 = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", default-features = false}
381+
cw2 = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", default-features = false }
373382

374383
serde = { version = '1.0.136', default-features = false, features = ["derive"] }
375384

code/composable-nodes.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
cargoBuildCommand = "cargo build --release --package ${name}";
3030
cargoExtraArgs = "--features=builtin-wasm";
3131
CW_XC_GATEWAY_WASM_PATH =
32-
"${self'.packages.xcvm-contracts}/lib/cw_xc_gateway.wasm";
32+
"${self'.packages.xc-cw-contracts}/lib/cw_xc_gateway.wasm";
3333
CW_XC_INTERPRETER_WASM_PATH =
34-
"${self'.packages.xcvm-contracts}/lib/cw_xc_interpreter.wasm";
34+
"${self'.packages.xc-cw-contracts}/lib/cw_xc_interpreter.wasm";
35+
CW_20_BASE_WASM_PATH = self'.packages.cw20_base;
3536
PICASSO_RUNTIME = "${picasso-runtime}/lib/runtime.optimized.wasm";
3637
COMPOSABLE_RUNTIME =
3738
"${composable-runtime}/lib/runtime.optimized.wasm";

code/parachain/frame/composable-traits/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bech32-no_std = { workspace = true, default-features = false, features = [
2424
] }
2525
bitflags = "1.3.2"
2626
composable-support = { default-features = false, path = "../composable-support" }
27-
xc-core = { default-features = false, path = "../../../xcvm/lib/core" }
27+
xc-core = { default-features = false, path = "../../../xcvm/lib/core"}
2828
plotters = { version = "0.3.1", optional = true }
2929
scale-info = { version = "2.1.1", default-features = false, features = [
3030
"derive",
@@ -43,7 +43,7 @@ sha2 = { workspace = true, default-features = false }
4343

4444
schemars = { optional = true, workspace = true, default-features = false }
4545

46-
cosmwasm-schema = { workspace = true, default-features = false, optional = true}
46+
cosmwasm-schema = { workspace = true, default-features = false, optional = true }
4747

4848
thiserror = { workspace = true, default-features = false }
4949

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
//! mapping of proper CW/Cosmos enabled types to Centauri
22
33
use crate::prelude::*;
4-
use xc_core::ibc::ics20::MemoData;
4+
use xc_core::transport::ibc::ics20::Memo;
55

66
pub struct Map;
77
impl Map {
8-
pub fn from_cw(mut value: MemoData) -> pallet_ibc::ics20::MemoData {
9-
let next = value.forward.next.take().map(|e| Box::new(Map::from_cw(*e)));
10-
let value = value.forward;
11-
let forward = pallet_ibc::ics20::Forward {
12-
receiver: value.receiver,
13-
port: value.port.map(|x| x.to_string()),
14-
channel: value.channel.map(|x| x.to_string()),
15-
timeout: value.timeout,
16-
retries: value.retries.map(Into::into),
17-
para_id: value.substrate.and_then(|x| x.para_id),
18-
substrate: value.substrate.map(|_| true),
19-
next,
20-
};
8+
pub fn try_from_xc_memo(value: Memo) -> Option<pallet_ibc::ics20::MemoData> {
9+
value.forward.map(|value| {
10+
let next: Option<Box<pallet_ibc::ics20::MemoData>> =
11+
value.next.and_then(|e| Map::try_from_xc_memo(*e)).map(Box::new);
12+
let forward = pallet_ibc::ics20::Forward {
13+
receiver: value.receiver,
14+
port: value.port.map(|x| x.to_string()),
15+
channel: value.channel.map(|x| x.to_string()),
16+
timeout: value.timeout,
17+
retries: value.retries.map(Into::into),
18+
para_id: value.substrate.and_then(|x| x.para_id),
19+
substrate: Some(value.substrate.is_some()),
20+
next,
21+
};
2122

22-
pallet_ibc::ics20::MemoData { forward }
23+
pallet_ibc::ics20::MemoData { forward }
24+
})
2325
}
2426
}

code/parachain/frame/pallet-multihop-xcm-ibc/src/lib.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ pub mod pallet {
4949
use ibc_primitives::Timeout as IbcTimeout;
5050
use ibc_rs_scale::core::ics24_host::identifier::{ChannelId, PortId};
5151
use pallet_ibc::{MultiAddress, TransferParams};
52-
use xc_core::ibc::ics20::{
53-
pfm::{Forward, IbcSubstrate},
54-
MemoData,
52+
use xc_core::transport::ibc::ics20::{
53+
pfm::{ForwardingMemo, XcmHop},
54+
Memo,
5555
};
5656
use xcm::latest::prelude::*;
5757

@@ -331,20 +331,20 @@ pub mod pallet {
331331
/// Return Ok(None) if `list_chain_name_address` is empty
332332
pub fn create_memo(
333333
mut list_chain_name_address: ListChainNameAddress,
334-
) -> Result<Option<MemoData>, DispatchError> {
334+
) -> Result<Option<Memo>, DispatchError> {
335335
list_chain_name_address.reverse(); // reverse to create memo from the end
336336

337337
//osmosis(ibc) <- huahua(ibc) <- centauri(ibc) = ibc transfer from composable to
338338
//picasso with memo substrate(xcm) hop can be only the last one
339339
//moonriver(xcm) = ibc transfer from composable to picasso
340340
//polkadot(xcm) = ibc transfer from picasso to composable
341341

342-
let mut last_memo_data: Option<MemoData> = None;
342+
let mut last_memo_data: Option<Memo> = None;
343343

344344
for (i, name, address) in list_chain_name_address {
345345
let mut forward = if i.chain_hop == ChainHop::Xcm {
346346
let memo_receiver = scale_info::prelude::format!("0x{}", hex::encode(address));
347-
Forward::new_xcm_memo(memo_receiver, IbcSubstrate::new(i.para_id))
347+
ForwardingMemo::new_xcm_memo(memo_receiver, XcmHop::new(i.para_id))
348348
} else {
349349
let memo_receiver = if i.chain_hop == ChainHop::SubstrateIbc {
350350
scale_info::prelude::format!("0x{}", hex::encode(address))
@@ -368,7 +368,7 @@ pub mod pallet {
368368
})?
369369
};
370370

371-
Forward::new_ibc_memo(
371+
ForwardingMemo::new_ibc_memo(
372372
memo_receiver,
373373
PortId::transfer(),
374374
ChannelId::new(i.channel_id),
@@ -379,7 +379,7 @@ pub mod pallet {
379379
if let Some(memo_memo) = last_memo_data {
380380
forward.next = Some(Box::new(memo_memo));
381381
};
382-
let new_memo = MemoData::forward(forward);
382+
let new_memo = Memo::forward(forward);
383383
last_memo_data = Some(new_memo);
384384
}
385385
Ok(last_memo_data)
@@ -684,8 +684,9 @@ pub mod pallet {
684684
return None;
685685
};
686686
if let Some(memo_data) = memo_data {
687-
let memo_result =
688-
<T as pallet_ibc::Config>::MemoMessage::try_from(Map::from_cw(memo_data));
687+
let memo_result = <T as pallet_ibc::Config>::MemoMessage::try_from(
688+
Map::try_from_xc_memo(memo_data)?,
689+
);
689690

690691
let Ok(memo_result) = memo_result else{
691692
<Pallet<T>>::deposit_event(crate::Event::<T>::FailedCallback {

code/parachain/frame/vesting/cli/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use sp_core::{ConstU32};
1+
use sp_core::ConstU32;
22
use sp_runtime::BoundedBTreeMap;
33
use subxt::utils::AccountId32;
44

0 commit comments

Comments
 (0)