diff --git a/.github/workflows/pr-workflow.yml b/.github/workflows/pr-workflow.yml index 02e10a625ef..4809bdd15d0 100644 --- a/.github/workflows/pr-workflow.yml +++ b/.github/workflows/pr-workflow.yml @@ -213,6 +213,38 @@ jobs: - id: ok run: echo "ok=true" >> "$GITHUB_OUTPUT" + build-cosmos-cosmwasm: + outputs: + ok: ${{ steps.ok.outputs.ok }} + name: build-cosmos-cosmwasm + needs: + - privilege-check + runs-on: + - x86_64-linux-32C-128GB-2TB + concurrency: + group: ${{ inputs.github_workflow }}-build-cosmos-cosmwasm-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + steps: + - name: Set up Cachix + if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }} + uses: cachix/cachix-action@586bf280495080c5a6d4868237ad28a860e4b309 + with: + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + name: composable-community + - uses: actions/checkout@v3 + if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }} + with: + lfs: true + ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }} + persist-credentials: false + - name: Build all packages + if: ${{ inputs.flow == 'push' || inputs.flow == 'pr_from_branch' }} + uses: "./.github/templates/watch-exec" + with: + command: nix -- build .#xcvm-tests --keep-going + - id: ok + run: echo "ok=true" >> "$GITHUB_OUTPUT" + build-all-ci-packages: name: build-all-ci-packages outputs: @@ -520,7 +552,6 @@ jobs: files: | release-artifacts/to-upload/* - # this should be split and commit docker are from here, but latest from release push-docker-images: name: push-docker-images if: ${{ inputs.github_event_name == 'push' || (inputs.github_event_name == 'pull_request' && inputs.github_event_pull_request_head_repo_id == 383289760) }} @@ -559,11 +590,6 @@ jobs: lfs: true ref: ${{ inputs.github_event_pull_request_head_sha || github.sha }} persist-credentials: false - - name: Nix flake show - run: | - nix --version - nix show-config - nix flake show --allow-import-from-derivation --show-trace --fallback --debug --print-build-logs --keep-failed - name: Build all packages uses: "./.github/templates/watch-exec" with: diff --git a/code/Cargo.lock b/code/Cargo.lock index 1704ed4ee95..d3e2e348bbe 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -2149,10 +2149,22 @@ dependencies = [ "memchr", ] +[[package]] +name = "cosmwasm-crypto" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" +dependencies = [ + "digest 0.10.6", + "ed25519-zebra", + "k256", + "rand_core 0.6.4", + "thiserror", +] + [[package]] name = "cosmwasm-derive" -version = "1.2.0" -source = "git+https://github.com/ComposableFi/cosmwasm?rev=34af48221c90e6818fe341d6d5b15116dfeab671#34af48221c90e6818fe341d6d5b15116dfeab671" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" dependencies = [ "syn 1.0.109", ] @@ -2182,22 +2194,27 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.2.0" -source = "git+https://github.com/ComposableFi/cosmwasm?rev=34af48221c90e6818fe341d6d5b15116dfeab671#34af48221c90e6818fe341d6d5b15116dfeab671" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" dependencies = [ "base64 0.13.1", + "cosmwasm-crypto", "cosmwasm-derive", "derivative", + "forward_ref", "hex", + "schemars", "serde", + "serde-json-wasm", "sha2 0.10.6", + "thiserror-core", "uint", ] [[package]] name = "cosmwasm-vm" -version = "0.1.0" -source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=c2a4fe2c764710c0db15c571135bc37619a289d5#c2a4fe2c764710c0db15c571135bc37619a289d5" +version = "0.2.0" +source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9#71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" dependencies = [ "cosmwasm-std", "log 0.4.17", @@ -2208,8 +2225,8 @@ dependencies = [ [[package]] name = "cosmwasm-vm-wasmi" -version = "0.1.0" -source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=c2a4fe2c764710c0db15c571135bc37619a289d5#c2a4fe2c764710c0db15c571135bc37619a289d5" +version = "0.2.0" +source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9#71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" dependencies = [ "cosmwasm-std", "cosmwasm-vm", @@ -2218,8 +2235,8 @@ dependencies = [ "log 0.4.17", "serde", "serde_json", - "wasm-instrument 0.2.0", - "wasmi 0.26.1", + "wasm-instrument 0.4.0", + "wasmi 0.30.0", "wasmi-validation", ] @@ -3121,7 +3138,7 @@ checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" name = "cw-dex-router" version = "0.1.0" dependencies = [ - "cosmwasm-vm", + "cosmwasm-std", "serde", "serde_json", ] @@ -3575,6 +3592,7 @@ dependencies = [ "hashbrown 0.12.3", "hex", "rand_core 0.6.4", + "serde", "sha2 0.9.9", "zeroize", ] @@ -4060,6 +4078,12 @@ dependencies = [ "percent-encoding 2.2.0", ] +[[package]] +name = "forward_ref" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" + [[package]] name = "fragile" version = "2.0.0" @@ -5607,6 +5631,12 @@ dependencies = [ "webrtc-util", ] +[[package]] +name = "intx" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" + [[package]] name = "invarch-xcm-builder" version = "0.1.0" @@ -8449,6 +8479,7 @@ dependencies = [ "composable-support", "composable-tests-helpers", "composable-traits", + "cosmwasm-std", "cosmwasm-vm", "cosmwasm-vm-wasmi", "frame-benchmarking", @@ -8484,8 +8515,8 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std 5.0.0", - "wasm-instrument 0.2.0", - "wasmi 0.26.1", + "wasm-instrument 0.4.0", + "wasmi 0.30.0", "wasmi-validation", ] @@ -10046,6 +10077,7 @@ dependencies = [ "composable-support", "composable-traits", "cosmwasm-runtime-api", + "cosmwasm-std", "cosmwasm-vm", "cosmwasm-vm-wasmi", "crowdloan-rewards-runtime-api", @@ -14047,6 +14079,30 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "schemars" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.27", + "serde_derive_internals", + "syn 1.0.109", +] + [[package]] name = "schnellru" version = "0.2.1" @@ -14256,6 +14312,14 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-json-wasm" +version = "0.5.1" +source = "git+https://github.com/dzmitry-lahoda-forks/serde-json-wasm?rev=8a7e522c0e4de36a6dfb535766f26a9941017d81#8a7e522c0e4de36a6dfb535766f26a9941017d81" +dependencies = [ + "serde", +] + [[package]] name = "serde_bytes" version = "0.11.9" @@ -14276,6 +14340,17 @@ dependencies = [ "syn 2.0.15", ] +[[package]] +name = "serde_derive_internals" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.27", + "syn 1.0.109", +] + [[package]] name = "serde_fmt" version = "1.0.3" @@ -16146,6 +16221,26 @@ dependencies = [ "thiserror-impl", ] +[[package]] +name = "thiserror-core" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" +dependencies = [ + "thiserror-core-impl", +] + +[[package]] +name = "thiserror-core-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" +dependencies = [ + "proc-macro2 1.0.56", + "quote 1.0.27", + "syn 1.0.109", +] + [[package]] name = "thiserror-impl" version = "1.0.40" @@ -17318,18 +17413,18 @@ checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb" [[package]] name = "wasm-instrument" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bca81f5279342b38b17d9acbf007a46ddeb73144e2bd5f0a21bfa9fc5d4ab3e" +checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" dependencies = [ "parity-wasm", ] [[package]] name = "wasm-instrument" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" +checksum = "2a47ecb37b9734d1085eaa5ae1a81e60801fd8c28d4cabdd8aedb982021918bc" dependencies = [ "parity-wasm", ] @@ -17403,13 +17498,15 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.26.1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35653e9f82eacc22583f303fa34f4c2d4efdee6521e70b46b6ca4c68c0e432d8" +checksum = "e51fb5c61993e71158abf5bb863df2674ca3ec39ed6471c64f07aeaf751d67b4" dependencies = [ + "intx", + "smallvec 1.10.0", "spin 0.9.8", "wasmi_arena", - "wasmi_core 0.11.0", + "wasmi_core 0.12.0", "wasmparser-nostd", ] @@ -17444,9 +17541,9 @@ dependencies = [ [[package]] name = "wasmi_core" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2bde97906bbc49ad61184db16e5c905e946e747f6febd09b583fc321d70af0" +checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" dependencies = [ "downcast-rs", "libm 0.2.6", diff --git a/code/Cargo.toml b/code/Cargo.toml index 88b90a99f68..e0974e19bbe 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -323,25 +323,25 @@ subxt = { git = "https://github.com/paritytech/subxt", rev = "2a913a3aa99a07f7ac # Only needed until the configs get merged into xcm-builder: https://github.com/paritytech/polkadot/pull/7165 invarch-xcm-builder = { git = "https://github.com/InvArch/InvArch-XCM-Builder", rev = "c704c0f2d4c436f96eff10d06c197527b46b3536", default-features = false } +wasm-instrument = { version = "0.4.0", default-features = false } +wasmi = { version = "0.30.0", default-features = false } +wasmi-validation = { version = "0.5", default-features = false } -cosmwasm-vm = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "c2a4fe2c764710c0db15c571135bc37619a289d5", default-features = false, features = [ - "ibc3", - "iterator", - "stargate", -] } -cosmwasm-vm-wasmi = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "c2a4fe2c764710c0db15c571135bc37619a289d5", default-features = false, features = [ +cosmwasm-vm = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9", default-features = false } +cosmwasm-vm-wasmi = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9", default-features = false } +serde-json-wasm = { git = "https://github.com/dzmitry-lahoda-forks/serde-json-wasm", rev = "8a7e522c0e4de36a6dfb535766f26a9941017d81", default-features = false } + +cosmwasm-std = { git = "https://github.com/dzmitry-lahoda-forks/cosmwasm", rev = "1277597cbf380a8d04dbe676d9cb344ca31634b6", default-features = false, features = [ "iterator", - "stargate", + "cosmwasm_1_2", ] } - serde = { version = '1.0.136', default-features= false, features = ["derive"] } serde_json = { version = "1.0.82", default-features = false, features = [ "alloc", ] } -serde-json-wasm = { version = "0.5.1", default-features = false } ####################################### # DO NOT DELETE PATCHES, BUT COMMENT OUT diff --git a/code/parachain/frame/cosmwasm/Cargo.toml b/code/parachain/frame/cosmwasm/Cargo.toml index 9e3b58d4bbe..6bdacc528e3 100644 --- a/code/parachain/frame/cosmwasm/Cargo.toml +++ b/code/parachain/frame/cosmwasm/Cargo.toml @@ -5,6 +5,9 @@ homepage = "https://composable.finance" name = "pallet-cosmwasm" version = "1.0.0" +[lib] +doctest = false + [dependencies.codec] default-features = false features = ["derive"] @@ -21,7 +24,15 @@ cosmwasm-vm = { workspace = true, default-features = false, features = [ cosmwasm-vm-wasmi = { workspace = true, default-features = false, features = [ "iterator", "stargate", + "ibc3" ] } + +cosmwasm-std = { workspace = true, default-features = false, features = [ + "ibc3", + "iterator", + "stargate", +] } + frame-benchmarking = { default-features = false, workspace = true, optional = true } frame-support = { default-features = false, workspace = true } frame-system = { default-features = false, workspace = true } @@ -61,9 +72,9 @@ sp-core = { default-features = false, workspace = true } sp-io = { default-features = false, workspace = true } sp-runtime = { default-features = false, workspace = true } sp-std = { default-features = false, workspace = true } -wasm-instrument = { version = "0.2", default-features = false } -wasmi = { version = "0.26", default-features = false } -wasmi-validation = { version = "0.5", default-features = false } +wasm-instrument = { workspace = true, default-features = false } +wasmi = { workspace = true, default-features = false } +wasmi-validation = { workspace = true, default-features = false } [dev-dependencies] composable-tests-helpers = { path = "../composable-tests-helpers", default-features = false } @@ -93,27 +104,40 @@ runtime-benchmarks = [ "pallet-ibc/runtime-benchmarks", "pallet-assets-transactor-router/runtime-benchmarks", "pallet-assets-registry/runtime-benchmarks", + "orml-tokens/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", ] std = [ "codec/std", + "composable-support/std", + "cosmwasm-std/std", + "cosmwasm-vm-wasmi/std", + "cosmwasm-vm/std", + "frame-benchmarking/std", "frame-support/std", "frame-system/std", - "frame-benchmarking/std", - "sp-runtime/std", - "sp-io/std", - "sp-core/std", - "sp-std/std", - "sp-arithmetic/std", - "composable-support/std", - "scale-info/std", - "primitives/std", - "pallet-balances/std", - "sha3/std", "hex/std", - "pallet-ibc/std", + "ibc-primitives/std", "ibc/std", - "pallet-assets-transactor-router/std", - "pallet-assets-registry/std", "orml-tokens/std", - + "pallet-assets-registry/std", + "pallet-assets-transactor-router/std", + "pallet-balances/std", + "pallet-timestamp/std", + "pallet-assets/std", + "pallet-ibc/std", + "primitives/std", + "scale-info/std", + "sha3/std", + "sp-arithmetic/std", + "sp-core/std", + "sp-io/std", + "parity-wasm/std", + "sp-runtime/std", + "sp-std/std", + "wasm-instrument/std", + "wasmi-validation/std", + "wasmi/std" ] diff --git a/code/parachain/frame/cosmwasm/src/benchmarking.rs b/code/parachain/frame/cosmwasm/src/benchmarking.rs index e299d42be73..a7ad89fa92b 100644 --- a/code/parachain/frame/cosmwasm/src/benchmarking.rs +++ b/code/parachain/frame/cosmwasm/src/benchmarking.rs @@ -14,10 +14,8 @@ use alloc::{ borrow::ToOwned, boxed::Box, collections::BTreeMap, format, string::String, vec, vec::Vec, }; use core::cell::SyncUnsafeCell; -use cosmwasm_vm::{ - cosmwasm_std::{Coin, Reply, SubMsgResult}, - system::CosmwasmContractMeta, -}; +use cosmwasm_std::{Coin, Reply, SubMsgResult}; +use cosmwasm_vm::system::CosmwasmContractMeta; use cosmwasm_vm_wasmi::code_gen::{ self, Function, FunctionBuilder, Table, WasmModule, INDEX_OF_USER_DEFINED_FNS, }; @@ -127,7 +125,7 @@ fn create_wasm_module_with_fns( let module = wasmi::Module::new(&engine, wasm_module.code.as_slice()).unwrap(); let mut store = wasmi::Store::new(&engine, ()); - let linker = >::new(); + let linker = >::new(&engine); let instance = linker.instantiate(&mut store, &module).unwrap().start(&mut store).unwrap(); @@ -167,7 +165,7 @@ where let module = wasmi::Module::new(&engine, wasm_module.code.as_slice()).unwrap(); let mut store = wasmi::Store::new(&engine, ()); - let linker = >::new(); + let linker = >::new(&engine); let instance = linker.instantiate(&mut store, &module).unwrap().start(&mut store).unwrap(); diff --git a/code/parachain/frame/cosmwasm/src/dispatchable_call.rs b/code/parachain/frame/cosmwasm/src/dispatchable_call.rs index a26194e9155..e3461016985 100644 --- a/code/parachain/frame/cosmwasm/src/dispatchable_call.rs +++ b/code/parachain/frame/cosmwasm/src/dispatchable_call.rs @@ -6,8 +6,8 @@ use crate::{ }; use alloc::vec::Vec; use core::marker::PhantomData; +use cosmwasm_std::Coin; use cosmwasm_vm::{ - cosmwasm_std::Coin, executor::{cosmwasm_call, AsFunctionName}, system::{ cosmwasm_system_entrypoint_hook, cosmwasm_system_run_hook, CosmwasmCallVM, @@ -60,7 +60,7 @@ impl DispatchableCall { match vm.0.as_context().data().contract_runtime { ContractBackend::CosmWasm { .. } => cosmwasm_call::(vm, message).map(Into::into), - ContractBackend::Pallet => + ContractBackend::Pallet { .. } => T::PalletHook::execute(vm, self.entrypoint, message), } }) @@ -82,8 +82,8 @@ impl DispatchableCall { shared: &mut CosmwasmVMShared, funds: Vec, message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, CosmwasmVMError> + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, CosmwasmVMError> where for<'x> OwnedWasmiVM>: CosmwasmCallVM + CosmwasmDynamicVM + StargateCosmwasmCallVM, @@ -105,7 +105,7 @@ impl DispatchableCall { match vm.0.as_context().data().contract_runtime { ContractBackend::CosmWasm { .. } => cosmwasm_call::(vm, message).map(Into::into), - ContractBackend::Pallet => + ContractBackend::Pallet { .. } => T::PalletHook::execute(vm, self.entrypoint, message), } }) diff --git a/code/parachain/frame/cosmwasm/src/ibc.rs b/code/parachain/frame/cosmwasm/src/ibc.rs index 1c70aa3cc4b..81dac85e1fc 100644 --- a/code/parachain/frame/cosmwasm/src/ibc.rs +++ b/code/parachain/frame/cosmwasm/src/ibc.rs @@ -5,12 +5,13 @@ use crate::{ CodeIdToInfo, Config, Pallet, }; +use cosmwasm_std::{ + Addr, Attribute as CosmwasmEventAttribute, Binary, ContractResult, Event as CosmwasmEvent, + IbcAcknowledgement, IbcChannel, IbcChannelCloseMsg, IbcChannelConnectMsg, IbcEndpoint, + IbcPacket, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcTimeout, +}; + use cosmwasm_vm::{ - cosmwasm_std::{ - Addr, Attribute as CosmwasmEventAttribute, Binary, ContractResult, Event as CosmwasmEvent, - IbcAcknowledgement, IbcChannel, IbcChannelCloseMsg, IbcChannelConnectMsg, IbcEndpoint, - IbcPacket, IbcPacketAckMsg, IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcTimeout, - }, executor::{ cosmwasm_call_serialize, ibc::{ @@ -104,12 +105,12 @@ impl Pallet { vm: &mut DefaultCosmwasmVM, channel_id: String, to_address: String, - amount: cosmwasm_vm::cosmwasm_std::Coin, - timeout: cosmwasm_vm::cosmwasm_std::IbcTimeout, + amount: cosmwasm_std::Coin, + timeout: cosmwasm_std::IbcTimeout, ) -> Result<(), CosmwasmVMError> { let channel_id = ChannelId::from_str(channel_id.as_ref()) .map_err(|_| >::Ibc("channel name is not valid".to_string()))?; - let address: cosmwasm_vm::cosmwasm_std::Addr = vm.contract_address.clone().into(); + let address: cosmwasm_std::Addr = vm.contract_address.clone().into(); let _port_id = PortId::from_str(address.as_str()) .expect("all pallet instanced contract addresses are valid port names; qwe"); @@ -141,8 +142,8 @@ impl Pallet { pub(crate) fn do_ibc_send_packet( vm: &mut DefaultCosmwasmVM, channel_id: String, - data: cosmwasm_vm::cosmwasm_std::Binary, - timeout: cosmwasm_vm::cosmwasm_std::IbcTimeout, + data: cosmwasm_std::Binary, + timeout: cosmwasm_std::IbcTimeout, ) -> Result<(), CosmwasmVMError> { let port_id = PortId::from_str(&Self::do_compute_ibc_contract_port( vm.contract_address.as_ref().clone(), @@ -169,7 +170,7 @@ impl Pallet { ) -> Result<(), CosmwasmVMError> { let channel_id = ChannelId::from_str(channel_id.as_ref()) .map_err(|_| >::Ibc("channel name is not valid".to_string()))?; - let address: cosmwasm_vm::cosmwasm_std::Addr = vm.contract_address.clone().into(); + let address: cosmwasm_std::Addr = vm.contract_address.clone().into(); let port_id = PortId::from_str(address.as_str()) .expect("all pallet instanced contract addresses are valid port names; qwe"); @@ -287,7 +288,7 @@ impl Router { match vm.0.data().contract_runtime { ContractBackend::CosmWasm { .. } => cosmwasm_call_serialize::(&mut vm, message).map_err(Into::into), - ContractBackend::Pallet => { + ContractBackend::Pallet { .. } => { let msg = serde_json::to_vec(&message).map_err(|e| { >::Ibc(format!( "failed to serialize IBC message {:?}", @@ -329,7 +330,7 @@ impl Router { match vm.0.data().contract_runtime { ContractBackend::CosmWasm { .. } => cosmwasm_call_serialize::(vm, message).map(Into::into), - ContractBackend::Pallet => T::PalletHook::execute( + ContractBackend::Pallet { .. } => T::PalletHook::execute( vm, I::ENTRY, serde_json::to_vec(&message) diff --git a/code/parachain/frame/cosmwasm/src/instrument.rs b/code/parachain/frame/cosmwasm/src/instrument.rs index 9c501d02148..9211032b57d 100644 --- a/code/parachain/frame/cosmwasm/src/instrument.rs +++ b/code/parachain/frame/cosmwasm/src/instrument.rs @@ -1,10 +1,11 @@ use crate::{weights::WeightInfo, Config}; use codec::{Decode, Encode}; use core::marker::PhantomData; +use cosmwasm_vm_wasmi::version::{Version, Version1x}; use frame_support::weights::Weight; use parity_wasm::elements::{Instruction, Module}; use scale_info::TypeInfo; -use wasm_instrument::gas_metering::{self, MemoryGrowCost, Rules}; +use wasm_instrument::gas_metering::{self, host_function, MemoryGrowCost, Rules}; pub const INSTRUCTIONS_MULTIPLIER: u32 = 100; @@ -22,15 +23,19 @@ pub enum InstrumentationError { /// Instrument a code for gas metering and stack height limiting. pub fn gas_and_stack_instrumentation( module: Module, - gas_module_name: &str, + _gas_module_name: &str, stack_limit: u32, cost_rules: &impl Rules, ) -> Result { - let gas_instrumented_module = gas_metering::inject(module, cost_rules, gas_module_name) - .map_err(|e| { - log::debug!(target: "runtime::contracts", "gas_and_stack_instrumentation: {:?}", e); - InstrumentationError::GasMeteringInjection - })?; + let gas_instrumented_module = gas_metering::inject( + module, + host_function::Injector::new(Version1x::ENV_MODULE, Version1x::ENV_GAS), + cost_rules, + ) + .map_err(|e| { + log::debug!(target: "runtime::contracts", "gas_and_stack_instrumentation: {:?}", e); + InstrumentationError::GasMeteringInjection + })?; let stack_and_gas_instrumented_module = wasm_instrument::inject_stack_limiter(gas_instrumented_module, stack_limit).map_err( |e| { @@ -339,4 +344,8 @@ impl Rules for CostRules { // GrowMemory is already benchmarked MemoryGrowCost::Free } + + fn call_per_local_cost(&self) -> u32 { + 0 + } } diff --git a/code/parachain/frame/cosmwasm/src/lib.rs b/code/parachain/frame/cosmwasm/src/lib.rs index 6f984ae9465..cdbcd4b0343 100644 --- a/code/parachain/frame/cosmwasm/src/lib.rs +++ b/code/parachain/frame/cosmwasm/src/lib.rs @@ -81,12 +81,12 @@ use alloc::{ string::String, }; use composable_support::abstractions::utils::increment::Increment; +use cosmwasm_std::{ + Addr, Attribute as CosmwasmEventAttribute, Binary as CosmwasmBinary, BlockInfo, + CodeInfoResponse, Coin, ContractInfo as CosmwasmContractInfo, ContractInfoResponse, Env, + Event as CosmwasmEvent, MessageInfo, Timestamp, TransactionInfo, +}; use cosmwasm_vm::{ - cosmwasm_std::{ - Addr, Attribute as CosmwasmEventAttribute, Binary as CosmwasmBinary, BlockInfo, - CodeInfoResponse, Coin, ContractInfo as CosmwasmContractInfo, ContractInfoResponse, Env, - Event as CosmwasmEvent, MessageInfo, Timestamp, TransactionInfo, - }, executor::{cosmwasm_call, QueryCall, QueryResponse}, system::{cosmwasm_system_query, CosmwasmCodeId, CosmwasmContractMeta}, }; @@ -1063,7 +1063,7 @@ impl Pallet { contract_info: precompiled_info.contract, shared, iterators: Default::default(), - contract_runtime: ContractBackend::Pallet, + contract_runtime: ContractBackend::Pallet { call_depth_mut: 0 }, }, ); @@ -1085,7 +1085,10 @@ impl Pallet { contract_info: info, shared, iterators: Default::default(), - contract_runtime: ContractBackend::CosmWasm { executing_module: None }, + contract_runtime: ContractBackend::CosmWasm { + executing_module: None, + call_depth_mut: 0, + }, }; let wasmi_vm = new_wasmi_vm(code.as_slice(), vm).map_err(|_| Error::::VmCreation)?; @@ -1284,8 +1287,8 @@ impl Pallet { funds: Vec, salt: &[u8], message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, CosmwasmVMError> { + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, CosmwasmVMError> { let label = label .as_bytes() .to_vec() @@ -1306,8 +1309,8 @@ impl Pallet { contract: AccountIdOf, funds: Vec, message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, CosmwasmVMError> { + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, CosmwasmVMError> { setup_execute_call(vm.contract_address.clone().into_inner(), contract)?.sub_call( vm.shared, funds, @@ -1318,9 +1321,9 @@ impl Pallet { pub(crate) fn do_continue_reply<'a>( vm: &'a mut DefaultCosmwasmVM, - reply: cosmwasm_vm::cosmwasm_std::Reply, - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, CosmwasmVMError> { + reply: cosmwasm_std::Reply, + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, CosmwasmVMError> { setup_reply_call( vm.contract_address.clone().into_inner(), vm.contract_address.clone().into_inner(), @@ -1337,8 +1340,8 @@ impl Pallet { vm: &'a mut DefaultCosmwasmVM, contract: AccountIdOf, message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, CosmwasmVMError> { + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, CosmwasmVMError> { let CosmwasmContractMeta { code_id, .. } = Self::do_running_contract_meta(vm); setup_migrate_call( vm.shared, @@ -1410,7 +1413,8 @@ impl Pallet { |mut vm| match vm.0.as_context().data().contract_runtime { ContractBackend::CosmWasm { .. } => cosmwasm_call::>>(&mut vm, message), - ContractBackend::Pallet => T::PalletHook::query(&mut vm, message).map(Into::into), + ContractBackend::Pallet { .. } => + T::PalletHook::query(&mut vm, message).map(Into::into), }, ); vm.shared.pop_readonly(); diff --git a/code/parachain/frame/cosmwasm/src/mapping.rs b/code/parachain/frame/cosmwasm/src/mapping.rs index abc33c3f9da..e2710df3923 100644 --- a/code/parachain/frame/cosmwasm/src/mapping.rs +++ b/code/parachain/frame/cosmwasm/src/mapping.rs @@ -1,6 +1,6 @@ //! this simply maps `ibc-rs` and `cosmwasm-std` types back and forth -use cosmwasm_vm::cosmwasm_std::{IbcChannel, IbcChannelOpenMsg, IbcEndpoint, IbcOrder as CwOrder}; +use cosmwasm_std::{IbcChannel, IbcChannelOpenMsg, IbcEndpoint, IbcOrder as CwOrder}; use ibc::core::{ ics04_channel::{ channel::{Counterparty, Order as IbcOrder}, @@ -46,17 +46,12 @@ pub fn map_order(order: IbcOrder) -> CwOrder { pub fn to_cosmwasm_timeout_block( ibc::core::ics02_client::height::Height { revision_number, revision_height }: ibc::core::ics02_client::height::Height, -) -> cosmwasm_vm::cosmwasm_std::IbcTimeoutBlock { - cosmwasm_vm::cosmwasm_std::IbcTimeoutBlock { - revision: revision_number, - height: revision_height, - } +) -> cosmwasm_std::IbcTimeoutBlock { + cosmwasm_std::IbcTimeoutBlock { revision: revision_number, height: revision_height } } -pub fn to_cosmwasm_timestamp( - timestamp: ibc::timestamp::Timestamp, -) -> cosmwasm_vm::cosmwasm_std::Timestamp { - cosmwasm_vm::cosmwasm_std::Timestamp::from_nanos(timestamp.nanoseconds()) +pub fn to_cosmwasm_timestamp(timestamp: ibc::timestamp::Timestamp) -> cosmwasm_std::Timestamp { + cosmwasm_std::Timestamp::from_nanos(timestamp.nanoseconds()) } pub fn ibc_open_try_to_cw_open( diff --git a/code/parachain/frame/cosmwasm/src/mock.rs b/code/parachain/frame/cosmwasm/src/mock.rs index b0870642675..4d85c69056c 100644 --- a/code/parachain/frame/cosmwasm/src/mock.rs +++ b/code/parachain/frame/cosmwasm/src/mock.rs @@ -11,13 +11,11 @@ use crate::{ use composable_traits::currency::{CurrencyFactory, RangeId}; use core::marker::PhantomData; -use cosmwasm_vm::{ - cosmwasm_std::{ - ContractResult, Event as CosmwasmEvent, Ibc3ChannelOpenResponse, IbcMsg, IbcTimeout, - QueryResponse, Response, SubMsg, WasmMsg, - }, - vm::{VMBase, VmErrorOf, VmGas}, +use cosmwasm_std::{ + ContractResult, Event as CosmwasmEvent, Ibc3ChannelOpenResponse, IbcMsg, IbcTimeout, + QueryResponse, Response, SubMsg, WasmMsg, }; +use cosmwasm_vm::vm::{VMBase, VmErrorOf, VmGas}; use cosmwasm_vm_wasmi::OwnedWasmiVM; use frame_support::{ ord_parameter_types, @@ -401,14 +399,14 @@ impl PalletHook for MockHook { contract_addr: AccountToAddr::convert( MOCK_PALLET_IBC_CONTRACT_ADDRESS, ), - msg: cosmwasm_vm::cosmwasm_std::Binary("42".as_bytes().to_vec()), + msg: cosmwasm_std::Binary("42".as_bytes().to_vec()), funds: Default::default(), }) .add_message(IbcMsg::SendPacket { channel_id: "channel-0".to_string(), data: [1, 2, 3].into(), timeout: IbcTimeout::with_timestamp( - cosmwasm_vm::cosmwasm_std::Timestamp::from_nanos(0), + cosmwasm_std::Timestamp::from_nanos(0), ), }) .set_data(0x666_u32.to_le_bytes()); diff --git a/code/parachain/frame/cosmwasm/src/pallet_hook.rs b/code/parachain/frame/cosmwasm/src/pallet_hook.rs index be4ba13f5ef..ef102ff3a2a 100644 --- a/code/parachain/frame/cosmwasm/src/pallet_hook.rs +++ b/code/parachain/frame/cosmwasm/src/pallet_hook.rs @@ -1,8 +1,6 @@ use crate::{prelude::*, runtimes::vm::CosmwasmVM, types::*, Config, Error}; -use cosmwasm_vm::{ - cosmwasm_std::{ContractResult, QueryResponse, Response}, - vm::{VMBase, VmErrorOf}, -}; +use cosmwasm_std::{ContractResult, QueryResponse, Response}; +use cosmwasm_vm::vm::{VMBase, VmErrorOf}; use cosmwasm_vm_wasmi::OwnedWasmiVM; /// A hook for pallets into the VM. Used to call substrate pallets from a CosmWasm contract. diff --git a/code/parachain/frame/cosmwasm/src/runtimes/abstraction.rs b/code/parachain/frame/cosmwasm/src/runtimes/abstraction.rs index 1c521ff8044..3dc9b696006 100644 --- a/code/parachain/frame/cosmwasm/src/runtimes/abstraction.rs +++ b/code/parachain/frame/cosmwasm/src/runtimes/abstraction.rs @@ -2,10 +2,8 @@ use crate::{types::AccountIdOf, Config, Pallet}; use alloc::{collections::VecDeque, string::String, vec::Vec}; use codec::Encode; use core::marker::PhantomData; -use cosmwasm_vm::{ - cosmwasm_std::{Addr, CanonicalAddr}, - vm::VmGasCheckpoint, -}; +use cosmwasm_std::{Addr, CanonicalAddr}; +use cosmwasm_vm::vm::VmGasCheckpoint; use scale_info::TypeInfo; pub trait VMPallet { diff --git a/code/parachain/frame/cosmwasm/src/runtimes/vm.rs b/code/parachain/frame/cosmwasm/src/runtimes/vm.rs index 0094b688675..3ba9f9fc762 100644 --- a/code/parachain/frame/cosmwasm/src/runtimes/vm.rs +++ b/code/parachain/frame/cosmwasm/src/runtimes/vm.rs @@ -2,8 +2,8 @@ use super::abstraction::{CanonicalCosmwasmAccount, CosmwasmAccount, Gas}; use crate::{runtimes::abstraction::GasOutcome, types::*, weights::WeightInfo, Config, Pallet}; use alloc::{borrow::ToOwned, string::String}; use core::marker::{Send, Sync}; +use cosmwasm_std::{CodeInfoResponse, Coin, ContractInfoResponse, Empty, Env, MessageInfo}; use cosmwasm_vm::{ - cosmwasm_std::{CodeInfoResponse, Coin, ContractInfoResponse, Empty, Env, MessageInfo}, executor::ExecutorError, has::Has, memory::{MemoryReadError, MemoryWriteError}, @@ -26,22 +26,32 @@ pub enum ContractBackend { CosmWasm { /// The wasmi module instantiated for the CosmWasm contract. executing_module: Option, + call_depth_mut: u32, }, /// A substrate pallet, which is a precompiled contract that is included in the runtime. - Pallet, + Pallet { call_depth_mut: u32 }, } impl WasmiContext for ContractBackend { fn executing_module(&self) -> Option { match self { - ContractBackend::CosmWasm { executing_module } => executing_module.clone(), - ContractBackend::Pallet => None, + ContractBackend::CosmWasm { executing_module, .. } => executing_module.clone(), + ContractBackend::Pallet { .. } => None, } } fn set_wasmi_context(&mut self, instance: Instance, memory: Memory) { - *self = - ContractBackend::CosmWasm { executing_module: Some(WasmiModule { instance, memory }) }; + *self = ContractBackend::CosmWasm { + executing_module: Some(WasmiModule { instance, memory }), + call_depth_mut: 0, + }; + } + + fn call_depth_mut(&mut self) -> &mut u32 { + match self { + ContractBackend::CosmWasm { call_depth_mut, .. } => call_depth_mut, + ContractBackend::Pallet { call_depth_mut } => call_depth_mut, + } } } @@ -64,6 +74,8 @@ pub enum CosmwasmVMError { AssetConversion, } +// impl wasmi_core::host_error::HostError for + impl HostError for CosmwasmVMError { @@ -206,6 +218,13 @@ impl<'a, T: Config> WasmiContext for CosmwasmVM<'a, T> { fn set_wasmi_context(&mut self, instance: Instance, memory: Memory) { self.contract_runtime.set_wasmi_context(instance, memory) } + + fn call_depth_mut(&mut self) -> &mut u32 { + match &mut self.contract_runtime { + ContractBackend::CosmWasm { call_depth_mut, .. } => call_depth_mut, + ContractBackend::Pallet { call_depth_mut } => call_depth_mut, + } + } } impl<'a, T: Config> CosmwasmVM<'a, T> { @@ -238,7 +257,7 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { &mut self, _start: Option, _end: Option, - _order: cosmwasm_vm::cosmwasm_std::Order, + _order: cosmwasm_std::Order, ) -> Result { log::debug!(target: "runtime::contracts", "db_scan"); Pallet::::do_db_scan(self) @@ -289,17 +308,17 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { address: Self::Address, funds: Vec, message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, Self::Error> { + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, Self::Error> { log::debug!(target: "runtime::contracts", "continue_execute"); Pallet::::do_continue_execute(self, address.into_inner(), funds, message, event_handler) } fn continue_reply( &mut self, - message: cosmwasm_vm::cosmwasm_std::Reply, - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, Self::Error> { + message: cosmwasm_std::Reply, + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, Self::Error> { log::debug!(target: "runtime::contracts", "continue_reply"); Pallet::::do_continue_reply(self, message, event_handler) } @@ -309,8 +328,8 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { contract_meta: Self::ContractMeta, funds: Vec, message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result<(Self::Address, Option), Self::Error> { + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result<(Self::Address, Option), Self::Error> { log::debug!(target: "runtime::contracts", "continue_instantiate"); self.continue_instantiate2(contract_meta, funds, b"salt", message, event_handler) } @@ -321,8 +340,8 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { funds: Vec, salt: &[u8], message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result<(Self::Address, Option), Self::Error> { + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result<(Self::Address, Option), Self::Error> { log::debug!(target: "runtime::contracts", "continue_instantiate2"); Pallet::::do_continue_instantiate( self, @@ -339,8 +358,8 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { &mut self, address: Self::Address, message: &[u8], - event_handler: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, Self::Error> { + event_handler: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, Self::Error> { log::debug!(target: "runtime::contracts", "continue_migrate"); Pallet::::do_continue_migrate(self, address.into_inner(), message, event_handler) } @@ -348,10 +367,8 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { fn query_custom( &mut self, _: Self::QueryCustom, - ) -> Result< - cosmwasm_vm::cosmwasm_std::SystemResult, - Self::Error, - > { + ) -> Result, Self::Error> + { log::debug!(target: "runtime::contracts", "query_custom"); Err(CosmwasmVMError::Unsupported) } @@ -359,8 +376,8 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { fn message_custom( &mut self, _: Self::MessageCustom, - _: &mut dyn FnMut(cosmwasm_vm::cosmwasm_std::Event), - ) -> Result, Self::Error> { + _: &mut dyn FnMut(cosmwasm_std::Event), + ) -> Result, Self::Error> { log::debug!(target: "runtime::contracts", "message_custom"); Err(CosmwasmVMError::Unsupported) } @@ -601,7 +618,7 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { channel_id: String, to_address: String, amount: Coin, - timeout: cosmwasm_vm::cosmwasm_std::IbcTimeout, + timeout: cosmwasm_std::IbcTimeout, ) -> Result<(), Self::Error> { Pallet::::do_ibc_transfer(self, channel_id, to_address, amount, timeout) } @@ -609,8 +626,8 @@ impl<'a, T: Config + Send + Sync> VMBase for CosmwasmVM<'a, T> { fn ibc_send_packet( &mut self, channel_id: String, - data: cosmwasm_vm::cosmwasm_std::Binary, - timeout: cosmwasm_vm::cosmwasm_std::IbcTimeout, + data: cosmwasm_std::Binary, + timeout: cosmwasm_std::IbcTimeout, ) -> Result<(), Self::Error> { Pallet::::do_ibc_send_packet(self, channel_id, data, timeout) } diff --git a/code/parachain/frame/cosmwasm/src/tests/extrinsics.rs b/code/parachain/frame/cosmwasm/src/tests/extrinsics.rs index eecf9e498d2..d12f2cef3c6 100644 --- a/code/parachain/frame/cosmwasm/src/tests/extrinsics.rs +++ b/code/parachain/frame/cosmwasm/src/tests/extrinsics.rs @@ -6,7 +6,8 @@ use crate::{ CodeHashToId, CodeIdToInfo, CodeIdentifier, Config, CosmwasmAccount, CurrentCodeId, InstrumentedCode, Pallet as Cosmwasm, PristineCode, INSTRUMENTATION_VERSION, }; -use cosmwasm_vm::{cosmwasm_std::instantiate2_address, vm::VMBase}; +use cosmwasm_std::instantiate2_address; +use cosmwasm_vm::vm::VMBase; use cosmwasm_vm_wasmi::code_gen; use frame_system::RawOrigin; use sha2::{Digest, Sha256}; @@ -119,9 +120,6 @@ pub fn instantiate_test_cases( contract_info.label, TryInto::>::try_into(COMMON_LABEL.as_bytes().to_vec()).unwrap() ); - - // TODO(aeryz): Improve code_gen to embed cosmwasm code, so that we can assert - // `instantiate` function is really called. } #[test] diff --git a/code/parachain/frame/cosmwasm/src/tests/helpers.rs b/code/parachain/frame/cosmwasm/src/tests/helpers.rs index f456ec05459..8d49cc00f27 100644 --- a/code/parachain/frame/cosmwasm/src/tests/helpers.rs +++ b/code/parachain/frame/cosmwasm/src/tests/helpers.rs @@ -5,7 +5,7 @@ use crate::{ DefaultCosmwasmVM, FundsOf, Gas, Pallet as Cosmwasm, }; use alloc::collections::BTreeMap; -use cosmwasm_vm::cosmwasm_std::{Coin, ContractResult, Empty, Response}; +use cosmwasm_std::{Coin, ContractResult, Empty, Response}; use cosmwasm_vm_wasmi::{code_gen, OwnedWasmiVM}; use frame_benchmarking::account; use frame_support::traits::{fungible, fungibles::Mutate}; diff --git a/code/parachain/frame/cosmwasm/src/tests/host_functions.rs b/code/parachain/frame/cosmwasm/src/tests/host_functions.rs index 7cb2299836a..c7d4c35068a 100644 --- a/code/parachain/frame/cosmwasm/src/tests/host_functions.rs +++ b/code/parachain/frame/cosmwasm/src/tests/host_functions.rs @@ -6,11 +6,8 @@ use crate::{ CodeIdToInfo, CodeInfoOf, Config, InstrumentedCode, PristineCode, }; use alloc::collections::BTreeSet; -use cosmwasm_vm::{ - cosmwasm_std::{CodeInfoResponse, Coin, ContractInfoResponse, Order}, - system::CosmwasmContractMeta, - vm::VMBase, -}; +use cosmwasm_std::{CodeInfoResponse, Coin, ContractInfoResponse, Order}; +use cosmwasm_vm::{system::CosmwasmContractMeta, vm::VMBase}; use cosmwasm_vm_wasmi::code_gen; use frame_benchmarking::account; use sp_runtime::AccountId32; diff --git a/code/parachain/frame/cosmwasm/src/tests/submessages.rs b/code/parachain/frame/cosmwasm/src/tests/submessages.rs index 35e64088e62..9ffbf129fde 100644 --- a/code/parachain/frame/cosmwasm/src/tests/submessages.rs +++ b/code/parachain/frame/cosmwasm/src/tests/submessages.rs @@ -6,7 +6,7 @@ use super::{ *, }; use crate::types::CodeIdentifier; -use cosmwasm_vm::cosmwasm_std::{BankMsg, Response, WasmMsg}; +use cosmwasm_std::{BankMsg, Response, WasmMsg}; use frame_benchmarking::account; use sp_runtime::AccountId32; diff --git a/code/parachain/frame/cosmwasm/src/utils.rs b/code/parachain/frame/cosmwasm/src/utils.rs index 5c43b348d29..82c1d6ffdfa 100644 --- a/code/parachain/frame/cosmwasm/src/utils.rs +++ b/code/parachain/frame/cosmwasm/src/utils.rs @@ -1,5 +1,6 @@ use alloc::{string::String, vec::Vec}; -use cosmwasm_vm::{cosmwasm_std::Coin, system::CosmwasmContractMeta}; +use cosmwasm_std::Coin; +use cosmwasm_vm::system::CosmwasmContractMeta; use sp_core::storage::ChildInfo; use sp_runtime::traits::{Convert, Hash}; diff --git a/code/parachain/frame/dex-router/cosmwasm/Cargo.toml b/code/parachain/frame/dex-router/cosmwasm/Cargo.toml index 846c7dbfea0..fb6765b24b9 100644 --- a/code/parachain/frame/dex-router/cosmwasm/Cargo.toml +++ b/code/parachain/frame/dex-router/cosmwasm/Cargo.toml @@ -6,10 +6,10 @@ version = "0.1.0" [features] library = [] default = ["std"] -std = [] +std = ["cosmwasm-std/std"] [dependencies] -cosmwasm-vm = { workspace = true, default-features = false, features = [ +cosmwasm-std = { workspace = true, default-features = false, features = [ "ibc3", "iterator", "stargate", diff --git a/code/parachain/frame/dex-router/cosmwasm/src/msg.rs b/code/parachain/frame/dex-router/cosmwasm/src/msg.rs index 745c07d8a95..836f4ba5f73 100644 --- a/code/parachain/frame/dex-router/cosmwasm/src/msg.rs +++ b/code/parachain/frame/dex-router/cosmwasm/src/msg.rs @@ -1,5 +1,5 @@ use alloc::string::String; -use cosmwasm_vm::cosmwasm_std::{Coin, Uint128}; +use cosmwasm_std::{Coin, Uint128}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] diff --git a/code/parachain/runtime/picasso/Cargo.toml b/code/parachain/runtime/picasso/Cargo.toml index 76c7747b75e..1a711663709 100644 --- a/code/parachain/runtime/picasso/Cargo.toml +++ b/code/parachain/runtime/picasso/Cargo.toml @@ -86,6 +86,13 @@ crowdloan-rewards-runtime-api = { path = "../../frame/crowdloan-rewards/runtime- pablo-runtime-api = { path = "../../frame/pablo/runtime-api", default-features = false } cosmwasm = { package = "pallet-cosmwasm", path = "../../frame/cosmwasm", default-features = false } cosmwasm-runtime-api = { path = "../../frame/cosmwasm/runtime-api", default-features = false } +cosmwasm-std = { workspace = true, default-features = false, features = [ + "ibc3", + "iterator", + "stargate", +] } + + reward = { path = "../../frame/reward", default-features = false } farming = { path = "../../frame/farming", default-features = false } @@ -207,6 +214,9 @@ std = [ "composable-traits/std", "cosmwasm-runtime-api/std", "cosmwasm/std", + "cosmwasm-vm/std", + "cosmwasm-std/std", + "cosmwasm-vm-wasmi/std", "cw-dex-router/std", "crowdloan-rewards-runtime-api/std", "crowdloan-rewards/std", diff --git a/code/parachain/runtime/picasso/src/contracts.rs b/code/parachain/runtime/picasso/src/contracts.rs index b441567037b..568f3718758 100644 --- a/code/parachain/runtime/picasso/src/contracts.rs +++ b/code/parachain/runtime/picasso/src/contracts.rs @@ -6,8 +6,8 @@ use cosmwasm::{ runtimes::vm::{CosmwasmVM, CosmwasmVMError}, types::{AccountIdOf, ContractLabelOf, ContractTrieIdOf, EntryPoint, PalletContractCodeInfo}, }; +use cosmwasm_std::{ContractResult, Response}; use cosmwasm_vm::{ - cosmwasm_std::{ContractResult, Response}, executor::QueryResponse, vm::{VMBase, VmErrorOf}, }; diff --git a/code/parachain/runtime/picasso/src/ibc.rs b/code/parachain/runtime/picasso/src/ibc.rs index cf8cb99f3b1..017d8868384 100644 --- a/code/parachain/runtime/picasso/src/ibc.rs +++ b/code/parachain/runtime/picasso/src/ibc.rs @@ -140,8 +140,9 @@ impl Ics20RateLimiter for ConstantAny { .ok(); let decimals = asset_id - .map(|x| as InspectRegistryMetadata>::decimals(&x)) - .flatten() + .and_then(|x| { + as InspectRegistryMetadata>::decimals(&x) + }) .unwrap_or(12); if msg.token.amount.as_u256() <= diff --git a/code/xcvm/Cargo.lock b/code/xcvm/Cargo.lock index 9419f250aca..0847f8b17d7 100644 --- a/code/xcvm/Cargo.lock +++ b/code/xcvm/Cargo.lock @@ -28,6 +28,12 @@ version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + [[package]] name = "arrayvec" version = "0.7.2" @@ -42,7 +48,7 @@ checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -192,8 +198,8 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cosmwasm-crypto" -version = "1.1.6" -source = "git+https://github.com/ComposableFi/cosmwasm?rev=21351cc1ced863b9af7c8a69f923036bc919b3b1#21351cc1ced863b9af7c8a69f923036bc919b3b1" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" dependencies = [ "digest 0.10.6", "ed25519-zebra", @@ -204,26 +210,29 @@ dependencies = [ [[package]] name = "cosmwasm-derive" -version = "1.1.6" -source = "git+https://github.com/ComposableFi/cosmwasm?rev=21351cc1ced863b9af7c8a69f923036bc919b3b1#21351cc1ced863b9af7c8a69f923036bc919b3b1" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" dependencies = [ - "syn", + "syn 1.0.107", ] [[package]] name = "cosmwasm-orchestrate" version = "0.1.0" -source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=96324b719b4e13d129c912e2ce8622b3cc720b9c#96324b719b4e13d129c912e2ce8622b3cc720b9c" +source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9#71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" dependencies = [ "async-trait", "base64", "bech32", "bs58", - "cosmwasm-crypto", "cosmwasm-std", "cosmwasm-vm", "cosmwasm-vm-wasmi", + "ed25519-zebra", + "libsecp256k1", "log", + "rand_chacha", + "rand_core 0.6.4", "reqwest", "serde", "serde_json", @@ -234,11 +243,23 @@ dependencies = [ [[package]] name = "cosmwasm-schema" -version = "1.1.9" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" +dependencies = [ + "cosmwasm-schema-derive 1.2.5", + "schemars", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04135971e2c3b867eb793ca4e832543c077dbf72edaef7672699190f8fcdb619" +checksum = "407aca6f1671a08b60db8167f03bb7cb6b2378f0ddd9a030367b66ba33c2fd41" dependencies = [ - "cosmwasm-schema-derive", + "cosmwasm-schema-derive 1.2.6", "schemars", "serde", "serde_json", @@ -247,19 +268,29 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.1.9" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.107", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06c8f516a13ae481016aa35f0b5c4652459e8aee65b15b6fb51547a07cea5a0" +checksum = "e6d1e00b8fd27ff923c10303023626358e23a6f9079f8ebec23a8b4b0bfcd4b3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] name = "cosmwasm-std" -version = "1.1.6" -source = "git+https://github.com/ComposableFi/cosmwasm?rev=21351cc1ced863b9af7c8a69f923036bc919b3b1#21351cc1ced863b9af7c8a69f923036bc919b3b1" +version = "1.2.5" +source = "git+https://github.com/dzmitry-lahoda-forks/cosmwasm?rev=1277597cbf380a8d04dbe676d9cb344ca31634b6#1277597cbf380a8d04dbe676d9cb344ca31634b6" dependencies = [ "base64", "cosmwasm-crypto", @@ -269,15 +300,16 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thiserror", + "serde-json-wasm", + "sha2 0.10.6", + "thiserror-core", "uint", ] [[package]] name = "cosmwasm-vm" -version = "0.1.0" -source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=96324b719b4e13d129c912e2ce8622b3cc720b9c#96324b719b4e13d129c912e2ce8622b3cc720b9c" +version = "0.2.0" +source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9#71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" dependencies = [ "cosmwasm-std", "log", @@ -288,8 +320,8 @@ dependencies = [ [[package]] name = "cosmwasm-vm-wasmi" -version = "0.1.0" -source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=96324b719b4e13d129c912e2ce8622b3cc720b9c#96324b719b4e13d129c912e2ce8622b3cc720b9c" +version = "0.2.0" +source = "git+https://github.com/ComposableFi/cosmwasm-vm?rev=71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9#71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" dependencies = [ "cosmwasm-std", "cosmwasm-vm", @@ -340,6 +372,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -355,252 +397,200 @@ dependencies = [ [[package]] name = "cw-storage-plus" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c8b264257c4f44c49b7ce09377af63aa040768ecd3fd7bdd2d48a09323a1e90" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", -] - -[[package]] -name = "cw-storage-plus" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b6f91c0b94481a3e9ef1ceb183c37d00764f8751e39b45fc09f4d9b970d469" -dependencies = [ - "cosmwasm-std", - "schemars", - "serde", -] - -[[package]] -name = "cw-utils" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414b91f3d7a619bb26c835119d7095804596a1382ddc1d184c33c1d2c17f6c5e" +version = "1.0.2" +source = "git+https://github.com/dzmitry-lahoda-forks/cw-storage-plus?rev=d0a2cf126cae3e3960c787ebcfc9baa54f59f71c#d0a2cf126cae3e3960c787ebcfc9baa54f59f71c" dependencies = [ "cosmwasm-std", - "cw2 0.14.0", "schemars", - "semver", "serde", - "thiserror", ] [[package]] name = "cw-utils" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6a84c6c1c0acc3616398eba50783934bd6c964bad6974241eaee3460c8f5b26" +version = "1.0.1" +source = "git+https://github.com/dzmitry-lahoda-forks/cw-plus?rev=458e2eb014253d2131219e518c64475a8348c5a3#458e2eb014253d2131219e518c64475a8348c5a3" dependencies = [ - "cosmwasm-schema", + "cosmwasm-schema 1.2.6", "cosmwasm-std", - "cw2 0.16.0", + "cw2", "schemars", "semver", "serde", - "thiserror", + "thiserror-core", ] [[package]] -name = "cw-xcvm-asset-registry" +name = "cw-xc-asset-registry" version = "0.1.0" dependencies = [ - "cosmwasm-schema", + "cosmwasm-schema 1.2.5", "cosmwasm-std", - "cw-storage-plus 0.14.0", - "cw-utils 0.14.0", - "cw2 0.14.0", + "cw-storage-plus", + "cw-utils", + "cw2", "schemars", "serde", - "thiserror", - "xcvm-core", + "serde-cw-value", + "thiserror-core", + "xc-core", ] [[package]] -name = "cw-xcvm-common" +name = "cw-xc-common" version = "0.1.0" dependencies = [ "cosmwasm-std", - "cw-xcvm-utils", + "cw-xc-utils", "schemars", "serde", - "xcvm-core", + "xc-core", ] [[package]] -name = "cw-xcvm-gateway" +name = "cw-xc-gateway" version = "0.1.0" dependencies = [ - "cosmwasm-schema", + "cosmwasm-schema 1.2.5", "cosmwasm-std", - "cw-storage-plus 0.14.0", - "cw-utils 0.14.0", - "cw-xcvm-asset-registry", - "cw-xcvm-common", - "cw-xcvm-interpreter", - "cw-xcvm-router", - "cw-xcvm-utils", - "cw2 0.14.0", - "cw20 0.14.0", + "cw-storage-plus", + "cw-utils", + "cw-xc-asset-registry", + "cw-xc-common", + "cw-xc-interpreter", + "cw-xc-router", + "cw-xc-utils", + "cw2", + "cw20", "hex", "prost", "schemars", "serde", - "serde-json-wasm 0.4.1 (git+https://github.com/hussein-aitlahcen/serde-json-wasm?rev=1608a13d2a2ba90605d9626a51ff6667aca5a2d6)", - "thiserror", - "xcvm-core", - "xcvm-proto", + "serde-json-wasm", + "thiserror-core", + "xc-core", + "xc-proto", ] [[package]] -name = "cw-xcvm-interpreter" +name = "cw-xc-interpreter" version = "0.1.0" dependencies = [ - "cosmwasm-schema", + "cosmwasm-schema 1.2.5", "cosmwasm-std", - "cw-storage-plus 0.14.0", - "cw-utils 0.14.0", - "cw-xcvm-asset-registry", - "cw-xcvm-common", - "cw-xcvm-utils", - "cw2 0.14.0", - "cw20 0.14.0", + "cw-storage-plus", + "cw-utils", + "cw-xc-asset-registry", + "cw-xc-common", + "cw-xc-utils", + "cw2", + "cw20", "hex", "num", "prost", "schemars", "serde", - "serde-json-wasm 0.4.1 (git+https://github.com/hussein-aitlahcen/serde-json-wasm?rev=1608a13d2a2ba90605d9626a51ff6667aca5a2d6)", + "serde-json-wasm", "serde_json", - "thiserror", - "xcvm-core", - "xcvm-proto", + "thiserror-core", + "xc-core", + "xc-proto", ] [[package]] -name = "cw-xcvm-pingpong" +name = "cw-xc-pingpong" version = "0.1.0" dependencies = [ "cosmwasm-std", - "cw-storage-plus 0.14.0", - "cw-utils 0.14.0", - "cw-xcvm-common", - "cw-xcvm-utils", - "cw2 0.14.0", - "cw20 0.14.0", + "cw-storage-plus", + "cw-utils", + "cw-xc-common", + "cw-xc-utils", + "cw2", + "cw20", "hex", "num", "prost", "schemars", "serde", - "serde-json-wasm 0.4.1 (git+https://github.com/hussein-aitlahcen/serde-json-wasm?rev=1608a13d2a2ba90605d9626a51ff6667aca5a2d6)", + "serde-json-wasm", "serde_json", - "thiserror", - "xcvm-core", - "xcvm-proto", + "thiserror-core", + "xc-core", + "xc-proto", ] [[package]] -name = "cw-xcvm-router" +name = "cw-xc-router" version = "0.1.0" dependencies = [ - "cosmwasm-schema", + "cosmwasm-schema 1.2.5", "cosmwasm-std", - "cw-storage-plus 0.14.0", - "cw-utils 0.14.0", - "cw-xcvm-asset-registry", - "cw-xcvm-common", - "cw-xcvm-interpreter", - "cw-xcvm-utils", - "cw2 0.14.0", - "cw20 0.14.0", + "cw-storage-plus", + "cw-utils", + "cw-xc-asset-registry", + "cw-xc-common", + "cw-xc-interpreter", + "cw-xc-utils", + "cw2", + "cw20", "hex", "prost", "schemars", "serde", - "serde-json-wasm 0.4.1 (git+https://github.com/hussein-aitlahcen/serde-json-wasm?rev=1608a13d2a2ba90605d9626a51ff6667aca5a2d6)", - "thiserror", - "xcvm-core", - "xcvm-proto", + "serde-json-wasm", + "thiserror-core", + "xc-core", + "xc-proto", ] [[package]] -name = "cw-xcvm-utils" +name = "cw-xc-utils" version = "0.1.0" dependencies = [ "cosmwasm-std", - "xcvm-core", + "xc-core", ] [[package]] name = "cw2" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa74c324af8e3506fd8d50759a265bead3f87402e413c840042af5d2808463d6" -dependencies = [ - "cosmwasm-std", - "cw-storage-plus 0.14.0", - "schemars", - "serde", -] - -[[package]] -name = "cw2" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91398113b806f4d2a8d5f8d05684704a20ffd5968bf87e3473e1973710b884ad" +version = "1.0.1" +source = "git+https://github.com/dzmitry-lahoda-forks/cw-plus?rev=458e2eb014253d2131219e518c64475a8348c5a3#458e2eb014253d2131219e518c64475a8348c5a3" dependencies = [ - "cosmwasm-schema", + "cosmwasm-schema 1.2.6", "cosmwasm-std", - "cw-storage-plus 0.16.0", + "cw-storage-plus", "schemars", "serde", + "thiserror-core", ] [[package]] name = "cw20" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f446f59c519fbac5ab8b9f6c7f8dcaa05ee761703971406b28221ea778bb737" +version = "1.0.1" +source = "git+https://github.com/dzmitry-lahoda-forks/cw-plus?rev=458e2eb014253d2131219e518c64475a8348c5a3#458e2eb014253d2131219e518c64475a8348c5a3" dependencies = [ + "cosmwasm-schema 1.2.6", "cosmwasm-std", - "cw-utils 0.14.0", - "schemars", - "serde", -] - -[[package]] -name = "cw20" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45a8794a5dd33b66af34caee52a7beceb690856adcc1682b6e3db88b2cdee62" -dependencies = [ - "cosmwasm-schema", - "cosmwasm-std", - "cw-utils 0.16.0", + "cw-utils", "schemars", "serde", ] [[package]] name = "cw20-base" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61d826fa1084d026d0abdb54faa5956972efa3a9053473bfcefb5388960aab69" +version = "1.0.1" +source = "git+https://github.com/dzmitry-lahoda-forks/cw-plus?rev=458e2eb014253d2131219e518c64475a8348c5a3#458e2eb014253d2131219e518c64475a8348c5a3" dependencies = [ - "cosmwasm-schema", + "cosmwasm-schema 1.2.6", "cosmwasm-std", - "cw-storage-plus 0.16.0", - "cw-utils 0.16.0", - "cw2 0.16.0", - "cw20 0.16.0", + "cw-storage-plus", + "cw-utils", + "cw2", + "cw20", "schemars", "semver", "serde", - "thiserror", + "thiserror-core", ] [[package]] @@ -621,7 +611,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -632,7 +622,7 @@ checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -655,6 +645,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + [[package]] name = "dyn-clone" version = "1.0.10" @@ -845,12 +841,6 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" -[[package]] -name = "futures-io" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" - [[package]] name = "futures-sink" version = "0.3.25" @@ -870,12 +860,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-core", - "futures-io", "futures-task", - "memchr", "pin-project-lite", "pin-utils", - "slab", ] [[package]] @@ -971,6 +958,16 @@ dependencies = [ "serde", ] +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + [[package]] name = "hmac" version = "0.12.1" @@ -980,6 +977,17 @@ dependencies = [ "digest 0.10.6", ] +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac 0.8.1", +] + [[package]] name = "http" version = "0.2.8" @@ -1075,7 +1083,7 @@ checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -1088,6 +1096,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + [[package]] name = "instant" version = "0.1.12" @@ -1097,6 +1111,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "intx" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" + [[package]] name = "io-lifetimes" version = "1.0.4" @@ -1179,6 +1199,54 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -1200,12 +1268,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "mime" version = "0.3.16" @@ -1254,7 +1316,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ - "num-bigint", "num-complex", "num-integer", "num-iter", @@ -1262,17 +1323,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-complex" version = "0.4.2" @@ -1310,7 +1360,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint", "num-integer", "num-traits", ] @@ -1324,16 +1373,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "once_cell" version = "1.17.0" @@ -1369,7 +1408,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -1393,9 +1432,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.2.2" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ab01d0f889e957861bc65888d5ccbe82c158d0270136ba46820d43837cdf72" +checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" dependencies = [ "arrayvec", "byte-slice-cast", @@ -1412,7 +1451,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -1421,6 +1460,12 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" +[[package]] +name = "paste" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" + [[package]] name = "percent-encoding" version = "2.2.0" @@ -1478,7 +1523,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78" dependencies = [ "proc-macro2", - "syn", + "syn 1.0.107", ] [[package]] @@ -1494,9 +1539,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] @@ -1523,9 +1568,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.6" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21dc42e00223fc37204bd4aa177e69420c604ca4a183209a8f9de30c6d934698" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -1533,9 +1578,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.6" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f8ad728fb08fe212df3c05169e940fbb6d9d16a877ddde14644a983ba2012e" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", @@ -1548,31 +1593,30 @@ dependencies = [ "prost", "prost-types", "regex", - "syn", + "syn 1.0.107", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.11.6" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda8c0881ea9f722eb9629376db3d0b903b462477c1aafcb0566610ac28ac5d" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] name = "prost-types" -version = "0.11.6" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e0526209433e96d83d750dd81a99118edbc55739e7e61a46764fd2ad537788" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "bytes", "prost", ] @@ -1590,9 +1634,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quote" -version = "1.0.23" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -1721,7 +1765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac", + "hmac 0.12.1", "zeroize", ] @@ -1759,9 +1803,9 @@ checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "scale-info" -version = "2.3.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" dependencies = [ "cfg-if", "derive_more", @@ -1771,14 +1815,14 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -1792,9 +1836,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5fb6c61f29e723026dc8e923d94c694313212abbecbbe5f55a7748eec5b307" +checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" dependencies = [ "dyn-clone", "schemars_derive", @@ -1804,14 +1848,14 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f188d036977451159430f3b8dc82ec76364a42b7e289c2b18a9a18f4470058e9" +checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn", + "syn 1.0.107", ] [[package]] @@ -1859,39 +1903,39 @@ checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" dependencies = [ "serde_derive", ] [[package]] -name = "serde-json-wasm" -version = "0.4.1" +name = "serde-cw-value" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479b4dbc401ca13ee8ce902851b834893251404c4f3c65370a49e047a6be09a5" +checksum = "a75d32da6b8ed758b7d850b6c3c08f1d7df51a4df3cb201296e63e34a78e99d4" dependencies = [ "serde", ] [[package]] name = "serde-json-wasm" -version = "0.4.1" -source = "git+https://github.com/hussein-aitlahcen/serde-json-wasm?rev=1608a13d2a2ba90605d9626a51ff6667aca5a2d6#1608a13d2a2ba90605d9626a51ff6667aca5a2d6" +version = "0.5.1" +source = "git+https://github.com/dzmitry-lahoda-forks/serde-json-wasm?rev=8a7e522c0e4de36a6dfb535766f26a9941017d81#8a7e522c0e4de36a6dfb535766f26a9941017d81" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.18", ] [[package]] @@ -1902,14 +1946,14 @@ checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -1971,6 +2015,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + [[package]] name = "socket2" version = "0.4.7" @@ -1981,6 +2031,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spki" version = "0.6.0" @@ -2014,6 +2070,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.3.0" @@ -2046,6 +2113,26 @@ dependencies = [ "thiserror-impl", ] +[[package]] +name = "thiserror-core" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" +dependencies = [ + "thiserror-core-impl", +] + +[[package]] +name = "thiserror-core-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.107", +] + [[package]] name = "thiserror-impl" version = "1.0.38" @@ -2054,7 +2141,7 @@ checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -2083,7 +2170,6 @@ dependencies = [ "libc", "memchr", "mio", - "num_cpus", "pin-project-lite", "socket2", "tokio-macros", @@ -2098,7 +2184,7 @@ checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -2274,7 +2360,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.107", "wasm-bindgen-shared", ] @@ -2308,7 +2394,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2321,41 +2407,61 @@ checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "wasm-instrument" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bca81f5279342b38b17d9acbf007a46ddeb73144e2bd5f0a21bfa9fc5d4ab3e" +checksum = "2a47ecb37b9734d1085eaa5ae1a81e60801fd8c28d4cabdd8aedb982021918bc" dependencies = [ "parity-wasm", ] [[package]] name = "wasmi" -version = "0.11.0" -source = "git+https://github.com/ComposableFi/wasmi?rev=cd8c0c775a1d197a35ff3d5c7d6cded3d476411b#cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51fb5c61993e71158abf5bb863df2674ca3ec39ed6471c64f07aeaf751d67b4" dependencies = [ - "parity-wasm", - "wasmi-validation", + "intx", + "smallvec", + "spin", + "wasmi_arena", "wasmi_core", + "wasmparser-nostd", ] [[package]] name = "wasmi-validation" -version = "0.4.1" -source = "git+https://github.com/ComposableFi/wasmi?rev=cd8c0c775a1d197a35ff3d5c7d6cded3d476411b#cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" dependencies = [ "parity-wasm", ] +[[package]] +name = "wasmi_arena" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" + [[package]] name = "wasmi_core" -version = "0.1.0" -source = "git+https://github.com/ComposableFi/wasmi?rev=cd8c0c775a1d197a35ff3d5c7d6cded3d476411b#cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" dependencies = [ + "downcast-rs", "libm", - "memory_units", - "num-rational", "num-traits", - "parity-wasm", + "paste", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724" +dependencies = [ + "indexmap-nostd", ] [[package]] @@ -2477,11 +2583,11 @@ dependencies = [ ] [[package]] -name = "xcvm-core" +name = "xc-core" version = "0.1.0" dependencies = [ "cosmwasm-std", - "cw-storage-plus 0.14.0", + "cw-storage-plus", "fixed", "num", "parity-scale-codec", @@ -2493,32 +2599,32 @@ dependencies = [ ] [[package]] -name = "xcvm-proto" +name = "xc-proto" version = "0.1.0" dependencies = [ "fixed", "prost", "prost-build", "prost-types", - "xcvm-core", + "xc-core", ] [[package]] -name = "xcvm-tests" +name = "xc-tests" version = "0.1.0" dependencies = [ "cosmwasm-orchestrate", "cosmwasm-std", "cosmwasm-vm", "cosmwasm-vm-wasmi", - "cw-xcvm-asset-registry", - "cw-xcvm-common", - "cw-xcvm-gateway", - "cw-xcvm-interpreter", - "cw-xcvm-pingpong", - "cw-xcvm-router", - "cw-xcvm-utils", - "cw20 0.16.0", + "cw-xc-asset-registry", + "cw-xc-common", + "cw-xc-gateway", + "cw-xc-interpreter", + "cw-xc-pingpong", + "cw-xc-router", + "cw-xc-utils", + "cw20", "cw20-base", "env_logger", "hex", @@ -2528,7 +2634,7 @@ dependencies = [ "serde", "serde_json", "tokio", - "xcvm-core", + "xc-core", ] [[package]] diff --git a/code/xcvm/Cargo.toml b/code/xcvm/Cargo.toml index b3e260db1ab..867bc6b5c93 100644 --- a/code/xcvm/Cargo.toml +++ b/code/xcvm/Cargo.toml @@ -16,5 +16,57 @@ overflow-checks = true panic = "abort" rpath = false +[workspace.dependencies] + +cosmwasm-schema = { git = "https://github.com/dzmitry-lahoda-forks/cosmwasm", rev = "1277597cbf380a8d04dbe676d9cb344ca31634b6", default-features = false } +serde-json-wasm = { git = "https://github.com/dzmitry-lahoda-forks/serde-json-wasm", rev = "8a7e522c0e4de36a6dfb535766f26a9941017d81", default-features = false} +cosmwasm-std = { git = "https://github.com/dzmitry-lahoda-forks/cosmwasm", rev = "1277597cbf380a8d04dbe676d9cb344ca31634b6", default-features = false, features = [ + "iterator", + "cosmwasm_1_2", +] } +cw-storage-plus = { git = "https://github.com/dzmitry-lahoda-forks/cw-storage-plus", rev = "d0a2cf126cae3e3960c787ebcfc9baa54f59f71c", default-features = false, features = ["std"] } + + +cosmwasm-vm = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" } +cosmwasm-vm-wasmi = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" } +cosmwasm-orchestrate = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "71520ece331c3d759f1cdb2a2f7e8d4e26bbffe9" } + + +fixed = { version = "1.15", default-features = false } +parity-scale-codec = { version = "3.5.0", default-features = false } +num = { version = "0.4", default-features = false } +prost = { version = "0.11.9", default-features = false, features = [ + "prost-derive", +] } +scale-info = { version = "2.7.0", default-features = false, features = [ + "derive", +] } +schemars = { version = "0.8.12" } +serde = { version = "1.0.163", default-features = false, features = [ + "derive", + "alloc", +] } +serde_json = { version = "1.0.96" } +prost-types = { version = "0.11.9", default-features = false } +prost-build = "0.11.9" + + +cw-utils = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3"} +cw20 = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3"} +cw20-base = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3", features = ["library"]} +cw2 = { git = "https://github.com/dzmitry-lahoda-forks/cw-plus", rev = "458e2eb014253d2131219e518c64475a8348c5a3"} + +thiserror = { version = "1.0.38", package = "thiserror-core", default-features = false } + +serde-cw-value = { version = "0.7.0", default-features = false } +hex = { version = "0.4", default-features = false, features = [ + "alloc", + "serde", +] } + + + [patch.crates-io] -cosmwasm-std = { git = "https://github.com/ComposableFi/cosmwasm", rev = "21351cc1ced863b9af7c8a69f923036bc919b3b1" } +serde-json-wasm = { git = "https://github.com/dzmitry-lahoda-forks/serde-json-wasm", rev = "8a7e522c0e4de36a6dfb535766f26a9941017d81" } +cosmwasm-std = { git = "https://github.com/dzmitry-lahoda-forks/cosmwasm", rev = "1277597cbf380a8d04dbe676d9cb344ca31634b6"} +cw-storage-plus = { git = "https://github.com/dzmitry-lahoda-forks/cw-storage-plus", rev = "d0a2cf126cae3e3960c787ebcfc9baa54f59f71c"} diff --git a/code/xcvm/README.md b/code/xcvm/README.md index 0baf5f4a4cc..9be4aeee825 100644 --- a/code/xcvm/README.md +++ b/code/xcvm/README.md @@ -4,22 +4,22 @@ ```mermaid erDiagram - XCVM-ACCOUNT { + XC-ACCOUNT { coin[] some_funds - address xcvm + address xc } OFFCHAIN_WALLET { string private_key } - XCVM { + XC { program[] programs address[][] wallets - address[] xcvm_accounts + address[] xc_accounts coin[] all_funds } - BRIDGE }|..|| XCVM : callback_or_call - XCVM ||--o{ XCVM-ACCOUNT : delegate - XCVM-ACCOUNT ||--o{ DEX: swap - OFFCHAIN_WALLET }|..|| XCVM-ACCOUNT : manage - OFFCHAIN_WALLET }|..|| XCVM : execute + BRIDGE }|..|| XC : callback_or_call + XC ||--o{ XC-ACCOUNT : delegate + XC-ACCOUNT ||--o{ DEX: swap + OFFCHAIN_WALLET }|..|| XC-ACCOUNT : manage + OFFCHAIN_WALLET }|..|| XC : execute ``` \ No newline at end of file diff --git a/code/xcvm/SPEC.md b/code/xcvm/SPEC.md index ff9940fdaed..c7a3bcc94ae 100644 --- a/code/xcvm/SPEC.md +++ b/code/xcvm/SPEC.md @@ -9,78 +9,10 @@ Karel L. Kubat, Hussein Ait Lahcen Cross-chain Virtual Machine (XCVM) is a specification outlining an application-level messaging protocol between state machines and other execution environments. It allows for a more sophisticated mechanism for cross-chain communication compared to message passing, by defining an interpreter-based communication interface between chains. - Turing-Complete Interactions: Complicated business logic can be dynamically dispatched to other chains, without the need for developers to deploy contracts on the destination chain. -- Configurable Security Levels: Developers can opt-in to use less secure transports, with the advantage of cheaper and faster execution. +- Configurable Bridges Levels: Developers can opt-in to use less secure transports, with the advantage of cheaper and faster execution. Most of all, `XCVM` has been designed in a very extensible way, building up small functionalities and by combining them, allowing for immense complexity. -# Status of This Memo - -This is a Composable Finance Protocol Specification document. It has not received public audits nor is the specification frozen. It is a product of the entire XCVM team. - -# Copyright Notice - -Copyright (c) 2022 Composable Finance and the persons identified as the -document authors. All rights reserved. - -# Table of Contents - - - -- [Abstract](#abstract) -- [Status of This Memo](#status-of-this-memo) -- [Copyright Notice](#copyright-notice) -- [Table of Contents](#table-of-contents) -- [1. Overview](#1-overview) - * [1.1. Document Structure](#11-document-structure) - * [1.2. Terms and Definitions](#12-terms-and-definitions) - * [1.3. Notational Conventions](#13--notational-conventions) - + [1.3.1. Types](#131-types) - + [1.3.2. Unions](#132-unions) - + [1.3.3. Sums](#133-sums) - + [1.3.4. Mappings](#134-mappings) - + [1.3.5. Sequences](#135-sequences) - + [1.3.6. Sets](#136-sets) - + [1.3.7. Primitive types](#137-primitive-types) -- [2. XCVM](#2-xcvm) - * [2.1. Versioning](#21-versioning) - * [2.2. Instruction Set](#22-instruction-set) - + [2.2.1. Transfer](#221-transfer) - + [2.2.2. Call](#222-call) - + [2.2.2.1. Late Bindings](#2221-late-bindings) - + [2.2.3 Spawn](#223-spawn) - + [2.2.4. Query](#224-query) - * [2.3. Balances](#23-balances) - * [2.4. Abstract Virtual Machine](#24-abstract-virtual-machine) - + [2.4.1 Registers](#241-registers) - - [2.4.1.1 Result Register](#2411-result-register) - - [2.4.1.2 IP Register](#2412-ip-register) - - [2.4.1.3 Relayer Register](#2413-relayer-register) - - [2.4.1.4 Self Register](#2414-self-register) - - [2.4.1.5 Version Register](#2415-version-register) - + [2.4.5 Program Execution Semantics](#245-program-execution-semantics) - * [2.5. XCVM Execution Semantics](#25-xcvm-execution-semantics) - + [2.5.1. Gateway](#251-gateway) - + [2.5.2. Router](#252-router) - + [2.6. Ownership](#26-ownership) -- [3. Encoding](#3-encoding) - * [3.1. JSON Encoding](#31-json-encoding) -- [4. Fees](#4-fees) - * [4.1. Execution Fees](#41-execution-fees) -- [5. Asset Registries](#5-asset-registries) -- [6. Further Work](#6-further-work) - * [6.1 NFTs](#61-nfts) - * [6.2 Name Service](#62-name-service) -- [7. Security considerations](#7-security-considerations) -- [8. References](#8-references) -- [9. Appendix](#9-appendix) - * [A.](#a) - * [B.](#b) - + [Examples](#examples) - - [Cross-chain borrowing](#cross-chain-borrowing) -- [10. Contributors](#10-contributors) - # 1. Overview ## 1.1. Document Structure @@ -240,17 +172,33 @@ sequenceDiagram participant IBC participant Gateway participant Router - participant XCVM Interpreter + participant Interpreter IBC->>Gateway: Pass program. Gateway->>Router: Add bridging info and transfer funds. - Router->>XCVM Interpreter: Instantiate VM and transfer funds. - loop Program - XCVM Interpreter-->XCVM Interpreter: Execute instructions and interact with contracts. + Router->>Interpreter: Instantiate VM and transfer funds. + loop Instructions + Interpreter-->Interpreter: Interact with contracts. end - XCVM Interpreter-->>Gateway: Send bridge agnostic program. + Interpreter-->>Gateway: Send program. Gateway->>IBC: Route through IBC. ``` +Interpreter may be also be singleton instance of contract per chain. + +Cross chain(XC) account contract is instantiated for each user which hold funds and proxies calls in this case. + +```mermaid +sequenceDiagram + Router->>Interpreter: Instantiate VM + Router->>XcAccount: Transfer funds + loop Instructions + Interpreter-->XcAccount: Interact with contracts. + end + Interpreter-->>Gateway: Send program. + Gateway->>IBC: Route through IBC. +``` + + ## 2.1. Versioning `XCVM` protocol versions and implementations use [semantic versioning](https://semver.org/spec/v2.0.0.html) to identify capabilities and backward compatibility. @@ -276,10 +224,11 @@ The following sequence shows possible high-level implementations for each instru ```mermaid sequenceDiagram - XCVM Interpreter->>ERC20 or CW20 or Native: Transfer - XCVM Interpreter->>Opaque Contract: Call - XCVM Interpreter->>Gateway: Spawn - XCVM Interpreter->>Gateway: Query + Interpreter->>ERC20 or CW20 or Native: Transfer + Interpreter->>XcAccount: Proxy Call + XcAccount->>Opaque Contract: Raw Call + Interpreter->>Gateway: Spawn + Interpreter->>Gateway: Query ``` ### 2.2.1. Transfer @@ -335,13 +284,16 @@ Bindings do not support non-byte aligned encodings. Sends a `Program` to another chain to be executed asynchronously. It is only guaranteed to execute on the specified `Network` if its `Program` contains an instruction that is guaranteed to execute on the `Network` of the `Spawn` context. ``` - ::= u128 - ::= bytes + ::= u128 + ::= bytes + ::= bytes - ::= + ::= ``` -Where the **salt** is used by the router while instantiating the interpreter (see section 2.5.2.). +Where the **salt** is used by the Router while instantiating the interpreter (see section 2.5.2.). + +`OriginNonce` is unique number generated once per program execution on originating consensus. Allows unique identify program invocation from origin to all child spawns. Combined with `Network` and `Program` can be considered `cross chain transaction identifier`. ### 2.2.3.1. IBC @@ -376,7 +328,7 @@ an XCVM-specific acknowledgement must be committed for the packet: - A single byte, `0x00` if unsuccessful - A single byte, `0x01` if successful -The bridge MUST deposit the **assets** in the Router contract before executing the +The bridge MUST deposit the **assets** in the Router before executing the XCVM program. Note: Assuming we transfer the assets `[asset1 amount1, ..., assetN amountN]`, @@ -475,26 +427,14 @@ See Appendix A for the algorithm. ## 2.5. XCVM Execution Semantics -Each chain within the `XCVM` contains a singleton entity, the router, and the gateway. Implementors MAY choose to create a monolithic smart contract or a set of modular contracts. +Each chain within the `XCVM` contains a singleton entity consisting of the Router, and the Gateway. Implementors MAY choose to create a monolithic smart contract or a set of modular contracts. ### 2.5.1. Gateway -Each chain contains a bridge aggregator contract (`Gateway`), which abstracts over transports. +Each chain contains a singleton bridge aggregator, the `Gateway`, which abstracts over transports. -The `Gateway` is configured to label bridges with different security levels. We define three security levels as of now: -``` - ::= - - | - | -``` - -- `Deterministic` bridges are light client based using a consensus protocol that has deterministic finality (IBC and XCM). Messages arriving from these bridges MUST never be fraudulent. -- `Probabilistic` bridges are still light client-based, but use a consensus protocol that at most has probabilistic finality (IBC with a PoW chain). Messages arriving from these bridges MUST never be fraudulent but MAY lead to inconsistent state because of block reorganizations. -- `Optimistic` bridges do not use proofs, but instead, have disputing mechanisms associated (Nomad). Messages arriving from these bridges MAY be fraudulent. - -Outgoing messages are routed based on bridge security, or by specifying the bridge contract directly. +Outgoing messages are routed based on bridge identifier, or by specifying the bridge contract directly. Each XCVM execution has access to its message `MessageOrigin` and can be configured to deny execution depending on the address or security level: @@ -504,7 +444,7 @@ Each XCVM execution has access to its message `MessageOrigin` and can be configu | | - ::= BridgeSecurity + ::= ::= bytes ``` @@ -520,28 +460,41 @@ The `Gateway` allows for third parties to add their bridges as well, using our o Each program arriving through the `Gateway` is passed to the `Router`, which becomes the initial beneficiary of the provided `Assets` before finding or instantiating an `Interpreter` instance. The router then transfers funds to the `Interpreter` instance. -Subsequent calls by the same `Origin` will not result in an instantiation, but instead in re-use of the `Interpreter` instance. This allows foreign Origins to maintain state across different protocols, such as managing LP positions. +Subsequent calls by the same `Origin` will not result in an instantiation, but instead in re-use of the `Interpreter` instance. This allows foreign `Origins` to maintain state across different protocols, such as managing LP positions. + +If no interpreter instance has been created for a given caller, the call to the `Router` must either come from the `IBC`, `XCM`, `OTP`, or a local origin. After the instance has been created, it can be configured to accept other origins by the caller. -If no interpreter instance has been created for a given caller, the call to the router must either come from the `IBC`, `XCM`, `OTP` with `Deterministic` security, or a local origin. After the instance has been created, it can be configured to accept other origins by the caller. +**Example** For a given XCVM program, its interpreter instance is derived from `Network Account Salt`. This allows users to create different interpreter instances to execute programs against. Note that the `Salt` is not additive and only the composite `Network Account` is forwarded to remote chains as the user origin: ``` -Spawn A BridgeSecurity::Deterministic 0x1 [ // Parent program spawned on A, with 0x1 as salt, the origin for the instructions is (A, AccountOnA, 0x1) +Spawn A 0x01 [ // Parent program spawned on A, with 0x01 as salt, the origin for the instructions is (A, AccountOnA, 0x1) Call 0x1337, // Call instruction executed on A - Spawn B BridgeSecurity::Deterministic 0x2 [] {}, // Sub-program spawned on B, with 0x2 as salt, the origin for the instructions is (A, AccountOnA, 0x2) + Spawn B 0x02 [] {}, // Sub-program spawned on B, with 0x02 as salt, the origin for the instructions is (A, AccountOnA, 0x2) ] {} ``` +Possible usage is to allow one program execution to act on state of other program execution to restore funds. + + In the above XCVM program, the parent program salt `0x01` is not a prefix of the sub-program salt `0x02`. The user is able to make it's interpreter origin using a fine grained mode. The following program is an example on how we can spread a salt: ``` -Spawn A BridgeSecurity::Deterministic 0x1 [ // Parent program spawned on A, with 0x1 as salt, the origin for the instructions is (A, AccountOnA, 0x1) +Spawn A 0x01 [ // Parent program spawned on A, with 0x01 as salt, the origin for the instructions is (A, AccountOnA, 0x01) Call 0x1337, // Call instruction executed on A - Spawn B BridgeSecurity::Deterministic 0x0102 [] {}, // Sub-program spawned on B, with 0x102 as salt, the origin for the instructions is (A, AccountOnA, 0x0102) + Spawn B 0x0102 [] {}, // Sub-program spawned on B, with 0x0102 as salt, the origin for the instructions is (A, AccountOnA, 0x0102) +] {} +``` + +In next program, all spawned instances on all chains share state (including assets): +``` +Spawn A 0x01 [ + Call 0x1337, + Spawn B 0x01 [] {}, // Sub-program spawned on B, with 0x01 as salt, the origin for the instructions is (A, AccountOnA, 0x01) allows to share ] {} ``` ### 2.6. Ownership -XCVM interpreter instances maintain a set of owners. +interpreter instances maintain a set of owners. ``` ::= {} @@ -558,9 +511,9 @@ Owners may be added by having the interpreter call the appropriate setters. We w # 3. Encoding -Different chains may choose to accept different encodings as the main entry point for contract calls. Such encodings can include but are not limited to `scale`, `ethabi`, or `bors`. Chain-to-chain calls are always in a single encoding: `protobuf`, which is used within the transport. +Different chains may choose to accept different encodings as the main entry point for contract calls. Such encodings can include but are not limited to `scale`, `ethabi`, `bors`, `borsh`. Chain-to-chain calls are always in a single encoding: `protobuf`, which is used within the transport. -`protobuf` is generally not deterministic. XCVM restricts encoders and decoders to a deterministic subset of protobuf. +`protobuf` is generally [not deterministic](https://protobuf.dev/programming-guides/encoding/). XCVM restricts encoders and decoders to a [deterministic subset of protobuf](https://docs.cosmos.network/main/architecture/adr-027-deterministic-protobuf-serialization). ## 3.1. JSON Encoding @@ -623,7 +576,7 @@ Adding an owner to the set of owners grants them the ability to evict other owne Failure to execute an instruction will lead to a transaction being reverted, however, the funds will still be in the interpreter account's control. Ensure that changing ownership is always done atomically (add and remove in the same transaction) to ensure funds are not lost forever. -Using insecure bridges such as LayerZero or Wormhole is equivalent to adding them as owners on your interpreter instance. +Using bridges is equivalent to adding them as owners on your interpreter instance. # 8. References @@ -667,31 +620,31 @@ For this example, we have the source initiator be a regular user, however, a sma ```mermaid sequenceDiagram - User->>XCVM Interpreter ABC: Submit Program - XCVM Interpreter ABC->>Router ABC: Spawn Program + User->>Interpreter ABC: Submit Program + Interpreter ABC->>Router ABC: Spawn Program Router ABC->>Gateway ABC: Submit Program Gateway ABC->>Gateway XYZ: Relay Program Gateway XYZ->>Router XYZ: Instantiate VM - Router XYZ->>XCVM Interpreter XYZ: Execute Spawn - XCVM Interpreter XYZ->>Lender: Call 0x1337 (Borrow USDC for DOT) - Lender->>XCVM Interpreter XYZ: Transfer USDC - XCVM Interpreter XYZ->>Relayer: Transfer USDC fee to Relayer - XCVM Interpreter XYZ->>Router XYZ: Spawn Program + Router XYZ->>Interpreter XYZ: Execute Spawn + Interpreter XYZ->>Lender: Call 0x1337 (Borrow USDC for DOT) + Lender->>Interpreter XYZ: Transfer USDC + Interpreter XYZ->>Relayer: Transfer USDC fee to Relayer + Interpreter XYZ->>Router XYZ: Spawn Program Router XYZ->>Gateway XYZ: Submit Program Gateway XYZ->>Gateway ABC: Relay Program Gateway ABC->>Router ABC: Instantiate VM - Router ABC->>XCVM Interpreter ABC: Execute Spawn - XCVM Interpreter ABC->>Relayer: Transfer USDC fee to Relayer - XCVM Interpreter ABC->>User: Transfer USDC + Router ABC->>Interpreter ABC: Execute Spawn + Interpreter ABC->>Relayer: Transfer USDC fee to Relayer + Interpreter ABC->>User: Transfer USDC ``` Although these operations are quite complicated to code by hand, using the XCVM protocol, we can very succinctly express them: ``` -Spawn XYZ BridgeSecurity::Deterministic 0 [ +Spawn XYZ 0 [ Call 0x1337, // chain-specific encoding to make a smart contract call. Transfer Relayer USDC Unit 50, // 50 bucks for the fee. The relayer earns this if the inner spawn is dispatched. - Spawn HOME BridgeSecurity::Deterministic 0 [ + Spawn HOME 0 [ Transfer Relayer USDC Unit 50 // Another 50 bucks fee for the operation, but now reverse direction. Transfer USER { USDC: Ratio::ALL } // On ABC, we transfer all USDC to the user. ] { USDC: ALL }, // We send over all our USDC back to ABC. @@ -700,11 +653,8 @@ Spawn XYZ BridgeSecurity::Deterministic 0 [ # 10. Contributors -- Karel L. Kubat -- Hussein Ait Lahcen - Abdullah Eryuzlu - Cor Pruijs -- Dzmitry Lahoda - Sofia de Proença - Jiang Qijong - Joon Whang diff --git a/code/xcvm/architecture/gateway.md b/code/xcvm/architecture/gateway.md deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/code/xcvm/architecture/interpreter.md b/code/xcvm/architecture/interpreter.md deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index abb04844a6e..66473be40d8 100644 --- a/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Composable Developers"] description = "XCVM Asset Registry contract" edition = "2021" -name = "cw-xcvm-asset-registry" +name = "cw-xc-asset-registry" version = "0.1.0" repository = "https://github.com/ComposableFi/composable" @@ -13,14 +13,18 @@ crate-type = ["cdylib", "rlib"] library = [] [dependencies] -cosmwasm-std = "1.0.0" -cw-storage-plus = "0.14.0" -cw-utils = "0.14.0" -cw2 = "0.14.0" -schemars = "0.8.8" -serde = { version = "1.0.137", default-features = false, features = ["derive"] } -thiserror = { version = "1.0.31" } -xcvm-core = { path = "../../../lib/core", features = ["cosmwasm", "std"] } +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true, default-features = false, features = ["derive"] } +xc-core = { path = "../../../lib/core", features = ["cosmwasm", "std"] } + +cw-utils = { workspace = true } +cw2 = { workspace = true } +thiserror = { workspace = true } + +serde-cw-value = { workspace = true } [dev-dependencies] -cosmwasm-schema = "1.0.0" +cosmwasm-schema = { workspace = true } diff --git a/code/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs b/code/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs index b6ba7d0677b..8ff8bd784c2 100644 --- a/code/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs +++ b/code/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs @@ -1,8 +1,9 @@ +use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::Addr; -use cw_storage_plus::{CwIntKey, Key, KeyDeserialize, PrimaryKey}; +use cw_storage_plus::{IntKey, Key, KeyDeserialize, PrimaryKey}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::AssetId; +use xc_core::AssetId; #[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, JsonSchema)] #[repr(transparent)] @@ -41,6 +42,8 @@ impl KeyDeserialize for AssetKey { fn from_vec(value: Vec) -> cosmwasm_std::StdResult { ::from_vec(value) } + + const KEY_ELEMS: u16 = 1; } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] @@ -73,13 +76,14 @@ pub enum ExecuteMsg { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct MigrateMsg {} -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[derive(QueryResponses)] pub enum QueryMsg { + #[returns(LookupResponse)] Lookup { asset_id: AssetKey }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[cw_serde] pub struct LookupResponse { pub reference: AssetReference, } diff --git a/code/xcvm/cosmwasm/contracts/common/Cargo.toml b/code/xcvm/cosmwasm/contracts/common/Cargo.toml index fed2c1d190c..2ef1fabe1de 100644 --- a/code/xcvm/cosmwasm/contracts/common/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/common/Cargo.toml @@ -1,12 +1,12 @@ [package] authors = ["Composable Developers"] edition = "2021" -name = "cw-xcvm-common" +name = "cw-xc-common" version = "0.1.0" [dependencies] -cosmwasm-std = "1.0.0" -cw-xcvm-utils = { path = "../utils" } -schemars = "0.8.8" -serde = { version = "1.0.137", default-features = false, features = ["derive"] } -xcvm-core = { path = "../../../lib/core", features = [] } +cosmwasm-std = { workspace = true } +cw-xc-utils = { path = "../utils" } +schemars = { workspace = true } +serde = { workspace = true, default-features = false, features = ["derive"] } +xc-core = { path = "../../../lib/core", features = ["std"] } diff --git a/code/xcvm/cosmwasm/contracts/common/src/gateway.rs b/code/xcvm/cosmwasm/contracts/common/src/gateway.rs index cbcacbf5537..1c412ddc7af 100644 --- a/code/xcvm/cosmwasm/contracts/common/src/gateway.rs +++ b/code/xcvm/cosmwasm/contracts/common/src/gateway.rs @@ -2,7 +2,7 @@ use crate::shared::BridgeMsg; use cosmwasm_std::{Addr, CosmosMsg}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::NetworkId; +use xc_core::NetworkId; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] diff --git a/code/xcvm/cosmwasm/contracts/common/src/router.rs b/code/xcvm/cosmwasm/contracts/common/src/router.rs index 3cc402f9447..d1e11e90652 100644 --- a/code/xcvm/cosmwasm/contracts/common/src/router.rs +++ b/code/xcvm/cosmwasm/contracts/common/src/router.rs @@ -1,8 +1,8 @@ use crate::shared::BridgeMsg; -use cw_xcvm_utils::DefaultXCVMProgram; +use cw_xc_utils::DefaultXCVMProgram; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{CallOrigin, Displayed, Funds}; +use xc_core::{CallOrigin, Displayed, Funds}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] diff --git a/code/xcvm/cosmwasm/contracts/common/src/shared.rs b/code/xcvm/cosmwasm/contracts/common/src/shared.rs index c715a61a041..622ee2c9d22 100644 --- a/code/xcvm/cosmwasm/contracts/common/src/shared.rs +++ b/code/xcvm/cosmwasm/contracts/common/src/shared.rs @@ -1,8 +1,8 @@ use cosmwasm_std::{from_binary, to_binary, Binary, StdResult}; -use cw_xcvm_utils::DefaultXCVMProgram; +use cw_xc_utils::DefaultXCVMProgram; use schemars::JsonSchema; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use xcvm_core::{Displayed, Funds, InterpreterOrigin, NetworkId}; +use xc_core::{Displayed, Funds, InterpreterOrigin, NetworkId}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct BridgeMsg { diff --git a/code/xcvm/cosmwasm/contracts/gateway/Cargo.toml b/code/xcvm/cosmwasm/contracts/gateway/Cargo.toml index 88a2bf0ea72..7e54d82d8dc 100644 --- a/code/xcvm/cosmwasm/contracts/gateway/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/gateway/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Composable Developers"] description = "XCVM Gateway contract" edition = "2021" -name = "cw-xcvm-gateway" +name = "cw-xc-gateway" repository = "https://github.com/ComposableFi/composable" version = "0.1.0" @@ -13,26 +13,26 @@ crate-type = ["cdylib", "rlib"] library = [] [dependencies] -cosmwasm-std = { version = "1.0.0", features = ["ibc3"] } -cw-storage-plus = "0.14.0" -cw-utils = "0.14.0" -cw-xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } -cw-xcvm-common = { path = "../common" } -cw-xcvm-interpreter = { path = "../interpreter", features = ["library"] } -cw-xcvm-router = { path = "../router", features = ["library"] } -cw-xcvm-utils = { path = "../utils" } -cw2 = "0.14.0" -cw20 = "0.14.0" -hex = "0.4" -schemars = "0.8.8" -serde = { version = "1.0.137", default-features = false, features = ["derive"] } -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } -thiserror = { version = "1.0.31" } -xcvm-core = { path = "../../../lib/core", features = ["std"] } -xcvm-proto = { path = "../../../lib/proto" } +cosmwasm-std = { workspace = true, features = ["ibc3"] } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +cw-xc-asset-registry = { path = "../asset-registry", features = ["library"] } +cw-xc-common = { path = "../common" } +cw-xc-interpreter = { path = "../interpreter", features = ["library"] } +cw-xc-router = { path = "../router", features = ["library"] } +cw-xc-utils = { path = "../utils" } +cw2 = { workspace = true } +cw20 = { workspace = true } +hex = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true, default-features = false, features = ["derive"] } +serde-json-wasm = { workspace = true } +thiserror = { workspace = true } +xc-core = { path = "../../../lib/core", features = ["std"] } +xc-proto = { path = "../../../lib/proto" } [dev-dependencies] -cosmwasm-schema = "1.0.0" -prost = { version = "0.11", default-features = false, features = [ +cosmwasm-schema = { workspace = true } +prost = { workspace = true, default-features = false, features = [ "prost-derive", ] } diff --git a/code/xcvm/cosmwasm/contracts/gateway/src/contract.rs b/code/xcvm/cosmwasm/contracts/gateway/src/contract.rs index 227dc5704b3..d2551278b4f 100644 --- a/code/xcvm/cosmwasm/contracts/gateway/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/gateway/src/contract.rs @@ -21,13 +21,13 @@ use cosmwasm_std::{ use cw2::set_contract_version; use cw20::Cw20ExecuteMsg; use cw_utils::ensure_from_older_version; -use cw_xcvm_asset_registry::{contract::external_query_lookup_asset, msg::AssetReference}; -use cw_xcvm_common::{gateway::ExecuteMsg, shared::BridgeMsg}; -use cw_xcvm_utils::{DefaultXCVMPacket, DefaultXCVMProgram}; -use xcvm_core::{ +use cw_xc_asset_registry::{contract::external_query_lookup_asset, msg::AssetReference}; +use cw_xc_common::{gateway::ExecuteMsg, shared::BridgeMsg}; +use cw_xc_utils::{DefaultXCVMPacket, DefaultXCVMProgram}; +use xc_core::{ BridgeProtocol, CallOrigin, Displayed, Funds, InterpreterOrigin, NetworkId, XCVMAck, }; -use xcvm_proto::{decode_packet, Encodable}; +use xc_proto::{decode_packet, Encodable}; pub const CONTRACT_NAME: &str = "composable:xcvm-gateway"; pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -56,7 +56,7 @@ pub fn instantiate( .add_submessage(SubMsg::reply_on_success( wasm_instantiate( msg.config.router_code_id, - &cw_xcvm_router::msg::InstantiateMsg { + &cw_xc_router::msg::InstantiateMsg { registry_address: msg.config.registry_address, interpreter_code_id: msg.config.interpreter_code_id, network_id: msg.config.network_id, @@ -221,7 +221,7 @@ pub fn ibc_packet_receive( msgs.push( wasm_execute( router_address, - &cw_xcvm_common::router::ExecuteMsg::ExecuteProgramPrivileged { + &cw_xc_common::router::ExecuteMsg::ExecuteProgramPrivileged { call_origin: CallOrigin::Remote { protocol: BridgeProtocol::IBC, relayer: msg.relayer, diff --git a/code/xcvm/cosmwasm/contracts/gateway/src/error.rs b/code/xcvm/cosmwasm/contracts/gateway/src/error.rs index 3e5258a4d1d..6e5ff118088 100644 --- a/code/xcvm/cosmwasm/contracts/gateway/src/error.rs +++ b/code/xcvm/cosmwasm/contracts/gateway/src/error.rs @@ -1,6 +1,6 @@ use cosmwasm_std::{IbcOrder, StdError}; use thiserror::Error; -use xcvm_proto::DecodingFailure; +use xc_proto::DecodingFailure; #[derive(Error, Debug)] pub enum ContractError { diff --git a/code/xcvm/cosmwasm/contracts/gateway/src/state.rs b/code/xcvm/cosmwasm/contracts/gateway/src/state.rs index 502d515e153..26cb1568c73 100644 --- a/code/xcvm/cosmwasm/contracts/gateway/src/state.rs +++ b/code/xcvm/cosmwasm/contracts/gateway/src/state.rs @@ -2,7 +2,7 @@ use cosmwasm_std::{Addr, IbcEndpoint}; use cw_storage_plus::{Item, Map}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{BridgeId, NetworkId}; +use xc_core::{BridgeId, NetworkId}; pub type ChannelId = String; diff --git a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index 6be675cefff..ee513862796 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Composable Developers"] description = "XCVM Interpreter contract" edition = "2021" -name = "cw-xcvm-interpreter" +name = "cw-xc-interpreter" repository = "https://github.com/ComposableFi/composable" version = "0.1.0" @@ -13,29 +13,29 @@ crate-type = ["cdylib", "rlib"] library = [] [dependencies] -cosmwasm-std = "1.0.0" -cw-storage-plus = "0.14.0" -cw-utils = "0.14.0" -cw-xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } -cw-xcvm-common = { path = "../common" } -cw-xcvm-utils = { path = "../utils" } -cw2 = "0.14.0" -cw20 = "0.14.0" -hex = { version = "0.4", default-features = false, features = [ +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +cw-xc-asset-registry = { path = "../asset-registry", features = ["library"] } +cw-xc-common = { path = "../common" } +cw-xc-utils = { path = "../utils" } +cw2 = { workspace = true } +cw20 = { workspace = true } +hex = { workspace = true, default-features = false, features = [ "alloc", "serde", ] } -num = "0.4" -prost = { version = "0.11", default-features = false, features = [ +num = { workspace = true } +prost = { workspace = true, default-features = false, features = [ "prost-derive", ] } -schemars = "0.8.8" -serde = { version = "1.0", default-features = false, features = ["derive"] } -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } -serde_json = "1" -thiserror = { version = "1.0.31" } -xcvm-core = { path = "../../../lib/core", features = ["cosmwasm", "std"] } -xcvm-proto = { path = "../../../lib/proto" } +schemars = { workspace = true } +serde = { workspace = true, default-features = false, features = ["derive"] } +serde-json-wasm = { workspace = true } +serde_json = { workspace = true } +thiserror = { workspace = true } +xc-core = { path = "../../../lib/core", features = ["cosmwasm", "std"] } +xc-proto = { path = "../../../lib/proto" } [dev-dependencies] -cosmwasm-schema = "1.0.0" +cosmwasm-schema = { workspace = true } diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 90d0031938d..5cc3bb6b65e 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -16,11 +16,11 @@ use cosmwasm_std::{ use cw2::set_contract_version; use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg, TokenInfoResponse}; use cw_utils::ensure_from_older_version; -use cw_xcvm_asset_registry::{contract::external_query_lookup_asset, msg::AssetReference}; -use cw_xcvm_common::shared::{encode_base64, BridgeMsg}; -use cw_xcvm_utils::DefaultXCVMProgram; +use cw_xc_asset_registry::{contract::external_query_lookup_asset, msg::AssetReference}; +use cw_xc_common::shared::{encode_base64, BridgeMsg}; +use cw_xc_utils::DefaultXCVMProgram; use num::Zero; -use xcvm_core::{ +use xc_core::{ apply_bindings, cosmwasm::*, Balance, BindingValue, Destination, Displayed, Funds, Instruction, NetworkId, Register, }; @@ -366,7 +366,7 @@ pub fn interpret_spawn( Ok(response .add_message(wasm_execute( router_address, - &cw_xcvm_common::router::ExecuteMsg::BridgeForward { + &cw_xc_common::router::ExecuteMsg::BridgeForward { msg: BridgeMsg { interpreter_origin: interpreter_origin.clone(), network_id: network, diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/error.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/error.rs index eeef10910a3..7025e35f4c4 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/error.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/error.rs @@ -1,6 +1,6 @@ use cosmwasm_std::StdError; use thiserror::Error; -use xcvm_core::LateBindingError; +use xc_core::LateBindingError; impl From<()> for ContractError { fn from(_: ()) -> Self { diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs index 95680436ba2..da66ec5ba4b 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs @@ -2,10 +2,10 @@ extern crate alloc; use alloc::{string::String, vec::Vec}; use cosmwasm_std::Addr; -use cw_xcvm_utils::DefaultXCVMProgram; +use cw_xc_utils::DefaultXCVMProgram; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{InterpreterOrigin, Register}; +use xc_core::{InterpreterOrigin, Register}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/state.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/state.rs index 082876d4ce0..ae0fd46e4ea 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/state.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/state.rs @@ -2,7 +2,7 @@ use cosmwasm_std::{Addr, SubMsgResponse}; use cw_storage_plus::{Item, Map}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::InterpreterOrigin; +use xc_core::InterpreterOrigin; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct Config { diff --git a/code/xcvm/cosmwasm/contracts/pingpong/Cargo.toml b/code/xcvm/cosmwasm/contracts/pingpong/Cargo.toml index e6548a1ef51..69a783e4e74 100644 --- a/code/xcvm/cosmwasm/contracts/pingpong/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/pingpong/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Composable Developers"] description = "XCVM Ping Pong contract" edition = "2021" -name = "cw-xcvm-pingpong" +name = "cw-xc-pingpong" repository = "https://github.com/ComposableFi/composable" version = "0.1.0" @@ -13,25 +13,26 @@ crate-type = ["cdylib", "rlib"] library = [] [dependencies] -cosmwasm-std = "1.0.0" -cw-storage-plus = "0.14.0" -cw-utils = "0.14.0" -cw-xcvm-common = { path = "../common" } -cw-xcvm-utils = { path = "../utils" } -cw2 = "0.14.0" -cw20 = "0.14.0" -hex = { version = "0.4", default-features = false, features = [ + +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +cw-xc-common = { path = "../common" } +cw-xc-utils = { path = "../utils" } +cw2 = { workspace = true } +cw20 = { workspace = true } +hex = { workspace = true, default-features = false, features = [ "alloc", "serde", ] } -num = "0.4" -prost = { version = "0.11", default-features = false, features = [ +num = { workspace = true } +prost = { workspace = true, default-features = false, features = [ "prost-derive", ] } -schemars = "0.8.8" -serde = { version = "1.0", default-features = false, features = ["derive"] } -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } -serde_json = "1" -thiserror = { version = "1.0.31" } -xcvm-core = { path = "../../../lib/core", features = ["cosmwasm", "std"] } -xcvm-proto = { path = "../../../lib/proto" } +schemars = { workspace = true } +serde = { workspace = true, default-features = false, features = ["derive"] } +serde-json-wasm = { workspace = true, default-features = false } +serde_json = { workspace = true } +thiserror = { workspace = true } +xc-core = { path = "../../../lib/core", features = ["cosmwasm", "std"] } +xc-proto = { path = "../../../lib/proto" } diff --git a/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs b/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs index 6ba9818b118..6ca5f04d2ff 100644 --- a/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/pingpong/src/contract.rs @@ -13,8 +13,8 @@ use cosmwasm_std::{ }; use cw2::set_contract_version; use cw_utils::ensure_from_older_version; -use cw_xcvm_utils::DefaultXCVMProgram; -use xcvm_core::{ +use cw_xc_utils::DefaultXCVMProgram; +use xc_core::{ cosmwasm::{FlatCosmosMsg, FlatWasmMsg}, Balance, Funds, Juno, Network, Picasso, ProgramBuilder, UserId, UserOrigin, }; @@ -90,7 +90,7 @@ pub fn execute( }; Ok(Response::default().add_message(wasm_execute( router, - &cw_xcvm_common::router::ExecuteMsg::ExecuteProgram { + &cw_xc_common::router::ExecuteMsg::ExecuteProgram { salt: vec![0x01, 0x02, 0x03], program: make_program(user_origin.user_id, message)?, assets: Funds::empty(), diff --git a/code/xcvm/cosmwasm/contracts/pingpong/src/msg.rs b/code/xcvm/cosmwasm/contracts/pingpong/src/msg.rs index 0a3abc43850..29093f88427 100644 --- a/code/xcvm/cosmwasm/contracts/pingpong/src/msg.rs +++ b/code/xcvm/cosmwasm/contracts/pingpong/src/msg.rs @@ -2,7 +2,7 @@ extern crate alloc; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{NetworkId, UserOrigin}; +use xc_core::{NetworkId, UserOrigin}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct InstantiateMsg { diff --git a/code/xcvm/cosmwasm/contracts/pingpong/src/state.rs b/code/xcvm/cosmwasm/contracts/pingpong/src/state.rs index 80a1fe000c1..51ad174bb04 100644 --- a/code/xcvm/cosmwasm/contracts/pingpong/src/state.rs +++ b/code/xcvm/cosmwasm/contracts/pingpong/src/state.rs @@ -2,7 +2,7 @@ extern crate alloc; use cosmwasm_std::Addr; use cw_storage_plus::Item; -use xcvm_core::NetworkId; +use xc_core::NetworkId; pub const ROUTER: Item = Item::new("router"); pub const NETWORK: Item = Item::new("network"); diff --git a/code/xcvm/cosmwasm/contracts/router/Cargo.toml b/code/xcvm/cosmwasm/contracts/router/Cargo.toml index 1a8ebcb386f..f756ad278ff 100644 --- a/code/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Composable Developers"] description = "XCVM Router contract" edition = "2021" -name = "cw-xcvm-router" +name = "cw-xc-router" repository = "https://github.com/ComposableFi/composable" version = "0.1.0" @@ -13,25 +13,25 @@ crate-type = ["cdylib", "rlib"] library = [] [dependencies] -cosmwasm-std = "1.0.0" -cw-storage-plus = "0.14.0" -cw-utils = "0.14.0" -cw-xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } -cw-xcvm-common = { path = "../common" } -cw-xcvm-interpreter = { path = "../interpreter", features = ["library"] } -cw-xcvm-utils = { path = "../utils" } -cw2 = "0.14.0" -cw20 = "0.14.0" -hex = "0.4" -schemars = "0.8.8" -serde = { version = "1.0.137", default-features = false, features = ["derive"] } -thiserror = { version = "1.0.31" } -xcvm-core = { path = "../../../lib/core", features = ["std", "cosmwasm"] } +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +cw-utils = { workspace = true } +cw-xc-asset-registry = { path = "../asset-registry", features = ["library"] } +cw-xc-common = { path = "../common" } +cw-xc-interpreter = { path = "../interpreter", features = ["library"] } +cw-xc-utils = { path = "../utils" } +cw2 = { workspace = true } +cw20 = { workspace = true } +hex = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true, default-features = false, features = ["derive"] } +thiserror = { workspace = true } +xc-core = { path = "../../../lib/core", features = ["std", "cosmwasm"] } [dev-dependencies] -cosmwasm-schema = "1.0.0" -prost = { version = "0.11", default-features = false, features = [ +cosmwasm-schema = { workspace = true } +prost = { workspace = true, default-features = false, features = [ "prost-derive", ] } -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } -xcvm-proto = { path = "../../../lib/proto" } +serde-json-wasm = { workspace = true } +xc-proto = { path = "../../../lib/proto" } diff --git a/code/xcvm/cosmwasm/contracts/router/src/contract.rs b/code/xcvm/cosmwasm/contracts/router/src/contract.rs index 20c485a25c7..423ca8ce8b6 100644 --- a/code/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -14,16 +14,16 @@ use cosmwasm_std::{ use cw2::set_contract_version; use cw20::{Cw20Contract, Cw20ExecuteMsg}; use cw_utils::ensure_from_older_version; -use cw_xcvm_asset_registry::{contract::external_query_lookup_asset, msg::AssetReference}; -use cw_xcvm_common::{ +use cw_xc_asset_registry::{contract::external_query_lookup_asset, msg::AssetReference}; +use cw_xc_common::{ router::ExecuteMsg, shared::{decode_base64, BridgeMsg}, }; -use cw_xcvm_interpreter::contract::{ +use cw_xc_interpreter::contract::{ XCVM_INTERPRETER_EVENT_DATA_ORIGIN, XCVM_INTERPRETER_EVENT_PREFIX, }; -use cw_xcvm_utils::DefaultXCVMProgram; -use xcvm_core::{CallOrigin, Displayed, Funds, InterpreterOrigin}; +use cw_xc_utils::DefaultXCVMProgram; +use xc_core::{CallOrigin, Displayed, Funds, InterpreterOrigin}; const CONTRACT_NAME: &str = "composable:xcvm-router"; const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -185,7 +185,7 @@ fn handle_bridge_forward( .collect::, _>>()?; Ok(Response::default().add_messages(transfers).add_message(wasm_execute( config.gateway_address, - &cw_xcvm_common::gateway::ExecuteMsg::Bridge { interpreter: info.sender, msg }, + &cw_xc_common::gateway::ExecuteMsg::Bridge { interpreter: info.sender, msg }, Default::default(), )?)) } @@ -213,7 +213,7 @@ fn handle_execute_program( send_funds_to_interpreter(deps.as_ref(), interpreter_address.clone(), assets)?; let wasm_msg = wasm_execute( interpreter_address.clone(), - &cw_xcvm_interpreter::msg::ExecuteMsg::Execute { + &cw_xc_interpreter::msg::ExecuteMsg::Execute { relayer: call_origin.relayer().clone(), program, }, @@ -234,7 +234,7 @@ fn handle_execute_program( // router is the default admin of a contract admin: Some(env.contract.address.clone().into_string()), code_id: config.interpreter_code_id, - msg: to_binary(&cw_xcvm_interpreter::msg::InstantiateMsg { + msg: to_binary(&cw_xc_interpreter::msg::InstantiateMsg { gateway_address: config.gateway_address.into(), registry_address: config.registry_address.into(), router_address: env.contract.address.clone().into_string(), diff --git a/code/xcvm/cosmwasm/contracts/router/src/helpers.rs b/code/xcvm/cosmwasm/contracts/router/src/helpers.rs index 27758279111..67bafb6a642 100644 --- a/code/xcvm/cosmwasm/contracts/router/src/helpers.rs +++ b/code/xcvm/cosmwasm/contracts/router/src/helpers.rs @@ -1,5 +1,5 @@ use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg}; -use cw_xcvm_common::router::ExecuteMsg; +use cw_xc_common::router::ExecuteMsg; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/code/xcvm/cosmwasm/contracts/router/src/msg.rs b/code/xcvm/cosmwasm/contracts/router/src/msg.rs index 70f3642c662..5ca999a1287 100644 --- a/code/xcvm/cosmwasm/contracts/router/src/msg.rs +++ b/code/xcvm/cosmwasm/contracts/router/src/msg.rs @@ -1,6 +1,6 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::NetworkId; +use xc_core::NetworkId; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct InstantiateMsg { diff --git a/code/xcvm/cosmwasm/contracts/router/src/state.rs b/code/xcvm/cosmwasm/contracts/router/src/state.rs index f57da4fc46c..c1bd9aafd1f 100644 --- a/code/xcvm/cosmwasm/contracts/router/src/state.rs +++ b/code/xcvm/cosmwasm/contracts/router/src/state.rs @@ -2,7 +2,7 @@ use cosmwasm_std::Addr; use cw_storage_plus::{Item, Map}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{InterpreterOrigin, NetworkId}; +use xc_core::{InterpreterOrigin, NetworkId}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct Config { diff --git a/code/xcvm/cosmwasm/contracts/utils/Cargo.toml b/code/xcvm/cosmwasm/contracts/utils/Cargo.toml index 5392ba79863..6c0603cc293 100644 --- a/code/xcvm/cosmwasm/contracts/utils/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/utils/Cargo.toml @@ -1,9 +1,9 @@ [package] authors = ["Composable Developers"] edition = "2021" -name = "cw-xcvm-utils" +name = "cw-xc-utils" version = "0.1.0" [dependencies] -cosmwasm-std = "1.0.0" -xcvm-core = { path = "../../../lib/core", features = [] } +cosmwasm-std = { workspace = true } +xc-core = { path = "../../../lib/core", features = [] } diff --git a/code/xcvm/cosmwasm/contracts/utils/src/lib.rs b/code/xcvm/cosmwasm/contracts/utils/src/lib.rs index 0bea3afd5e5..ec5dcdf4544 100644 --- a/code/xcvm/cosmwasm/contracts/utils/src/lib.rs +++ b/code/xcvm/cosmwasm/contracts/utils/src/lib.rs @@ -1,9 +1,9 @@ use cosmwasm_std::CanonicalAddr; use std::collections::VecDeque; -use xcvm_core::{Balance, Funds, NetworkId}; +use xc_core::{Balance, Funds, NetworkId}; pub type DefaultXCVMInstruction = - xcvm_core::Instruction, CanonicalAddr, Funds>; -pub type DefaultXCVMProgram = xcvm_core::Program>; -pub type DefaultXCVMPacket = xcvm_core::Packet; + xc_core::Instruction, CanonicalAddr, Funds>; +pub type DefaultXCVMProgram = xc_core::Program>; +pub type DefaultXCVMPacket = xc_core::Packet; pub type Salt = Vec; diff --git a/code/xcvm/cosmwasm/tests/Cargo.toml b/code/xcvm/cosmwasm/tests/Cargo.toml index 3699da7e245..b6819c6199a 100644 --- a/code/xcvm/cosmwasm/tests/Cargo.toml +++ b/code/xcvm/cosmwasm/tests/Cargo.toml @@ -1,33 +1,39 @@ [package] authors = ["Composable Developers"] homepage = "https://composable.finance" -name = "xcvm-tests" +name = "xc-tests" version = "0.1.0" edition = "2021" [lib] +[features] +default = ["std"] +std = ["cosmwasm-std/std", "cosmwasm-vm/std", "cosmwasm-vm-wasmi/std", "cw20/std" ] + [dev-dependencies] -cosmwasm-std = { version = "1.0.0", features = ["ibc3"] } -cosmwasm-vm = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "96324b719b4e13d129c912e2ce8622b3cc720b9c" } -cosmwasm-vm-wasmi = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "96324b719b4e13d129c912e2ce8622b3cc720b9c" } -cosmwasm-orchestrate = { git = "https://github.com/ComposableFi/cosmwasm-vm", rev = "96324b719b4e13d129c912e2ce8622b3cc720b9c" } -cw-xcvm-asset-registry = { path = "../contracts/asset-registry" } -cw-xcvm-gateway = { path = "../contracts/gateway" } -cw-xcvm-interpreter = { path = "../contracts/interpreter" } -cw-xcvm-router = { path = "../contracts/router" } -cw-xcvm-pingpong = { path = "../contracts/pingpong" } -cw-xcvm-common = { path = "../contracts/common" } -cw-xcvm-utils = { path = "../contracts/utils" } -xcvm-core = { path = "../../lib/core" } +cosmwasm-std = { workspace = true, features = ["ibc3"] } + +cosmwasm-vm = { workspace = true } +cosmwasm-vm-wasmi = { workspace = true } +cosmwasm-orchestrate = { workspace = true } + +cw-xc-asset-registry = { path = "../contracts/asset-registry" } +cw-xc-gateway = { path = "../contracts/gateway" } +cw-xc-interpreter = { path = "../contracts/interpreter" } +cw-xc-router = { path = "../contracts/router" } +cw-xc-pingpong = { path = "../contracts/pingpong" } +cw-xc-common = { path = "../contracts/common" } +cw-xc-utils = { path = "../contracts/utils" } +xc-core = { path = "../../lib/core" } log = { version = "0.4" } env_logger = { version = "0.10" } tokio = { version = "1.22", features = ["rt", "macros"] } -cw20 = { version = "0.16" } -cw20-base = { version = "0.16", features = ["library"] } +cw20 = { workspace = true } +cw20-base = { workspace = true, features = ["library"] } hex = { version = "0.4" } -serde_json = { version = "1.0" } -serde = { version = "1.0" } +serde_json = { workspace = true } +serde = { workspace = true } rand = { version = "0.8" } proptest = { version = "1" } diff --git a/code/xcvm/cosmwasm/tests/proptest-regressions/tests/suite.txt b/code/xcvm/cosmwasm/tests/proptest-regressions/tests/suite.txt new file mode 100644 index 00000000000..a461ce2532e --- /dev/null +++ b/code/xcvm/cosmwasm/tests/proptest-regressions/tests/suite.txt @@ -0,0 +1,11 @@ +# Seeds for failure cases proptest has generated in the past. It is +# automatically read and these particular cases re-run before any +# novel cases are generated. +# +# It is recommended to check this file in to source control so that +# everyone who runs the test benefits from these saved cases. +cc dff9ec13a1d0aade8754f3db2e5724a6f496ab56aa51a5b157334237a8ab1d99 # shrinks to admin = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")) +cc e0987d1ad956023da7d3062c8160ab55b5ecf2f468c5869cbdf2fd4b960c0c87 # shrinks to admin = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")) +cc 47324d532c1d34e26dde20885162bc0085dbbc8fd09668274a9e806962c616ad # shrinks to admin = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), arbitrary_sender = Account(Addr("5HQWsQyM9BPRZubLzCZLF8zf2qwtac4NxGeFRDJvDYXpUcLX")) +cc c3a5268daef43d83f491b23160dcd27efd80b99b2e1f8e069652156194f09755 # shrinks to admin = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), admin_counterparty = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), relayer = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), relayer_counterparty = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), alice = Account(Addr("5FgCVrdgWmGuhqdvGh61GLtWkx9BSMHt3CEPZJsj66i92C2s")), bob = Account(Addr("5CTevxDt4mw1uSk9EwPSX4GQr92AciGhiiy7rfWknErAhZQT")), transfer_amount = 254266932017561636424054971643907671450 +cc 3ab8184079fc8743c804170b3056a6bbdc01fd970c9327f6baae64791454aa69 # shrinks to admin = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), admin_counterparty = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), relayer = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), relayer_counterparty = Account(Addr("5ENyn69tT4FCAzjNdvs3Cr9C4cWMJRMTU96J57HdTp1fpD99")), alice = Account(Addr("5FgsaY77DLSNX9S7STTi5aWgpa2BdENpzxiyeYy98tMHYZq9")), bob = Account(Addr("5ESps3V6q3ERb9s8AQfmA6A38zpWhE3deuLMgVKVtsRdo8t7")), transfer_amount = 291370933194839262750748044501324907429 diff --git a/code/xcvm/cosmwasm/tests/src/tests/framework.rs b/code/xcvm/cosmwasm/tests/src/tests/framework.rs index 8ee83280eb4..6f170c83fbd 100644 --- a/code/xcvm/cosmwasm/tests/src/tests/framework.rs +++ b/code/xcvm/cosmwasm/tests/src/tests/framework.rs @@ -8,11 +8,11 @@ use cosmwasm_std::{ }; use cosmwasm_vm::system::CosmwasmCodeId; use cw20::{Cw20Coin, Expiration, MinterResponse}; -use cw_xcvm_asset_registry::msg::AssetReference; -use cw_xcvm_router::contract::XCVM_ROUTER_EVENT_PREFIX; -use cw_xcvm_utils::{DefaultXCVMProgram, Salt}; +use cw_xc_asset_registry::msg::AssetReference; +use cw_xc_router::contract::XCVM_ROUTER_EVENT_PREFIX; +use cw_xc_utils::{DefaultXCVMProgram, Salt}; use std::{collections::HashMap, hash::Hash}; -use xcvm_core::{Asset, AssetId, AssetSymbol, Funds, Network, NetworkId}; +use xc_core::{Asset, AssetId, AssetSymbol, Funds, Network, NetworkId}; pub const XCVM_ASSET_REGISTRY_CODE: CosmwasmCodeId = 0; pub const XCVM_INTERPRETER_CODE: CosmwasmCodeId = 1; @@ -138,7 +138,7 @@ impl InMemoryIbcNetworkChannel { }, tx_admin.info.clone(), gas, - cw_xcvm_common::gateway::ExecuteMsg::IbcSetNetworkChannel { + cw_xc_common::gateway::ExecuteMsg::IbcSetNetworkChannel { network_id: vm_counterparty.network_id, channel_id: channel_id.clone(), }, @@ -154,7 +154,7 @@ impl InMemoryIbcNetworkChannel { }, tx_admin_counterparty.info.clone(), gas, - cw_xcvm_common::gateway::ExecuteMsg::IbcSetNetworkChannel { + cw_xc_common::gateway::ExecuteMsg::IbcSetNetworkChannel { network_id: vm.network_id, channel_id: channel_id.clone(), }, @@ -240,7 +240,7 @@ impl TestVM<()> { tx.transaction.clone(), tx.info.clone(), tx.gas, - cw_xcvm_asset_registry::msg::InstantiateMsg { admin: tx.info.sender.clone().into() }, + cw_xc_asset_registry::msg::InstantiateMsg { admin: tx.info.sender.clone().into() }, )?; // The gateway deploy the router under the hood. let (gateway_address, (gateway_data, gateway_events)) = @@ -252,8 +252,8 @@ impl TestVM<()> { tx.transaction, tx.info.clone(), tx.gas, - cw_xcvm_gateway::msg::InstantiateMsg { - config: cw_xcvm_gateway::state::Config { + cw_xc_gateway::msg::InstantiateMsg { + config: cw_xc_gateway::state::Config { registry_address: registry_address.clone().to_string(), router_code_id: XCVM_ROUTER_CODE, interpreter_code_id: XCVM_INTERPRETER_CODE, @@ -320,7 +320,7 @@ impl TestVM> { }, tx.info, tx.gas, - cw_xcvm_asset_registry::msg::ExecuteMsg::RegisterAsset { + cw_xc_asset_registry::msg::ExecuteMsg::RegisterAsset { asset_id: A::ID.into(), reference: AssetReference::Virtual { cw20_address: asset_address.clone().into() }, }, @@ -382,7 +382,7 @@ impl TestVM> { }, tx.info, tx.gas, - cw_xcvm_common::router::ExecuteMsg::ExecuteProgram { + cw_xc_common::router::ExecuteMsg::ExecuteProgram { salt: salt.into(), program: program.into(), assets: Funds::from(assets.into_iter().collect::>()), diff --git a/code/xcvm/cosmwasm/tests/src/tests/suite.rs b/code/xcvm/cosmwasm/tests/src/tests/suite.rs index 067081ff9af..c2f1abf1fc4 100644 --- a/code/xcvm/cosmwasm/tests/src/tests/suite.rs +++ b/code/xcvm/cosmwasm/tests/src/tests/suite.rs @@ -8,14 +8,14 @@ use cosmwasm_std::{ }; use cosmwasm_vm::system::CUSTOM_CONTRACT_EVENT_PREFIX; use cw20::{Cw20Coin, Expiration, MinterResponse}; -use cw_xcvm_asset_registry::contract::XCVM_ASSET_REGISTRY_EVENT_PREFIX; -use cw_xcvm_gateway::contract::{XCVM_GATEWAY_EVENT_PREFIX, XCVM_GATEWAY_IBC_VERSION}; -use cw_xcvm_interpreter::contract::XCVM_INTERPRETER_EVENT_PREFIX; -use cw_xcvm_router::contract::XCVM_ROUTER_EVENT_PREFIX; -use cw_xcvm_utils::{DefaultXCVMProgram, Salt}; +use cw_xc_asset_registry::contract::XCVM_ASSET_REGISTRY_EVENT_PREFIX; +use cw_xc_gateway::contract::{XCVM_GATEWAY_EVENT_PREFIX, XCVM_GATEWAY_IBC_VERSION}; +use cw_xc_interpreter::contract::XCVM_INTERPRETER_EVENT_PREFIX; +use cw_xc_router::contract::XCVM_ROUTER_EVENT_PREFIX; +use cw_xc_utils::{DefaultXCVMProgram, Salt}; use proptest::{prelude::any, prop_assume, prop_compose, proptest}; use std::assert_matches::assert_matches; -use xcvm_core::{ +use xc_core::{ Asset, AssetId, AssetSymbol, Balance, Destination, Funds, Juno, Network, Picasso, ProgramBuilder, ETH, PICA, USDC, USDT, }; @@ -565,8 +565,8 @@ mod single_chain { ) .expect("Must be able to transfer assets via XCVM"); // We don't do cross-chain operation, nothing must happen from the relayer POV. - assert_eq!(relay_data, Vec::default()); - assert_eq!(relay_events, Vec::default()); + assert!(relay_data.is_empty()); + assert!(relay_events.is_empty()); // We don't dispatch any information in the data field. assert_eq!(dispatch_data, None); @@ -623,7 +623,7 @@ mod single_chain { mod cross_chain { use cosmwasm_std::Uint128; - use xcvm_core::XCVMAck; + use xc_core::XCVMAck; use super::*; diff --git a/code/xcvm/lib/core/Cargo.toml b/code/xcvm/lib/core/Cargo.toml index 76c84ba9ec8..bf9d1806262 100644 --- a/code/xcvm/lib/core/Cargo.toml +++ b/code/xcvm/lib/core/Cargo.toml @@ -2,32 +2,30 @@ authors = ["Composable Developers"] edition = "2021" homepage = "https://composable.finance" -name = "xcvm-core" +name = "xc-core" version = "0.1.0" [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -cosmwasm-std = "1.0.0" -cw-storage-plus = { version = "0.14.0", optional = true } -fixed = { version = "1.15", default-features = false } -num = { version = "0.4", default-features = false } -prost = { version = "0.11", default-features = false, features = [ +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true, optional = true } + +fixed = { workspace = true, default-features = false } +parity-scale-codec = { workspace = true, default-features = false } +num = { workspace = true, default-features = false } +prost = { workspace = true, default-features = false, features = [ "prost-derive", ] } -scale-info = { version = "2.1.1", default-features = false, features = [ +scale-info = { workspace = true, default-features = false, features = [ "derive", ] } -schemars = { version = "0.8.1", optional = true } -serde = { version = "1", default-features = false, features = [ +schemars = { workspace = true, optional = true } +serde = { workspace = true, default-features = false, features = [ "derive", "alloc", ] } -serde_json = "1.0" +serde_json = { workspace = true } [features] default = [] -# Although `JsonSchema` is only supported with `std`, let's not enable -# `std` with `cosmwasm` automatically. `cosmwasm` can be used in `no_std` -# environments as well without the need of `JsonSchema`. cosmwasm = ["cw-storage-plus"] std = ["dep:schemars"] diff --git a/code/xcvm/lib/core/src/asset.rs b/code/xcvm/lib/core/src/asset.rs index 1dcc4258800..c5c9b5c6398 100644 --- a/code/xcvm/lib/core/src/asset.rs +++ b/code/xcvm/lib/core/src/asset.rs @@ -1,9 +1,9 @@ use crate::abstraction::IndexOf; use alloc::{string::ToString, vec::Vec}; -use codec::{Decode, Encode}; use core::ops::Add; use cosmwasm_std::{Uint128, Uint256}; use num::Zero; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use serde::{Deserialize, Deserializer, Serialize, Serializer}; diff --git a/code/xcvm/lib/core/src/bridge.rs b/code/xcvm/lib/core/src/bridge.rs index 1cb44d050fb..94df3913aea 100644 --- a/code/xcvm/lib/core/src/bridge.rs +++ b/code/xcvm/lib/core/src/bridge.rs @@ -1,7 +1,7 @@ use crate::{NetworkId, UserOrigin}; use alloc::vec::Vec; -use codec::{Decode, Encode}; use cosmwasm_std::Addr; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; diff --git a/code/xcvm/lib/core/src/cosmwasm.rs b/code/xcvm/lib/core/src/cosmwasm.rs index 2eaf61c0e5d..1d598a293e3 100644 --- a/code/xcvm/lib/core/src/cosmwasm.rs +++ b/code/xcvm/lib/core/src/cosmwasm.rs @@ -67,7 +67,7 @@ use super::{BindingValue, Bindings}; use crate::{InterpreterOrigin, NetworkId, OrderedBindings, UserId, UserOrigin}; use alloc::{fmt::Debug, string::String, vec, vec::Vec}; use cosmwasm_std::{BankMsg, Coin, CosmosMsg, StdResult}; -use cw_storage_plus::{CwIntKey, Key, KeyDeserialize, Prefixer, PrimaryKey}; +use cw_storage_plus::{IntKey, Key, KeyDeserialize, Prefixer, PrimaryKey}; use serde::{Deserialize, Serialize}; impl<'a> PrimaryKey<'a> for InterpreterOrigin { @@ -99,6 +99,8 @@ impl KeyDeserialize for InterpreterOrigin { fn from_vec(value: Vec) -> StdResult { <(u32, Vec, Vec) as KeyDeserialize>::from_vec(value) } + + const KEY_ELEMS: u16 = 1; } impl<'a> PrimaryKey<'a> for UserOrigin { @@ -122,6 +124,8 @@ impl KeyDeserialize for UserOrigin { fn from_vec(value: Vec) -> StdResult { <(u32, Vec) as KeyDeserialize>::from_vec(value) } + + const KEY_ELEMS: u16 = 1; } impl<'a> PrimaryKey<'a> for UserId { @@ -142,9 +146,12 @@ impl<'a> Prefixer<'a> for UserId { impl KeyDeserialize for UserId { type Output = as KeyDeserialize>::Output; + fn from_vec(value: Vec) -> StdResult { as KeyDeserialize>::from_vec(value) } + + const KEY_ELEMS: u16 = 1; } impl<'a> PrimaryKey<'a> for NetworkId { @@ -168,6 +175,8 @@ impl KeyDeserialize for NetworkId { fn from_vec(value: Vec) -> StdResult { ::from_vec(value) } + + const KEY_ELEMS: u16 = 1; } #[derive(Debug, Serialize, Deserialize)] diff --git a/code/xcvm/lib/core/src/instruction.rs b/code/xcvm/lib/core/src/instruction.rs index ac1d01c0e25..6f4b7ef6ed7 100644 --- a/code/xcvm/lib/core/src/instruction.rs +++ b/code/xcvm/lib/core/src/instruction.rs @@ -4,7 +4,7 @@ use alloc::{ collections::{BTreeMap, VecDeque}, vec::Vec, }; -use codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; diff --git a/code/xcvm/lib/core/src/network.rs b/code/xcvm/lib/core/src/network.rs index a7eb7272647..e16d0851a1d 100644 --- a/code/xcvm/lib/core/src/network.rs +++ b/code/xcvm/lib/core/src/network.rs @@ -2,7 +2,7 @@ use core::fmt::Display; use crate::abstraction::IndexOf; use alloc::vec::Vec; -use codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; diff --git a/code/xcvm/lib/core/src/packet.rs b/code/xcvm/lib/core/src/packet.rs index 9544be28542..7297726edfe 100644 --- a/code/xcvm/lib/core/src/packet.rs +++ b/code/xcvm/lib/core/src/packet.rs @@ -1,7 +1,7 @@ use crate::{Displayed, Funds, UserOrigin}; use alloc::{vec, vec::Vec}; -use codec::{Decode, Encode}; use cosmwasm_std::Binary; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; diff --git a/code/xcvm/lib/core/src/program.rs b/code/xcvm/lib/core/src/program.rs index 3e4f05c53f8..dadd30e1d0e 100644 --- a/code/xcvm/lib/core/src/program.rs +++ b/code/xcvm/lib/core/src/program.rs @@ -1,5 +1,5 @@ use alloc::vec::Vec; -use codec::{Decode, Encode}; +use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; diff --git a/code/xcvm/lib/proto/Cargo.toml b/code/xcvm/lib/proto/Cargo.toml index 6a46332e3c1..4be2bf79c9e 100644 --- a/code/xcvm/lib/proto/Cargo.toml +++ b/code/xcvm/lib/proto/Cargo.toml @@ -2,17 +2,16 @@ authors = ["Composable Developers"] edition = "2021" homepage = "https://composable.finance" -name = "xcvm-proto" +name = "xc-proto" version = "0.1.0" [dependencies] -fixed = { version = "1.15", default-features = false } -prost = { version = "0.11", default-features = false, features = [ +fixed = { workspace = true, default-features = false } +prost = { workspace = true, default-features = false, features = [ "prost-derive", ] } -xcvm-core = { path = "../core" } -# Only necessary if using Protobuf well-known types: -prost-types = { version = "0.11", default-features = false } +xc-core = { path = "../core" } +prost-types = { workspace = true, default-features = false } [build-dependencies] -prost-build = "0.11" +prost-build = { workspace = true} diff --git a/code/xcvm/lib/proto/build.rs b/code/xcvm/lib/proto/build.rs index ffacff234be..c6465f30225 100644 --- a/code/xcvm/lib/proto/build.rs +++ b/code/xcvm/lib/proto/build.rs @@ -1,5 +1,5 @@ extern crate prost_build; fn main() { - prost_build::compile_protos(&["protos/xcvm_program.proto"], &["protos/"]).unwrap(); + prost_build::compile_protos(&["protos/xc.proto"], &["protos/"]).unwrap(); } diff --git a/code/xcvm/lib/proto/protos/xcvm_program.proto b/code/xcvm/lib/proto/protos/xc.proto similarity index 100% rename from code/xcvm/lib/proto/protos/xcvm_program.proto rename to code/xcvm/lib/proto/protos/xc.proto diff --git a/code/xcvm/lib/proto/src/lib.rs b/code/xcvm/lib/proto/src/lib.rs index 76b4f370739..4644ddde132 100644 --- a/code/xcvm/lib/proto/src/lib.rs +++ b/code/xcvm/lib/proto/src/lib.rs @@ -7,15 +7,15 @@ use core::fmt::Display; use alloc::{collections::VecDeque, format, vec::Vec}; use fixed::{types::extra::U16, FixedU128}; use prost::{DecodeError, Message}; -use xcvm_core::{Amount, Destination, Displayed, Funds, NetworkId, MAX_PARTS}; +use xc_core::{Amount, Destination, Displayed, Funds, NetworkId, MAX_PARTS}; include!(concat!(env!("OUT_DIR"), "/interpreter.rs")); pub type XCVMPacket = - xcvm_core::Packet>; + xc_core::Packet>; pub type XCVMProgram = - xcvm_core::Program>>; + xc_core::Program>>; pub trait Encodable { fn encode(self) -> Vec; @@ -36,14 +36,14 @@ impl Display for DecodingFailure { pub fn decode_packet( buffer: &[u8], ) -> core::result::Result< - xcvm_core::Packet>, + xc_core::Packet>, DecodingFailure, > where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { Packet::decode(buffer) .map_err(DecodingFailure::Protobuf) @@ -57,7 +57,7 @@ where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { Program::decode(buffer) .map_err(DecodingFailure::Protobuf) @@ -70,7 +70,7 @@ where TNetwork: Into, TAbiEncoded: Into>, TAccount: Into>, - TAssets: Into>, + TAssets: Into>, { fn encode(self) -> Vec { Packet::encode_to_vec(&self.into()) @@ -83,20 +83,20 @@ impl From> for Salt { } } -impl From for Account { - fn from(xcvm_core::UserId(account): xcvm_core::UserId) -> Self { +impl From for Account { + fn from(xc_core::UserId(account): xc_core::UserId) -> Self { Account { account } } } -impl From for UserOrigin { - fn from(value: xcvm_core::UserOrigin) -> Self { +impl From for UserOrigin { + fn from(value: xc_core::UserOrigin) -> Self { UserOrigin { network: Some(value.network_id.into()), account: Some(value.user_id.into()) } } } -impl From<(xcvm_core::AssetId, Displayed)> for PacketAsset { - fn from((asset, Displayed(amount)): (xcvm_core::AssetId, Displayed)) -> Self { +impl From<(xc_core::AssetId, Displayed)> for PacketAsset { + fn from((asset, Displayed(amount)): (xc_core::AssetId, Displayed)) -> Self { PacketAsset { asset_id: Some(asset.into()), amount: Some(amount.into()) } } } @@ -107,7 +107,7 @@ where TNetwork: Into, TAbiEncoded: Into>, TAccount: Into>, - TAssets: Into>, + TAssets: Into>, { fn from(value: XCVMPacket) -> Self { Packet { @@ -126,7 +126,7 @@ where TNetwork: Into, TAbiEncoded: Into>, TAccount: Into>, - TAssets: Into>, + TAssets: Into>, { fn encode(self) -> Vec { Program::encode_to_vec(&self.into()) @@ -145,21 +145,21 @@ impl From for Uint128 { } } -impl TryFrom for xcvm_core::UserOrigin { +impl TryFrom for xc_core::UserOrigin { type Error = (); fn try_from(value: UserOrigin) -> core::result::Result { - Ok(xcvm_core::UserOrigin { + Ok(xc_core::UserOrigin { network_id: value.network.ok_or(())?.network_id.into(), user_id: value.account.ok_or(())?.account.into(), }) } } -impl TryFrom for (xcvm_core::AssetId, Displayed) { +impl TryFrom for (xc_core::AssetId, Displayed) { type Error = (); fn try_from(value: PacketAsset) -> core::result::Result { Ok(( - xcvm_core::AssetId::from(u128::from(value.asset_id.ok_or(())?.asset_id.ok_or(())?)), + xc_core::AssetId::from(u128::from(value.asset_id.ok_or(())?.asset_id.ok_or(())?)), Displayed(value.amount.ok_or(())?.into()), )) } @@ -171,7 +171,7 @@ where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); @@ -185,7 +185,7 @@ where packet .assets .into_iter() - .map(|asset| <(xcvm_core::AssetId, Displayed)>::try_from(asset)) + .map(|asset| <(xc_core::AssetId, Displayed)>::try_from(asset)) .collect::, _>>()?, ), }) @@ -198,7 +198,7 @@ where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); @@ -211,12 +211,12 @@ where } impl TryFrom - for VecDeque> + for VecDeque> where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); @@ -230,12 +230,12 @@ where } impl TryFrom - for xcvm_core::Instruction + for xc_core::Instruction where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); @@ -245,12 +245,12 @@ where } impl TryFrom - for xcvm_core::Instruction + for xc_core::Instruction where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); @@ -264,25 +264,25 @@ where } impl TryFrom - for xcvm_core::Instruction + for xc_core::Instruction where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); fn try_from(call: Call) -> core::result::Result { let bindings = call.bindings.ok_or(())?.try_into()?; - Ok(xcvm_core::Instruction::Call { + Ok(xc_core::Instruction::Call { bindings, encoded: call.payload.try_into().map_err(|_| ())?, }) } } -impl TryFrom for xcvm_core::Bindings { +impl TryFrom for xc_core::Bindings { type Error = (); fn try_from(bindings: Bindings) -> core::result::Result { @@ -297,7 +297,7 @@ impl TryFrom for xcvm_core::Bindings { } } -impl TryFrom for xcvm_core::BindingValue { +impl TryFrom for xc_core::BindingValue { type Error = (); fn try_from(binding_value: BindingValue) -> core::result::Result { @@ -305,44 +305,44 @@ impl TryFrom for xcvm_core::BindingValue { } } -impl TryFrom for xcvm_core::BindingValue { +impl TryFrom for xc_core::BindingValue { type Error = (); fn try_from(binding_val: binding_value::Type) -> core::result::Result { Ok(match binding_val { binding_value::Type::Self_(_) => - xcvm_core::BindingValue::Register(xcvm_core::Register::This), + xc_core::BindingValue::Register(xc_core::Register::This), binding_value::Type::Relayer(_) => - xcvm_core::BindingValue::Register(xcvm_core::Register::Relayer), + xc_core::BindingValue::Register(xc_core::Register::Relayer), binding_value::Type::Result(_) => - xcvm_core::BindingValue::Register(xcvm_core::Register::Result), + xc_core::BindingValue::Register(xc_core::Register::Result), binding_value::Type::IpRegister(_) => - xcvm_core::BindingValue::Register(xcvm_core::Register::Ip), + xc_core::BindingValue::Register(xc_core::Register::Ip), binding_value::Type::AssetAmount(AssetAmount { asset_id, balance }) => - xcvm_core::BindingValue::AssetAmount( + xc_core::BindingValue::AssetAmount( asset_id.ok_or(())?.try_into()?, balance.ok_or(())?.try_into()?, ), binding_value::Type::AssetId(asset_id) => - xcvm_core::BindingValue::Asset(asset_id.try_into()?), + xc_core::BindingValue::Asset(asset_id.try_into()?), }) } } impl TryFrom - for xcvm_core::Instruction + for xc_core::Instruction where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); fn try_from(spawn: Spawn) -> core::result::Result { let network = spawn.network.ok_or(())?.network_id.into(); let salt = spawn.salt.ok_or(())?.salt; - Ok(xcvm_core::Instruction::Spawn { + Ok(xc_core::Instruction::Spawn { network, salt, assets: spawn @@ -366,18 +366,18 @@ impl From for NetworkId { } impl TryFrom - for xcvm_core::Instruction + for xc_core::Instruction where TNetwork: From, TAbiEncoded: TryFrom>, TAccount: for<'a> TryFrom<&'a [u8]>, - TAssets: From>, + TAssets: From>, { type Error = (); fn try_from(transfer: Transfer) -> core::result::Result { let account_type = transfer.account_type.ok_or(())?; - Ok(xcvm_core::Instruction::Transfer { + Ok(xc_core::Instruction::Transfer { to: account_type.try_into()?, assets: transfer .assets @@ -404,7 +404,7 @@ where } } -impl TryFrom for (xcvm_core::AssetId, xcvm_core::Balance) { +impl TryFrom for (xc_core::AssetId, xc_core::Balance) { type Error = (); fn try_from(asset: Asset) -> core::result::Result { @@ -415,15 +415,15 @@ impl TryFrom for (xcvm_core::AssetId, xcvm_core::Balance) { } } -impl TryFrom for xcvm_core::AssetId { +impl TryFrom for xc_core::AssetId { type Error = (); fn try_from(asset_id: AssetId) -> core::result::Result { - Ok(xcvm_core::AssetId(Displayed(asset_id.asset_id.ok_or(())?.into()))) + Ok(xc_core::AssetId(Displayed(asset_id.asset_id.ok_or(())?.into()))) } } -impl TryFrom for xcvm_core::Balance { +impl TryFrom for xc_core::Balance { type Error = (); fn try_from(balance: Balance) -> core::result::Result { @@ -431,10 +431,10 @@ impl TryFrom for xcvm_core::Balance { match balance_type { balance::BalanceType::Ratio(ratio) => - Ok(xcvm_core::Balance::new(ratio.try_into()?, false)), + Ok(xc_core::Balance::new(ratio.try_into()?, false)), balance::BalanceType::Absolute(Absolute { value }) => { let value = value.ok_or(())?; - Ok(xcvm_core::Balance::new(Amount::absolute(value.into()), false)) + Ok(xc_core::Balance::new(Amount::absolute(value.into()), false)) }, balance::BalanceType::Unit(unit) => unit.try_into(), } @@ -451,13 +451,13 @@ impl TryFrom for Amount { } } -impl TryFrom for xcvm_core::Balance { +impl TryFrom for xc_core::Balance { type Error = (); fn try_from(unit: Unit) -> core::result::Result { let integer = unit.integer.ok_or(())?; let ratio = unit.ratio.ok_or(())?; - Ok(xcvm_core::Balance::new( + Ok(xc_core::Balance::new( Amount::new( integer.into(), calc_nom( @@ -472,8 +472,8 @@ impl TryFrom for xcvm_core::Balance { } // XCVM types to Protobuf conversion -impl From for Balance { - fn from(balance: xcvm_core::Balance) -> Self { +impl From for Balance { + fn from(balance: xc_core::Balance) -> Self { // Note that although functionally nothing changes, there is no guarantee of getting the // same protobuf when you convert protobuf to XCVM types and convert back again. Because // `intercept = 0 & ratio = 0` is always converted to `Absolute`. But this can be also @@ -502,32 +502,31 @@ impl From for Balance { } } -impl From for AssetId { - fn from(asset_id: xcvm_core::AssetId) -> Self { +impl From for AssetId { + fn from(asset_id: xc_core::AssetId) -> Self { AssetId { asset_id: Some(asset_id.0 .0.into()) } } } -impl From<(xcvm_core::AssetId, xcvm_core::Balance)> for Asset { - fn from((asset_id, amount): (xcvm_core::AssetId, xcvm_core::Balance)) -> Self { +impl From<(xc_core::AssetId, xc_core::Balance)> for Asset { + fn from((asset_id, amount): (xc_core::AssetId, xc_core::Balance)) -> Self { Asset { asset_id: Some(asset_id.into()), balance: Some(amount.into()) } } } -impl From for binding_value::Type { - fn from(binding_value: xcvm_core::BindingValue) -> Self { +impl From for binding_value::Type { + fn from(binding_value: xc_core::BindingValue) -> Self { match binding_value { - xcvm_core::BindingValue::Register(xcvm_core::Register::Ip) => + xc_core::BindingValue::Register(xc_core::Register::Ip) => binding_value::Type::IpRegister(IpRegister { ip: 0 }), - xcvm_core::BindingValue::Register(xcvm_core::Register::Relayer) => + xc_core::BindingValue::Register(xc_core::Register::Relayer) => binding_value::Type::Relayer(Relayer { id: 0 }), - xcvm_core::BindingValue::Register(xcvm_core::Register::Result) => + xc_core::BindingValue::Register(xc_core::Register::Result) => binding_value::Type::Result(Result { result: 0 }), - xcvm_core::BindingValue::Register(xcvm_core::Register::This) => + xc_core::BindingValue::Register(xc_core::Register::This) => binding_value::Type::Self_(Self_ { self_: 0 }), - xcvm_core::BindingValue::Asset(asset_id) => - binding_value::Type::AssetId(asset_id.into()), - xcvm_core::BindingValue::AssetAmount(asset_id, balance) => + xc_core::BindingValue::Asset(asset_id) => binding_value::Type::AssetId(asset_id.into()), + xc_core::BindingValue::AssetAmount(asset_id, balance) => binding_value::Type::AssetAmount(AssetAmount { asset_id: Some(asset_id.into()), balance: Some(balance.into()), @@ -536,23 +535,23 @@ impl From for binding_value::Type { } } -impl From for BindingValue { - fn from(binding_value: xcvm_core::BindingValue) -> Self { +impl From for BindingValue { + fn from(binding_value: xc_core::BindingValue) -> Self { BindingValue { r#type: Some(binding_value.into()) } } } -impl From for Network { - fn from(network_id: xcvm_core::NetworkId) -> Self { +impl From for Network { + fn from(network_id: xc_core::NetworkId) -> Self { Network { network_id: network_id.0 as u32 } } } -impl From> for transfer::AccountType +impl From> for transfer::AccountType where TAccount: Into>, { - fn from(destination: xcvm_core::Destination) -> Self { + fn from(destination: xc_core::Destination) -> Self { match destination { Destination::Account(account) => transfer::AccountType::Account(Account { account: account.into() }), @@ -561,35 +560,35 @@ where } } -impl From<(u32, xcvm_core::BindingValue)> for Binding { - fn from((position, binding_value): (u32, xcvm_core::BindingValue)) -> Self { +impl From<(u32, xc_core::BindingValue)> for Binding { + fn from((position, binding_value): (u32, xc_core::BindingValue)) -> Self { Binding { position, binding_value: Some(binding_value.into()) } } } impl - From> for instruction::Instruction + From> for instruction::Instruction where TNetwork: Into, TAbiEncoded: Into>, TAccount: Into>, - TAssets: Into>, + TAssets: Into>, { - fn from(instruction: xcvm_core::Instruction) -> Self { + fn from(instruction: xc_core::Instruction) -> Self { match instruction { - xcvm_core::Instruction::Transfer { to, assets } => + xc_core::Instruction::Transfer { to, assets } => instruction::Instruction::Transfer(Transfer { assets: assets.into().into_iter().map(|asset| asset.into()).collect(), account_type: Some(to.into()), }), - xcvm_core::Instruction::Call { bindings, encoded } => + xc_core::Instruction::Call { bindings, encoded } => instruction::Instruction::Call(Call { payload: encoded.into(), bindings: Some(Bindings { bindings: bindings.into_iter().map(|binding| binding.into()).collect(), }), }), - xcvm_core::Instruction::Spawn { network, salt, assets, program } => + xc_core::Instruction::Spawn { network, salt, assets, program } => instruction::Instruction::Spawn(Spawn { network: Some(Network { network_id: network.into() }), salt: Some(Salt { salt }), @@ -601,14 +600,14 @@ where } impl - From> for Instruction + From> for Instruction where TNetwork: Into, TAbiEncoded: Into>, TAccount: Into>, - TAssets: Into>, + TAssets: Into>, { - fn from(instruction: xcvm_core::Instruction) -> Self { + fn from(instruction: xc_core::Instruction) -> Self { Instruction { instruction: Some(instruction.into()) } } } @@ -619,7 +618,7 @@ where TNetwork: Into, TAbiEncoded: Into>, TAccount: Into>, - TAssets: Into>, + TAssets: Into>, { fn from(program: XCVMProgram) -> Self { Program { @@ -645,7 +644,7 @@ fn calc_nom(nom: u128, denom: u128, max: u128) -> u128 { #[cfg(test)] mod tests { use super::*; - use xcvm_core::Displayed; + use xc_core::Displayed; #[test] fn balance_to_amount_works() { @@ -655,7 +654,7 @@ mod tests { denominator: Some(5u128.into()), })), }; - let xcvm_balance: xcvm_core::Balance = balance.try_into().unwrap(); + let xcvm_balance: xc_core::Balance = balance.try_into().unwrap(); assert_eq!(xcvm_balance.amount.intercept, Displayed(0)); let wrap = |num: u128| -> FixedU128 { FixedU128::wrapping_from_num(num) }; diff --git a/code/xcvm/xcvm-contracts.nix b/code/xcvm/xcvm-contracts.nix index 3f2d7e1de89..d9ce50e362a 100644 --- a/code/xcvm/xcvm-contracts.nix +++ b/code/xcvm/xcvm-contracts.nix @@ -17,13 +17,13 @@ }); in { packages = rec { - xcvm-contract-asset-registry = mkXcvmContract "cw-xcvm-asset-registry"; - xcvm-contract-router = mkXcvmContract "cw-xcvm-router"; - xcvm-contract-interpreter = mkXcvmContract "cw-xcvm-interpreter"; - xcvm-contract-gateway = mkXcvmContract "cw-xcvm-gateway"; - xcvm-contract-pingpong = mkXcvmContract "cw-xcvm-pingpong"; + xcvm-contract-asset-registry = mkXcvmContract "cw-xc-asset-registry"; + xcvm-contract-router = mkXcvmContract "cw-xc-router"; + xcvm-contract-interpreter = mkXcvmContract "cw-xc-interpreter"; + xcvm-contract-gateway = mkXcvmContract "cw-xc-gateway"; + xcvm-contract-pingpong = mkXcvmContract "cw-xc-pingpong"; xcvm-contracts = pkgs.symlinkJoin { - name = "xcvm-contracts"; + name = "xc-contracts"; paths = [ xcvm-contract-asset-registry xcvm-contract-router @@ -39,14 +39,14 @@ // { src = systemCommonRust.mkRustSrc ./.; cargoArtifacts = xcvm-deps; - buildPhase = "cargo test --release -p xcvm-tests"; + buildPhase = "cargo test --release --package xc-tests"; installPhase = "mkdir -p $out"; CW_XCVM_ASSET_REGISTRY = - "${xcvm-contracts}/lib/cw_xcvm_asset_registry.wasm"; + "${xcvm-contracts}/lib/cw_xc_asset_registry.wasm"; CW_XCVM_INTERPRETER = - "${xcvm-contracts}/lib/cw_xcvm_interpreter.wasm"; - CW_XCVM_ROUTER = "${xcvm-contracts}/lib/cw_xcvm_router.wasm"; - CW_XCVM_GATEWAY = "${xcvm-contracts}/lib/cw_xcvm_gateway.wasm"; + "${xcvm-contracts}/lib/cw_xc_interpreter.wasm"; + CW_XCVM_ROUTER = "${xcvm-contracts}/lib/cw_xc_router.wasm"; + CW_XCVM_GATEWAY = "${xcvm-contracts}/lib/cw_xc_gateway.wasm"; CW20 = pkgs.fetchurl { url = "https://github.com/CosmWasm/cw-plus/releases/download/v1.0.1/cw20_base.wasm"; diff --git a/docs/docs/internal/currency.md b/docs/docs/internal/currency.md index 8e646302701..187b30d4fca 100644 --- a/docs/docs/internal/currency.md +++ b/docs/docs/internal/currency.md @@ -61,7 +61,7 @@ For details on registry mapping, check the AssetsRegistry (frame/assets-registry Generally, a remote currency transferred via one bridge is not necessarily the same as the same currency transferred via another bridge. -For example, USDC transferred via Mosaic is not equal to the same amount transferred via XCMP from Acala. +For example, USDC transferred via IBC is not equal to the same amount transferred via XCMP from Acala. There are several solutions to equalize currencies: @@ -163,7 +163,6 @@ See Angular documentation for more examples. - tokens - balances - unknownTokens -- currencyFactory - assets - assetsRegistry -- mosaic \ No newline at end of file +- ibc \ No newline at end of file diff --git a/docs/docs/pallets/mosaic.md b/docs/docs/pallets/mosaic.md deleted file mode 100644 index da39f158039..00000000000 --- a/docs/docs/pallets/mosaic.md +++ /dev/null @@ -1,5 +0,0 @@ -# Mosaic - -*The Mosaic pallet enables cross-chain and cross-layer transfers* - -{{#include ../../../code/parachain/frame/mosaic/README.md:5:}} diff --git a/flake.nix b/flake.nix index 53ca9606421..b9727dac274 100644 --- a/flake.nix +++ b/flake.nix @@ -92,6 +92,7 @@ ./inputs/centauri/flake-module.nix ./inputs/chevdor/subwasm.nix ./inputs/cosmos/cosmwasm.nix + ./inputs/notional-labs/composable-centauri/flake-module.nix ./inputs/cosmos/gex.nix ./inputs/CosmosContracts/juno.nix ./inputs/CosmWasm/wasmvm.nix diff --git a/inputs/paritytech/substrate.nix b/inputs/paritytech/substrate.nix index 2081bd30963..554d36a6288 100644 --- a/inputs/paritytech/substrate.nix +++ b/inputs/paritytech/substrate.nix @@ -39,10 +39,10 @@ if [[ -n "''${2-}" ]]; then EXTRA_FEATURES=",$2" fi + echo "$EXTRA_FEATURES" cargo check --no-default-features --target wasm32-unknown-unknown --package "$1" cargo clippy --package "$1" -- --deny warnings --allow deprecated cargo test --features=std,runtime-benchmarks"$EXTRA_FEATURES" --package "$1" - cargo check --tests --features=std,runtime-benchmarks --package "$1" ''; }; check-std-wasm = pkgs.writeShellApplication {