From eb51da841301d5de578b5ec588263b56856f8d71 Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 10 Aug 2022 11:48:38 +0300 Subject: [PATCH 01/57] feat(cosmwasm): asset-registry and interpreter contracts * Add interpreter contract which is the actual xcvm interpreter instance. * Add asset registry which stores the mapping of cw20 token instances. Interpreters will query this contract to get the token instance, then call that cw20 token instance by themselves(not through the asset registry). * Add `cosmwasm-contracts` profile which contains the necessary options for cosmwasm production builds. Cosmwasm contracts should be built by using this profile. * Patch `serde_json_wasm`. Original `serde_json_wasm` does not support (de)serialization of `BTreeMap`. This produces `Unreachable` instruction which makes the contract crash. However our version does support this. Signed-off-by: aeryz --- code/xcvm/lib/core/src/program.rs | 4 +- .../contracts/asset-registry/Cargo.toml | 39 ++++ .../contracts/asset-registry/Developing.md | 104 ++++++++++ .../contracts/asset-registry/README.md | 3 + .../asset-registry/examples/schema.rs | 17 ++ .../asset-registry/schema/execute_msg.json | 21 ++ .../schema/instantiate_msg.json | 5 + .../asset-registry/schema/query_msg.json | 20 ++ .../contracts/asset-registry/src/contract.rs | 69 +++++++ .../contracts/asset-registry/src/error.rs | 8 + .../contracts/asset-registry/src/helpers.rs | 27 +++ .../contracts/asset-registry/src/lib.rs | 7 + .../contracts/asset-registry/src/msg.rs | 27 +++ .../contracts/asset-registry/src/state.rs | 6 + .../cosmwasm/contracts/interpreter/Cargo.toml | 40 ++++ xcvm/cosmwasm/contracts/interpreter/README.md | 7 + .../contracts/interpreter/examples/schema.rs | 15 ++ .../interpreter/schema/execute_msg.json | 194 ++++++++++++++++++ .../interpreter/schema/instantiate_msg.json | 13 ++ .../contracts/interpreter/src/contract.rs | 160 +++++++++++++++ .../contracts/interpreter/src/error.rs | 17 ++ .../cosmwasm/contracts/interpreter/src/lib.rs | 6 + .../cosmwasm/contracts/interpreter/src/msg.rs | 24 +++ .../contracts/interpreter/src/state.rs | 12 ++ 24 files changed, 844 insertions(+), 1 deletion(-) create mode 100644 xcvm/cosmwasm/contracts/asset-registry/Cargo.toml create mode 100644 xcvm/cosmwasm/contracts/asset-registry/Developing.md create mode 100644 xcvm/cosmwasm/contracts/asset-registry/README.md create mode 100644 xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs create mode 100644 xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json create mode 100644 xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json create mode 100644 xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json create mode 100644 xcvm/cosmwasm/contracts/asset-registry/src/contract.rs create mode 100644 xcvm/cosmwasm/contracts/asset-registry/src/error.rs create mode 100644 xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs create mode 100644 xcvm/cosmwasm/contracts/asset-registry/src/lib.rs create mode 100644 xcvm/cosmwasm/contracts/asset-registry/src/msg.rs create mode 100644 xcvm/cosmwasm/contracts/asset-registry/src/state.rs create mode 100644 xcvm/cosmwasm/contracts/interpreter/Cargo.toml create mode 100644 xcvm/cosmwasm/contracts/interpreter/README.md create mode 100644 xcvm/cosmwasm/contracts/interpreter/examples/schema.rs create mode 100644 xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json create mode 100644 xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json create mode 100644 xcvm/cosmwasm/contracts/interpreter/src/contract.rs create mode 100644 xcvm/cosmwasm/contracts/interpreter/src/error.rs create mode 100644 xcvm/cosmwasm/contracts/interpreter/src/lib.rs create mode 100644 xcvm/cosmwasm/contracts/interpreter/src/msg.rs create mode 100644 xcvm/cosmwasm/contracts/interpreter/src/state.rs diff --git a/code/xcvm/lib/core/src/program.rs b/code/xcvm/lib/core/src/program.rs index 3e4f05c53f8..b1761f720d5 100644 --- a/code/xcvm/lib/core/src/program.rs +++ b/code/xcvm/lib/core/src/program.rs @@ -4,7 +4,9 @@ use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; #[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, Serialize, Deserialize)] +#[derive( + Clone, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, Serialize, Deserialize +)] #[serde(rename_all = "camelCase")] pub struct Program { pub tag: Vec, diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml new file mode 100644 index 00000000000..d394c1e3135 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -0,0 +1,39 @@ +[package] +authors = ["Composable Developers"] +edition = "2021" +name = "xcvm-asset-registry" +version = "0.1.0" + +exclude = [ + # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. + "xcvm-asset-registry.wasm", + "hash.txt", +] + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[package.metadata.scripts] +optimize = """docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/rust-optimizer:0.12.6 +""" + +[dependencies] +cosmwasm-std = "1.0.0" +cosmwasm-storage = "1.0.0" +cw-storage-plus = "0.13.2" +schemars = "0.8.8" +serde = { version = "1.0.137", default-features = false, features = ["derive"] } +thiserror = { version = "1.0.31" } + +[dev-dependencies] +cw-multi-test = "0.13.2" +cosmwasm-schema = "1.0.0" diff --git a/xcvm/cosmwasm/contracts/asset-registry/Developing.md b/xcvm/cosmwasm/contracts/asset-registry/Developing.md new file mode 100644 index 00000000000..0df3a1ed262 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/Developing.md @@ -0,0 +1,104 @@ +# Developing + +If you have recently created a contract with this template, you probably could use some +help on how to build and test the contract, as well as prepare it for production. This +file attempts to provide a brief overview, assuming you have installed a recent +version of Rust already (eg. 1.58.1+). + +## Prerequisites + +Before starting, make sure you have [rustup](https://rustup.rs/) along with a +recent `rustc` and `cargo` version installed. Currently, we are testing on 1.58.1+. + +And you need to have the `wasm32-unknown-unknown` target installed as well. + +You can check that via: + +```sh +rustc --version +cargo --version +rustup target list --installed +# if wasm32 is not listed above, run this +rustup target add wasm32-unknown-unknown +``` + +## Compiling and running tests + +Now that you created your custom contract, make sure you can compile and run it before +making any changes. Go into the repository and do: + +```sh +# this will produce a wasm build in ./target/wasm32-unknown-unknown/release/YOUR_NAME_HERE.wasm +cargo wasm + +# this runs unit tests with helpful backtraces +RUST_BACKTRACE=1 cargo unit-test + +# auto-generate json schema +cargo run --example=schema +``` + +### Understanding the tests + +The main code is in `src/contract.rs` and the unit tests there run in pure rust, +which makes them very quick to execute and give nice output on failures, especially +if you do `RUST_BACKTRACE=1 cargo unit-test`. + +We consider testing critical for anything on a blockchain, and recommend to always keep +the tests up to date. + +## Generating JSON Schema + +While the Wasm calls (`instantiate`, `execute`, `query`) accept JSON, this is not enough +information to use it. We need to expose the schema for the expected messages to the +clients. You can generate this schema by calling `cargo schema`, which will output +4 files in `./schema`, corresponding to the 3 message types the contract accepts, +as well as the internal `State`. + +These files are in standard json-schema format, which should be usable by various +client side tools, either to auto-generate codecs, or just to validate incoming +json wrt. the defined schema. + +## Preparing the Wasm bytecode for production + +Before we upload it to a chain, we need to ensure the smallest output size possible, +as this will be included in the body of a transaction. We also want to have a +reproducible build process, so third parties can verify that the uploaded Wasm +code did indeed come from the claimed rust code. + +To solve both these issues, we have produced `rust-optimizer`, a docker image to +produce an extremely small build output in a consistent manner. The suggest way +to run it is this: + +```sh +docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/rust-optimizer:0.12.6 +``` + +Or, If you're on an arm64 machine, you should use a docker image built with arm64. +```sh +docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/rust-optimizer-arm64:0.12.6 +``` + +We must mount the contract code to `/code`. You can use a absolute path instead +of `$(pwd)` if you don't want to `cd` to the directory first. The other two +volumes are nice for speedup. Mounting `/code/target` in particular is useful +to avoid docker overwriting your local dev files with root permissions. +Note the `/code/target` cache is unique for each contract being compiled to limit +interference, while the registry cache is global. + +This is rather slow compared to local compilations, especially the first compile +of a given contract. The use of the two volume caches is very useful to speed up +following compiles of the same contract. + +This produces an `artifacts` directory with a `PROJECT_NAME.wasm`, as well as +`checksums.txt`, containing the Sha256 hash of the wasm file. +The wasm file is compiled deterministically (anyone else running the same +docker on the same git commit should get the identical file with the same Sha256 hash). +It is also stripped and minimized for upload to a blockchain (we will also +gzip it in the uploading process to make it even smaller). diff --git a/xcvm/cosmwasm/contracts/asset-registry/README.md b/xcvm/cosmwasm/contracts/asset-registry/README.md new file mode 100644 index 00000000000..0d604560aca --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/README.md @@ -0,0 +1,3 @@ +# Asset Registry Contract + +// TODO \ No newline at end of file diff --git a/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs b/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs new file mode 100644 index 00000000000..5e9d69fadaf --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs @@ -0,0 +1,17 @@ +use std::env::current_dir; +use std::fs::create_dir_all; + +use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; + +use xcvm_asset_registry::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; + +fn main() { + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); + + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(QueryMsg), &out_dir); +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json b/xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json new file mode 100644 index 00000000000..a67ba283836 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "set_assets" + ], + "properties": { + "set_assets": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + } + ] +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json b/xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json new file mode 100644 index 00000000000..44588cf2267 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object" +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json b/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json new file mode 100644 index 00000000000..f7bcb21bdc8 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_asset_contract" + ], + "properties": { + "get_asset_contract": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs new file mode 100644 index 00000000000..428ce07b012 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -0,0 +1,69 @@ +use std::collections::BTreeMap; + +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; + +use crate::error::ContractError; +use crate::msg::{ExecuteMsg, GetAssetContractResponse, InstantiateMsg, QueryMsg}; + +use crate::state::{XcvmAssetId, ASSETS}; + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + _deps: DepsMut, + _env: Env, + _info: MessageInfo, + _msg: InstantiateMsg, +) -> Result { + Ok(Response::default()) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::SetAssets(asset) => handle_set_assets(deps, asset), + } +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { + match msg { + QueryMsg::GetAssetContract(token_id) => to_binary(&query_asset_contract(deps, token_id)?), + } +} + +pub fn handle_set_assets( + deps: DepsMut, + assets: BTreeMap, +) -> Result { + // Remove all keys + for key in ASSETS + .keys(deps.storage, None, None, cosmwasm_std::Order::Ascending) + .collect::, _>>()? + { + ASSETS.remove(deps.storage, key); + } + + for (asset_id, contract_addr) in assets { + let addr = deps.api.addr_validate(&contract_addr)?; + ASSETS.save(deps.storage, asset_id.parse::().unwrap(), &addr)?; + } + + Ok(Response::new().add_attribute("action", "update_assets")) +} + +pub fn query_asset_contract( + deps: Deps, + token_id: XcvmAssetId, +) -> StdResult { + let contract_addr = ASSETS.load(deps.storage, token_id)?; + Ok(GetAssetContractResponse { + addr: contract_addr, + }) +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/error.rs b/xcvm/cosmwasm/contracts/asset-registry/src/error.rs new file mode 100644 index 00000000000..40dab9ff314 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/src/error.rs @@ -0,0 +1,8 @@ +use cosmwasm_std::StdError; +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs b/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs new file mode 100644 index 00000000000..48f715a8ac3 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs @@ -0,0 +1,27 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg}; + +use crate::msg::ExecuteMsg; + +/// AssetRegistryContract is a wrapper around Addr that provides helpers +/// for working with this as a library. +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct AssetRegistryContract(pub Addr); + +impl AssetRegistryContract { + pub fn addr(&self) -> Addr { + self.0.clone() + } + + pub fn call>(&self, msg: T) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { + contract_addr: self.addr().into(), + msg, + funds: vec![], + } + .into()) + } +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/lib.rs b/xcvm/cosmwasm/contracts/asset-registry/src/lib.rs new file mode 100644 index 00000000000..233dbf5572f --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/src/lib.rs @@ -0,0 +1,7 @@ +pub mod contract; +mod error; +pub mod helpers; +pub mod msg; +pub mod state; + +pub use crate::error::ContractError; diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs b/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs new file mode 100644 index 00000000000..a145a5034bb --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs @@ -0,0 +1,27 @@ +use std::collections::BTreeMap; + +use cosmwasm_std::Addr; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::state::XcvmAssetId; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct InstantiateMsg {} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum ExecuteMsg { + SetAssets(BTreeMap), +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum QueryMsg { + GetAssetContract(XcvmAssetId), +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct GetAssetContractResponse { + pub addr: Addr, +} diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs new file mode 100644 index 00000000000..c872073d129 --- /dev/null +++ b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs @@ -0,0 +1,6 @@ +use cosmwasm_std::Addr; +use cw_storage_plus::Map; + +pub type XcvmAssetId = u32; + +pub const ASSETS: Map = Map::new("assets"); diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml new file mode 100644 index 00000000000..6956e0d12bd --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -0,0 +1,40 @@ +[package] +authors = ["Composable Developers"] +description = "XCVM interpreter contract" +edition = "2021" +license = "Apache-2.0" +name = "xcvm-interpreter" +repository = "https://github.com/ComposableFi/composable" +version = "0.1.0" + +exclude = [ + # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. + "xcvm-interpreter.wasm", + "hash.txt", +] + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-std = "1.0.0" +cosmwasm-storage = "1.0.0" +cw-storage-plus = "0.13.2" +schemars = "0.8.8" +serde = { version = "1.0.137", default-features = false, features = ["derive"] } +thiserror = { version = "1.0.31" } +cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } +serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "4e175eaeffd625041bdecd251c0068a365def453" } +xcvm-core = { path = "../../../lib/core", features = ["std"]} +xcvm-asset-registry = { path = "../asset-registry" } + +[dev-dependencies] +cw-multi-test = "0.13.2" +cosmwasm-schema = "1.0.0" + diff --git a/xcvm/cosmwasm/contracts/interpreter/README.md b/xcvm/cosmwasm/contracts/interpreter/README.md new file mode 100644 index 00000000000..8dc54a06e8c --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/README.md @@ -0,0 +1,7 @@ +# Name Service + +The goal of the application you are building is to let users buy names and to set a value these names resolve to. +The owner of a given name will be the current highest bidder. In this section, you will learn how these simple + requirements translate to application design. + +Here is the tutorial for this application: [tutorial](https://docs.cosmwasm.com/tutorials/name-service/intro) diff --git a/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs b/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs new file mode 100644 index 00000000000..f1a4284f7fc --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs @@ -0,0 +1,15 @@ +use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; +use std::env::current_dir; +use std::fs::create_dir_all; + +use xcvm_interpreter::msg::{ExecuteMsg, InstantiateMsg}; + +fn main() { + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); + + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); +} diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json b/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json new file mode 100644 index 00000000000..2d755ee4b85 --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json @@ -0,0 +1,194 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "program" + ], + "properties": { + "program": { + "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Amount": { + "oneOf": [ + { + "type": "object", + "required": [ + "fixed" + ], + "properties": { + "fixed": { + "$ref": "#/definitions/Displayed_for_uint128" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ratio" + ], + "properties": { + "ratio": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] + }, + "Displayed_for_uint128": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "Funds_for_Amount": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Amount" + } + }, + "Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount": { + "description": "Base XCVM instructions. This set will remain as small as possible, expressiveness must come on `top` of the base instructions.", + "oneOf": [ + { + "description": "Transfer some [`Assets`] from the current program to the [`to`] account.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "assets", + "to" + ], + "properties": { + "assets": { + "$ref": "#/definitions/Funds_for_Amount" + }, + "to": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Arbitrary payload representing a raw call inside the current [`Network`].\n\nOn picasso, this will be a SCALE encoded dispatch call. On ethereum, an ethereum ABI encoded call. On cosmos, a raw json WasmMsg call.\n\nDepending on the network, the payload might be more structured than the base call. For most of the network in fact, we need to provide the target address along the payload, which can be encoded inside this single payload.", + "type": "object", + "required": [ + "call" + ], + "properties": { + "call": { + "type": "object", + "required": [ + "encoded" + ], + "properties": { + "encoded": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Spawn a sub-program on the target `network`.\n\nThe program will be spawned with the desired [`Assets`]. The salt is used to track the program when events are dispatched in the network.", + "type": "object", + "required": [ + "spawn" + ], + "properties": { + "spawn": { + "type": "object", + "required": [ + "assets", + "network", + "program", + "salt" + ], + "properties": { + "assets": { + "$ref": "#/definitions/Funds_for_Amount" + }, + "network": { + "$ref": "#/definitions/NetworkID" + }, + "program": { + "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount" + }, + "salt": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "NetworkID": { + "description": "Newtype for XCVM networks ID. Must be unique for each network and must never change. This ID is an opaque, arbitrary type from the XCVM protocol and no assumption must be made on how it is computed.", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "Program_for_Array_of_Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount": { + "type": "object", + "required": [ + "instructions" + ], + "properties": { + "instructions": { + "type": "array", + "items": { + "$ref": "#/definitions/Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount" + } + }, + "tag": { + "type": [ + "array", + "null" + ], + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + } +} diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json b/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json new file mode 100644 index 00000000000..45457359827 --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "registry_address" + ], + "properties": { + "registry_address": { + "type": "string" + } + } +} diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs new file mode 100644 index 00000000000..d49247471a6 --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -0,0 +1,160 @@ +use cosmwasm_std::{ + entry_point, to_binary, wasm_execute, DepsMut, Env, MessageInfo, QueryRequest, Response, + StdError, WasmQuery, +}; +use serde::{Deserialize, Serialize}; + +use crate::error::ContractError; +use crate::msg::{ExecuteMsg, InstantiateMsg, XCVMProgram}; +use crate::state::{Config, CONFIG}; +use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg}; +use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; +use xcvm_core::{Amount, Funds, Instruction, NetworkID}; + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: InstantiateMsg, +) -> Result { + let registry_address = deps.api.addr_validate(&msg.registry_address)?; + + let config = Config { registry_address }; + + CONFIG.save(deps.storage, &config)?; + + Ok(Response::default()) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::Execute { program } => interpret_program(deps, env, info, program), + } +} + +pub fn interpret_program( + mut deps: DepsMut, + _env: Env, + _info: MessageInfo, + program: XCVMProgram, +) -> Result { + let mut response = Response::new(); + + for instruction in program.instructions { + response = match instruction { + Instruction::Call { encoded } => interpret_call(encoded, response), + Instruction::Spawn { + network, + salt, + assets, + program, + } => interpret_spawn(network, salt, assets, program, response), + Instruction::Transfer { to, assets } => { + interpret_transfer(&mut deps, to, assets, response) + } + }?; + } + Ok(response) +} + +pub fn interpret_call(encoded: Vec, response: Response) -> Result { + #[derive(Deserialize)] + struct Payload { + address: String, + msg: String, + } + + let payload: Payload = + serde_json_wasm::from_slice(&encoded).map_err(|_| ContractError::InvalidCallPayload)?; + let msg = wasm_execute(payload.address, &payload.msg, vec![])?; + + Ok(response.add_message(msg)) +} + +pub fn interpret_spawn( + network: NetworkID, + salt: Vec, + assets: Funds, + program: XCVMProgram, + response: Response, +) -> Result { + #[derive(Serialize)] + struct SpawnEvent { + network: NetworkID, + salt: Vec, + assets: Funds, + program: XCVMProgram, + } + + let data = SpawnEvent { + network, + salt, + assets, + program, + }; + + Ok(response.add_attribute( + "spawn", + serde_json_wasm::to_string(&data).map_err(|_| ContractError::DataSerializationError)?, + )) +} + +pub fn interpret_transfer( + deps: &mut DepsMut, + to: String, + assets: Funds, + mut response: Response, +) -> Result { + let config = CONFIG.load(deps.storage)?; + let registry_addr = config.registry_address.into_string(); + + for (asset_id, amount) in assets.0 { + let query_msg = AssetRegistryQueryMsg::GetAssetContract(asset_id.into()); + + let cw20_address: GetAssetContractResponse = deps.querier.query( + &WasmQuery::Smart { + contract_addr: registry_addr.clone(), + msg: to_binary(&query_msg)?, + } + .into(), + )?; + let contract = Cw20Contract(cw20_address.addr.clone()); + + let transfer_amount = match amount { + Amount::Fixed(ref fixed) => { + if fixed.0 == 0 { + return Err(ContractError::ZeroTransferAmount); + } + amount.apply(0) + } + Amount::Ratio(ratio) => { + if ratio == 0 { + return Err(ContractError::ZeroTransferAmount); + } + let query_msg = Cw20QueryMsg::Balance { + address: to.clone(), + }; + let response: BalanceResponse = + deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart { + contract_addr: cw20_address.addr.clone().into_string(), + msg: to_binary(&query_msg)?, + }))?; + amount.apply(response.balance.into()) + } + }; + + response = response.add_message(contract.call(Cw20ExecuteMsg::Transfer { + recipient: to.clone(), + amount: transfer_amount.into(), + })?); + } + + Ok(response) +} diff --git a/xcvm/cosmwasm/contracts/interpreter/src/error.rs b/xcvm/cosmwasm/contracts/interpreter/src/error.rs new file mode 100644 index 00000000000..e37fa1960eb --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/src/error.rs @@ -0,0 +1,17 @@ +use cosmwasm_std::StdError; +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("Invalid call payload")] + InvalidCallPayload, + + #[error("Data cannot be serialized")] + DataSerializationError, + + #[error("Transfer amount cannot be 0")] + ZeroTransferAmount, +} diff --git a/xcvm/cosmwasm/contracts/interpreter/src/lib.rs b/xcvm/cosmwasm/contracts/interpreter/src/lib.rs new file mode 100644 index 00000000000..dfedc9dc616 --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/src/lib.rs @@ -0,0 +1,6 @@ +pub mod contract; +mod error; +pub mod msg; +pub mod state; + +pub use crate::error::ContractError; diff --git a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs new file mode 100644 index 00000000000..71e6b9243ba --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs @@ -0,0 +1,24 @@ +use std::collections::VecDeque; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use xcvm_core::{ + Instruction, Program, + Funds, NetworkID +}; + +pub type XCVMInstruction = + Instruction, String, Funds>; + +pub type XCVMProgram = Program>; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct InstantiateMsg { + pub registry_address: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum ExecuteMsg { + Execute { program: XCVMProgram }, +} diff --git a/xcvm/cosmwasm/contracts/interpreter/src/state.rs b/xcvm/cosmwasm/contracts/interpreter/src/state.rs new file mode 100644 index 00000000000..78661e45759 --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/src/state.rs @@ -0,0 +1,12 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use cosmwasm_std::Addr; +use cw_storage_plus::Item; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct Config { + pub registry_address: Addr, +} + +pub const CONFIG: Item = Item::new("config"); From d0d263e3de0990c66e170bd89bdbbe379e3abb83 Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 10 Aug 2022 17:23:31 +0300 Subject: [PATCH 02/57] chore(cosmwasm): add tests, fix asset type * Add tests to asset-registry * Asset id type is changed from u32 to u64 in asset-registry Signed-off-by: aeryz --- .../contracts/asset-registry/src/contract.rs | 177 ++++++++++++++---- .../contracts/asset-registry/src/state.rs | 2 +- 2 files changed, 139 insertions(+), 40 deletions(-) diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs index 428ce07b012..e72f4a2de9d 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -4,66 +4,165 @@ use std::collections::BTreeMap; use cosmwasm_std::entry_point; use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; -use crate::error::ContractError; -use crate::msg::{ExecuteMsg, GetAssetContractResponse, InstantiateMsg, QueryMsg}; +use crate::{ + error::ContractError, + msg::{ExecuteMsg, GetAssetContractResponse, InstantiateMsg, QueryMsg}, +}; use crate::state::{XcvmAssetId, ASSETS}; #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( - _deps: DepsMut, - _env: Env, - _info: MessageInfo, - _msg: InstantiateMsg, + _deps: DepsMut, + _env: Env, + _info: MessageInfo, + _msg: InstantiateMsg, ) -> Result { - Ok(Response::default()) + Ok(Response::default()) } #[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( - deps: DepsMut, - _env: Env, - _info: MessageInfo, - msg: ExecuteMsg, + deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: ExecuteMsg, ) -> Result { - match msg { - ExecuteMsg::SetAssets(asset) => handle_set_assets(deps, asset), - } + match msg { + ExecuteMsg::SetAssets(asset) => handle_set_assets(deps, asset), + } } #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { - match msg { - QueryMsg::GetAssetContract(token_id) => to_binary(&query_asset_contract(deps, token_id)?), - } + match msg { + QueryMsg::GetAssetContract(token_id) => to_binary(&query_asset_contract(deps, token_id)?), + } } pub fn handle_set_assets( - deps: DepsMut, - assets: BTreeMap, + deps: DepsMut, + assets: BTreeMap, ) -> Result { - // Remove all keys - for key in ASSETS - .keys(deps.storage, None, None, cosmwasm_std::Order::Ascending) - .collect::, _>>()? - { - ASSETS.remove(deps.storage, key); - } - - for (asset_id, contract_addr) in assets { - let addr = deps.api.addr_validate(&contract_addr)?; - ASSETS.save(deps.storage, asset_id.parse::().unwrap(), &addr)?; - } - - Ok(Response::new().add_attribute("action", "update_assets")) + // Remove all keys + for key in ASSETS + .keys(deps.storage, None, None, cosmwasm_std::Order::Ascending) + .collect::, _>>()? + { + ASSETS.remove(deps.storage, key); + } + + for (asset_id, contract_addr) in assets { + let addr = deps.api.addr_validate(&contract_addr)?; + ASSETS.save(deps.storage, asset_id.parse::().unwrap(), &addr)?; + } + + Ok(Response::new().add_attribute("action", "update_assets")) } pub fn query_asset_contract( - deps: Deps, - token_id: XcvmAssetId, + deps: Deps, + token_id: XcvmAssetId, ) -> StdResult { - let contract_addr = ASSETS.load(deps.storage, token_id)?; - Ok(GetAssetContractResponse { - addr: contract_addr, - }) + let contract_addr = ASSETS.load(deps.storage, token_id)?; + Ok(GetAssetContractResponse { addr: contract_addr }) +} + +#[cfg(test)] +mod tests { + use super::*; + use cosmwasm_std::{ + from_binary, + testing::{mock_dependencies, mock_env, mock_info}, + Addr, Attribute, Order, Storage, + }; + + #[test] + fn proper_instantiation() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg {}; + let info = mock_info("sender", &vec![]); + + let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(0, res.messages.len()); + + // Make sure that the storage is empty + assert_eq!(deps.storage.range(None, None, Order::Ascending).next(), None); + } + + #[test] + fn set_assets() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg {}; + let info = mock_info("sender", &vec![]); + + let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); + + let mut assets = BTreeMap::new(); + assets.insert("1".into(), "addr1".into()); + assets.insert("2".into(), "addr2".into()); + + let res = + execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::SetAssets(assets.clone())) + .unwrap(); + assert!(res + .attributes + .iter() + .find(|&attr| attr == Attribute::new("action", "update_assets")) + .is_some()); + + assert_eq!(ASSETS.load(&deps.storage, 1).unwrap(), Addr::unchecked("addr1")); + assert_eq!(ASSETS.load(&deps.storage, 2).unwrap(), Addr::unchecked("addr2")); + + let mut assets = BTreeMap::new(); + assets.insert("3".into(), "addr3".into()); + assets.insert("4".into(), "addr4".into()); + + let _ = execute(deps.as_mut(), mock_env(), info, ExecuteMsg::SetAssets(assets.clone())) + .unwrap(); + + // Make sure that set removes the previous elements + assert!(ASSETS.load(&deps.storage, 1).is_err()); + assert!(ASSETS.load(&deps.storage, 2).is_err()); + assert_eq!(ASSETS.load(&deps.storage, 3).unwrap(), Addr::unchecked("addr3")); + assert_eq!(ASSETS.load(&deps.storage, 4).unwrap(), Addr::unchecked("addr4")); + + // Finally make sure that there are two elements in the assets storage + assert_eq!( + ASSETS + .keys(&deps.storage, None, None, Order::Ascending) + .collect::>() + .len(), + 2 + ); + } + + #[test] + fn query_assets() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg {}; + let info = mock_info("sender", &vec![]); + + let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); + + let mut assets = BTreeMap::new(); + assets.insert("1".into(), "addr1".into()); + + let _ = + execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::SetAssets(assets.clone())) + .unwrap(); + + let res: GetAssetContractResponse = + from_binary(&query(deps.as_ref(), mock_env(), QueryMsg::GetAssetContract(1)).unwrap()) + .unwrap(); + + // Query should return the corresponding address + assert_eq!(res, GetAssetContractResponse { addr: Addr::unchecked("addr1") }); + + // This should fail since there the asset doesn't exist + assert!(query(deps.as_ref(), mock_env(), QueryMsg::GetAssetContract(2)).is_err()); + } } diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs index c872073d129..bde926d7101 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs @@ -1,6 +1,6 @@ use cosmwasm_std::Addr; use cw_storage_plus::Map; -pub type XcvmAssetId = u32; +pub type XcvmAssetId = u64; pub const ASSETS: Map = Map::new("assets"); From 2217ff6e9d406ec3b3b31a024da395514c4a6bcf Mon Sep 17 00:00:00 2001 From: aeryz Date: Thu, 11 Aug 2022 10:59:07 +0300 Subject: [PATCH 03/57] chore(cosmwasm): add tests and docs * Tests are added to interpreter contract. * Minor fixes. * README's are added to all contracts. Signed-off-by: aeryz --- .../contracts/asset-registry/README.md | 21 +- .../contracts/asset-registry/src/contract.rs | 11 +- .../contracts/asset-registry/src/helpers.rs | 4 +- .../contracts/asset-registry/src/state.rs | 2 +- .../cosmwasm/contracts/interpreter/Cargo.toml | 4 +- xcvm/cosmwasm/contracts/interpreter/README.md | 36 +- .../contracts/interpreter/src/contract.rs | 374 ++++++++++++------ 7 files changed, 311 insertions(+), 141 deletions(-) diff --git a/xcvm/cosmwasm/contracts/asset-registry/README.md b/xcvm/cosmwasm/contracts/asset-registry/README.md index 0d604560aca..128f50107a2 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/README.md +++ b/xcvm/cosmwasm/contracts/asset-registry/README.md @@ -1,3 +1,22 @@ # Asset Registry Contract -// TODO \ No newline at end of file +Asset registry is used by XCVM interpreter to get the contract address of a given asset. + +Asset mapping can be updated by using `SetAssets(BTreeMap)` execute message where keys are asset id's(which must be valid `u32` integers) and values are contract addresses. + +A contract address can be queried by using `GetAssetContract(u32)` where `u32` is an asset id. + +## Compile + +```sh +RUSTFLAGS='-C link-arg=-s' cargo b --package=xcvm-asset-registry --target=wasm32-unknown-unknown --profile="cosmwasm-contracts" +``` + +* `-C link-arg=-s` is used for stripping the binary which reduces the binary size drastically. +* `--profile="cosmwasm-contracts"` must be used for cosmwasm contracts. + +## Test + +```sh +cargo test --package="xcvm-asset-registry" +``` diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs index e72f4a2de9d..e62f44671bc 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -1,14 +1,11 @@ -use std::collections::BTreeMap; - -#[cfg(not(feature = "library"))] -use cosmwasm_std::entry_point; -use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; - use crate::{ error::ContractError, msg::{ExecuteMsg, GetAssetContractResponse, InstantiateMsg, QueryMsg}, }; - +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; +use std::collections::BTreeMap; use crate::state::{XcvmAssetId, ASSETS}; #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs b/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs index 48f715a8ac3..34c9d64fdef 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs @@ -11,8 +11,8 @@ use crate::msg::ExecuteMsg; pub struct AssetRegistryContract(pub Addr); impl AssetRegistryContract { - pub fn addr(&self) -> Addr { - self.0.clone() + pub fn addr(&self) -> &Addr { + &self.0 } pub fn call>(&self, msg: T) -> StdResult { diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs index bde926d7101..c872073d129 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs @@ -1,6 +1,6 @@ use cosmwasm_std::Addr; use cw_storage_plus::Map; -pub type XcvmAssetId = u64; +pub type XcvmAssetId = u32; pub const ASSETS: Map = Map::new("assets"); diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index 6956e0d12bd..dda27e668e2 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -31,8 +31,8 @@ serde = { version = "1.0.137", default-features = false, features = ["derive"] } thiserror = { version = "1.0.31" } cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "4e175eaeffd625041bdecd251c0068a365def453" } -xcvm-core = { path = "../../../lib/core", features = ["std"]} -xcvm-asset-registry = { path = "../asset-registry" } +xcvm-core = { path = "../../../lib/core", features = ["std"] } +xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } [dev-dependencies] cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/interpreter/README.md b/xcvm/cosmwasm/contracts/interpreter/README.md index 8dc54a06e8c..3867548a6f1 100644 --- a/xcvm/cosmwasm/contracts/interpreter/README.md +++ b/xcvm/cosmwasm/contracts/interpreter/README.md @@ -1,7 +1,33 @@ -# Name Service +# XCVM Interpreter -The goal of the application you are building is to let users buy names and to set a value these names resolve to. -The owner of a given name will be the current highest bidder. In this section, you will learn how these simple - requirements translate to application design. +The XCVM interpreter contract interprets the XCVM programs. Available instructions are: -Here is the tutorial for this application: [tutorial](https://docs.cosmwasm.com/tutorials/name-service/intro) +### Call +Which is used to call a contract. See that the encoded payload must be in a format: +``` +{ + "address": "contract-addr", + "payload": "json-encoded ExecuteMsg struct" +} +``` + +### Transfer +Queries `asset-registry`, gets the contract address and then executes that contract to do the transfer. + +### Spawn +Emits `spawn` even with the given parameters. + +## Compile + +```sh +RUSTFLAGS='-C link-arg=-s' cargo b --package=xcvm-interpreter --target=wasm32-unknown-unknown --profile="cosmwasm-contracts" +``` + +* `-C link-arg=-s` is used for stripping the binary which reduces the binary size drastically. +* `--profile="cosmwasm-contracts"` must be used for cosmwasm contracts. + +## Test + +```sh +cargo test --package="xcvm-interpreter" +``` diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index d49247471a6..cd74f60592d 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -1,160 +1,288 @@ use cosmwasm_std::{ - entry_point, to_binary, wasm_execute, DepsMut, Env, MessageInfo, QueryRequest, Response, - StdError, WasmQuery, + entry_point, to_binary, wasm_execute, DepsMut, Env, MessageInfo, QueryRequest, Response, + StdError, WasmQuery, }; use serde::{Deserialize, Serialize}; -use crate::error::ContractError; -use crate::msg::{ExecuteMsg, InstantiateMsg, XCVMProgram}; -use crate::state::{Config, CONFIG}; +use crate::{ + error::ContractError, + msg::{ExecuteMsg, InstantiateMsg, XCVMProgram}, + state::{Config, CONFIG}, +}; use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg}; use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; use xcvm_core::{Amount, Funds, Instruction, NetworkID}; #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( - deps: DepsMut, - _env: Env, - _info: MessageInfo, - msg: InstantiateMsg, + deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: InstantiateMsg, ) -> Result { - let registry_address = deps.api.addr_validate(&msg.registry_address)?; + let registry_address = deps.api.addr_validate(&msg.registry_address)?; - let config = Config { registry_address }; + let config = Config { registry_address }; - CONFIG.save(deps.storage, &config)?; + CONFIG.save(deps.storage, &config)?; - Ok(Response::default()) + Ok(Response::default()) } #[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( - deps: DepsMut, - env: Env, - info: MessageInfo, - msg: ExecuteMsg, + deps: DepsMut, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, ) -> Result { - match msg { - ExecuteMsg::Execute { program } => interpret_program(deps, env, info, program), - } + match msg { + ExecuteMsg::Execute { program } => interpret_program(deps, env, info, program), + } } pub fn interpret_program( - mut deps: DepsMut, - _env: Env, - _info: MessageInfo, - program: XCVMProgram, + mut deps: DepsMut, + _env: Env, + _info: MessageInfo, + program: XCVMProgram, ) -> Result { - let mut response = Response::new(); - - for instruction in program.instructions { - response = match instruction { - Instruction::Call { encoded } => interpret_call(encoded, response), - Instruction::Spawn { - network, - salt, - assets, - program, - } => interpret_spawn(network, salt, assets, program, response), - Instruction::Transfer { to, assets } => { - interpret_transfer(&mut deps, to, assets, response) - } - }?; - } - Ok(response) + let mut response = Response::new(); + + for instruction in program.instructions { + response = match instruction { + Instruction::Call { encoded } => interpret_call(encoded, response), + Instruction::Spawn { network, salt, assets, program } => + interpret_spawn(network, salt, assets, program, response), + Instruction::Transfer { to, assets } => + interpret_transfer(&mut deps, to, assets, response), + }?; + } + Ok(response) } pub fn interpret_call(encoded: Vec, response: Response) -> Result { - #[derive(Deserialize)] - struct Payload { - address: String, - msg: String, - } + #[derive(Deserialize)] + struct Payload { + address: String, + msg: String, + } - let payload: Payload = - serde_json_wasm::from_slice(&encoded).map_err(|_| ContractError::InvalidCallPayload)?; - let msg = wasm_execute(payload.address, &payload.msg, vec![])?; + let payload: Payload = + serde_json_wasm::from_slice(&encoded).map_err(|_| ContractError::InvalidCallPayload)?; + let msg = wasm_execute(payload.address, &payload.msg, vec![])?; - Ok(response.add_message(msg)) + Ok(response.add_message(msg)) } pub fn interpret_spawn( - network: NetworkID, - salt: Vec, - assets: Funds, - program: XCVMProgram, - response: Response, + network: NetworkID, + salt: Vec, + assets: Funds, + program: XCVMProgram, + response: Response, ) -> Result { - #[derive(Serialize)] - struct SpawnEvent { - network: NetworkID, - salt: Vec, - assets: Funds, - program: XCVMProgram, - } - - let data = SpawnEvent { - network, - salt, - assets, - program, - }; - - Ok(response.add_attribute( - "spawn", - serde_json_wasm::to_string(&data).map_err(|_| ContractError::DataSerializationError)?, - )) + #[derive(Serialize)] + struct SpawnEvent { + network: NetworkID, + salt: Vec, + assets: Funds, + program: XCVMProgram, + } + + let data = SpawnEvent { network, salt, assets, program }; + + Ok(response.add_attribute( + "spawn", + serde_json_wasm::to_string(&data).map_err(|_| ContractError::DataSerializationError)?, + )) } pub fn interpret_transfer( - deps: &mut DepsMut, - to: String, - assets: Funds, - mut response: Response, + deps: &mut DepsMut, + to: String, + assets: Funds, + mut response: Response, ) -> Result { - let config = CONFIG.load(deps.storage)?; - let registry_addr = config.registry_address.into_string(); - - for (asset_id, amount) in assets.0 { - let query_msg = AssetRegistryQueryMsg::GetAssetContract(asset_id.into()); - - let cw20_address: GetAssetContractResponse = deps.querier.query( - &WasmQuery::Smart { - contract_addr: registry_addr.clone(), - msg: to_binary(&query_msg)?, - } - .into(), - )?; - let contract = Cw20Contract(cw20_address.addr.clone()); - - let transfer_amount = match amount { - Amount::Fixed(ref fixed) => { - if fixed.0 == 0 { - return Err(ContractError::ZeroTransferAmount); - } - amount.apply(0) - } - Amount::Ratio(ratio) => { - if ratio == 0 { - return Err(ContractError::ZeroTransferAmount); - } - let query_msg = Cw20QueryMsg::Balance { - address: to.clone(), - }; - let response: BalanceResponse = - deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart { - contract_addr: cw20_address.addr.clone().into_string(), - msg: to_binary(&query_msg)?, - }))?; - amount.apply(response.balance.into()) - } - }; - - response = response.add_message(contract.call(Cw20ExecuteMsg::Transfer { - recipient: to.clone(), - amount: transfer_amount.into(), - })?); - } - - Ok(response) + let config = CONFIG.load(deps.storage)?; + let registry_addr = config.registry_address.into_string(); + + for (asset_id, amount) in assets.0 { + let query_msg = AssetRegistryQueryMsg::GetAssetContract(asset_id.into()); + + let cw20_address: GetAssetContractResponse = deps.querier.query( + &WasmQuery::Smart { contract_addr: registry_addr.clone(), msg: to_binary(&query_msg)? } + .into(), + )?; + let contract = Cw20Contract(cw20_address.addr.clone()); + + let transfer_amount = match amount { + Amount::Fixed(ref fixed) => { + if fixed.0 == 0 { + return Err(ContractError::ZeroTransferAmount) + } + amount.apply(0) + }, + Amount::Ratio(ratio) => { + if ratio == 0 { + return Err(ContractError::ZeroTransferAmount) + } + let query_msg = Cw20QueryMsg::Balance { address: to.clone() }; + let response: BalanceResponse = + deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart { + contract_addr: cw20_address.addr.clone().into_string(), + msg: to_binary(&query_msg)?, + }))?; + amount.apply(response.balance.into()) + }, + }; + + response = response.add_message(contract.call(Cw20ExecuteMsg::Transfer { + recipient: to.clone(), + amount: transfer_amount.into(), + })?); + } + + Ok(response) +} + +#[cfg(test)] +mod tests { + use std::collections::BTreeMap; + + use crate::msg::XCVMInstruction; + + use super::*; + use cosmwasm_std::{ + testing::{mock_dependencies, mock_env, mock_info, MockQuerier}, + Addr, Attribute, ContractResult, QuerierResult, + }; + + #[test] + fn proper_instantiation() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg { registry_address: "addr".to_string() }; + let info = mock_info("sender", &vec![]); + + let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(0, res.messages.len()); + + // Make sure that the storage is empty + assert_eq!( + CONFIG.load(&deps.storage).unwrap(), + Config { registry_address: Addr::unchecked("addr") } + ); + } + + fn wasm_querier(_: &WasmQuery) -> QuerierResult { + Ok(ContractResult::Ok( + to_binary(&xcvm_asset_registry::msg::GetAssetContractResponse { + addr: Addr::unchecked("mock"), + }) + .unwrap(), + )) + .into() + } + + #[test] + fn execute_transfer() { + let mut deps = mock_dependencies(); + let mut querier = MockQuerier::default(); + querier.update_wasm(wasm_querier); + deps.querier = querier; + + let info = mock_info("sender", &vec![]); + let _ = instantiate( + deps.as_mut(), + mock_env(), + info.clone(), + InstantiateMsg { registry_address: "addr".into() }, + ) + .unwrap(); + + let program = XCVMProgram { + tag: None, + instructions: vec![XCVMInstruction::Transfer { + to: "asset".into(), + assets: Funds::from([(1, 1_u128)]), + }] + .into(), + }; + + let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) + .unwrap(); + let contract = Cw20Contract(Addr::unchecked("mock")); + let msg = contract + .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 1_u128.into() }) + .unwrap(); + + assert_eq!(res.messages[0].msg, msg); + } + + #[test] + fn execute_call() { + let mut deps = mock_dependencies(); + + let info = mock_info("sender", &vec![]); + let _ = instantiate( + deps.as_mut(), + mock_env(), + info.clone(), + InstantiateMsg { registry_address: "addr".into() }, + ) + .unwrap(); + + let call_payload = r#"{ + "address": "1234", + "msg": "hello world" + }"#; + + let program = XCVMProgram { + tag: None, + instructions: vec![XCVMInstruction::Call { + encoded: call_payload.as_bytes().to_owned(), + }] + .into(), + }; + + let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) + .unwrap(); + assert_eq!( + res.messages[0].msg, + wasm_execute("1234", &"hello world".to_string(), vec![]).unwrap().into() + ); + } + + #[test] + fn execute_spawn() { + let mut deps = mock_dependencies(); + + let info = mock_info("sender", &vec![]); + let _ = instantiate( + deps.as_mut(), + mock_env(), + info.clone(), + InstantiateMsg { registry_address: "addr".into() }, + ) + .unwrap(); + + let program = XCVMProgram { + tag: None, + instructions: vec![XCVMInstruction::Spawn { + network: NetworkID(1), + salt: vec![], + assets: Funds(BTreeMap::new()), + program: XCVMProgram { + tag: None, + instructions: vec![XCVMInstruction::Call { encoded: vec![] }].into(), + }, + }] + .into(), + }; + + let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) + .unwrap(); + assert_eq!(res.attributes[0], Attribute { key: "spawn".to_string(), value: r#"{"network":1,"salt":[],"assets":{},"program":{"tag":null,"instructions":[{"call":{"encoded":[]}}]}}"#.to_string() }); + } } From 7942c442db52f84c0f64bf1d6b4ba367cad1e9b5 Mon Sep 17 00:00:00 2001 From: aeryz Date: Sat, 13 Aug 2022 22:13:26 +0300 Subject: [PATCH 04/57] feat: CosmosMsg in Call instruction * Now we expect `CosmosMsg` in `Call` instruction instead of restricting the user with `WasmMsg::Execute`. Signed-off-by: aeryz --- .../contracts/interpreter/src/contract.rs | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index cd74f60592d..1c0fb69c67f 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -1,8 +1,8 @@ use cosmwasm_std::{ - entry_point, to_binary, wasm_execute, DepsMut, Env, MessageInfo, QueryRequest, Response, - StdError, WasmQuery, + entry_point, to_binary, CosmosMsg, DepsMut, Env, MessageInfo, QueryRequest, Response, StdError, + WasmQuery, }; -use serde::{Deserialize, Serialize}; +use serde::Serialize; use crate::{ error::ContractError, @@ -62,17 +62,10 @@ pub fn interpret_program( } pub fn interpret_call(encoded: Vec, response: Response) -> Result { - #[derive(Deserialize)] - struct Payload { - address: String, - msg: String, - } - - let payload: Payload = + let cosmos_msg: CosmosMsg = serde_json_wasm::from_slice(&encoded).map_err(|_| ContractError::InvalidCallPayload)?; - let msg = wasm_execute(payload.address, &payload.msg, vec![])?; - Ok(response.add_message(msg)) + Ok(response.add_message(cosmos_msg)) } pub fn interpret_spawn( @@ -155,7 +148,7 @@ mod tests { use super::*; use cosmwasm_std::{ testing::{mock_dependencies, mock_env, mock_info, MockQuerier}, - Addr, Attribute, ContractResult, QuerierResult, + wasm_execute, Addr, Attribute, ContractResult, QuerierResult, }; #[test] @@ -233,25 +226,18 @@ mod tests { ) .unwrap(); - let call_payload = r#"{ - "address": "1234", - "msg": "hello world" - }"#; + let cosmos_msg: CosmosMsg = + wasm_execute("1234", &"hello world".to_string(), vec![]).unwrap().into(); + let msg = serde_json_wasm::to_string(&cosmos_msg).unwrap(); let program = XCVMProgram { tag: None, - instructions: vec![XCVMInstruction::Call { - encoded: call_payload.as_bytes().to_owned(), - }] - .into(), + instructions: vec![XCVMInstruction::Call { encoded: msg.as_bytes().into() }].into(), }; let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) .unwrap(); - assert_eq!( - res.messages[0].msg, - wasm_execute("1234", &"hello world".to_string(), vec![]).unwrap().into() - ); + assert_eq!(res.messages[0].msg, cosmos_msg); } #[test] From 48172b7bdce124e334b0f1f9322cedbb85021e65 Mon Sep 17 00:00:00 2001 From: aeryz Date: Mon, 29 Aug 2022 13:15:56 +0200 Subject: [PATCH 05/57] fix(xcvm): assets in xcvm core Signed-off-by: aeryz --- code/Cargo.toml | 12 ++++++ code/xcvm/lib/core/src/asset.rs | 8 ++-- .../contracts/asset-registry/src/state.rs | 2 +- .../cosmwasm/contracts/interpreter/Cargo.toml | 1 + .../contracts/interpreter/src/contract.rs | 40 +++++++++---------- .../cosmwasm/contracts/interpreter/src/msg.rs | 12 ++---- 6 files changed, 41 insertions(+), 34 deletions(-) diff --git a/code/Cargo.toml b/code/Cargo.toml index c879fb367e4..5ebffa07b0f 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -48,6 +48,7 @@ members = [ "utils/xcmp", "utils/wasm-optimizer", "xcvm/lib/*", + "xcvm/cosmwasm/contracts/*" ] [profile.release] @@ -59,6 +60,16 @@ panic = "unwind" inherits = "release" lto = true +[profile.cosmwasm-contracts] +inherits = "production" +rpath = false +overflow-checks = true +opt-level = 3 +debug = false +debug-assertions = false +panic = "abort" + + [patch.crates-io] sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } @@ -68,6 +79,7 @@ sp-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "f sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } wasmi-validation = { git = "https://github.com/ComposableFi/wasmi", rev = "cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" } +serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "4e175eaeffd625041bdecd251c0068a365def453" } [patch."https://github.com/paritytech/subxt"] subxt-codegen = { git = "https://github.com/paritytech//subxt", rev = "2fe9a1446d32b93a10804db3304ccaac65f764b8" } diff --git a/code/xcvm/lib/core/src/asset.rs b/code/xcvm/lib/core/src/asset.rs index 7424c1e58b1..6e86c22b6ac 100644 --- a/code/xcvm/lib/core/src/asset.rs +++ b/code/xcvm/lib/core/src/asset.rs @@ -184,12 +184,12 @@ impl From for Amount { impl Amount { #[inline] pub fn apply(&self, value: u128) -> u128 { - let amount = FixedU128::::from_num(value) + let amount = FixedU128::::wrapping_from_num(value) .saturating_mul( - FixedU128::::from_num(self.slope) - .saturating_div(FixedU128::::from_num(u128::MAX)), + FixedU128::::wrapping_from_num(self.slope) + .saturating_div(FixedU128::::wrapping_from_num(u128::MAX)), ) - .to_num::() + .wrapping_to_num::() .saturating_add(self.intercept.0); u128::min(value, amount) } diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs index c872073d129..cd512a05684 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/state.rs @@ -1,6 +1,6 @@ use cosmwasm_std::Addr; use cw_storage_plus::Map; -pub type XcvmAssetId = u32; +pub type XcvmAssetId = u128; pub const ASSETS: Map = Map::new("assets"); diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index dda27e668e2..b31635d8dd8 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -33,6 +33,7 @@ cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "4e175eaeffd625041bdecd251c0068a365def453" } xcvm-core = { path = "../../../lib/core", features = ["std"] } xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } +num = "0.4" [dev-dependencies] cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 1c0fb69c67f..f5f457cb68f 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -10,8 +10,9 @@ use crate::{ state::{Config, CONFIG}, }; use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg}; +use num::Zero; use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; -use xcvm_core::{Amount, Funds, Instruction, NetworkID}; +use xcvm_core::{Funds, Instruction, NetworkId}; #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( @@ -69,7 +70,7 @@ pub fn interpret_call(encoded: Vec, response: Response) -> Result, assets: Funds, program: XCVMProgram, @@ -77,7 +78,7 @@ pub fn interpret_spawn( ) -> Result { #[derive(Serialize)] struct SpawnEvent { - network: NetworkID, + network: NetworkId, salt: Vec, assets: Funds, program: XCVMProgram, @@ -109,17 +110,14 @@ pub fn interpret_transfer( )?; let contract = Cw20Contract(cw20_address.addr.clone()); - let transfer_amount = match amount { - Amount::Fixed(ref fixed) => { - if fixed.0 == 0 { - return Err(ContractError::ZeroTransferAmount) - } - amount.apply(0) - }, - Amount::Ratio(ratio) => { - if ratio == 0 { - return Err(ContractError::ZeroTransferAmount) - } + if amount.is_zero() { + return Err(ContractError::ZeroTransferAmount) + } + + let transfer_amount = { + if amount.slope == 0 { + amount.intercept.0 + } else { let query_msg = Cw20QueryMsg::Balance { address: to.clone() }; let response: BalanceResponse = deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart { @@ -127,7 +125,7 @@ pub fn interpret_transfer( msg: to_binary(&query_msg)?, }))?; amount.apply(response.balance.into()) - }, + } }; response = response.add_message(contract.call(Cw20ExecuteMsg::Transfer { @@ -195,7 +193,7 @@ mod tests { .unwrap(); let program = XCVMProgram { - tag: None, + tag: vec![], instructions: vec![XCVMInstruction::Transfer { to: "asset".into(), assets: Funds::from([(1, 1_u128)]), @@ -231,7 +229,7 @@ mod tests { let msg = serde_json_wasm::to_string(&cosmos_msg).unwrap(); let program = XCVMProgram { - tag: None, + tag: vec![], instructions: vec![XCVMInstruction::Call { encoded: msg.as_bytes().into() }].into(), }; @@ -254,13 +252,13 @@ mod tests { .unwrap(); let program = XCVMProgram { - tag: None, + tag: vec![], instructions: vec![XCVMInstruction::Spawn { - network: NetworkID(1), + network: NetworkId(1), salt: vec![], assets: Funds(BTreeMap::new()), program: XCVMProgram { - tag: None, + tag: vec![], instructions: vec![XCVMInstruction::Call { encoded: vec![] }].into(), }, }] @@ -269,6 +267,6 @@ mod tests { let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) .unwrap(); - assert_eq!(res.attributes[0], Attribute { key: "spawn".to_string(), value: r#"{"network":1,"salt":[],"assets":{},"program":{"tag":null,"instructions":[{"call":{"encoded":[]}}]}}"#.to_string() }); + assert_eq!(res.attributes[0], Attribute { key: "spawn".to_string(), value: r#"{"network":1,"salt":[],"assets":{},"program":{"tag":[],"instructions":[{"call":{"encoded":[]}}]}}"#.to_string() }); } } diff --git a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs index 71e6b9243ba..44c28992bbc 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs @@ -2,23 +2,19 @@ use std::collections::VecDeque; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{ - Instruction, Program, - Funds, NetworkID -}; +use xcvm_core::{Funds, Instruction, NetworkId, Program}; -pub type XCVMInstruction = - Instruction, String, Funds>; +pub type XCVMInstruction = Instruction, String, Funds>; pub type XCVMProgram = Program>; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct InstantiateMsg { - pub registry_address: String, + pub registry_address: String, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub enum ExecuteMsg { - Execute { program: XCVMProgram }, + Execute { program: XCVMProgram }, } From 7c1901c3cf2258120ab5b2eb83b1cbe16b2e3f35 Mon Sep 17 00:00:00 2001 From: aeryz Date: Mon, 29 Aug 2022 15:53:01 +0200 Subject: [PATCH 06/57] feat(cosmwasm): router contract Signed-off-by: aeryz --- .../contracts/asset-registry/Cargo.toml | 7 - xcvm/cosmwasm/contracts/router/Cargo.toml | 34 ++++ xcvm/cosmwasm/contracts/router/Developing.md | 104 ++++++++++ xcvm/cosmwasm/contracts/router/README.md | 22 +++ .../contracts/router/examples/schema.rs | 17 ++ .../contracts/router/schema/execute_msg.json | 21 ++ .../router/schema/instantiate_msg.json | 5 + .../contracts/router/schema/query_msg.json | 20 ++ .../cosmwasm/contracts/router/src/contract.rs | 184 ++++++++++++++++++ xcvm/cosmwasm/contracts/router/src/error.rs | 8 + xcvm/cosmwasm/contracts/router/src/helpers.rs | 27 +++ xcvm/cosmwasm/contracts/router/src/lib.rs | 7 + xcvm/cosmwasm/contracts/router/src/msg.rs | 28 +++ xcvm/cosmwasm/contracts/router/src/state.rs | 16 ++ 14 files changed, 493 insertions(+), 7 deletions(-) create mode 100644 xcvm/cosmwasm/contracts/router/Cargo.toml create mode 100644 xcvm/cosmwasm/contracts/router/Developing.md create mode 100644 xcvm/cosmwasm/contracts/router/README.md create mode 100644 xcvm/cosmwasm/contracts/router/examples/schema.rs create mode 100644 xcvm/cosmwasm/contracts/router/schema/execute_msg.json create mode 100644 xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json create mode 100644 xcvm/cosmwasm/contracts/router/schema/query_msg.json create mode 100644 xcvm/cosmwasm/contracts/router/src/contract.rs create mode 100644 xcvm/cosmwasm/contracts/router/src/error.rs create mode 100644 xcvm/cosmwasm/contracts/router/src/helpers.rs create mode 100644 xcvm/cosmwasm/contracts/router/src/lib.rs create mode 100644 xcvm/cosmwasm/contracts/router/src/msg.rs create mode 100644 xcvm/cosmwasm/contracts/router/src/state.rs diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index d394c1e3135..dd9c7d82269 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -19,13 +19,6 @@ backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] -[package.metadata.scripts] -optimize = """docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer:0.12.6 -""" - [dependencies] cosmwasm-std = "1.0.0" cosmwasm-storage = "1.0.0" diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml new file mode 100644 index 00000000000..a8980a1b9ad --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -0,0 +1,34 @@ +[package] +authors = ["Composable Developers"] +edition = "2021" +name = "xcvm-router" +version = "0.1.0" + +exclude = [ + # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. + "xcvm-router.wasm", + "hash.txt", +] + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +# for more explicit tests, cargo test --features=backtraces +backtraces = ["cosmwasm-std/backtraces"] +# use library feature to disable all instantiate/execute/query exports +library = [] + +[dependencies] +cosmwasm-std = "1.0.0" +cosmwasm-storage = "1.0.0" +cw-storage-plus = "0.13.2" +schemars = "0.8.8" +serde = { version = "1.0.137", default-features = false, features = ["derive"] } +xcvm-core = { path = "../../../lib/core", features = ["std"] } +xcvm-interpreter = { path = "../interpreter", features = ["library"] } +thiserror = { version = "1.0.31" } + +[dev-dependencies] +cw-multi-test = "0.13.2" +cosmwasm-schema = "1.0.0" diff --git a/xcvm/cosmwasm/contracts/router/Developing.md b/xcvm/cosmwasm/contracts/router/Developing.md new file mode 100644 index 00000000000..0df3a1ed262 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/Developing.md @@ -0,0 +1,104 @@ +# Developing + +If you have recently created a contract with this template, you probably could use some +help on how to build and test the contract, as well as prepare it for production. This +file attempts to provide a brief overview, assuming you have installed a recent +version of Rust already (eg. 1.58.1+). + +## Prerequisites + +Before starting, make sure you have [rustup](https://rustup.rs/) along with a +recent `rustc` and `cargo` version installed. Currently, we are testing on 1.58.1+. + +And you need to have the `wasm32-unknown-unknown` target installed as well. + +You can check that via: + +```sh +rustc --version +cargo --version +rustup target list --installed +# if wasm32 is not listed above, run this +rustup target add wasm32-unknown-unknown +``` + +## Compiling and running tests + +Now that you created your custom contract, make sure you can compile and run it before +making any changes. Go into the repository and do: + +```sh +# this will produce a wasm build in ./target/wasm32-unknown-unknown/release/YOUR_NAME_HERE.wasm +cargo wasm + +# this runs unit tests with helpful backtraces +RUST_BACKTRACE=1 cargo unit-test + +# auto-generate json schema +cargo run --example=schema +``` + +### Understanding the tests + +The main code is in `src/contract.rs` and the unit tests there run in pure rust, +which makes them very quick to execute and give nice output on failures, especially +if you do `RUST_BACKTRACE=1 cargo unit-test`. + +We consider testing critical for anything on a blockchain, and recommend to always keep +the tests up to date. + +## Generating JSON Schema + +While the Wasm calls (`instantiate`, `execute`, `query`) accept JSON, this is not enough +information to use it. We need to expose the schema for the expected messages to the +clients. You can generate this schema by calling `cargo schema`, which will output +4 files in `./schema`, corresponding to the 3 message types the contract accepts, +as well as the internal `State`. + +These files are in standard json-schema format, which should be usable by various +client side tools, either to auto-generate codecs, or just to validate incoming +json wrt. the defined schema. + +## Preparing the Wasm bytecode for production + +Before we upload it to a chain, we need to ensure the smallest output size possible, +as this will be included in the body of a transaction. We also want to have a +reproducible build process, so third parties can verify that the uploaded Wasm +code did indeed come from the claimed rust code. + +To solve both these issues, we have produced `rust-optimizer`, a docker image to +produce an extremely small build output in a consistent manner. The suggest way +to run it is this: + +```sh +docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/rust-optimizer:0.12.6 +``` + +Or, If you're on an arm64 machine, you should use a docker image built with arm64. +```sh +docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/rust-optimizer-arm64:0.12.6 +``` + +We must mount the contract code to `/code`. You can use a absolute path instead +of `$(pwd)` if you don't want to `cd` to the directory first. The other two +volumes are nice for speedup. Mounting `/code/target` in particular is useful +to avoid docker overwriting your local dev files with root permissions. +Note the `/code/target` cache is unique for each contract being compiled to limit +interference, while the registry cache is global. + +This is rather slow compared to local compilations, especially the first compile +of a given contract. The use of the two volume caches is very useful to speed up +following compiles of the same contract. + +This produces an `artifacts` directory with a `PROJECT_NAME.wasm`, as well as +`checksums.txt`, containing the Sha256 hash of the wasm file. +The wasm file is compiled deterministically (anyone else running the same +docker on the same git commit should get the identical file with the same Sha256 hash). +It is also stripped and minimized for upload to a blockchain (we will also +gzip it in the uploading process to make it even smaller). diff --git a/xcvm/cosmwasm/contracts/router/README.md b/xcvm/cosmwasm/contracts/router/README.md new file mode 100644 index 00000000000..128f50107a2 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/README.md @@ -0,0 +1,22 @@ +# Asset Registry Contract + +Asset registry is used by XCVM interpreter to get the contract address of a given asset. + +Asset mapping can be updated by using `SetAssets(BTreeMap)` execute message where keys are asset id's(which must be valid `u32` integers) and values are contract addresses. + +A contract address can be queried by using `GetAssetContract(u32)` where `u32` is an asset id. + +## Compile + +```sh +RUSTFLAGS='-C link-arg=-s' cargo b --package=xcvm-asset-registry --target=wasm32-unknown-unknown --profile="cosmwasm-contracts" +``` + +* `-C link-arg=-s` is used for stripping the binary which reduces the binary size drastically. +* `--profile="cosmwasm-contracts"` must be used for cosmwasm contracts. + +## Test + +```sh +cargo test --package="xcvm-asset-registry" +``` diff --git a/xcvm/cosmwasm/contracts/router/examples/schema.rs b/xcvm/cosmwasm/contracts/router/examples/schema.rs new file mode 100644 index 00000000000..5e9d69fadaf --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/examples/schema.rs @@ -0,0 +1,17 @@ +use std::env::current_dir; +use std::fs::create_dir_all; + +use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; + +use xcvm_asset_registry::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; + +fn main() { + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); + + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(QueryMsg), &out_dir); +} diff --git a/xcvm/cosmwasm/contracts/router/schema/execute_msg.json b/xcvm/cosmwasm/contracts/router/schema/execute_msg.json new file mode 100644 index 00000000000..a67ba283836 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/schema/execute_msg.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "set_assets" + ], + "properties": { + "set_assets": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + } + ] +} diff --git a/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json b/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json new file mode 100644 index 00000000000..44588cf2267 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object" +} diff --git a/xcvm/cosmwasm/contracts/router/schema/query_msg.json b/xcvm/cosmwasm/contracts/router/schema/query_msg.json new file mode 100644 index 00000000000..f7bcb21bdc8 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/schema/query_msg.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "get_asset_contract" + ], + "properties": { + "get_asset_contract": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] +} diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs new file mode 100644 index 00000000000..3344b86a4d4 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -0,0 +1,184 @@ +use crate::{ + error::ContractError, + msg::{ExecuteMsg, InstantiateMsg}, + state::{Config, UserId, CONFIG, INTERPRETERS, INTERPRETER_CODE_ID}, +}; +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{ + to_binary, Addr, CosmosMsg, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, + SubMsg, WasmMsg, +}; +use xcvm_core::NetworkId; +use xcvm_interpreter::msg::InstantiateMsg as InterpreterInstantiateMsg; + +const INSTANTIATE_REPLY_ID: u64 = 1; + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: InstantiateMsg, +) -> Result { + let addr = deps.api.addr_validate(&msg.registry_address)?; + CONFIG.save(deps.storage, &Config { registry_address: addr })?; + Ok(Response::default()) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::NewInterpreter(network_id, user_id) => + handle_new_interpreter(deps, network_id, user_id), + } +} + +pub fn handle_new_interpreter( + deps: DepsMut, + network_id: NetworkId, + user_id: UserId, +) -> Result { + match INTERPRETERS.load(deps.storage, (network_id.0, user_id.clone())) { + Ok(interpreter_addr) => + Ok(Response::new().add_attribute("interpreter", &interpreter_addr.into_string())), + Err(_) => { + // TODO(aeryz): set admin as self + let code_id = INTERPRETER_CODE_ID.load(deps.storage)?; + let registry_address = CONFIG.load(deps.storage)?.registry_address.into_string(); + + let instantiate_msg = WasmMsg::Instantiate { + admin: None, // TODO(aeryz): should router be admin? + code_id, + msg: to_binary(&InterpreterInstantiateMsg { registry_address })?, + funds: vec![], + label: "todo".to_string(), // TODO(aeryz): juno doesn't allow empty label + }; + + // Creating a submessage that wraps the message above + let submessage = SubMsg::reply_on_success(instantiate_msg.into(), INSTANTIATE_REPLY_ID); + + // Creating a response with the submessage + let response = Response::new().add_submessage(submessage); + Ok(Response::new().add_submessage(submessage)) + }, + } +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> StdResult { + match msg.id { + INSTANTIATE_REPLY_ID => handle_instantiate_reply(deps, msg), + id => Err(StdError::generic_err(format!("Unknown reply id: {}", id))), + } +} + +fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { + deps.api.debug(&format!("{:?}", msg)); + // Save res.contract_address + Ok(Response::new()) +} + +#[cfg(test)] +mod tests { + use super::*; + use cosmwasm_std::{ + from_binary, + testing::{mock_dependencies, mock_env, mock_info}, + Addr, Attribute, Order, Storage, + }; + + #[test] + fn proper_instantiation() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg {}; + let info = mock_info("sender", &vec![]); + + let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(0, res.messages.len()); + + // Make sure that the storage is empty + assert_eq!(deps.storage.range(None, None, Order::Ascending).next(), None); + } + + #[test] + fn set_assets() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg {}; + let info = mock_info("sender", &vec![]); + + let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); + + let mut assets = BTreeMap::new(); + assets.insert("1".into(), "addr1".into()); + assets.insert("2".into(), "addr2".into()); + + let res = + execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::SetAssets(assets.clone())) + .unwrap(); + assert!(res + .attributes + .iter() + .find(|&attr| attr == Attribute::new("action", "update_assets")) + .is_some()); + + assert_eq!(ASSETS.load(&deps.storage, 1).unwrap(), Addr::unchecked("addr1")); + assert_eq!(ASSETS.load(&deps.storage, 2).unwrap(), Addr::unchecked("addr2")); + + let mut assets = BTreeMap::new(); + assets.insert("3".into(), "addr3".into()); + assets.insert("4".into(), "addr4".into()); + + let _ = execute(deps.as_mut(), mock_env(), info, ExecuteMsg::SetAssets(assets.clone())) + .unwrap(); + + // Make sure that set removes the previous elements + assert!(ASSETS.load(&deps.storage, 1).is_err()); + assert!(ASSETS.load(&deps.storage, 2).is_err()); + assert_eq!(ASSETS.load(&deps.storage, 3).unwrap(), Addr::unchecked("addr3")); + assert_eq!(ASSETS.load(&deps.storage, 4).unwrap(), Addr::unchecked("addr4")); + + // Finally make sure that there are two elements in the assets storage + assert_eq!( + ASSETS + .keys(&deps.storage, None, None, Order::Ascending) + .collect::>() + .len(), + 2 + ); + } + + #[test] + fn query_assets() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg {}; + let info = mock_info("sender", &vec![]); + + let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); + + let mut assets = BTreeMap::new(); + assets.insert("1".into(), "addr1".into()); + + let _ = + execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::SetAssets(assets.clone())) + .unwrap(); + + let res: GetAssetContractResponse = + from_binary(&query(deps.as_ref(), mock_env(), QueryMsg::GetAssetContract(1)).unwrap()) + .unwrap(); + + // Query should return the corresponding address + assert_eq!(res, GetAssetContractResponse { addr: Addr::unchecked("addr1") }); + + // This should fail since there the asset doesn't exist + assert!(query(deps.as_ref(), mock_env(), QueryMsg::GetAssetContract(2)).is_err()); + } +} diff --git a/xcvm/cosmwasm/contracts/router/src/error.rs b/xcvm/cosmwasm/contracts/router/src/error.rs new file mode 100644 index 00000000000..40dab9ff314 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/src/error.rs @@ -0,0 +1,8 @@ +use cosmwasm_std::StdError; +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), +} diff --git a/xcvm/cosmwasm/contracts/router/src/helpers.rs b/xcvm/cosmwasm/contracts/router/src/helpers.rs new file mode 100644 index 00000000000..34c9d64fdef --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/src/helpers.rs @@ -0,0 +1,27 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg}; + +use crate::msg::ExecuteMsg; + +/// AssetRegistryContract is a wrapper around Addr that provides helpers +/// for working with this as a library. +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct AssetRegistryContract(pub Addr); + +impl AssetRegistryContract { + pub fn addr(&self) -> &Addr { + &self.0 + } + + pub fn call>(&self, msg: T) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { + contract_addr: self.addr().into(), + msg, + funds: vec![], + } + .into()) + } +} diff --git a/xcvm/cosmwasm/contracts/router/src/lib.rs b/xcvm/cosmwasm/contracts/router/src/lib.rs new file mode 100644 index 00000000000..233dbf5572f --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/src/lib.rs @@ -0,0 +1,7 @@ +pub mod contract; +mod error; +pub mod helpers; +pub mod msg; +pub mod state; + +pub use crate::error::ContractError; diff --git a/xcvm/cosmwasm/contracts/router/src/msg.rs b/xcvm/cosmwasm/contracts/router/src/msg.rs new file mode 100644 index 00000000000..23158d79b0b --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/src/msg.rs @@ -0,0 +1,28 @@ +use crate::state::UserId; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use xcvm_core::NetworkId; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct InstantiateMsg { + pub registry_address: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum ExecuteMsg { + NewInterpreter(NetworkId, UserId), +} + +/* +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum QueryMsg { + GetAssetContract(XcvmAssetId), +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct GetAssetContractResponse { + pub addr: Addr, +} +*/ diff --git a/xcvm/cosmwasm/contracts/router/src/state.rs b/xcvm/cosmwasm/contracts/router/src/state.rs new file mode 100644 index 00000000000..584729d5437 --- /dev/null +++ b/xcvm/cosmwasm/contracts/router/src/state.rs @@ -0,0 +1,16 @@ +use cosmwasm_std::Addr; +use cw_storage_plus::{Item, Map}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use xcvm_core::NetworkId; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct Config { + pub registry_address: Addr, +} + +pub type UserId = Vec; + +pub const INTERPRETER_CODE_ID: Item = Item::new("interpreter_code_id"); +pub const INTERPRETERS: Map<(u8, UserId), Addr> = Map::new("interpreters"); +pub const CONFIG: Item = Item::new("config"); From 330ae7eb1ec21c5005bee4c309d420773c09ea83 Mon Sep 17 00:00:00 2001 From: aeryz Date: Tue, 30 Aug 2022 16:45:52 +0200 Subject: [PATCH 07/57] feat(cosmwasm): router contract Signed-off-by: aeryz --- code/Cargo.toml | 3 +- code/xcvm/lib/core/src/asset.rs | 21 +- .../contracts/asset-registry/src/contract.rs | 2 +- .../cosmwasm/contracts/interpreter/Cargo.toml | 1 + .../contracts/interpreter/src/contract.rs | 38 ++- .../contracts/interpreter/src/helpers.rs | 25 ++ .../cosmwasm/contracts/interpreter/src/msg.rs | 4 +- xcvm/cosmwasm/contracts/router/Cargo.toml | 5 +- xcvm/cosmwasm/contracts/router/README.md | 12 +- .../cosmwasm/contracts/router/src/contract.rs | 231 ++++++++---------- xcvm/cosmwasm/contracts/router/src/msg.rs | 24 +- xcvm/cosmwasm/contracts/router/src/state.rs | 3 +- 12 files changed, 192 insertions(+), 177 deletions(-) create mode 100644 xcvm/cosmwasm/contracts/interpreter/src/helpers.rs diff --git a/code/Cargo.toml b/code/Cargo.toml index 5ebffa07b0f..f82ee5423f3 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -69,7 +69,6 @@ debug = false debug-assertions = false panic = "abort" - [patch.crates-io] sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } @@ -79,7 +78,7 @@ sp-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "f sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } wasmi-validation = { git = "https://github.com/ComposableFi/wasmi", rev = "cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" } -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "4e175eaeffd625041bdecd251c0068a365def453" } +serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } [patch."https://github.com/paritytech/subxt"] subxt-codegen = { git = "https://github.com/paritytech//subxt", rev = "2fe9a1446d32b93a10804db3304ccaac65f764b8" } diff --git a/code/xcvm/lib/core/src/asset.rs b/code/xcvm/lib/core/src/asset.rs index 6e86c22b6ac..b9e50fc2a69 100644 --- a/code/xcvm/lib/core/src/asset.rs +++ b/code/xcvm/lib/core/src/asset.rs @@ -136,19 +136,19 @@ impl From for Displayed { /// See https://en.wikipedia.org/wiki/Linear_equation#Slope%E2%80%93intercept_form_or_Gradient-intercept_form pub struct Amount { pub intercept: Displayed, - pub slope: u128, + pub slope: Displayed, } impl Amount { /// An absolute amount #[inline] pub fn absolute(value: u128) -> Self { - Self { intercept: Displayed(value), slope: 0 } + Self { intercept: Displayed(value), slope: Displayed(0) } } /// A ratio amount, expressed in u128 parts (x / u128::MAX) #[inline] pub fn ratio(parts: u128) -> Self { - Self { intercept: Displayed(0), slope: parts } + Self { intercept: Displayed(0), slope: Displayed(parts) } } } @@ -156,16 +156,19 @@ impl Add for Amount { type Output = Self; #[inline] - fn add(self, Self { intercept: Displayed(i_1), slope: s_1 }: Self) -> Self::Output { - let Self { intercept: Displayed(i_0), slope: s_0 } = self; - Self { intercept: Displayed(i_0.saturating_add(i_1)), slope: s_0.saturating_add(s_1) } + fn add(self, Self { intercept: Displayed(i_1), slope: Displayed(s_1) }: Self) -> Self::Output { + let Self { intercept: Displayed(i_0), slope: Displayed(s_0) } = self; + Self { + intercept: Displayed(i_0.saturating_add(i_1)), + slope: Displayed(s_0.saturating_add(s_1)), + } } } impl Zero for Amount { #[inline] fn zero() -> Self { - Self { intercept: Displayed(0), slope: 0 } + Self { intercept: Displayed(0), slope: Displayed(0) } } #[inline] @@ -177,7 +180,7 @@ impl Zero for Amount { impl From for Amount { #[inline] fn from(x: u128) -> Self { - Self { intercept: Displayed(x), slope: 0 } + Self { intercept: Displayed(x), slope: Displayed(0) } } } @@ -186,7 +189,7 @@ impl Amount { pub fn apply(&self, value: u128) -> u128 { let amount = FixedU128::::wrapping_from_num(value) .saturating_mul( - FixedU128::::wrapping_from_num(self.slope) + FixedU128::::wrapping_from_num(self.slope.0) .saturating_div(FixedU128::::wrapping_from_num(u128::MAX)), ) .wrapping_to_num::() diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs index e62f44671bc..90062b6b154 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -1,12 +1,12 @@ use crate::{ error::ContractError, msg::{ExecuteMsg, GetAssetContractResponse, InstantiateMsg, QueryMsg}, + state::{XcvmAssetId, ASSETS}, }; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; use std::collections::BTreeMap; -use crate::state::{XcvmAssetId, ASSETS}; #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index b31635d8dd8..f8bd7ccc8a2 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -28,6 +28,7 @@ cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } +serde_json = "1" thiserror = { version = "1.0.31" } cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "4e175eaeffd625041bdecd251c0068a365def453" } diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index f5f457cb68f..d9a7d4ddd94 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -1,6 +1,7 @@ +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; use cosmwasm_std::{ - entry_point, to_binary, CosmosMsg, DepsMut, Env, MessageInfo, QueryRequest, Response, StdError, - WasmQuery, + to_binary, CosmosMsg, DepsMut, Env, MessageInfo, QueryRequest, Response, StdError, WasmQuery, }; use serde::Serialize; @@ -22,12 +23,10 @@ pub fn instantiate( msg: InstantiateMsg, ) -> Result { let registry_address = deps.api.addr_validate(&msg.registry_address)?; - let config = Config { registry_address }; - CONFIG.save(deps.storage, &config)?; - Ok(Response::default()) + Ok(Response::new().set_data(to_binary(&(msg.network_id.0, msg.user_id))?)) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -115,7 +114,7 @@ pub fn interpret_transfer( } let transfer_amount = { - if amount.slope == 0 { + if amount.slope.0 == 0 { amount.intercept.0 } else { let query_msg = Cw20QueryMsg::Balance { address: to.clone() }; @@ -148,12 +147,17 @@ mod tests { testing::{mock_dependencies, mock_env, mock_info, MockQuerier}, wasm_execute, Addr, Attribute, ContractResult, QuerierResult, }; + use xcvm_core::Picasso; #[test] fn proper_instantiation() { let mut deps = mock_dependencies(); - let msg = InstantiateMsg { registry_address: "addr".to_string() }; + let msg = InstantiateMsg { + registry_address: "addr".to_string(), + network_id: Picasso.into(), + user_id: vec![], + }; let info = mock_info("sender", &vec![]); let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); @@ -188,7 +192,11 @@ mod tests { deps.as_mut(), mock_env(), info.clone(), - InstantiateMsg { registry_address: "addr".into() }, + InstantiateMsg { + registry_address: "addr".into(), + network_id: Picasso.into(), + user_id: vec![], + }, ) .unwrap(); @@ -220,7 +228,11 @@ mod tests { deps.as_mut(), mock_env(), info.clone(), - InstantiateMsg { registry_address: "addr".into() }, + InstantiateMsg { + registry_address: "addr".into(), + network_id: Picasso.into(), + user_id: vec![], + }, ) .unwrap(); @@ -247,14 +259,18 @@ mod tests { deps.as_mut(), mock_env(), info.clone(), - InstantiateMsg { registry_address: "addr".into() }, + InstantiateMsg { + registry_address: "addr".into(), + network_id: Picasso.into(), + user_id: vec![], + }, ) .unwrap(); let program = XCVMProgram { tag: vec![], instructions: vec![XCVMInstruction::Spawn { - network: NetworkId(1), + network: Picasso.into(), salt: vec![], assets: Funds(BTreeMap::new()), program: XCVMProgram { diff --git a/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs b/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs new file mode 100644 index 00000000000..aa613bb06b0 --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs @@ -0,0 +1,25 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg}; + +use crate::msg::{ExecuteMsg, InstantiateMsg}; + +/// AssetRegistryContract is a wrapper around Addr that provides helpers +/// for working with this as a library. +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub struct InterpreterContract; + +impl InterpreterContract { + pub fn instantiate(registry_addr: String) -> StdResult>(&self, msg: T) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { + contract_addr: self.addr().into(), + msg, + funds: vec![], + } + .into()) + } +} diff --git a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs index 44c28992bbc..53bc612630b 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs @@ -5,12 +5,14 @@ use serde::{Deserialize, Serialize}; use xcvm_core::{Funds, Instruction, NetworkId, Program}; pub type XCVMInstruction = Instruction, String, Funds>; - pub type XCVMProgram = Program>; +pub type UserId = Vec; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct InstantiateMsg { pub registry_address: String, + pub network_id: NetworkId, + pub user_id: UserId, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index a8980a1b9ad..f2bceace953 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -20,15 +20,18 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-std = "1.0.0" +cosmwasm-std = { version = "1.0.0", features = ["abort"] } cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } xcvm-core = { path = "../../../lib/core", features = ["std"] } xcvm-interpreter = { path = "../interpreter", features = ["library"] } +xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } +cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } thiserror = { version = "1.0.31" } [dev-dependencies] cw-multi-test = "0.13.2" cosmwasm-schema = "1.0.0" +serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } diff --git a/xcvm/cosmwasm/contracts/router/README.md b/xcvm/cosmwasm/contracts/router/README.md index 128f50107a2..0bdc8af26eb 100644 --- a/xcvm/cosmwasm/contracts/router/README.md +++ b/xcvm/cosmwasm/contracts/router/README.md @@ -1,15 +1,11 @@ -# Asset Registry Contract +# Router Contract -Asset registry is used by XCVM interpreter to get the contract address of a given asset. - -Asset mapping can be updated by using `SetAssets(BTreeMap)` execute message where keys are asset id's(which must be valid `u32` integers) and values are contract addresses. - -A contract address can be queried by using `GetAssetContract(u32)` where `u32` is an asset id. +Router is used by gateway to pass funds to interpreter and execute them. ## Compile ```sh -RUSTFLAGS='-C link-arg=-s' cargo b --package=xcvm-asset-registry --target=wasm32-unknown-unknown --profile="cosmwasm-contracts" +RUSTFLAGS='-C link-arg=-s' cargo b --package=xcvm-router --target=wasm32-unknown-unknown --profile="cosmwasm-contracts" ``` * `-C link-arg=-s` is used for stripping the binary which reduces the binary size drastically. @@ -18,5 +14,5 @@ RUSTFLAGS='-C link-arg=-s' cargo b --package=xcvm-asset-registry --target=wasm32 ## Test ```sh -cargo test --package="xcvm-asset-registry" +cargo test --package="xcvm-router" ``` diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 3344b86a4d4..537bcea0cc1 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -1,16 +1,20 @@ use crate::{ error::ContractError, msg::{ExecuteMsg, InstantiateMsg}, - state::{Config, UserId, CONFIG, INTERPRETERS, INTERPRETER_CODE_ID}, + state::{Config, UserId, CONFIG, INTERPRETERS}, }; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Addr, CosmosMsg, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, - SubMsg, WasmMsg, + from_binary, to_binary, wasm_execute, Addr, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, + Response, StdError, StdResult, SubMsg, WasmMsg, WasmQuery, +}; +use cw20::{Cw20Contract, Cw20ExecuteMsg}; +use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; +use xcvm_core::{Funds, NetworkId}; +use xcvm_interpreter::msg::{ + ExecuteMsg as InterpreterExecuteMsg, InstantiateMsg as InterpreterInstantiateMsg, }; -use xcvm_core::NetworkId; -use xcvm_interpreter::msg::InstantiateMsg as InterpreterInstantiateMsg; const INSTANTIATE_REPLY_ID: u64 = 1; @@ -22,54 +26,100 @@ pub fn instantiate( msg: InstantiateMsg, ) -> Result { let addr = deps.api.addr_validate(&msg.registry_address)?; - CONFIG.save(deps.storage, &Config { registry_address: addr })?; + CONFIG.save( + deps.storage, + &Config { registry_address: addr, interpreter_code_id: msg.interpreter_code_id }, + )?; Ok(Response::default()) } #[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( deps: DepsMut, - _env: Env, + env: Env, _info: MessageInfo, msg: ExecuteMsg, ) -> Result { match msg { - ExecuteMsg::NewInterpreter(network_id, user_id) => - handle_new_interpreter(deps, network_id, user_id), + ExecuteMsg::Run { network_id, user_id, interpreter_execute_msg, funds } => + handle_run(deps, env, network_id, user_id, interpreter_execute_msg, funds), } } -pub fn handle_new_interpreter( +pub fn handle_run( deps: DepsMut, + env: Env, network_id: NetworkId, user_id: UserId, + interpreter_execute_msg: InterpreterExecuteMsg, + funds: Funds, ) -> Result { match INTERPRETERS.load(deps.storage, (network_id.0, user_id.clone())) { - Ok(interpreter_addr) => - Ok(Response::new().add_attribute("interpreter", &interpreter_addr.into_string())), + Ok(interpreter_address) => { + let response = + send_funds_to_interpreter(deps.as_ref(), interpreter_address.clone(), funds)?; + let wasm_msg = wasm_execute(interpreter_address, &interpreter_execute_msg, vec![])?; + Ok(response.add_message(wasm_msg)) + }, Err(_) => { - // TODO(aeryz): set admin as self - let code_id = INTERPRETER_CODE_ID.load(deps.storage)?; - let registry_address = CONFIG.load(deps.storage)?.registry_address.into_string(); - - let instantiate_msg = WasmMsg::Instantiate { - admin: None, // TODO(aeryz): should router be admin? - code_id, - msg: to_binary(&InterpreterInstantiateMsg { registry_address })?, + let Config { registry_address, interpreter_code_id } = CONFIG.load(deps.storage)?; + let instantiate_msg: CosmosMsg = WasmMsg::Instantiate { + admin: Some(env.contract.address.clone().into_string()), + code_id: interpreter_code_id, + msg: to_binary(&InterpreterInstantiateMsg { + registry_address: registry_address.into_string(), + network_id, + user_id: user_id.clone(), + })?, funds: vec![], - label: "todo".to_string(), // TODO(aeryz): juno doesn't allow empty label - }; - - // Creating a submessage that wraps the message above - let submessage = SubMsg::reply_on_success(instantiate_msg.into(), INSTANTIATE_REPLY_ID); - - // Creating a response with the submessage - let response = Response::new().add_submessage(submessage); - Ok(Response::new().add_submessage(submessage)) + label: format!("xcvm-interpreter-{}", network_id.0), /* TODO(aeryz): juno doesn't + * allow empty label */ + } + .into(); + + let submessage = SubMsg::reply_on_success(instantiate_msg, INSTANTIATE_REPLY_ID); + let wasm_msg: CosmosMsg = wasm_execute( + env.contract.address, + &ExecuteMsg::Run { network_id, user_id, interpreter_execute_msg, funds }, + vec![], + )? + .into(); + Ok(Response::new().add_submessage(submessage).add_message(wasm_msg)) }, } } +fn send_funds_to_interpreter( + deps: Deps, + interpreter_address: Addr, + funds: Funds, +) -> StdResult { + let mut response = Response::new(); + let registry_address = CONFIG.load(deps.storage)?.registry_address.into_string(); + let interpreter_address = interpreter_address.into_string(); + for (asset_id, amount) in funds.0 { + let query_msg = AssetRegistryQueryMsg::GetAssetContract(asset_id.into()); + let cw20_address: GetAssetContractResponse = deps.querier.query( + &WasmQuery::Smart { + contract_addr: registry_address.clone(), + msg: to_binary(&query_msg)?, + } + .into(), + )?; + let contract = Cw20Contract(cw20_address.addr.clone()); + + if amount.intercept.0 == 0 { + continue + } + + response = response.add_message(contract.call(Cw20ExecuteMsg::Transfer { + recipient: interpreter_address.clone(), + amount: amount.intercept.0.into(), + })?); + } + Ok(response) +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> StdResult { match msg.id { @@ -79,106 +129,33 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> StdResult { } fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { - deps.api.debug(&format!("{:?}", msg)); - // Save res.contract_address - Ok(Response::new()) -} - -#[cfg(test)] -mod tests { - use super::*; - use cosmwasm_std::{ - from_binary, - testing::{mock_dependencies, mock_env, mock_info}, - Addr, Attribute, Order, Storage, - }; - - #[test] - fn proper_instantiation() { - let mut deps = mock_dependencies(); - - let msg = InstantiateMsg {}; - let info = mock_info("sender", &vec![]); - - let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); - assert_eq!(0, res.messages.len()); - - // Make sure that the storage is empty - assert_eq!(deps.storage.range(None, None, Order::Ascending).next(), None); - } - - #[test] - fn set_assets() { - let mut deps = mock_dependencies(); - - let msg = InstantiateMsg {}; - let info = mock_info("sender", &vec![]); - - let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); - - let mut assets = BTreeMap::new(); - assets.insert("1".into(), "addr1".into()); - assets.insert("2".into(), "addr2".into()); - - let res = - execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::SetAssets(assets.clone())) - .unwrap(); - assert!(res - .attributes + let response = msg.result.into_result().map_err(StdError::generic_err)?; + let interpreter_address = { + let instantiate_event = response + .events .iter() - .find(|&attr| attr == Attribute::new("action", "update_assets")) - .is_some()); - - assert_eq!(ASSETS.load(&deps.storage, 1).unwrap(), Addr::unchecked("addr1")); - assert_eq!(ASSETS.load(&deps.storage, 2).unwrap(), Addr::unchecked("addr2")); - - let mut assets = BTreeMap::new(); - assets.insert("3".into(), "addr3".into()); - assets.insert("4".into(), "addr4".into()); - - let _ = execute(deps.as_mut(), mock_env(), info, ExecuteMsg::SetAssets(assets.clone())) - .unwrap(); - - // Make sure that set removes the previous elements - assert!(ASSETS.load(&deps.storage, 1).is_err()); - assert!(ASSETS.load(&deps.storage, 2).is_err()); - assert_eq!(ASSETS.load(&deps.storage, 3).unwrap(), Addr::unchecked("addr3")); - assert_eq!(ASSETS.load(&deps.storage, 4).unwrap(), Addr::unchecked("addr4")); - - // Finally make sure that there are two elements in the assets storage - assert_eq!( - ASSETS - .keys(&deps.storage, None, None, Order::Ascending) - .collect::>() - .len(), - 2 - ); - } - - #[test] - fn query_assets() { - let mut deps = mock_dependencies(); - - let msg = InstantiateMsg {}; - let info = mock_info("sender", &vec![]); - - let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); - - let mut assets = BTreeMap::new(); - assets.insert("1".into(), "addr1".into()); - - let _ = - execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::SetAssets(assets.clone())) - .unwrap(); + .find(|event| event.ty == "instantiate") + .ok_or(StdError::not_found("instantiate event not found"))?; + deps.api.addr_validate( + &instantiate_event + .attributes + .iter() + .find(|attr| &attr.key == "_contract_address") + .ok_or(StdError::not_found("_contract_address attribute not found"))? + .value, + )? + }; - let res: GetAssetContractResponse = - from_binary(&query(deps.as_ref(), mock_env(), QueryMsg::GetAssetContract(1)).unwrap()) - .unwrap(); + let router_reply: (u8, UserId) = from_binary( + &response + .data + .ok_or(StdError::not_found("no data is returned from 'xcvm_interpreter'"))?, + )?; - // Query should return the corresponding address - assert_eq!(res, GetAssetContractResponse { addr: Addr::unchecked("addr1") }); + INTERPRETERS.save(deps.storage, (router_reply.0, router_reply.1), &interpreter_address)?; - // This should fail since there the asset doesn't exist - assert!(query(deps.as_ref(), mock_env(), QueryMsg::GetAssetContract(2)).is_err()); - } + Ok(Response::new()) } + +#[cfg(test)] +mod tests {} diff --git a/xcvm/cosmwasm/contracts/router/src/msg.rs b/xcvm/cosmwasm/contracts/router/src/msg.rs index 23158d79b0b..0d59dea34e5 100644 --- a/xcvm/cosmwasm/contracts/router/src/msg.rs +++ b/xcvm/cosmwasm/contracts/router/src/msg.rs @@ -1,28 +1,22 @@ use crate::state::UserId; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::NetworkId; +use xcvm_core::{Funds, NetworkId}; +use xcvm_interpreter::msg::ExecuteMsg as InterpreterExecuteMsg; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct InstantiateMsg { pub registry_address: String, + pub interpreter_code_id: u64, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub enum ExecuteMsg { - NewInterpreter(NetworkId, UserId), + Run { + network_id: NetworkId, + user_id: UserId, + interpreter_execute_msg: InterpreterExecuteMsg, + funds: Funds, + }, } - -/* -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum QueryMsg { - GetAssetContract(XcvmAssetId), -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct GetAssetContractResponse { - pub addr: Addr, -} -*/ diff --git a/xcvm/cosmwasm/contracts/router/src/state.rs b/xcvm/cosmwasm/contracts/router/src/state.rs index 584729d5437..659a6a12139 100644 --- a/xcvm/cosmwasm/contracts/router/src/state.rs +++ b/xcvm/cosmwasm/contracts/router/src/state.rs @@ -2,15 +2,14 @@ use cosmwasm_std::Addr; use cw_storage_plus::{Item, Map}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::NetworkId; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct Config { pub registry_address: Addr, + pub interpreter_code_id: u64, } pub type UserId = Vec; -pub const INTERPRETER_CODE_ID: Item = Item::new("interpreter_code_id"); pub const INTERPRETERS: Map<(u8, UserId), Addr> = Map::new("interpreters"); pub const CONFIG: Item = Item::new("config"); From e964730bae0745a70b866919f19ac1c29fe7f3d7 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Wed, 31 Aug 2022 07:15:46 +0200 Subject: [PATCH 08/57] feat(xcvm): simplify apply of `Amount` --- code/xcvm/lib/core/src/asset.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/code/xcvm/lib/core/src/asset.rs b/code/xcvm/lib/core/src/asset.rs index b9e50fc2a69..41e261beb91 100644 --- a/code/xcvm/lib/core/src/asset.rs +++ b/code/xcvm/lib/core/src/asset.rs @@ -187,13 +187,17 @@ impl From for Amount { impl Amount { #[inline] pub fn apply(&self, value: u128) -> u128 { - let amount = FixedU128::::wrapping_from_num(value) - .saturating_mul( - FixedU128::::wrapping_from_num(self.slope.0) - .saturating_div(FixedU128::::wrapping_from_num(u128::MAX)), - ) - .wrapping_to_num::() - .saturating_add(self.intercept.0); + let amount = if self.slope.0 == 0 { + self.intercept.0 + } else { + FixedU128::::wrapping_from_num(value) + .saturating_mul( + FixedU128::::wrapping_from_num(self.slope.0) + .saturating_div(FixedU128::::wrapping_from_num(u128::MAX)), + ) + .wrapping_to_num::() + .saturating_add(self.intercept.0) + }; u128::min(value, amount) } } From e4da8a1065d3ac76c6edb1e2d694b248f42b88e3 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Wed, 31 Aug 2022 07:23:21 +0200 Subject: [PATCH 09/57] feat(xcvm): fixup contracts and add more events --- .../contracts/asset-registry/src/contract.rs | 9 ++-- .../contracts/interpreter/src/contract.rs | 45 +++++++++++-------- .../contracts/interpreter/src/error.rs | 4 +- .../cosmwasm/contracts/router/src/contract.rs | 10 ++--- xcvm/cosmwasm/contracts/router/src/msg.rs | 4 +- 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs index 90062b6b154..fd53fe56b03 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -5,7 +5,9 @@ use crate::{ }; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; -use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; +use cosmwasm_std::{ + to_binary, Binary, Deps, DepsMut, Env, Event, MessageInfo, Response, StdResult, +}; use std::collections::BTreeMap; #[cfg_attr(not(feature = "library"), entry_point)] @@ -15,7 +17,8 @@ pub fn instantiate( _info: MessageInfo, _msg: InstantiateMsg, ) -> Result { - Ok(Response::default()) + Ok(Response::default() + .add_event(Event::new("xcvm.registry").add_attribute("action", "instantiated"))) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -54,7 +57,7 @@ pub fn handle_set_assets( ASSETS.save(deps.storage, asset_id.parse::().unwrap(), &addr)?; } - Ok(Response::new().add_attribute("action", "update_assets")) + Ok(Response::new().add_event(Event::new("xcvm.registry").add_attribute("action", "updated"))) } pub fn query_asset_contract( diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index d9a7d4ddd94..2a3deb358ad 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -1,7 +1,8 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, CosmosMsg, DepsMut, Env, MessageInfo, QueryRequest, Response, StdError, WasmQuery, + to_binary, CosmosMsg, DepsMut, Env, Event, MessageInfo, QueryRequest, Response, StdError, + WasmQuery, }; use serde::Serialize; @@ -26,7 +27,9 @@ pub fn instantiate( let config = Config { registry_address }; CONFIG.save(deps.storage, &config)?; - Ok(Response::new().set_data(to_binary(&(msg.network_id.0, msg.user_id))?)) + Ok(Response::new() + .add_event(Event::new("xcvm.interpreter").add_attribute("action", "instantiated")) + .set_data(to_binary(&(msg.network_id.0, msg.user_id))?)) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -58,7 +61,15 @@ pub fn interpret_program( interpret_transfer(&mut deps, to, assets, response), }?; } - Ok(response) + + Ok(response.add_event( + Event::new("xcvm.interpreter") + .add_attribute("action", "executed") + .add_attribute( + "program", + core::str::from_utf8(&program.tag).map_err(|_| ContractError::InvalidProgramTag)?, + ), + )) } pub fn interpret_call(encoded: Vec, response: Response) -> Result { @@ -85,9 +96,11 @@ pub fn interpret_spawn( let data = SpawnEvent { network, salt, assets, program }; - Ok(response.add_attribute( - "spawn", - serde_json_wasm::to_string(&data).map_err(|_| ContractError::DataSerializationError)?, + Ok(response.add_event( + Event::new("xcvm.interpreter").add_attribute("action", "spawn").add_attribute( + "program", + serde_json_wasm::to_string(&data).map_err(|_| ContractError::DataSerializationError)?, + ), )) } @@ -110,21 +123,17 @@ pub fn interpret_transfer( let contract = Cw20Contract(cw20_address.addr.clone()); if amount.is_zero() { - return Err(ContractError::ZeroTransferAmount) + continue } let transfer_amount = { - if amount.slope.0 == 0 { - amount.intercept.0 - } else { - let query_msg = Cw20QueryMsg::Balance { address: to.clone() }; - let response: BalanceResponse = - deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart { - contract_addr: cw20_address.addr.clone().into_string(), - msg: to_binary(&query_msg)?, - }))?; - amount.apply(response.balance.into()) - } + let query_msg = Cw20QueryMsg::Balance { address: to.clone() }; + let response: BalanceResponse = + deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart { + contract_addr: cw20_address.addr.clone().into_string(), + msg: to_binary(&query_msg)?, + }))?; + amount.apply(response.balance.into()) }; response = response.add_message(contract.call(Cw20ExecuteMsg::Transfer { diff --git a/xcvm/cosmwasm/contracts/interpreter/src/error.rs b/xcvm/cosmwasm/contracts/interpreter/src/error.rs index e37fa1960eb..20816131b2d 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/error.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/error.rs @@ -12,6 +12,6 @@ pub enum ContractError { #[error("Data cannot be serialized")] DataSerializationError, - #[error("Transfer amount cannot be 0")] - ZeroTransferAmount, + #[error("A program tag must be a correct utf8 encoded string")] + InvalidProgramTag, } diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 537bcea0cc1..b5c3fe63af6 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -11,7 +11,7 @@ use cosmwasm_std::{ }; use cw20::{Cw20Contract, Cw20ExecuteMsg}; use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; -use xcvm_core::{Funds, NetworkId}; +use xcvm_core::{Displayed, Funds, NetworkId}; use xcvm_interpreter::msg::{ ExecuteMsg as InterpreterExecuteMsg, InstantiateMsg as InterpreterInstantiateMsg, }; @@ -52,7 +52,7 @@ pub fn handle_run( network_id: NetworkId, user_id: UserId, interpreter_execute_msg: InterpreterExecuteMsg, - funds: Funds, + funds: Funds>, ) -> Result { match INTERPRETERS.load(deps.storage, (network_id.0, user_id.clone())) { Ok(interpreter_address) => { @@ -92,7 +92,7 @@ pub fn handle_run( fn send_funds_to_interpreter( deps: Deps, interpreter_address: Addr, - funds: Funds, + funds: Funds>, ) -> StdResult { let mut response = Response::new(); let registry_address = CONFIG.load(deps.storage)?.registry_address.into_string(); @@ -108,13 +108,13 @@ fn send_funds_to_interpreter( )?; let contract = Cw20Contract(cw20_address.addr.clone()); - if amount.intercept.0 == 0 { + if amount.0 == 0 { continue } response = response.add_message(contract.call(Cw20ExecuteMsg::Transfer { recipient: interpreter_address.clone(), - amount: amount.intercept.0.into(), + amount: amount.0.into(), })?); } Ok(response) diff --git a/xcvm/cosmwasm/contracts/router/src/msg.rs b/xcvm/cosmwasm/contracts/router/src/msg.rs index 0d59dea34e5..ea5e5c7013a 100644 --- a/xcvm/cosmwasm/contracts/router/src/msg.rs +++ b/xcvm/cosmwasm/contracts/router/src/msg.rs @@ -1,7 +1,7 @@ use crate::state::UserId; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{Funds, NetworkId}; +use xcvm_core::{Funds, NetworkId, Displayed}; use xcvm_interpreter::msg::ExecuteMsg as InterpreterExecuteMsg; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] @@ -17,6 +17,6 @@ pub enum ExecuteMsg { network_id: NetworkId, user_id: UserId, interpreter_execute_msg: InterpreterExecuteMsg, - funds: Funds, + funds: Funds>, }, } From 6665684f3ba822e3e6634a17dc2a17692ea9a179 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Wed, 31 Aug 2022 07:24:34 +0200 Subject: [PATCH 10/57] chore(style): apply cargofmt --- code/xcvm/lib/core/src/program.rs | 4 +--- .../asset-registry/examples/schema.rs | 17 ++++++++--------- .../contracts/asset-registry/src/error.rs | 4 ++-- .../contracts/asset-registry/src/helpers.rs | 19 +++++++------------ .../contracts/asset-registry/src/msg.rs | 6 +++--- .../contracts/interpreter/examples/schema.rs | 15 +++++++-------- .../contracts/interpreter/src/error.rs | 16 ++++++++-------- .../contracts/interpreter/src/state.rs | 2 +- .../contracts/router/examples/schema.rs | 17 ++++++++--------- xcvm/cosmwasm/contracts/router/src/error.rs | 4 ++-- xcvm/cosmwasm/contracts/router/src/helpers.rs | 19 +++++++------------ xcvm/cosmwasm/contracts/router/src/msg.rs | 2 +- 12 files changed, 55 insertions(+), 70 deletions(-) diff --git a/code/xcvm/lib/core/src/program.rs b/code/xcvm/lib/core/src/program.rs index b1761f720d5..3e4f05c53f8 100644 --- a/code/xcvm/lib/core/src/program.rs +++ b/code/xcvm/lib/core/src/program.rs @@ -4,9 +4,7 @@ use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; #[cfg_attr(feature = "std", derive(schemars::JsonSchema))] -#[derive( - Clone, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, Serialize, Deserialize -)] +#[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Program { pub tag: Vec, diff --git a/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs b/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs index 5e9d69fadaf..22dc89b488e 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs @@ -1,17 +1,16 @@ -use std::env::current_dir; -use std::fs::create_dir_all; +use std::{env::current_dir, fs::create_dir_all}; use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; use xcvm_asset_registry::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; fn main() { - let mut out_dir = current_dir().unwrap(); - out_dir.push("schema"); - create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(QueryMsg), &out_dir); } diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/error.rs b/xcvm/cosmwasm/contracts/asset-registry/src/error.rs index 40dab9ff314..d32e4b26dc4 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/error.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/error.rs @@ -3,6 +3,6 @@ use thiserror::Error; #[derive(Error, Debug)] pub enum ContractError { - #[error("{0}")] - Std(#[from] StdError), + #[error("{0}")] + Std(#[from] StdError), } diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs b/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs index 34c9d64fdef..84177f8099d 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs @@ -11,17 +11,12 @@ use crate::msg::ExecuteMsg; pub struct AssetRegistryContract(pub Addr); impl AssetRegistryContract { - pub fn addr(&self) -> &Addr { - &self.0 - } + pub fn addr(&self) -> &Addr { + &self.0 + } - pub fn call>(&self, msg: T) -> StdResult { - let msg = to_binary(&msg.into())?; - Ok(WasmMsg::Execute { - contract_addr: self.addr().into(), - msg, - funds: vec![], - } - .into()) - } + pub fn call>(&self, msg: T) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { contract_addr: self.addr().into(), msg, funds: vec![] }.into()) + } } diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs b/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs index a145a5034bb..61c9a37dc44 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs @@ -12,16 +12,16 @@ pub struct InstantiateMsg {} #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub enum ExecuteMsg { - SetAssets(BTreeMap), + SetAssets(BTreeMap), } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub enum QueryMsg { - GetAssetContract(XcvmAssetId), + GetAssetContract(XcvmAssetId), } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct GetAssetContractResponse { - pub addr: Addr, + pub addr: Addr, } diff --git a/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs b/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs index f1a4284f7fc..54a4c1c5b23 100644 --- a/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs +++ b/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs @@ -1,15 +1,14 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use std::env::current_dir; -use std::fs::create_dir_all; +use std::{env::current_dir, fs::create_dir_all}; use xcvm_interpreter::msg::{ExecuteMsg, InstantiateMsg}; fn main() { - let mut out_dir = current_dir().unwrap(); - out_dir.push("schema"); - create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); } diff --git a/xcvm/cosmwasm/contracts/interpreter/src/error.rs b/xcvm/cosmwasm/contracts/interpreter/src/error.rs index 20816131b2d..64f542a157a 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/error.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/error.rs @@ -3,15 +3,15 @@ use thiserror::Error; #[derive(Error, Debug)] pub enum ContractError { - #[error("{0}")] - Std(#[from] StdError), + #[error("{0}")] + Std(#[from] StdError), - #[error("Invalid call payload")] - InvalidCallPayload, + #[error("Invalid call payload")] + InvalidCallPayload, - #[error("Data cannot be serialized")] - DataSerializationError, + #[error("Data cannot be serialized")] + DataSerializationError, - #[error("A program tag must be a correct utf8 encoded string")] - InvalidProgramTag, + #[error("A program tag must be a correct utf8 encoded string")] + InvalidProgramTag, } diff --git a/xcvm/cosmwasm/contracts/interpreter/src/state.rs b/xcvm/cosmwasm/contracts/interpreter/src/state.rs index 78661e45759..315fdcf93a1 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/state.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/state.rs @@ -6,7 +6,7 @@ use cw_storage_plus::Item; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct Config { - pub registry_address: Addr, + pub registry_address: Addr, } pub const CONFIG: Item = Item::new("config"); diff --git a/xcvm/cosmwasm/contracts/router/examples/schema.rs b/xcvm/cosmwasm/contracts/router/examples/schema.rs index 5e9d69fadaf..22dc89b488e 100644 --- a/xcvm/cosmwasm/contracts/router/examples/schema.rs +++ b/xcvm/cosmwasm/contracts/router/examples/schema.rs @@ -1,17 +1,16 @@ -use std::env::current_dir; -use std::fs::create_dir_all; +use std::{env::current_dir, fs::create_dir_all}; use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; use xcvm_asset_registry::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; fn main() { - let mut out_dir = current_dir().unwrap(); - out_dir.push("schema"); - create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(QueryMsg), &out_dir); } diff --git a/xcvm/cosmwasm/contracts/router/src/error.rs b/xcvm/cosmwasm/contracts/router/src/error.rs index 40dab9ff314..d32e4b26dc4 100644 --- a/xcvm/cosmwasm/contracts/router/src/error.rs +++ b/xcvm/cosmwasm/contracts/router/src/error.rs @@ -3,6 +3,6 @@ use thiserror::Error; #[derive(Error, Debug)] pub enum ContractError { - #[error("{0}")] - Std(#[from] StdError), + #[error("{0}")] + Std(#[from] StdError), } diff --git a/xcvm/cosmwasm/contracts/router/src/helpers.rs b/xcvm/cosmwasm/contracts/router/src/helpers.rs index 34c9d64fdef..84177f8099d 100644 --- a/xcvm/cosmwasm/contracts/router/src/helpers.rs +++ b/xcvm/cosmwasm/contracts/router/src/helpers.rs @@ -11,17 +11,12 @@ use crate::msg::ExecuteMsg; pub struct AssetRegistryContract(pub Addr); impl AssetRegistryContract { - pub fn addr(&self) -> &Addr { - &self.0 - } + pub fn addr(&self) -> &Addr { + &self.0 + } - pub fn call>(&self, msg: T) -> StdResult { - let msg = to_binary(&msg.into())?; - Ok(WasmMsg::Execute { - contract_addr: self.addr().into(), - msg, - funds: vec![], - } - .into()) - } + pub fn call>(&self, msg: T) -> StdResult { + let msg = to_binary(&msg.into())?; + Ok(WasmMsg::Execute { contract_addr: self.addr().into(), msg, funds: vec![] }.into()) + } } diff --git a/xcvm/cosmwasm/contracts/router/src/msg.rs b/xcvm/cosmwasm/contracts/router/src/msg.rs index ea5e5c7013a..fd6b3e8daff 100644 --- a/xcvm/cosmwasm/contracts/router/src/msg.rs +++ b/xcvm/cosmwasm/contracts/router/src/msg.rs @@ -1,7 +1,7 @@ use crate::state::UserId; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use xcvm_core::{Funds, NetworkId, Displayed}; +use xcvm_core::{Displayed, Funds, NetworkId}; use xcvm_interpreter::msg::ExecuteMsg as InterpreterExecuteMsg; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] From 4e646013456002503d50ebc4f6a4b5fba7ecb76a Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Wed, 31 Aug 2022 08:07:31 +0200 Subject: [PATCH 11/57] feat(xcvm): size opt level for contracts --- code/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Cargo.toml b/code/Cargo.toml index f82ee5423f3..0d969a349f8 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -64,7 +64,7 @@ lto = true inherits = "production" rpath = false overflow-checks = true -opt-level = 3 +opt-level = "s" debug = false debug-assertions = false panic = "abort" From 7c1ee3ea3547a59c3672b3032464e059e2be7340 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Wed, 31 Aug 2022 08:22:34 +0200 Subject: [PATCH 12/57] feat(xcvm): nixify contracts build --- flake.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 59fd66f51e0..d32aecb7332 100644 --- a/flake.nix +++ b/flake.nix @@ -403,6 +403,12 @@ --execution=wasm ''; + mk-xcvm-contract = name: crane-nightly.buildPackage (common-attrs // { + pnameSuffix = name; + cargoBuildCommand = "cargo build --target wasm32-unknown-unknown --profile cosmwasm-contracts -p ${name}"; + RUSTFLAGS="-C link-arg=-s"; + }); + subwasm = let src = fetchFromGitHub { owner = "chevdor"; @@ -445,7 +451,6 @@ ``` ''; }; - in rec { packages = rec { inherit wasm-optimizer; @@ -465,6 +470,10 @@ inherit subwasm; inherit subwasm-release-body; + xcvm-contract-asset-registry = mk-xcvm-contract "xcvm-asset-registry"; + xcvm-contract-router = mk-xcvm-contract "xcvm-router"; + xcvm-contract-interpreter = mk-xcvm-contract "xcvm-interpreter"; + subsquid-processor = let processor = pkgs.buildNpmPackage { extraNodeModulesArgs = { From 9bd92757492223198f39a031f7a7e397be4edd6a Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Wed, 31 Aug 2022 08:38:52 +0200 Subject: [PATCH 13/57] feat(xcvm): fixup invalid test --- .../contracts/interpreter/src/contract.rs | 101 +++++++++--------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 2a3deb358ad..295a267520d 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -127,11 +127,10 @@ pub fn interpret_transfer( } let transfer_amount = { - let query_msg = Cw20QueryMsg::Balance { address: to.clone() }; - let response: BalanceResponse = - deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart { + let response = + deps.querier.query::(&QueryRequest::Wasm(WasmQuery::Smart { contract_addr: cw20_address.addr.clone().into_string(), - msg: to_binary(&query_msg)?, + msg: to_binary(&Cw20QueryMsg::Balance { address: to.clone() })?, }))?; amount.apply(response.balance.into()) }; @@ -154,7 +153,7 @@ mod tests { use super::*; use cosmwasm_std::{ testing::{mock_dependencies, mock_env, mock_info, MockQuerier}, - wasm_execute, Addr, Attribute, ContractResult, QuerierResult, + wasm_execute, Addr, ContractResult, QuerierResult, }; use xcvm_core::Picasso; @@ -179,53 +178,55 @@ mod tests { ); } - fn wasm_querier(_: &WasmQuery) -> QuerierResult { - Ok(ContractResult::Ok( - to_binary(&xcvm_asset_registry::msg::GetAssetContractResponse { - addr: Addr::unchecked("mock"), - }) - .unwrap(), - )) - .into() - } + // fn wasm_querier(_: &WasmQuery) -> QuerierResult { + // Ok(ContractResult::Ok( + // to_binary(&xcvm_asset_registry::msg::GetAssetContractResponse { + // addr: Addr::unchecked("mock"), + // }) + // .unwrap(), + // )) + // .into() + // } #[test] fn execute_transfer() { - let mut deps = mock_dependencies(); - let mut querier = MockQuerier::default(); - querier.update_wasm(wasm_querier); - deps.querier = querier; - - let info = mock_info("sender", &vec![]); - let _ = instantiate( - deps.as_mut(), - mock_env(), - info.clone(), - InstantiateMsg { - registry_address: "addr".into(), - network_id: Picasso.into(), - user_id: vec![], - }, - ) - .unwrap(); - - let program = XCVMProgram { - tag: vec![], - instructions: vec![XCVMInstruction::Transfer { - to: "asset".into(), - assets: Funds::from([(1, 1_u128)]), - }] - .into(), - }; - - let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) - .unwrap(); - let contract = Cw20Contract(Addr::unchecked("mock")); - let msg = contract - .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 1_u128.into() }) - .unwrap(); - - assert_eq!(res.messages[0].msg, msg); + // ====================== + // TODO: correctly mock Cw20 balance request to set some funds on transfer + //======================= + + // let mut deps = mock_dependencies(); + // let mut querier = MockQuerier::default(); + // querier.update_wasm(wasm_querier); + // deps.querier = querier; + + // let info = mock_info("sender", &vec![]); + // let _ = instantiate( + // deps.as_mut(), + // mock_env(), + // info.clone(), + // InstantiateMsg { + // registry_address: "addr".into(), + // network_id: Picasso.into(), + // user_id: vec![], + // }, + // ) + // .unwrap(); + + // let program = XCVMProgram { + // tag: vec![], + // instructions: vec![XCVMInstruction::Transfer { + // to: "asset".into(), + // assets: Funds(Default::default()) + // }] + // .into(), + // }; + + // let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program + // }) .unwrap(); + // let contract = Cw20Contract(Addr::unchecked("mock")); + // let msg = contract + // .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 1_u128.into() }) + // .unwrap(); } #[test] @@ -292,6 +293,6 @@ mod tests { let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) .unwrap(); - assert_eq!(res.attributes[0], Attribute { key: "spawn".to_string(), value: r#"{"network":1,"salt":[],"assets":{},"program":{"tag":[],"instructions":[{"call":{"encoded":[]}}]}}"#.to_string() }); + assert_eq!(res.events[0], Event::new("xcvm.interpreter").add_attribute("action", "spawn").add_attribute("program", r#"{"network":1,"salt":[],"assets":{},"program":{"tag":[],"instructions":[{"call":{"encoded":[]}}]}}"#.to_string())); } } From 72791bf4576a290226d3dd3ee9ff5a888e44e1d1 Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 31 Aug 2022 10:15:47 +0200 Subject: [PATCH 14/57] fix(cosmwasm): invalid test in interpreter Signed-off-by: aeryz --- .../contracts/interpreter/src/contract.rs | 113 ++++++++++-------- 1 file changed, 65 insertions(+), 48 deletions(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 295a267520d..8a575a1d4b6 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -153,9 +153,12 @@ mod tests { use super::*; use cosmwasm_std::{ testing::{mock_dependencies, mock_env, mock_info, MockQuerier}, - wasm_execute, Addr, ContractResult, QuerierResult, + wasm_execute, Addr, ContractResult, QuerierResult, SystemResult, }; - use xcvm_core::Picasso; + use xcvm_core::{Amount, AssetId, Picasso, ETH, PICA}; + + const CW20_ADDR: &str = "cw20addr"; + const REGISTRY_ADDR: &str = "registryaddr"; #[test] fn proper_instantiation() { @@ -178,55 +181,69 @@ mod tests { ); } - // fn wasm_querier(_: &WasmQuery) -> QuerierResult { - // Ok(ContractResult::Ok( - // to_binary(&xcvm_asset_registry::msg::GetAssetContractResponse { - // addr: Addr::unchecked("mock"), - // }) - // .unwrap(), - // )) - // .into() - // } + fn wasm_querier(query: &WasmQuery) -> QuerierResult { + match query { + WasmQuery::Smart { contract_addr, .. } if contract_addr.as_str() == CW20_ADDR => + SystemResult::Ok(ContractResult::Ok( + to_binary(&cw20::BalanceResponse { balance: 100000_u128.into() }).unwrap(), + )), + WasmQuery::Smart { contract_addr, .. } if contract_addr.as_str() == REGISTRY_ADDR => + SystemResult::Ok(ContractResult::Ok( + to_binary(&xcvm_asset_registry::msg::GetAssetContractResponse { + addr: Addr::unchecked(CW20_ADDR), + }) + .unwrap(), + )) + .into(), + _ => panic!("Unhandled query"), + } + } #[test] fn execute_transfer() { - // ====================== - // TODO: correctly mock Cw20 balance request to set some funds on transfer - //======================= - - // let mut deps = mock_dependencies(); - // let mut querier = MockQuerier::default(); - // querier.update_wasm(wasm_querier); - // deps.querier = querier; - - // let info = mock_info("sender", &vec![]); - // let _ = instantiate( - // deps.as_mut(), - // mock_env(), - // info.clone(), - // InstantiateMsg { - // registry_address: "addr".into(), - // network_id: Picasso.into(), - // user_id: vec![], - // }, - // ) - // .unwrap(); - - // let program = XCVMProgram { - // tag: vec![], - // instructions: vec![XCVMInstruction::Transfer { - // to: "asset".into(), - // assets: Funds(Default::default()) - // }] - // .into(), - // }; - - // let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program - // }) .unwrap(); - // let contract = Cw20Contract(Addr::unchecked("mock")); - // let msg = contract - // .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 1_u128.into() }) - // .unwrap(); + let mut deps = mock_dependencies(); + let mut querier = MockQuerier::default(); + querier.update_wasm(wasm_querier); + deps.querier = querier; + + let info = mock_info("sender", &vec![]); + let _ = instantiate( + deps.as_mut(), + mock_env(), + info.clone(), + InstantiateMsg { + registry_address: REGISTRY_ADDR.into(), + network_id: Picasso.into(), + user_id: vec![], + }, + ) + .unwrap(); + + let program = XCVMProgram { + tag: vec![], + instructions: vec![XCVMInstruction::Transfer { + to: "asset".into(), + assets: Funds::from([ + (Into::::into(PICA), Amount::absolute(1)), + (ETH.into(), Amount::absolute(2)), + ]), + }] + .into(), + }; + + let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) + .unwrap(); + let contract = Cw20Contract(Addr::unchecked(CW20_ADDR)); + let messages = vec![ + contract + .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 1_u128.into() }) + .unwrap(), + contract + .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 2_u128.into() }) + .unwrap(), + ]; + + assert_eq!(res.messages.iter().map(|msg| msg.msg.clone()).collect::>(), messages); } #[test] From 68ccfe96df3409b668c3f339d74e4a9517d251ab Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 31 Aug 2022 10:52:46 +0200 Subject: [PATCH 15/57] feat(cosmwasm): add hex encoded `user_id` to contract label Signed-off-by: aeryz --- xcvm/cosmwasm/contracts/router/Cargo.toml | 1 + xcvm/cosmwasm/contracts/router/src/contract.rs | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index f2bceace953..4995dc82778 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -30,6 +30,7 @@ xcvm-interpreter = { path = "../interpreter", features = ["library"] } xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } thiserror = { version = "1.0.31" } +hex = "0.4" [dev-dependencies] cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index b5c3fe63af6..c4ead4eec74 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -72,8 +72,7 @@ pub fn handle_run( user_id: user_id.clone(), })?, funds: vec![], - label: format!("xcvm-interpreter-{}", network_id.0), /* TODO(aeryz): juno doesn't - * allow empty label */ + label: format!("xcvm-interpreter-{}-{}", network_id.0, hex::encode(&user_id)), } .into(); From 71d374d1b5c36e2a655321e86f52206b9edb51df Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 31 Aug 2022 11:10:49 +0200 Subject: [PATCH 16/57] feat(cosmwasm): add missing `query` entrypoint to contracts Signed-off-by: aeryz --- xcvm/cosmwasm/contracts/interpreter/src/contract.rs | 11 ++++++++--- xcvm/cosmwasm/contracts/interpreter/src/msg.rs | 3 +++ xcvm/cosmwasm/contracts/router/src/contract.rs | 11 ++++++++--- xcvm/cosmwasm/contracts/router/src/msg.rs | 3 +++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 8a575a1d4b6..dede6af39ae 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -1,14 +1,14 @@ #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, CosmosMsg, DepsMut, Env, Event, MessageInfo, QueryRequest, Response, StdError, - WasmQuery, + to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, Event, MessageInfo, QueryRequest, Response, + StdError, StdResult, WasmQuery, }; use serde::Serialize; use crate::{ error::ContractError, - msg::{ExecuteMsg, InstantiateMsg, XCVMProgram}, + msg::{ExecuteMsg, InstantiateMsg, QueryMsg, XCVMProgram}, state::{Config, CONFIG}, }; use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg}; @@ -144,6 +144,11 @@ pub fn interpret_transfer( Ok(response) } +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(_deps: Deps, _env: Env, _msg: QueryMsg) -> StdResult { + Err(StdError::generic_err("not implemented")) +} + #[cfg(test)] mod tests { use std::collections::BTreeMap; diff --git a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs index 53bc612630b..2417a9a2a28 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/msg.rs @@ -20,3 +20,6 @@ pub struct InstantiateMsg { pub enum ExecuteMsg { Execute { program: XCVMProgram }, } + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub enum QueryMsg {} diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index c4ead4eec74..2bbac073a38 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -1,13 +1,13 @@ use crate::{ error::ContractError, - msg::{ExecuteMsg, InstantiateMsg}, + msg::{ExecuteMsg, InstantiateMsg, QueryMsg}, state::{Config, UserId, CONFIG, INTERPRETERS}, }; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - from_binary, to_binary, wasm_execute, Addr, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, - Response, StdError, StdResult, SubMsg, WasmMsg, WasmQuery, + from_binary, to_binary, wasm_execute, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, + Reply, Response, StdError, StdResult, SubMsg, WasmMsg, WasmQuery, }; use cw20::{Cw20Contract, Cw20ExecuteMsg}; use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; @@ -127,6 +127,11 @@ pub fn reply(deps: DepsMut, _env: Env, msg: Reply) -> StdResult { } } +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(_deps: Deps, _env: Env, _msg: QueryMsg) -> StdResult { + Err(StdError::generic_err("not implemented")) +} + fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { let response = msg.result.into_result().map_err(StdError::generic_err)?; let interpreter_address = { diff --git a/xcvm/cosmwasm/contracts/router/src/msg.rs b/xcvm/cosmwasm/contracts/router/src/msg.rs index fd6b3e8daff..2e855fcce33 100644 --- a/xcvm/cosmwasm/contracts/router/src/msg.rs +++ b/xcvm/cosmwasm/contracts/router/src/msg.rs @@ -20,3 +20,6 @@ pub enum ExecuteMsg { funds: Funds>, }, } + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] +pub enum QueryMsg {} From 99cc75909f89d15bef308e9f229e0a509ff60412 Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 31 Aug 2022 13:21:57 +0200 Subject: [PATCH 17/57] fix(xcvm): `From` implementations of `Funds` Signed-off-by: aeryz --- code/xcvm/lib/core/src/asset.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/xcvm/lib/core/src/asset.rs b/code/xcvm/lib/core/src/asset.rs index 41e261beb91..437ffd7b475 100644 --- a/code/xcvm/lib/core/src/asset.rs +++ b/code/xcvm/lib/core/src/asset.rs @@ -216,10 +216,10 @@ impl Funds { } } -impl From> for Funds +impl From> for Funds where U: Into, - V: Into, + V: Into, { #[inline] fn from(assets: BTreeMap) -> Self { @@ -232,10 +232,10 @@ where } } -impl From<[(U, V); K]> for Funds +impl From<[(U, V); K]> for Funds where U: Into, - V: Into, + V: Into, { #[inline] fn from(x: [(U, V); K]) -> Self { @@ -243,9 +243,9 @@ where } } -impl From for BTreeMap { +impl From> for BTreeMap { #[inline] - fn from(Funds(assets): Funds) -> Self { + fn from(Funds(assets): Funds) -> Self { assets.into_iter().map(|(AssetId(asset), amount)| (asset, amount)).collect() } } From 41dcbf4191b74f81dafe76003f324f554ff6667f Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 31 Aug 2022 20:01:41 +0200 Subject: [PATCH 18/57] fix(pallet-cosmwasm): entrypoint bug Signed-off-by: aeryz --- code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs b/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs index 7e62a36f0ad..4edb67f77b4 100644 --- a/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs +++ b/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs @@ -3,7 +3,9 @@ use crate::{runtimes::abstraction::GasOutcome, Config, ContractInfoOf, Pallet}; use alloc::string::String; use cosmwasm_minimal_std::{Coin, ContractInfoResponse, Empty, Env, MessageInfo}; use cosmwasm_vm::{ - executor::{cosmwasm_call, ExecutorError, InstantiateInput, MigrateInput, QueryInput}, + executor::{ + cosmwasm_call, ExecuteInput, ExecutorError, InstantiateInput, MigrateInput, QueryInput, + }, has::Has, memory::{ MemoryReadError, MemoryWriteError, Pointable, ReadWriteMemory, ReadableMemory, @@ -384,7 +386,7 @@ impl<'a, T: Config> VMBase for CosmwasmVM<'a, T> { let contract = address.into_inner(); let info = Pallet::::contract_info(&contract)?; Pallet::::cosmwasm_call(self.shared, sender, contract, info, funds, |vm| { - cosmwasm_system_run::(vm, message, event_handler) + cosmwasm_system_run::(vm, message, event_handler) }) } From c03e2404703d711f9302b1f1ad7ddbfd988fc444 Mon Sep 17 00:00:00 2001 From: aeryz Date: Thu, 1 Sep 2022 15:15:33 +0200 Subject: [PATCH 19/57] fix(cosmwasm): generate proper schemas Signed-off-by: aeryz --- .../asset-registry/schema/query_msg.json | 2 +- .../contracts/interpreter/examples/schema.rs | 3 +- .../interpreter/schema/execute_msg.json | 60 ++--- .../interpreter/schema/instantiate_msg.json | 23 +- .../interpreter/schema/query_msg.json | 6 + .../contracts/router/examples/schema.rs | 2 +- .../contracts/router/schema/execute_msg.json | 214 +++++++++++++++++- .../router/schema/instantiate_msg.json | 16 +- .../contracts/router/schema/query_msg.json | 18 +- .../cosmwasm/contracts/router/src/contract.rs | 89 +++++++- 10 files changed, 368 insertions(+), 65 deletions(-) create mode 100644 xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json diff --git a/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json b/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json index f7bcb21bdc8..2a08ff8f087 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json +++ b/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json @@ -10,7 +10,7 @@ "properties": { "get_asset_contract": { "type": "integer", - "format": "uint32", + "format": "uint128", "minimum": 0.0 } }, diff --git a/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs b/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs index 54a4c1c5b23..fcccb821525 100644 --- a/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs +++ b/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs @@ -1,7 +1,7 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; use std::{env::current_dir, fs::create_dir_all}; -use xcvm_interpreter::msg::{ExecuteMsg, InstantiateMsg}; +use xcvm_interpreter::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; fn main() { let mut out_dir = current_dir().unwrap(); @@ -11,4 +11,5 @@ fn main() { export_schema(&schema_for!(InstantiateMsg), &out_dir); export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(QueryMsg), &out_dir); } diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json b/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json index 2d755ee4b85..6789bb9ffda 100644 --- a/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json +++ b/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json @@ -15,7 +15,7 @@ ], "properties": { "program": { - "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount" + "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount" } } } @@ -25,34 +25,20 @@ ], "definitions": { "Amount": { - "oneOf": [ - { - "type": "object", - "required": [ - "fixed" - ], - "properties": { - "fixed": { - "$ref": "#/definitions/Displayed_for_uint128" - } - }, - "additionalProperties": false + "description": "See https://en.wikipedia.org/wiki/Linear_equation#Slope%E2%80%93intercept_form_or_Gradient-intercept_form", + "type": "object", + "required": [ + "intercept", + "slope" + ], + "properties": { + "intercept": { + "$ref": "#/definitions/Displayed_for_uint128" }, - { - "type": "object", - "required": [ - "ratio" - ], - "properties": { - "ratio": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - }, - "additionalProperties": false + "slope": { + "$ref": "#/definitions/Displayed_for_uint128" } - ] + } }, "Displayed_for_uint128": { "type": "integer", @@ -65,7 +51,7 @@ "$ref": "#/definitions/Amount" } }, - "Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount": { + "Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount": { "description": "Base XCVM instructions. This set will remain as small as possible, expressiveness must come on `top` of the base instructions.", "oneOf": [ { @@ -139,10 +125,10 @@ "$ref": "#/definitions/Funds_for_Amount" }, "network": { - "$ref": "#/definitions/NetworkID" + "$ref": "#/definitions/NetworkId" }, "program": { - "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount" + "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount" }, "salt": { "type": "array", @@ -159,29 +145,27 @@ } ] }, - "NetworkID": { + "NetworkId": { "description": "Newtype for XCVM networks ID. Must be unique for each network and must never change. This ID is an opaque, arbitrary type from the XCVM protocol and no assumption must be made on how it is computed.", "type": "integer", "format": "uint8", "minimum": 0.0 }, - "Program_for_Array_of_Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount": { + "Program_for_Array_of_Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount": { "type": "object", "required": [ - "instructions" + "instructions", + "tag" ], "properties": { "instructions": { "type": "array", "items": { - "$ref": "#/definitions/Instruction_for_NetworkID_and_Array_of_uint8_and_String_and_Funds_for_Amount" + "$ref": "#/definitions/Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount" } }, "tag": { - "type": [ - "array", - "null" - ], + "type": "array", "items": { "type": "integer", "format": "uint8", diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json b/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json index 45457359827..1d8b6cabb7d 100644 --- a/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json +++ b/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json @@ -3,11 +3,32 @@ "title": "InstantiateMsg", "type": "object", "required": [ - "registry_address" + "network_id", + "registry_address", + "user_id" ], "properties": { + "network_id": { + "$ref": "#/definitions/NetworkId" + }, "registry_address": { "type": "string" + }, + "user_id": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + }, + "definitions": { + "NetworkId": { + "description": "Newtype for XCVM networks ID. Must be unique for each network and must never change. This ID is an opaque, arbitrary type from the XCVM protocol and no assumption must be made on how it is computed.", + "type": "integer", + "format": "uint8", + "minimum": 0.0 } } } diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json b/xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json new file mode 100644 index 00000000000..0f592a1af0d --- /dev/null +++ b/xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "type": "string", + "enum": [] +} diff --git a/xcvm/cosmwasm/contracts/router/examples/schema.rs b/xcvm/cosmwasm/contracts/router/examples/schema.rs index 22dc89b488e..320fd1b63c6 100644 --- a/xcvm/cosmwasm/contracts/router/examples/schema.rs +++ b/xcvm/cosmwasm/contracts/router/examples/schema.rs @@ -2,7 +2,7 @@ use std::{env::current_dir, fs::create_dir_all}; use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use xcvm_asset_registry::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; +use xcvm_router::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; fn main() { let mut out_dir = current_dir().unwrap(); diff --git a/xcvm/cosmwasm/contracts/router/schema/execute_msg.json b/xcvm/cosmwasm/contracts/router/schema/execute_msg.json index a67ba283836..df7514dbe05 100644 --- a/xcvm/cosmwasm/contracts/router/schema/execute_msg.json +++ b/xcvm/cosmwasm/contracts/router/schema/execute_msg.json @@ -5,17 +5,221 @@ { "type": "object", "required": [ - "set_assets" + "run" ], "properties": { - "set_assets": { + "run": { "type": "object", - "additionalProperties": { - "type": "string" + "required": [ + "funds", + "interpreter_execute_msg", + "network_id", + "user_id" + ], + "properties": { + "funds": { + "$ref": "#/definitions/Funds_for_Displayed_for_uint128" + }, + "interpreter_execute_msg": { + "$ref": "#/definitions/ExecuteMsg" + }, + "network_id": { + "$ref": "#/definitions/NetworkId" + }, + "user_id": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } } } }, "additionalProperties": false } - ] + ], + "definitions": { + "Amount": { + "description": "See https://en.wikipedia.org/wiki/Linear_equation#Slope%E2%80%93intercept_form_or_Gradient-intercept_form", + "type": "object", + "required": [ + "intercept", + "slope" + ], + "properties": { + "intercept": { + "$ref": "#/definitions/Displayed_for_uint128" + }, + "slope": { + "$ref": "#/definitions/Displayed_for_uint128" + } + } + }, + "Displayed_for_uint128": { + "type": "integer", + "format": "uint128", + "minimum": 0.0 + }, + "ExecuteMsg": { + "oneOf": [ + { + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "program" + ], + "properties": { + "program": { + "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "Funds_for_Amount": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Amount" + } + }, + "Funds_for_Displayed_for_uint128": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Displayed_for_uint128" + } + }, + "Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount": { + "description": "Base XCVM instructions. This set will remain as small as possible, expressiveness must come on `top` of the base instructions.", + "oneOf": [ + { + "description": "Transfer some [`Assets`] from the current program to the [`to`] account.", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "assets", + "to" + ], + "properties": { + "assets": { + "$ref": "#/definitions/Funds_for_Amount" + }, + "to": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Arbitrary payload representing a raw call inside the current [`Network`].\n\nOn picasso, this will be a SCALE encoded dispatch call. On ethereum, an ethereum ABI encoded call. On cosmos, a raw json WasmMsg call.\n\nDepending on the network, the payload might be more structured than the base call. For most of the network in fact, we need to provide the target address along the payload, which can be encoded inside this single payload.", + "type": "object", + "required": [ + "call" + ], + "properties": { + "call": { + "type": "object", + "required": [ + "encoded" + ], + "properties": { + "encoded": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Spawn a sub-program on the target `network`.\n\nThe program will be spawned with the desired [`Assets`]. The salt is used to track the program when events are dispatched in the network.", + "type": "object", + "required": [ + "spawn" + ], + "properties": { + "spawn": { + "type": "object", + "required": [ + "assets", + "network", + "program", + "salt" + ], + "properties": { + "assets": { + "$ref": "#/definitions/Funds_for_Amount" + }, + "network": { + "$ref": "#/definitions/NetworkId" + }, + "program": { + "$ref": "#/definitions/Program_for_Array_of_Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount" + }, + "salt": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + }, + "additionalProperties": false + } + ] + }, + "NetworkId": { + "description": "Newtype for XCVM networks ID. Must be unique for each network and must never change. This ID is an opaque, arbitrary type from the XCVM protocol and no assumption must be made on how it is computed.", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "Program_for_Array_of_Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount": { + "type": "object", + "required": [ + "instructions", + "tag" + ], + "properties": { + "instructions": { + "type": "array", + "items": { + "$ref": "#/definitions/Instruction_for_NetworkId_and_Array_of_uint8_and_String_and_Funds_for_Amount" + } + }, + "tag": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } + } + } } diff --git a/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json b/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json index 44588cf2267..883a67ad66a 100644 --- a/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json +++ b/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json @@ -1,5 +1,19 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "InstantiateMsg", - "type": "object" + "type": "object", + "required": [ + "interpreter_code_id", + "registry_address" + ], + "properties": { + "interpreter_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "registry_address": { + "type": "string" + } + } } diff --git a/xcvm/cosmwasm/contracts/router/schema/query_msg.json b/xcvm/cosmwasm/contracts/router/schema/query_msg.json index f7bcb21bdc8..0f592a1af0d 100644 --- a/xcvm/cosmwasm/contracts/router/schema/query_msg.json +++ b/xcvm/cosmwasm/contracts/router/schema/query_msg.json @@ -1,20 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "QueryMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "get_asset_contract" - ], - "properties": { - "get_asset_contract": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - ] + "type": "string", + "enum": [] } diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 2bbac073a38..9b077da3f89 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -162,4 +162,91 @@ fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { } #[cfg(test)] -mod tests {} +mod tests { + use super::*; + use cosmwasm_std::{ + testing::{mock_dependencies, mock_env, mock_info, MockQuerier}, + wasm_execute, Addr, ContractResult, QuerierResult, SystemResult, + }; + use std::collections::BTreeMap; + use xcvm_core::{Amount, AssetId, Picasso, ETH, PICA}; + use xcvm_interpreter::msg::{ + ExecuteMsg as InterpreterExecuteMsg, XCVMInstruction, XCVMProgram, + }; + + const CW20_ADDR: &str = "cw20addr"; + const REGISTRY_ADDR: &str = "registryaddr"; + + #[test] + fn proper_instantiation() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg { registry_address: "addr".to_string(), interpreter_code_id: 1 }; + let info = mock_info("sender", &vec![]); + + let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(0, res.messages.len()); + + // Make sure that the storage is empty + assert_eq!( + CONFIG.load(&deps.storage).unwrap(), + Config { registry_address: Addr::unchecked("addr"), interpreter_code_id: 1 } + ); + } + + #[test] + fn execute_run() { + let mut deps = mock_dependencies(); + let mut querier = MockQuerier::default(); + //querier.update_wasm(wasm_querier); + deps.querier = querier; + + let msg = InstantiateMsg { registry_address: "addr".to_string(), interpreter_code_id: 1 }; + let info = mock_info("sender", &vec![]); + let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); + + let program = XCVMProgram { + tag: vec![], + instructions: vec![XCVMInstruction::Transfer { + to: "asset".into(), + assets: Funds::from([ + (Into::::into(PICA), Amount::absolute(1)), + (ETH.into(), Amount::absolute(2)), + ]), + }] + .into(), + }; + let interpreter_execute_msg = InterpreterExecuteMsg::Execute { program }; + + let res = execute( + deps.as_mut(), + mock_env(), + info.clone(), + ExecuteMsg::Run { + network_id: Picasso.into(), + user_id: vec![1], + interpreter_execute_msg, + funds: Funds::>::from([( + Into::::into(PICA), + Displayed(1000_u128), + )]), + }, + ) + .unwrap(); + + panic!("RES: {:?}", res); + /* + let contract = Cw20Contract(Addr::unchecked(CW20_ADDR)); + let messages = vec![ + contract + .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 1_u128.into() }) + .unwrap(), + contract + .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 2_u128.into() }) + .unwrap(), + ]; + + assert_eq!(res.messages.iter().map(|msg| msg.msg.clone()).collect::>(), messages); + */ + } +} From 728fbc149c01bcea8269d2f95ae52a541e5b66b5 Mon Sep 17 00:00:00 2001 From: aeryz Date: Thu, 1 Sep 2022 18:09:24 +0200 Subject: [PATCH 20/57] fix(cosmwasm): don't allow juno to mess our data Signed-off-by: aeryz --- .../contracts/interpreter/src/contract.rs | 11 +++++++--- .../cosmwasm/contracts/router/src/contract.rs | 22 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index dede6af39ae..cb62aa712ec 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -27,9 +27,14 @@ pub fn instantiate( let config = Config { registry_address }; CONFIG.save(deps.storage, &config)?; - Ok(Response::new() - .add_event(Event::new("xcvm.interpreter").add_attribute("action", "instantiated")) - .set_data(to_binary(&(msg.network_id.0, msg.user_id))?)) + Ok(Response::new().add_event( + Event::new("xcvm.interpreter") + .add_attribute("action", "instantiated") + .add_attribute( + "data", + to_binary(&(msg.network_id.0, msg.user_id))?.to_base64().as_str(), + ), + )) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 9b077da3f89..205710d774a 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -150,11 +150,23 @@ fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { )? }; - let router_reply: (u8, UserId) = from_binary( - &response - .data - .ok_or(StdError::not_found("no data is returned from 'xcvm_interpreter'"))?, - )?; + let router_reply = { + let interpreter_event = response + .events + .iter() + .find(|event| event.ty == "wasm-xcvm.interpreter") + .ok_or(StdError::not_found("interpreter event not found"))?; + + from_binary::<(u8, UserId)>(&Binary::from_base64( + interpreter_event + .attributes + .iter() + .find(|attr| &attr.key == "data") + .ok_or(StdError::not_found("no data is returned from 'xcvm_interpreter'"))? + .value + .as_str(), + )?)? + }; INTERPRETERS.save(deps.storage, (router_reply.0, router_reply.1), &interpreter_address)?; From 66cbb6930d85901408a4ca8c1dfb1ce91b4d6cea Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Thu, 1 Sep 2022 17:57:39 +0100 Subject: [PATCH 21/57] fmt to pass ci Signed-off-by: Dzmitry Lahoda --- code/Cargo.toml | 21 ++++++++++++++----- flake.nix | 12 +++++++---- .../contracts/asset-registry/Cargo.toml | 2 +- .../cosmwasm/contracts/interpreter/Cargo.toml | 11 +++++----- xcvm/cosmwasm/contracts/router/Cargo.toml | 10 ++++----- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/code/Cargo.toml b/code/Cargo.toml index 0d969a349f8..d7136e1af25 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -48,7 +48,7 @@ members = [ "utils/xcmp", "utils/wasm-optimizer", "xcvm/lib/*", - "xcvm/cosmwasm/contracts/*" + "xcvm/cosmwasm/contracts/*", ] [profile.release] @@ -61,15 +61,16 @@ inherits = "release" lto = true [profile.cosmwasm-contracts] -inherits = "production" -rpath = false -overflow-checks = true -opt-level = "s" debug = false debug-assertions = false +inherits = "production" +opt-level = "s" +overflow-checks = true panic = "abort" +rpath = false [patch.crates-io] +<<<<<<< HEAD sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-core = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } @@ -79,6 +80,16 @@ sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f1 sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } wasmi-validation = { git = "https://github.com/ComposableFi/wasmi", rev = "cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" } serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } +======= +serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } +sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } +sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } +sp-core = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } +sp-debug-derive = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } +sp-externalities = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } +sp-io = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } +sp-runtime = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } +>>>>>>> 1f717b826 (fmt to pass ci) [patch."https://github.com/paritytech/subxt"] subxt-codegen = { git = "https://github.com/paritytech//subxt", rev = "2fe9a1446d32b93a10804db3304ccaac65f764b8" } diff --git a/flake.nix b/flake.nix index d32aecb7332..97611631504 100644 --- a/flake.nix +++ b/flake.nix @@ -350,6 +350,7 @@ ''; docs-renders = [ mdbook plantuml graphviz pandoc ]; +<<<<<<< HEAD mkFrontendStatic = { kusamaEndpoint, picassoEndpoint, karuraEndpoint , subsquidEndpoint }: let bp = pkgs.callPackage npm-buildpackage { }; @@ -403,10 +404,12 @@ --execution=wasm ''; - mk-xcvm-contract = name: crane-nightly.buildPackage (common-attrs // { + mk-xcvm-contract = name: + crane-nightly.buildPackage (common-attrs // { pnameSuffix = name; - cargoBuildCommand = "cargo build --target wasm32-unknown-unknown --profile cosmwasm-contracts -p ${name}"; - RUSTFLAGS="-C link-arg=-s"; + cargoBuildCommand = + "cargo build --target wasm32-unknown-unknown --profile cosmwasm-contracts -p ${name}"; + RUSTFLAGS = "-C link-arg=-s"; }); subwasm = let @@ -470,7 +473,8 @@ inherit subwasm; inherit subwasm-release-body; - xcvm-contract-asset-registry = mk-xcvm-contract "xcvm-asset-registry"; + xcvm-contract-asset-registry = + mk-xcvm-contract "xcvm-asset-registry"; xcvm-contract-router = mk-xcvm-contract "xcvm-router"; xcvm-contract-interpreter = mk-xcvm-contract "xcvm-interpreter"; diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index dd9c7d82269..e86979d39d1 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -28,5 +28,5 @@ serde = { version = "1.0.137", default-features = false, features = ["derive"] } thiserror = { version = "1.0.31" } [dev-dependencies] -cw-multi-test = "0.13.2" cosmwasm-schema = "1.0.0" +cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index f8bd7ccc8a2..566412a54be 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -26,17 +26,16 @@ library = [] cosmwasm-std = "1.0.0" cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" +cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } +num = "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 = "4e175eaeffd625041bdecd251c0068a365def453" } serde_json = "1" thiserror = { version = "1.0.31" } -cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "4e175eaeffd625041bdecd251c0068a365def453" } -xcvm-core = { path = "../../../lib/core", features = ["std"] } xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } -num = "0.4" +xcvm-core = { path = "../../../lib/core", features = ["std"] } [dev-dependencies] -cw-multi-test = "0.13.2" cosmwasm-schema = "1.0.0" - +cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index 4995dc82778..94193f3c4e1 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -23,16 +23,16 @@ library = [] cosmwasm-std = { version = "1.0.0", features = ["abort"] } cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" +cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } +hex = "0.4" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } +thiserror = { version = "1.0.31" } +xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } xcvm-core = { path = "../../../lib/core", features = ["std"] } xcvm-interpreter = { path = "../interpreter", features = ["library"] } -xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } -cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } -thiserror = { version = "1.0.31" } -hex = "0.4" [dev-dependencies] -cw-multi-test = "0.13.2" cosmwasm-schema = "1.0.0" +cw-multi-test = "0.13.2" serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } From ef2450a571718dd085a5bb35b725c0562adcfa06 Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Thu, 1 Sep 2022 18:39:02 +0100 Subject: [PATCH 22/57] fixed all features fixes Signed-off-by: Dzmitry Lahoda --- xcvm/cosmwasm/contracts/asset-registry/Cargo.toml | 4 ++-- xcvm/cosmwasm/contracts/interpreter/Cargo.toml | 4 ++-- xcvm/cosmwasm/contracts/router/Cargo.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index e86979d39d1..9d5201bde48 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -14,8 +14,6 @@ exclude = [ crate-type = ["cdylib", "rlib"] [features] -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] @@ -28,5 +26,7 @@ serde = { version = "1.0.137", default-features = false, features = ["derive"] } thiserror = { version = "1.0.31" } [dev-dependencies] +# more explicit tests +cosmwasm-std = { version = "1.0.0", features = ["backtraces"] } cosmwasm-schema = "1.0.0" cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index 566412a54be..8ce8d8bcb0c 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -17,8 +17,6 @@ exclude = [ crate-type = ["cdylib", "rlib"] [features] -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] @@ -37,5 +35,7 @@ xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } xcvm-core = { path = "../../../lib/core", features = ["std"] } [dev-dependencies] +# more explicit tests +cosmwasm-std = { version = "1.0.0", features = ["backtraces"] } cosmwasm-schema = "1.0.0" cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index 94193f3c4e1..7f6df826a6a 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -14,8 +14,6 @@ exclude = [ crate-type = ["cdylib", "rlib"] [features] -# for more explicit tests, cargo test --features=backtraces -backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] @@ -33,6 +31,8 @@ xcvm-core = { path = "../../../lib/core", features = ["std"] } xcvm-interpreter = { path = "../interpreter", features = ["library"] } [dev-dependencies] +# more explicit tests +cosmwasm-std = { version = "1.0.0", features = ["backtraces", "abort"] } cosmwasm-schema = "1.0.0" cw-multi-test = "0.13.2" serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } From 4779298136000e0c8c14127fb7ca56d2676b8131 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 1 Sep 2022 19:39:21 +0200 Subject: [PATCH 23/57] feat(xcvm): distinct events --- xcvm/cosmwasm/contracts/asset-registry/src/contract.rs | 4 ++-- xcvm/cosmwasm/contracts/interpreter/src/contract.rs | 10 ++++------ xcvm/cosmwasm/contracts/router/src/contract.rs | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs index fd53fe56b03..79bc20b9126 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -18,7 +18,7 @@ pub fn instantiate( _msg: InstantiateMsg, ) -> Result { Ok(Response::default() - .add_event(Event::new("xcvm.registry").add_attribute("action", "instantiated"))) + .add_event(Event::new("xcvm.registry.instantiated"))) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -57,7 +57,7 @@ pub fn handle_set_assets( ASSETS.save(deps.storage, asset_id.parse::().unwrap(), &addr)?; } - Ok(Response::new().add_event(Event::new("xcvm.registry").add_attribute("action", "updated"))) + Ok(Response::new().add_event(Event::new("xcvm.registry.updated"))) } pub fn query_asset_contract( diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index cb62aa712ec..2098a9a10ca 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -28,8 +28,7 @@ pub fn instantiate( CONFIG.save(deps.storage, &config)?; Ok(Response::new().add_event( - Event::new("xcvm.interpreter") - .add_attribute("action", "instantiated") + Event::new("xcvm.interpreter.instantiated") .add_attribute( "data", to_binary(&(msg.network_id.0, msg.user_id))?.to_base64().as_str(), @@ -68,8 +67,7 @@ pub fn interpret_program( } Ok(response.add_event( - Event::new("xcvm.interpreter") - .add_attribute("action", "executed") + Event::new("xcvm.interpreter.executed") .add_attribute( "program", core::str::from_utf8(&program.tag).map_err(|_| ContractError::InvalidProgramTag)?, @@ -102,7 +100,7 @@ pub fn interpret_spawn( let data = SpawnEvent { network, salt, assets, program }; Ok(response.add_event( - Event::new("xcvm.interpreter").add_attribute("action", "spawn").add_attribute( + Event::new("xcvm.interpreter.spawn").add_attribute( "program", serde_json_wasm::to_string(&data).map_err(|_| ContractError::DataSerializationError)?, ), @@ -320,6 +318,6 @@ mod tests { let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) .unwrap(); - assert_eq!(res.events[0], Event::new("xcvm.interpreter").add_attribute("action", "spawn").add_attribute("program", r#"{"network":1,"salt":[],"assets":{},"program":{"tag":[],"instructions":[{"call":{"encoded":[]}}]}}"#.to_string())); + assert_eq!(res.events[0], Event::new("xcvm.interpreter.spawn").add_attribute("program", r#"{"network":1,"salt":[],"assets":{},"program":{"tag":[],"instructions":[{"call":{"encoded":[]}}]}}"#.to_string())); } } diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 205710d774a..733e9c26c77 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -154,7 +154,7 @@ fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { let interpreter_event = response .events .iter() - .find(|event| event.ty == "wasm-xcvm.interpreter") + .find(|event| event.ty == "wasm-xcvm.interpreter.instantiate") .ok_or(StdError::not_found("interpreter event not found"))?; from_binary::<(u8, UserId)>(&Binary::from_base64( From 27ee7c013a6d29dab9e154a26be726f4aff238da Mon Sep 17 00:00:00 2001 From: aeryz Date: Thu, 1 Sep 2022 19:18:29 +0200 Subject: [PATCH 24/57] chore(cosmwasm): revert router tests Signed-off-by: aeryz --- .../cosmwasm/contracts/router/src/contract.rs | 89 +------------------ 1 file changed, 1 insertion(+), 88 deletions(-) diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 733e9c26c77..52e743fed87 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -174,91 +174,4 @@ fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { } #[cfg(test)] -mod tests { - use super::*; - use cosmwasm_std::{ - testing::{mock_dependencies, mock_env, mock_info, MockQuerier}, - wasm_execute, Addr, ContractResult, QuerierResult, SystemResult, - }; - use std::collections::BTreeMap; - use xcvm_core::{Amount, AssetId, Picasso, ETH, PICA}; - use xcvm_interpreter::msg::{ - ExecuteMsg as InterpreterExecuteMsg, XCVMInstruction, XCVMProgram, - }; - - const CW20_ADDR: &str = "cw20addr"; - const REGISTRY_ADDR: &str = "registryaddr"; - - #[test] - fn proper_instantiation() { - let mut deps = mock_dependencies(); - - let msg = InstantiateMsg { registry_address: "addr".to_string(), interpreter_code_id: 1 }; - let info = mock_info("sender", &vec![]); - - let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); - assert_eq!(0, res.messages.len()); - - // Make sure that the storage is empty - assert_eq!( - CONFIG.load(&deps.storage).unwrap(), - Config { registry_address: Addr::unchecked("addr"), interpreter_code_id: 1 } - ); - } - - #[test] - fn execute_run() { - let mut deps = mock_dependencies(); - let mut querier = MockQuerier::default(); - //querier.update_wasm(wasm_querier); - deps.querier = querier; - - let msg = InstantiateMsg { registry_address: "addr".to_string(), interpreter_code_id: 1 }; - let info = mock_info("sender", &vec![]); - let _ = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap(); - - let program = XCVMProgram { - tag: vec![], - instructions: vec![XCVMInstruction::Transfer { - to: "asset".into(), - assets: Funds::from([ - (Into::::into(PICA), Amount::absolute(1)), - (ETH.into(), Amount::absolute(2)), - ]), - }] - .into(), - }; - let interpreter_execute_msg = InterpreterExecuteMsg::Execute { program }; - - let res = execute( - deps.as_mut(), - mock_env(), - info.clone(), - ExecuteMsg::Run { - network_id: Picasso.into(), - user_id: vec![1], - interpreter_execute_msg, - funds: Funds::>::from([( - Into::::into(PICA), - Displayed(1000_u128), - )]), - }, - ) - .unwrap(); - - panic!("RES: {:?}", res); - /* - let contract = Cw20Contract(Addr::unchecked(CW20_ADDR)); - let messages = vec![ - contract - .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 1_u128.into() }) - .unwrap(), - contract - .call(Cw20ExecuteMsg::Transfer { recipient: "asset".into(), amount: 2_u128.into() }) - .unwrap(), - ]; - - assert_eq!(res.messages.iter().map(|msg| msg.msg.clone()).collect::>(), messages); - */ - } -} +mod tests {} From 35d0a85f30fe1afb3d19ca13e2a0e83793e0848a Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 1 Sep 2022 20:18:37 +0200 Subject: [PATCH 25/57] feat(xcvm): missing event --- xcvm/cosmwasm/contracts/router/src/contract.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 52e743fed87..c3f930279bd 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -154,7 +154,7 @@ fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { let interpreter_event = response .events .iter() - .find(|event| event.ty == "wasm-xcvm.interpreter.instantiate") + .find(|event| event.ty == "wasm-xcvm.interpreter.instantiated") .ok_or(StdError::not_found("interpreter event not found"))?; from_binary::<(u8, UserId)>(&Binary::from_base64( From 6372597c9897d76c52e65fe5013f374443b6da8d Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Thu, 1 Sep 2022 21:26:38 +0200 Subject: [PATCH 26/57] feat(xcvm): missing origin in spawn --- .../contracts/interpreter/src/contract.rs | 48 ++++++++++++------- .../contracts/interpreter/src/state.rs | 4 ++ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 2098a9a10ca..ca51465e3f8 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -24,15 +24,15 @@ pub fn instantiate( msg: InstantiateMsg, ) -> Result { let registry_address = deps.api.addr_validate(&msg.registry_address)?; - let config = Config { registry_address }; + let config = + Config { registry_address, network_id: msg.network_id, user_id: msg.user_id.clone() }; CONFIG.save(deps.storage, &config)?; Ok(Response::new().add_event( - Event::new("xcvm.interpreter.instantiated") - .add_attribute( - "data", - to_binary(&(msg.network_id.0, msg.user_id))?.to_base64().as_str(), - ), + Event::new("xcvm.interpreter.instantiated").add_attribute( + "data", + to_binary(&(msg.network_id.0, msg.user_id))?.to_base64().as_str(), + ), )) } @@ -60,19 +60,16 @@ pub fn interpret_program( response = match instruction { Instruction::Call { encoded } => interpret_call(encoded, response), Instruction::Spawn { network, salt, assets, program } => - interpret_spawn(network, salt, assets, program, response), + interpret_spawn(&deps, network, salt, assets, program, response), Instruction::Transfer { to, assets } => interpret_transfer(&mut deps, to, assets, response), }?; } - Ok(response.add_event( - Event::new("xcvm.interpreter.executed") - .add_attribute( - "program", - core::str::from_utf8(&program.tag).map_err(|_| ContractError::InvalidProgramTag)?, - ), - )) + Ok(response.add_event(Event::new("xcvm.interpreter.executed").add_attribute( + "program", + core::str::from_utf8(&program.tag).map_err(|_| ContractError::InvalidProgramTag)?, + ))) } pub fn interpret_call(encoded: Vec, response: Response) -> Result { @@ -83,6 +80,7 @@ pub fn interpret_call(encoded: Vec, response: Response) -> Result, assets: Funds, @@ -99,11 +97,25 @@ pub fn interpret_spawn( let data = SpawnEvent { network, salt, assets, program }; + let config = CONFIG.load(deps.storage)?; + Ok(response.add_event( - Event::new("xcvm.interpreter.spawn").add_attribute( - "program", - serde_json_wasm::to_string(&data).map_err(|_| ContractError::DataSerializationError)?, - ), + Event::new("xcvm.interpreter.spawn") + .add_attribute( + "origin_network_id", + serde_json_wasm::to_string(&config.network_id.0) + .map_err(|_| ContractError::DataSerializationError)?, + ) + .add_attribute( + "origin_user_id", + serde_json_wasm::to_string(&config.user_id) + .map_err(|_| ContractError::DataSerializationError)?, + ) + .add_attribute( + "program", + serde_json_wasm::to_string(&data) + .map_err(|_| ContractError::DataSerializationError)?, + ), )) } diff --git a/xcvm/cosmwasm/contracts/interpreter/src/state.rs b/xcvm/cosmwasm/contracts/interpreter/src/state.rs index 315fdcf93a1..ea1e24a8edf 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/state.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/state.rs @@ -1,12 +1,16 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use crate::msg::UserId; use cosmwasm_std::Addr; use cw_storage_plus::Item; +use xcvm_core::NetworkId; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct Config { pub registry_address: Addr, + pub network_id: NetworkId, + pub user_id: UserId, } pub const CONFIG: Item = Item::new("config"); From 40383301f2adc049d42829a7540bb6b32f7bd94d Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 2 Sep 2022 09:39:28 +0200 Subject: [PATCH 27/57] doc(cosmwasm): interpreter events Signed-off-by: aeryz --- xcvm/cosmwasm/contracts/interpreter/README.md | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/README.md b/xcvm/cosmwasm/contracts/interpreter/README.md index 3867548a6f1..395e5ca8b06 100644 --- a/xcvm/cosmwasm/contracts/interpreter/README.md +++ b/xcvm/cosmwasm/contracts/interpreter/README.md @@ -1,7 +1,70 @@ # XCVM Interpreter +## Events + +Note that these events will be yield from the router in production. + +### Instantiate contract +```json +{ + "type": "wasm-xcvm.interpreter.instantiated", + "attributes": [ + { + "key": "data", + "value": "{BASE64_ENCODED_DATA}" + } + ] +} +``` + +- **BASE64_ENCODED_DATA**: base64 encoded `(network_id, user_id)` pair. + +### Execute contract +```json +{ + "type": "wasm-xcvm.interpreter.executed", + "attributes": [ + { + "key": "program", + "value": "{XCVM_PROGRAM_TAG}" + } + ] +} +``` + +- **XCVM_PROGRAM_TAG**: Tag of the executed XCVM program + +### Execute spawn instruction + +```json +{ + "type": "wasm-xcvm.interpreter.spawn", + "attributes": [ + { + "key": "origin_network_id", + "value": "{ORIGIN_NETWORK_ID}" + }, + { + "key": "origin_user_id", + "value": "{ORIGIN_USER_ID}" + }, + { + "key": "program", + "value": "{XCVM_PROGRAM}" + } + ] +} +``` + +- **ORIGIN_NETWORK_ID**: Network id of the origin. Eg. Picasso, Ethereum +- **ORIGIN_USER_ID**: Chain agnostic user identifier of the origin. Eg. contract_address in Juno +- **XCVM_PROGRAM**: Json-encoded xcvm program. Note that although it is json-encoded, it is put as a string because of the restrictions of cosmwasm. + +## Usage + The XCVM interpreter contract interprets the XCVM programs. Available instructions are: + ### Call Which is used to call a contract. See that the encoded payload must be in a format: ``` @@ -15,7 +78,7 @@ Which is used to call a contract. See that the encoded payload must be in a form Queries `asset-registry`, gets the contract address and then executes that contract to do the transfer. ### Spawn -Emits `spawn` even with the given parameters. +Emits `spawn` event with the given parameters. ## Compile From 27e5ac9969d8e214f252da3d6041d092b37b3364 Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Fri, 2 Sep 2022 11:36:01 +0100 Subject: [PATCH 28/57] removed non working feature in cosmwasm tests Signed-off-by: Dzmitry Lahoda --- xcvm/cosmwasm/contracts/asset-registry/Cargo.toml | 3 --- xcvm/cosmwasm/contracts/interpreter/Cargo.toml | 3 --- xcvm/cosmwasm/contracts/router/Cargo.toml | 3 --- 3 files changed, 9 deletions(-) diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index 9d5201bde48..2cd44ade840 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -19,14 +19,11 @@ library = [] [dependencies] cosmwasm-std = "1.0.0" -cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } thiserror = { version = "1.0.31" } [dev-dependencies] -# more explicit tests -cosmwasm-std = { version = "1.0.0", features = ["backtraces"] } cosmwasm-schema = "1.0.0" cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index 8ce8d8bcb0c..2f904bed99d 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -22,7 +22,6 @@ library = [] [dependencies] cosmwasm-std = "1.0.0" -cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } num = "0.4" @@ -35,7 +34,5 @@ xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } xcvm-core = { path = "../../../lib/core", features = ["std"] } [dev-dependencies] -# more explicit tests -cosmwasm-std = { version = "1.0.0", features = ["backtraces"] } cosmwasm-schema = "1.0.0" cw-multi-test = "0.13.2" diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index 7f6df826a6a..001d3b9c416 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -19,7 +19,6 @@ library = [] [dependencies] cosmwasm-std = { version = "1.0.0", features = ["abort"] } -cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } hex = "0.4" @@ -31,8 +30,6 @@ xcvm-core = { path = "../../../lib/core", features = ["std"] } xcvm-interpreter = { path = "../interpreter", features = ["library"] } [dev-dependencies] -# more explicit tests -cosmwasm-std = { version = "1.0.0", features = ["backtraces", "abort"] } cosmwasm-schema = "1.0.0" cw-multi-test = "0.13.2" serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } From e27a66eac4e71250ec457f57933fb0c8794bd714 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 2 Sep 2022 15:17:29 +0200 Subject: [PATCH 29/57] chore(cosmwasm): router tests Signed-off-by: aeryz --- .../cosmwasm/contracts/router/src/contract.rs | 112 +++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index c3f930279bd..06611c10c3d 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -174,4 +174,114 @@ fn handle_instantiate_reply(deps: DepsMut, msg: Reply) -> StdResult { } #[cfg(test)] -mod tests {} +mod tests { + use super::*; + use cosmwasm_std::{ + testing::{mock_dependencies, mock_env, mock_info, MockQuerier, MOCK_CONTRACT_ADDR}, + Addr, ContractResult, QuerierResult, SystemResult, + }; + use xcvm_core::{Amount, AssetId, Picasso, ETH, PICA}; + use xcvm_interpreter::msg::{XCVMInstruction, XCVMProgram}; + + const CW20_ADDR: &str = "cw20addr"; + const REGISTRY_ADDR: &str = "registryaddr"; + + #[test] + fn proper_instantiation() { + let mut deps = mock_dependencies(); + + let msg = InstantiateMsg { registry_address: "addr".to_string(), interpreter_code_id: 1 }; + let info = mock_info("sender", &vec![]); + + let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(0, res.messages.len()); + + // Make sure that the storage is empty + assert_eq!( + CONFIG.load(&deps.storage).unwrap(), + Config { registry_address: Addr::unchecked("addr"), interpreter_code_id: 1 } + ); + } + + fn wasm_querier(query: &WasmQuery) -> QuerierResult { + match query { + WasmQuery::Smart { contract_addr, .. } if contract_addr.as_str() == CW20_ADDR => + SystemResult::Ok(ContractResult::Ok( + to_binary(&cw20::BalanceResponse { balance: 100000_u128.into() }).unwrap(), + )), + WasmQuery::Smart { contract_addr, .. } if contract_addr.as_str() == REGISTRY_ADDR => + SystemResult::Ok(ContractResult::Ok( + to_binary(&xcvm_asset_registry::msg::GetAssetContractResponse { + addr: Addr::unchecked(CW20_ADDR), + }) + .unwrap(), + )) + .into(), + _ => panic!("Unhandled query"), + } + } + + #[test] + fn execute_run_phase1() { + let mut deps = mock_dependencies(); + let mut querier = MockQuerier::default(); + querier.update_wasm(wasm_querier); + deps.querier = querier; + + let info = mock_info("sender", &vec![]); + let _ = instantiate( + deps.as_mut(), + mock_env(), + info.clone(), + InstantiateMsg { registry_address: REGISTRY_ADDR.into(), interpreter_code_id: 1 }, + ) + .unwrap(); + + let program = XCVMProgram { + tag: vec![], + instructions: vec![XCVMInstruction::Transfer { + to: "asset".into(), + assets: Funds::from([ + (Into::::into(PICA), Amount::absolute(1)), + (ETH.into(), Amount::absolute(2)), + ]), + }] + .into(), + }; + let interpreter_execute_msg = InterpreterExecuteMsg::Execute { program }; + + let funds = + Funds::>::from([(Into::::into(PICA), Displayed(1000_u128))]); + + let run_msg = ExecuteMsg::Run { + network_id: Picasso.into(), + user_id: vec![1], + interpreter_execute_msg, + funds: funds.clone(), + }; + + let res = execute(deps.as_mut(), mock_env(), info.clone(), run_msg.clone()).unwrap(); + + let instantiate_msg = WasmMsg::Instantiate { + admin: Some(MOCK_CONTRACT_ADDR.to_string()), + code_id: 1, + msg: to_binary(&InterpreterInstantiateMsg { + registry_address: REGISTRY_ADDR.to_string(), + network_id: Picasso.into(), + user_id: vec![1], + }) + .unwrap(), + funds: vec![], + label: "xcvm-interpreter-1-01".to_string(), + }; + + let execute_msg = WasmMsg::Execute { + contract_addr: MOCK_CONTRACT_ADDR.to_string(), + msg: to_binary(&run_msg).unwrap(), + funds: vec![], + }; + + assert_eq!(res.messages[0].msg, instantiate_msg.into()); + assert_eq!(res.messages[1].msg, execute_msg.into()); + } +} From ab67af74b6464da1b703e146b3301b9e16f622c7 Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Sun, 4 Sep 2022 20:37:20 +0100 Subject: [PATCH 30/57] removed mars (#1560) * removed not used nixes Signed-off-by: Dzmitry Lahoda * clean up Signed-off-by: Dzmitry Lahoda Signed-off-by: Dzmitry Lahoda --- .nix/composable-bin.nix | 27 ----------------------- flake.nix | 8 ++----- xcvm/cosmwasm/contracts/router/Cargo.toml | 1 + 3 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 .nix/composable-bin.nix diff --git a/.nix/composable-bin.nix b/.nix/composable-bin.nix deleted file mode 100644 index 07d263fe6aa..00000000000 --- a/.nix/composable-bin.nix +++ /dev/null @@ -1,27 +0,0 @@ -# TODO: move to `parachains` folder -{ pkgs, composable }: -pkgs.stdenv.mkDerivation rec { - name = "composable-${composable.name}-${composable.version}"; - version = composable.version; - src = pkgs.fetchurl { - # TODO: remove - use cachix for builds - or pure buildsfrom repo - url = - "https://storage.googleapis.com/composable-binaries/community-releases/${composable.name}/${name}.tar.gz"; - sha256 = composable.hash; - }; - nativeBuildInputs = [ pkgs.autoPatchelfHook ]; - autoPatchelfIgnoreMissingDeps = [ "*" ]; - buildInputs = [ pkgs.stdenv.cc.cc pkgs.zlib pkgs.rocksdb ]; - installPhase = '' - tar -xvf $src - mkdir -p $out/bin - mv release/composable $out/bin - mv doc $out - ''; - ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib"; - LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath [ - pkgs.stdenv.cc.cc.lib - pkgs.llvmPackages.libclang.lib - pkgs.rocksdb - ]; -} diff --git a/flake.nix b/flake.nix index 97611631504..8012395680c 100644 --- a/flake.nix +++ b/flake.nix @@ -943,12 +943,8 @@ ''; }; - junod = pkgs.callPackage ./code/xcvm/cosmos/junod.nix { }; - gex = pkgs.callPackage ./code/xcvm/cosmos/gex.nix { }; - wasmswap = pkgs.callPackage ./code/xcvm/cosmos/wasmswap.nix { - crane = crane-nightly; - }; - + junod = pkgs.callPackage ./xcvm/cosmos/junod.nix { }; + gex = pkgs.callPackage ./xcvm/cosmos/gex.nix { }; default = packages.composable-node; }; diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index 001d3b9c416..59fd67ffebb 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -31,5 +31,6 @@ xcvm-interpreter = { path = "../interpreter", features = ["library"] } [dev-dependencies] cosmwasm-schema = "1.0.0" +cosmwasm-std = { version = "1.0.0", features = ["backtraces", "abort"] } cw-multi-test = "0.13.2" serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } From 7f170d62ac35ddd80eb96eccd4b5424342e8d4f1 Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Sun, 4 Sep 2022 23:04:03 +0100 Subject: [PATCH 31/57] ugly rustcosmos Signed-off-by: Dzmitry Lahoda --- flake.nix | 13 +- scripts/style.sh | 123 ++++++++++++++++++ .../contracts/asset-registry/Cargo.toml | 3 +- .../contracts/asset-registry/src/contract.rs | 3 +- .../cosmwasm/contracts/interpreter/Cargo.toml | 3 +- xcvm/cosmwasm/contracts/router/Cargo.toml | 2 +- 6 files changed, 140 insertions(+), 7 deletions(-) create mode 100755 scripts/style.sh diff --git a/flake.nix b/flake.nix index 8012395680c..c3cfd9d5a17 100644 --- a/flake.nix +++ b/flake.nix @@ -860,8 +860,17 @@ buildInputs = [ cargo-udeps expat freetype fontconfig openssl ]; cargoArtifacts = common-deps-nightly; cargoBuildCommand = "cargo udeps"; - cargoExtraArgs = - "--workspace --exclude local-integration-tests --all-features"; + # NOTE: + # we are bad here, rust does not allows features per tests/targets/devs + # https://github.com/rust-lang/cargo/issues/2911 + # neither cosmos provides fake implementation for feature when it is enabled + # so there are 2 solutions: + # 1. ignore (like here) + # 2. move tests into separate crate (and ignore it) + cargoExtraArgs = '' + --workspace --all-features \ + --exclude local-integration-tests xcvm-* + ''; }); benchmarks-check = crane-nightly.cargoBuild (common-attrs // { diff --git a/scripts/style.sh b/scripts/style.sh new file mode 100755 index 00000000000..abceef6f36e --- /dev/null +++ b/scripts/style.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +# TODO: remove version as must run under just +nightly after nix env applied +NIGHTLY_VERSION="2022-04-18" + +usage() { + cat </dev/null +fi + +for arg in "$@"; do + case $arg in + "--help" | "-h") + usage + exit 0 + ;; + "--check" | "-c") + check="check" + ;; + "--verbose" | "-v") + verbose="verbose" + ;; + *) + echo "Unknown option '$arg'" + usage + exit 1 + ;; + esac +done + +cargo_fmt +taplo_fmt +prettier_fmt diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index 2cd44ade840..53bccea030e 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -15,10 +15,11 @@ crate-type = ["cdylib", "rlib"] [features] # use library feature to disable all instantiate/execute/query exports +backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-std = "1.0.0" +cosmwasm-std = { version = "1.0.0" } cw-storage-plus = "0.13.2" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs index 79bc20b9126..093b31cbefe 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -17,8 +17,7 @@ pub fn instantiate( _info: MessageInfo, _msg: InstantiateMsg, ) -> Result { - Ok(Response::default() - .add_event(Event::new("xcvm.registry.instantiated"))) + Ok(Response::default().add_event(Event::new("xcvm.registry.instantiated"))) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index 2f904bed99d..31d112e1eef 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -18,10 +18,11 @@ crate-type = ["cdylib", "rlib"] [features] # use library feature to disable all instantiate/execute/query exports +backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-std = "1.0.0" +cosmwasm-std = { version = "1.0.0" } cw-storage-plus = "0.13.2" cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } num = "0.4" diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index 59fd67ffebb..b2efa3b682d 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -15,6 +15,7 @@ crate-type = ["cdylib", "rlib"] [features] # use library feature to disable all instantiate/execute/query exports +backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] @@ -31,6 +32,5 @@ xcvm-interpreter = { path = "../interpreter", features = ["library"] } [dev-dependencies] cosmwasm-schema = "1.0.0" -cosmwasm-std = { version = "1.0.0", features = ["backtraces", "abort"] } cw-multi-test = "0.13.2" serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } From 9051b928cfd5988a925e352090ec32e12407741d Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Sun, 4 Sep 2022 23:26:30 +0100 Subject: [PATCH 32/57] fix tests Signed-off-by: Dzmitry Lahoda --- xcvm/cosmwasm/contracts/interpreter/src/contract.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index ca51465e3f8..7f6fc8dc7a8 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -197,7 +197,11 @@ mod tests { // Make sure that the storage is empty assert_eq!( CONFIG.load(&deps.storage).unwrap(), - Config { registry_address: Addr::unchecked("addr") } + Config { + registry_address: Addr::unchecked("addr"), + network_id: Picasso.into(), + user_id: <_>::default(), + } ); } @@ -298,6 +302,7 @@ mod tests { } #[test] + #[ignore = "please fix it by stuctural comparison"] fn execute_spawn() { let mut deps = mock_dependencies(); From 96a8e478122a0bd03fb15cfb43dffa967914c09b Mon Sep 17 00:00:00 2001 From: aeryz Date: Mon, 5 Sep 2022 09:44:38 +0200 Subject: [PATCH 33/57] fix(cosmwasm): tests Signed-off-by: aeryz --- xcvm/cosmwasm/contracts/asset-registry/src/contract.rs | 8 ++------ xcvm/cosmwasm/contracts/interpreter/src/contract.rs | 5 ++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs index 093b31cbefe..9f13507c8c9 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs +++ b/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs @@ -73,7 +73,7 @@ mod tests { use cosmwasm_std::{ from_binary, testing::{mock_dependencies, mock_env, mock_info}, - Addr, Attribute, Order, Storage, + Addr, Order, Storage, }; #[test] @@ -106,11 +106,7 @@ mod tests { let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::SetAssets(assets.clone())) .unwrap(); - assert!(res - .attributes - .iter() - .find(|&attr| attr == Attribute::new("action", "update_assets")) - .is_some()); + assert_eq!(res.attributes.len(), 0); assert_eq!(ASSETS.load(&deps.storage, 1).unwrap(), Addr::unchecked("addr1")); assert_eq!(ASSETS.load(&deps.storage, 2).unwrap(), Addr::unchecked("addr2")); diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 7f6fc8dc7a8..b33a7c512a8 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -200,7 +200,7 @@ mod tests { Config { registry_address: Addr::unchecked("addr"), network_id: Picasso.into(), - user_id: <_>::default(), + user_id: vec![] } ); } @@ -302,7 +302,6 @@ mod tests { } #[test] - #[ignore = "please fix it by stuctural comparison"] fn execute_spawn() { let mut deps = mock_dependencies(); @@ -335,6 +334,6 @@ mod tests { let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) .unwrap(); - assert_eq!(res.events[0], Event::new("xcvm.interpreter.spawn").add_attribute("program", r#"{"network":1,"salt":[],"assets":{},"program":{"tag":[],"instructions":[{"call":{"encoded":[]}}]}}"#.to_string())); + assert_eq!(res.events[0], Event::new("xcvm.interpreter.spawn").add_attribute("origin_network_id", "1").add_attribute("origin_user_id", "[]").add_attribute("program", r#"{"network":1,"salt":[],"assets":{},"program":{"tag":[],"instructions":[{"call":{"encoded":[]}}]}}"#.to_string())); } } From b9c494e56dcad831ba0270d1438708a01bf558c5 Mon Sep 17 00:00:00 2001 From: aeryz Date: Mon, 5 Sep 2022 10:22:48 +0200 Subject: [PATCH 34/57] chore(cosmwasm): complete router execute tests Signed-off-by: aeryz --- .../cosmwasm/contracts/router/src/contract.rs | 83 ++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/xcvm/cosmwasm/contracts/router/src/contract.rs index 06611c10c3d..64124381b82 100644 --- a/xcvm/cosmwasm/contracts/router/src/contract.rs +++ b/xcvm/cosmwasm/contracts/router/src/contract.rs @@ -178,7 +178,7 @@ mod tests { use super::*; use cosmwasm_std::{ testing::{mock_dependencies, mock_env, mock_info, MockQuerier, MOCK_CONTRACT_ADDR}, - Addr, ContractResult, QuerierResult, SystemResult, + wasm_execute, Addr, ContractResult, QuerierResult, SystemResult, }; use xcvm_core::{Amount, AssetId, Picasso, ETH, PICA}; use xcvm_interpreter::msg::{XCVMInstruction, XCVMProgram}; @@ -284,4 +284,85 @@ mod tests { assert_eq!(res.messages[0].msg, instantiate_msg.into()); assert_eq!(res.messages[1].msg, execute_msg.into()); } + + #[test] + fn execute_run_phase2() { + let mut deps = mock_dependencies(); + let mut querier = MockQuerier::default(); + querier.update_wasm(wasm_querier); + deps.querier = querier; + + let info = mock_info("sender", &vec![]); + let _ = instantiate( + deps.as_mut(), + mock_env(), + info.clone(), + InstantiateMsg { registry_address: REGISTRY_ADDR.into(), interpreter_code_id: 1 }, + ) + .unwrap(); + + INTERPRETERS + .save( + &mut deps.storage, + (Into::::into(Picasso).0, vec![]), + &Addr::unchecked("interpreter"), + ) + .unwrap(); + + let program = XCVMProgram { + tag: vec![], + instructions: vec![XCVMInstruction::Transfer { + to: "asset".into(), + assets: Funds::from([ + (Into::::into(PICA), Amount::absolute(1)), + (ETH.into(), Amount::absolute(2)), + ]), + }] + .into(), + }; + let interpreter_execute_msg = InterpreterExecuteMsg::Execute { program }; + + let funds = Funds::>::from([ + (Into::::into(PICA), Displayed(1000_u128)), + (Into::::into(ETH), Displayed(2000_u128)), + ]); + + let run_msg = ExecuteMsg::Run { + network_id: Picasso.into(), + user_id: vec![], + interpreter_execute_msg: interpreter_execute_msg.clone(), + funds: funds.clone(), + }; + + let res = execute(deps.as_mut(), mock_env(), info.clone(), run_msg.clone()).unwrap(); + + let cw20_contract = Cw20Contract(Addr::unchecked(CW20_ADDR)); + let messages = vec![ + cw20_contract + .call(Cw20ExecuteMsg::Transfer { + recipient: "interpreter".into(), + amount: 1000_u128.into(), + }) + .unwrap(), + cw20_contract + .call(Cw20ExecuteMsg::Transfer { + recipient: "interpreter".into(), + amount: 2000_u128.into(), + }) + .unwrap(), + wasm_execute("interpreter", &interpreter_execute_msg, vec![]).unwrap().into(), + ]; + + messages.into_iter().enumerate().for_each(|(i, msg)| { + assert_eq!(res.messages[i].msg, msg); + }) + + /* + let execute_msg = WasmMsg::Execute { + contract_addr: MOCK_CONTRACT_ADDR.to_string(), + msg: to_binary(&run_msg).unwrap(), + funds: vec![], + }; + */ + } } From 0f85fd3258b57015d50ea5814903add09a5f9908 Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Mon, 5 Sep 2022 20:05:05 +0100 Subject: [PATCH 35/57] consistent prefix for raw calls and non need to_string in test Signed-off-by: Dzmitry Lahoda --- code/xcvm/lib/core/src/lib.rs | 9 +++++---- xcvm/cosmwasm/contracts/interpreter/src/contract.rs | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/xcvm/lib/core/src/lib.rs b/code/xcvm/lib/core/src/lib.rs index c809948391d..409beac4dc0 100644 --- a/code/xcvm/lib/core/src/lib.rs +++ b/code/xcvm/lib/core/src/lib.rs @@ -13,6 +13,7 @@ pub use crate::{asset::*, instruction::*, network::*, program::*, protocol::*}; use alloc::{collections::VecDeque, vec::Vec}; use core::marker::PhantomData; +/// Strongly typed network builder originating on `CurrentNetwork` network. #[derive(Clone)] pub struct ProgramBuilder { pub tag: Vec, @@ -72,7 +73,7 @@ where } #[inline] - pub fn call(self, protocol: T) -> Result + pub fn call_raw_protocol(self, protocol: T) -> Result where T: Protocol, { @@ -142,15 +143,15 @@ mod tests { fn can_build() { let program = || -> Result<_, ProgramBuildError> { Ok(ProgramBuilder::::new("Main program".as_bytes().to_vec()) - .call(DummyProtocol1)? + .call_raw_protocol(DummyProtocol1)? .spawn::( Default::default(), Default::default(), Funds::empty(), |child| { Ok(child - .call(DummyProtocol2)? - .call(DummyProtocol1)? + .call_raw_protocol(DummyProtocol2)? + .call_raw_protocol(DummyProtocol1)? .transfer((), Funds::from([(PICA::ID, u128::MAX)]))) }, )? diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index b33a7c512a8..5dff108ca27 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -289,11 +289,11 @@ mod tests { let cosmos_msg: CosmosMsg = wasm_execute("1234", &"hello world".to_string(), vec![]).unwrap().into(); - let msg = serde_json_wasm::to_string(&cosmos_msg).unwrap(); + let program = XCVMProgram { tag: vec![], - instructions: vec![XCVMInstruction::Call { encoded: msg.as_bytes().into() }].into(), + instructions: vec![XCVMInstruction::Call { encoded: serde_json_wasm::to_vec(&cosmos_msg).unwrap().into() }].into(), }; let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) From 543e2982f3bf949eed55587f29a62cfd0453d51e Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Tue, 6 Sep 2022 17:03:16 +0100 Subject: [PATCH 36/57] revereted --- .nix/composable-bin.nix | 27 +++++++++++++++++++ code/xcvm/lib/core/src/lib.rs | 8 +++--- flake.nix | 16 ++++------- scripts/style.sh | 1 - .../contracts/asset-registry/Cargo.toml | 1 + .../cosmwasm/contracts/interpreter/Cargo.toml | 1 + .../contracts/interpreter/src/contract.rs | 10 +++---- xcvm/cosmwasm/contracts/router/Cargo.toml | 1 + 8 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 .nix/composable-bin.nix diff --git a/.nix/composable-bin.nix b/.nix/composable-bin.nix new file mode 100644 index 00000000000..07d263fe6aa --- /dev/null +++ b/.nix/composable-bin.nix @@ -0,0 +1,27 @@ +# TODO: move to `parachains` folder +{ pkgs, composable }: +pkgs.stdenv.mkDerivation rec { + name = "composable-${composable.name}-${composable.version}"; + version = composable.version; + src = pkgs.fetchurl { + # TODO: remove - use cachix for builds - or pure buildsfrom repo + url = + "https://storage.googleapis.com/composable-binaries/community-releases/${composable.name}/${name}.tar.gz"; + sha256 = composable.hash; + }; + nativeBuildInputs = [ pkgs.autoPatchelfHook ]; + autoPatchelfIgnoreMissingDeps = [ "*" ]; + buildInputs = [ pkgs.stdenv.cc.cc pkgs.zlib pkgs.rocksdb ]; + installPhase = '' + tar -xvf $src + mkdir -p $out/bin + mv release/composable $out/bin + mv doc $out + ''; + ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib"; + LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath [ + pkgs.stdenv.cc.cc.lib + pkgs.llvmPackages.libclang.lib + pkgs.rocksdb + ]; +} diff --git a/code/xcvm/lib/core/src/lib.rs b/code/xcvm/lib/core/src/lib.rs index 409beac4dc0..028776fb074 100644 --- a/code/xcvm/lib/core/src/lib.rs +++ b/code/xcvm/lib/core/src/lib.rs @@ -73,7 +73,7 @@ where } #[inline] - pub fn call_raw_protocol(self, protocol: T) -> Result + pub fn call(self, protocol: T) -> Result where T: Protocol, { @@ -143,15 +143,15 @@ mod tests { fn can_build() { let program = || -> Result<_, ProgramBuildError> { Ok(ProgramBuilder::::new("Main program".as_bytes().to_vec()) - .call_raw_protocol(DummyProtocol1)? + .call(DummyProtocol1)? .spawn::( Default::default(), Default::default(), Funds::empty(), |child| { Ok(child - .call_raw_protocol(DummyProtocol2)? - .call_raw_protocol(DummyProtocol1)? + .call(DummyProtocol2)? + .call(DummyProtocol1)? .transfer((), Funds::from([(PICA::ID, u128::MAX)]))) }, )? diff --git a/flake.nix b/flake.nix index c3cfd9d5a17..8d883ee6aa8 100644 --- a/flake.nix +++ b/flake.nix @@ -860,17 +860,8 @@ buildInputs = [ cargo-udeps expat freetype fontconfig openssl ]; cargoArtifacts = common-deps-nightly; cargoBuildCommand = "cargo udeps"; - # NOTE: - # we are bad here, rust does not allows features per tests/targets/devs - # https://github.com/rust-lang/cargo/issues/2911 - # neither cosmos provides fake implementation for feature when it is enabled - # so there are 2 solutions: - # 1. ignore (like here) - # 2. move tests into separate crate (and ignore it) - cargoExtraArgs = '' - --workspace --all-features \ - --exclude local-integration-tests xcvm-* - ''; + cargoExtraArgs = + "--workspace --exclude local-integration-tests --all-features"; }); benchmarks-check = crane-nightly.cargoBuild (common-attrs // { @@ -954,6 +945,9 @@ junod = pkgs.callPackage ./xcvm/cosmos/junod.nix { }; gex = pkgs.callPackage ./xcvm/cosmos/gex.nix { }; + wasmswap = pkgs.callPackage ./xcvm/cosmos/wasmswap.nix { + crane = crane-nightly; + }; default = packages.composable-node; }; diff --git a/scripts/style.sh b/scripts/style.sh index abceef6f36e..f02657f6090 100755 --- a/scripts/style.sh +++ b/scripts/style.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -# TODO: remove version as must run under just +nightly after nix env applied NIGHTLY_VERSION="2022-04-18" usage() { diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index 53bccea030e..1f97d6e68db 100644 --- a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -19,6 +19,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] +cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0" } cw-storage-plus = "0.13.2" schemars = "0.8.8" diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index 31d112e1eef..4d618645c8d 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -22,6 +22,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] +cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0" } cw-storage-plus = "0.13.2" cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 5dff108ca27..80bad7c9201 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -197,11 +197,7 @@ mod tests { // Make sure that the storage is empty assert_eq!( CONFIG.load(&deps.storage).unwrap(), - Config { - registry_address: Addr::unchecked("addr"), - network_id: Picasso.into(), - user_id: vec![] - } + Config { registry_address: Addr::unchecked("addr") } ); } @@ -289,11 +285,11 @@ mod tests { let cosmos_msg: CosmosMsg = wasm_execute("1234", &"hello world".to_string(), vec![]).unwrap().into(); - + let msg = serde_json_wasm::to_string(&cosmos_msg).unwrap(); let program = XCVMProgram { tag: vec![], - instructions: vec![XCVMInstruction::Call { encoded: serde_json_wasm::to_vec(&cosmos_msg).unwrap().into() }].into(), + instructions: vec![XCVMInstruction::Call { encoded: msg.as_bytes().into() }].into(), }; let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/xcvm/cosmwasm/contracts/router/Cargo.toml index b2efa3b682d..37db38b7b90 100644 --- a/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -19,6 +19,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] +cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0", features = ["abort"] } cw-storage-plus = "0.13.2" cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } From 244f934f65556e7bf1423fd3e1911b2fde76ca2b Mon Sep 17 00:00:00 2001 From: cor Date: Thu, 15 Sep 2022 20:46:28 +0200 Subject: [PATCH 37/57] feat: add bob genesis account --- .nix/services/junod.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nix/services/junod.nix b/.nix/services/junod.nix index 86b14addb93..005a4714453 100644 --- a/.nix/services/junod.nix +++ b/.nix/services/junod.nix @@ -12,7 +12,7 @@ "sh" "-c" '' - ./setup_junod.sh juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y + ./setup_junod.sh juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y juno16y8au6s5lc8mmf6pjm8m735sn7sdkennh7x0e6 mkdir -p /root/log junod start --rpc.laddr tcp://0.0.0.0:26657 --grpc.address 0.0.0.0:9099 --trace '' From a2f404affda5edf93f654ce16c85e8c26cd62575 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 16 Sep 2022 10:06:05 +0200 Subject: [PATCH 38/57] fix(cosmwasm): interpreter checks its own balance Signed-off-by: aeryz --- xcvm/cosmwasm/contracts/interpreter/src/contract.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 80bad7c9201..9d9a459fcef 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -50,7 +50,7 @@ pub fn execute( pub fn interpret_program( mut deps: DepsMut, - _env: Env, + env: Env, _info: MessageInfo, program: XCVMProgram, ) -> Result { @@ -62,7 +62,7 @@ pub fn interpret_program( Instruction::Spawn { network, salt, assets, program } => interpret_spawn(&deps, network, salt, assets, program, response), Instruction::Transfer { to, assets } => - interpret_transfer(&mut deps, to, assets, response), + interpret_transfer(&mut deps, &env, to, assets, response), }?; } @@ -121,6 +121,7 @@ pub fn interpret_spawn( pub fn interpret_transfer( deps: &mut DepsMut, + env: &Env, to: String, assets: Funds, mut response: Response, @@ -145,7 +146,9 @@ pub fn interpret_transfer( let response = deps.querier.query::(&QueryRequest::Wasm(WasmQuery::Smart { contract_addr: cw20_address.addr.clone().into_string(), - msg: to_binary(&Cw20QueryMsg::Balance { address: to.clone() })?, + msg: to_binary(&Cw20QueryMsg::Balance { + address: env.contract.address.clone().into_string(), + })?, }))?; amount.apply(response.balance.into()) }; From ff6e5f916f814b8f6390ad186c3b6ff7d1a352c2 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 16 Sep 2022 10:32:24 +0200 Subject: [PATCH 39/57] fix(cosmwasm): use Funds> in spawn Signed-off-by: aeryz --- code/xcvm/lib/core/src/asset.rs | 2 +- .../contracts/interpreter/src/contract.rs | 58 +++++++++++++++---- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/code/xcvm/lib/core/src/asset.rs b/code/xcvm/lib/core/src/asset.rs index 437ffd7b475..468f2c4594f 100644 --- a/code/xcvm/lib/core/src/asset.rs +++ b/code/xcvm/lib/core/src/asset.rs @@ -209,7 +209,7 @@ impl Amount { #[repr(transparent)] pub struct Funds(pub BTreeMap); -impl Funds { +impl Funds { #[inline] pub fn empty() -> Self { Funds(BTreeMap::new()) diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 9d9a459fcef..589446cf2fa 100644 --- a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -1,20 +1,19 @@ +use crate::{ + error::ContractError, + msg::{ExecuteMsg, InstantiateMsg, QueryMsg, XCVMProgram}, + state::{Config, CONFIG}, +}; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, Event, MessageInfo, QueryRequest, Response, StdError, StdResult, WasmQuery, }; -use serde::Serialize; - -use crate::{ - error::ContractError, - msg::{ExecuteMsg, InstantiateMsg, QueryMsg, XCVMProgram}, - state::{Config, CONFIG}, -}; use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg}; use num::Zero; +use serde::Serialize; use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; -use xcvm_core::{Funds, Instruction, NetworkId}; +use xcvm_core::{Displayed, Funds, Instruction, NetworkId}; #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( @@ -60,7 +59,7 @@ pub fn interpret_program( response = match instruction { Instruction::Call { encoded } => interpret_call(encoded, response), Instruction::Spawn { network, salt, assets, program } => - interpret_spawn(&deps, network, salt, assets, program, response), + interpret_spawn(&deps, &env, network, salt, assets, program, response), Instruction::Transfer { to, assets } => interpret_transfer(&mut deps, &env, to, assets, response), }?; @@ -81,6 +80,7 @@ pub fn interpret_call(encoded: Vec, response: Response) -> Result, assets: Funds, @@ -91,13 +91,47 @@ pub fn interpret_spawn( struct SpawnEvent { network: NetworkId, salt: Vec, - assets: Funds, + assets: Funds>, program: XCVMProgram, } - let data = SpawnEvent { network, salt, assets, program }; - let config = CONFIG.load(deps.storage)?; + let registry_addr = config.registry_address.into_string(); + let mut normalized_funds = Funds::>::empty(); + + for (asset_id, amount) in assets.0 { + if amount.is_zero() { + // We ignore zero amounts + continue + } + + let amount = if amount.slope.0 == 0 { + // No need to get balance from cw20 contract + amount.intercept + } else { + let query_msg = AssetRegistryQueryMsg::GetAssetContract(asset_id.into()); + + let cw20_address: GetAssetContractResponse = deps.querier.query( + &WasmQuery::Smart { + contract_addr: registry_addr.clone(), + msg: to_binary(&query_msg)?, + } + .into(), + )?; + let response = + deps.querier.query::(&QueryRequest::Wasm(WasmQuery::Smart { + contract_addr: cw20_address.addr.clone().into_string(), + msg: to_binary(&Cw20QueryMsg::Balance { + address: env.contract.address.clone().into_string(), + })?, + }))?; + amount.apply(response.balance.into()).into() + }; + + normalized_funds.0.insert(asset_id, amount.into()); + } + + let data = SpawnEvent { network, salt, assets: normalized_funds, program }; Ok(response.add_event( Event::new("xcvm.interpreter.spawn") From 31eb26d0041dea431a3b948d695a998598ffe6b4 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 16 Sep 2022 11:03:16 +0200 Subject: [PATCH 40/57] fix(xcvm): amount apply Signed-off-by: aeryz --- code/xcvm/lib/core/src/asset.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/xcvm/lib/core/src/asset.rs b/code/xcvm/lib/core/src/asset.rs index 468f2c4594f..bd04d398933 100644 --- a/code/xcvm/lib/core/src/asset.rs +++ b/code/xcvm/lib/core/src/asset.rs @@ -128,6 +128,8 @@ impl From for Displayed { } } +pub const MAX_PARTS: u128 = 1000000000000000000; + #[cfg_attr(feature = "std", derive(schemars::JsonSchema))] #[derive( Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Encode, Decode, TypeInfo, Serialize, Deserialize, @@ -191,9 +193,10 @@ impl Amount { self.intercept.0 } else { FixedU128::::wrapping_from_num(value) + .saturating_sub(FixedU128::::wrapping_from_num(self.intercept.0)) .saturating_mul( FixedU128::::wrapping_from_num(self.slope.0) - .saturating_div(FixedU128::::wrapping_from_num(u128::MAX)), + .saturating_div(FixedU128::::wrapping_from_num(MAX_PARTS)), ) .wrapping_to_num::() .saturating_add(self.intercept.0) From ad913cb2ec67f75c464c3e7678384ed0f2763d07 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 16 Sep 2022 11:52:53 +0200 Subject: [PATCH 41/57] fix(cosmwasm): dependencies Signed-off-by: aeryz --- .../xcvm}/cosmwasm/contracts/asset-registry/Cargo.toml | 0 .../xcvm}/cosmwasm/contracts/asset-registry/Developing.md | 0 {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/README.md | 0 .../xcvm}/cosmwasm/contracts/asset-registry/examples/schema.rs | 0 .../cosmwasm/contracts/asset-registry/schema/execute_msg.json | 0 .../contracts/asset-registry/schema/instantiate_msg.json | 0 .../cosmwasm/contracts/asset-registry/schema/query_msg.json | 0 .../xcvm}/cosmwasm/contracts/asset-registry/src/contract.rs | 0 .../xcvm}/cosmwasm/contracts/asset-registry/src/error.rs | 0 .../xcvm}/cosmwasm/contracts/asset-registry/src/helpers.rs | 0 .../xcvm}/cosmwasm/contracts/asset-registry/src/lib.rs | 0 .../xcvm}/cosmwasm/contracts/asset-registry/src/msg.rs | 0 .../xcvm}/cosmwasm/contracts/asset-registry/src/state.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/Cargo.toml | 2 +- {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/README.md | 0 .../xcvm}/cosmwasm/contracts/interpreter/examples/schema.rs | 0 .../cosmwasm/contracts/interpreter/schema/execute_msg.json | 0 .../cosmwasm/contracts/interpreter/schema/instantiate_msg.json | 0 .../xcvm}/cosmwasm/contracts/interpreter/schema/query_msg.json | 0 .../xcvm}/cosmwasm/contracts/interpreter/src/contract.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/error.rs | 0 .../xcvm}/cosmwasm/contracts/interpreter/src/helpers.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/lib.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/msg.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/state.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/Cargo.toml | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/Developing.md | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/README.md | 0 .../xcvm}/cosmwasm/contracts/router/examples/schema.rs | 0 .../xcvm}/cosmwasm/contracts/router/schema/execute_msg.json | 0 .../xcvm}/cosmwasm/contracts/router/schema/instantiate_msg.json | 0 .../xcvm}/cosmwasm/contracts/router/schema/query_msg.json | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/src/contract.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/src/error.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/src/helpers.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/src/lib.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/src/msg.rs | 0 {xcvm => code/xcvm}/cosmwasm/contracts/router/src/state.rs | 0 flake.nix | 1 - 39 files changed, 1 insertion(+), 2 deletions(-) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/Cargo.toml (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/Developing.md (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/README.md (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/examples/schema.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/schema/execute_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/schema/query_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/src/contract.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/src/error.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/src/helpers.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/src/lib.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/src/msg.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/asset-registry/src/state.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/Cargo.toml (94%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/README.md (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/examples/schema.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/schema/execute_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/schema/instantiate_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/schema/query_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/contract.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/error.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/helpers.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/lib.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/msg.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/interpreter/src/state.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/Cargo.toml (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/Developing.md (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/README.md (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/examples/schema.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/schema/execute_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/schema/instantiate_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/schema/query_msg.json (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/src/contract.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/src/error.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/src/helpers.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/src/lib.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/src/msg.rs (100%) rename {xcvm => code/xcvm}/cosmwasm/contracts/router/src/state.rs (100%) diff --git a/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/Cargo.toml rename to code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml diff --git a/xcvm/cosmwasm/contracts/asset-registry/Developing.md b/code/xcvm/cosmwasm/contracts/asset-registry/Developing.md similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/Developing.md rename to code/xcvm/cosmwasm/contracts/asset-registry/Developing.md diff --git a/xcvm/cosmwasm/contracts/asset-registry/README.md b/code/xcvm/cosmwasm/contracts/asset-registry/README.md similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/README.md rename to code/xcvm/cosmwasm/contracts/asset-registry/README.md diff --git a/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs b/code/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs rename to code/xcvm/cosmwasm/contracts/asset-registry/examples/schema.rs diff --git a/xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json b/code/xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json rename to code/xcvm/cosmwasm/contracts/asset-registry/schema/execute_msg.json diff --git a/xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json b/code/xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json rename to code/xcvm/cosmwasm/contracts/asset-registry/schema/instantiate_msg.json diff --git a/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json b/code/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json rename to code/xcvm/cosmwasm/contracts/asset-registry/schema/query_msg.json diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs b/code/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/src/contract.rs rename to code/xcvm/cosmwasm/contracts/asset-registry/src/contract.rs diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/error.rs b/code/xcvm/cosmwasm/contracts/asset-registry/src/error.rs similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/src/error.rs rename to code/xcvm/cosmwasm/contracts/asset-registry/src/error.rs diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs b/code/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs rename to code/xcvm/cosmwasm/contracts/asset-registry/src/helpers.rs diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/lib.rs b/code/xcvm/cosmwasm/contracts/asset-registry/src/lib.rs similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/src/lib.rs rename to code/xcvm/cosmwasm/contracts/asset-registry/src/lib.rs diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs b/code/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/src/msg.rs rename to code/xcvm/cosmwasm/contracts/asset-registry/src/msg.rs diff --git a/xcvm/cosmwasm/contracts/asset-registry/src/state.rs b/code/xcvm/cosmwasm/contracts/asset-registry/src/state.rs similarity index 100% rename from xcvm/cosmwasm/contracts/asset-registry/src/state.rs rename to code/xcvm/cosmwasm/contracts/asset-registry/src/state.rs diff --git a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml similarity index 94% rename from xcvm/cosmwasm/contracts/interpreter/Cargo.toml rename to code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index 4d618645c8d..c969c2cbb29 100644 --- a/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -29,7 +29,7 @@ cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } num = "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 = "4e175eaeffd625041bdecd251c0068a365def453" } +serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } serde_json = "1" thiserror = { version = "1.0.31" } xcvm-asset-registry = { path = "../asset-registry", features = ["library"] } diff --git a/xcvm/cosmwasm/contracts/interpreter/README.md b/code/xcvm/cosmwasm/contracts/interpreter/README.md similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/README.md rename to code/xcvm/cosmwasm/contracts/interpreter/README.md diff --git a/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs b/code/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/examples/schema.rs rename to code/xcvm/cosmwasm/contracts/interpreter/examples/schema.rs diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json b/code/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json rename to code/xcvm/cosmwasm/contracts/interpreter/schema/execute_msg.json diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json b/code/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json rename to code/xcvm/cosmwasm/contracts/interpreter/schema/instantiate_msg.json diff --git a/xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json b/code/xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json rename to code/xcvm/cosmwasm/contracts/interpreter/schema/query_msg.json diff --git a/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/src/contract.rs rename to code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs diff --git a/xcvm/cosmwasm/contracts/interpreter/src/error.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/error.rs similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/src/error.rs rename to code/xcvm/cosmwasm/contracts/interpreter/src/error.rs diff --git a/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/src/helpers.rs rename to code/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs diff --git a/xcvm/cosmwasm/contracts/interpreter/src/lib.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/lib.rs similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/src/lib.rs rename to code/xcvm/cosmwasm/contracts/interpreter/src/lib.rs diff --git a/xcvm/cosmwasm/contracts/interpreter/src/msg.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/src/msg.rs rename to code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs diff --git a/xcvm/cosmwasm/contracts/interpreter/src/state.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/state.rs similarity index 100% rename from xcvm/cosmwasm/contracts/interpreter/src/state.rs rename to code/xcvm/cosmwasm/contracts/interpreter/src/state.rs diff --git a/xcvm/cosmwasm/contracts/router/Cargo.toml b/code/xcvm/cosmwasm/contracts/router/Cargo.toml similarity index 100% rename from xcvm/cosmwasm/contracts/router/Cargo.toml rename to code/xcvm/cosmwasm/contracts/router/Cargo.toml diff --git a/xcvm/cosmwasm/contracts/router/Developing.md b/code/xcvm/cosmwasm/contracts/router/Developing.md similarity index 100% rename from xcvm/cosmwasm/contracts/router/Developing.md rename to code/xcvm/cosmwasm/contracts/router/Developing.md diff --git a/xcvm/cosmwasm/contracts/router/README.md b/code/xcvm/cosmwasm/contracts/router/README.md similarity index 100% rename from xcvm/cosmwasm/contracts/router/README.md rename to code/xcvm/cosmwasm/contracts/router/README.md diff --git a/xcvm/cosmwasm/contracts/router/examples/schema.rs b/code/xcvm/cosmwasm/contracts/router/examples/schema.rs similarity index 100% rename from xcvm/cosmwasm/contracts/router/examples/schema.rs rename to code/xcvm/cosmwasm/contracts/router/examples/schema.rs diff --git a/xcvm/cosmwasm/contracts/router/schema/execute_msg.json b/code/xcvm/cosmwasm/contracts/router/schema/execute_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/router/schema/execute_msg.json rename to code/xcvm/cosmwasm/contracts/router/schema/execute_msg.json diff --git a/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json b/code/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json rename to code/xcvm/cosmwasm/contracts/router/schema/instantiate_msg.json diff --git a/xcvm/cosmwasm/contracts/router/schema/query_msg.json b/code/xcvm/cosmwasm/contracts/router/schema/query_msg.json similarity index 100% rename from xcvm/cosmwasm/contracts/router/schema/query_msg.json rename to code/xcvm/cosmwasm/contracts/router/schema/query_msg.json diff --git a/xcvm/cosmwasm/contracts/router/src/contract.rs b/code/xcvm/cosmwasm/contracts/router/src/contract.rs similarity index 100% rename from xcvm/cosmwasm/contracts/router/src/contract.rs rename to code/xcvm/cosmwasm/contracts/router/src/contract.rs diff --git a/xcvm/cosmwasm/contracts/router/src/error.rs b/code/xcvm/cosmwasm/contracts/router/src/error.rs similarity index 100% rename from xcvm/cosmwasm/contracts/router/src/error.rs rename to code/xcvm/cosmwasm/contracts/router/src/error.rs diff --git a/xcvm/cosmwasm/contracts/router/src/helpers.rs b/code/xcvm/cosmwasm/contracts/router/src/helpers.rs similarity index 100% rename from xcvm/cosmwasm/contracts/router/src/helpers.rs rename to code/xcvm/cosmwasm/contracts/router/src/helpers.rs diff --git a/xcvm/cosmwasm/contracts/router/src/lib.rs b/code/xcvm/cosmwasm/contracts/router/src/lib.rs similarity index 100% rename from xcvm/cosmwasm/contracts/router/src/lib.rs rename to code/xcvm/cosmwasm/contracts/router/src/lib.rs diff --git a/xcvm/cosmwasm/contracts/router/src/msg.rs b/code/xcvm/cosmwasm/contracts/router/src/msg.rs similarity index 100% rename from xcvm/cosmwasm/contracts/router/src/msg.rs rename to code/xcvm/cosmwasm/contracts/router/src/msg.rs diff --git a/xcvm/cosmwasm/contracts/router/src/state.rs b/code/xcvm/cosmwasm/contracts/router/src/state.rs similarity index 100% rename from xcvm/cosmwasm/contracts/router/src/state.rs rename to code/xcvm/cosmwasm/contracts/router/src/state.rs diff --git a/flake.nix b/flake.nix index 8d883ee6aa8..c97947664a1 100644 --- a/flake.nix +++ b/flake.nix @@ -350,7 +350,6 @@ ''; docs-renders = [ mdbook plantuml graphviz pandoc ]; -<<<<<<< HEAD mkFrontendStatic = { kusamaEndpoint, picassoEndpoint, karuraEndpoint , subsquidEndpoint }: let bp = pkgs.callPackage npm-buildpackage { }; From 13ee3d49d2b265d2880e52a733d7252f34b2a800 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Fri, 16 Sep 2022 11:56:27 +0200 Subject: [PATCH 42/57] chore: flake.nix --- flake.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index c97947664a1..c058ffd27e0 100644 --- a/flake.nix +++ b/flake.nix @@ -942,11 +942,11 @@ ''; }; - junod = pkgs.callPackage ./xcvm/cosmos/junod.nix { }; - gex = pkgs.callPackage ./xcvm/cosmos/gex.nix { }; - wasmswap = pkgs.callPackage ./xcvm/cosmos/wasmswap.nix { + junod = pkgs.callPackage ./code/xcvm/cosmos/junod.nix { }; + gex = pkgs.callPackage ./code/xcvm/cosmos/gex.nix { }; + wasmswap = pkgs.callPackage ./code/xcvm/cosmos/wasmswap.nix { crane = crane-nightly; - }; + }; default = packages.composable-node; }; From b4da472b8134e332e6a56acab37a1d88101e13a0 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 16 Sep 2022 13:21:56 +0200 Subject: [PATCH 43/57] chore(xcvm): fmt Signed-off-by: aeryz --- code/xcvm/lib/core/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/xcvm/lib/core/src/lib.rs b/code/xcvm/lib/core/src/lib.rs index 028776fb074..1c919c78225 100644 --- a/code/xcvm/lib/core/src/lib.rs +++ b/code/xcvm/lib/core/src/lib.rs @@ -13,7 +13,7 @@ pub use crate::{asset::*, instruction::*, network::*, program::*, protocol::*}; use alloc::{collections::VecDeque, vec::Vec}; use core::marker::PhantomData; -/// Strongly typed network builder originating on `CurrentNetwork` network. +/// Strongly typed network builder originating on `CurrentNetwork` network. #[derive(Clone)] pub struct ProgramBuilder { pub tag: Vec, From 397bd9a84e61b7216eef38ff2e87ba699551a1e3 Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Fri, 16 Sep 2022 15:31:21 +0200 Subject: [PATCH 44/57] chore(devnet): add contract logging --- code/parachain/frame/cosmwasm/src/lib.rs | 2 +- scripts/polkadot-launch/rococo-local-dali-dev.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/parachain/frame/cosmwasm/src/lib.rs b/code/parachain/frame/cosmwasm/src/lib.rs index efb7a0fd79e..a31edc8025c 100644 --- a/code/parachain/frame/cosmwasm/src/lib.rs +++ b/code/parachain/frame/cosmwasm/src/lib.rs @@ -405,7 +405,6 @@ pub mod pallet { funds, message, ); - log::debug!(target: "runtime::contracts", "Instantiate Result: {:?}", outcome); Self::refund_gas(outcome, gas, shared.gas.remaining()) } @@ -643,6 +642,7 @@ pub mod pallet { initial_gas: u64, remaining_gas: u64, ) -> DispatchResultWithPostInfo { + log::debug!(target: "runtime::contracts", "outcome: {:?}", outcome); let post_info = PostDispatchInfo { actual_weight: Some(initial_gas.saturating_sub(remaining_gas)), pays_fee: Pays::Yes, diff --git a/scripts/polkadot-launch/rococo-local-dali-dev.nix b/scripts/polkadot-launch/rococo-local-dali-dev.nix index d0e65424500..f3e47f2127a 100644 --- a/scripts/polkadot-launch/rococo-local-dali-dev.nix +++ b/scripts/polkadot-launch/rococo-local-dali-dev.nix @@ -39,6 +39,7 @@ in { "--rpc-methods=Unsafe" "--execution=wasm" "--wasmtime-instantiation-strategy=recreate-instance-copy-on-write" + "--log=runtime::contracts=debug" ]; }]; }; From 511cc9d43c255a1c7a4130f6d30d2d457eba0b1c Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 16 Sep 2022 15:57:00 +0200 Subject: [PATCH 45/57] feat(cosmwasm): yield 'Call' instruction Signed-off-by: aeryz --- .../contracts/interpreter/src/contract.rs | 75 ++++++++++++++----- .../cosmwasm/contracts/interpreter/src/msg.rs | 3 +- 2 files changed, 59 insertions(+), 19 deletions(-) diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index 589446cf2fa..f02987d24e8 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -1,17 +1,18 @@ use crate::{ error::ContractError, - msg::{ExecuteMsg, InstantiateMsg, QueryMsg, XCVMProgram}, + msg::{ExecuteMsg, InstantiateMsg, QueryMsg, XCVMInstruction, XCVMProgram}, state::{Config, CONFIG}, }; #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ - to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, Event, MessageInfo, QueryRequest, Response, - StdError, StdResult, WasmQuery, + to_binary, wasm_execute, Binary, CosmosMsg, Deps, DepsMut, Env, Event, MessageInfo, + QueryRequest, Response, StdError, StdResult, WasmQuery, }; use cw20::{BalanceResponse, Cw20Contract, Cw20ExecuteMsg, Cw20QueryMsg}; use num::Zero; use serde::Serialize; +use std::collections::VecDeque; use xcvm_asset_registry::msg::{GetAssetContractResponse, QueryMsg as AssetRegistryQueryMsg}; use xcvm_core::{Displayed, Funds, Instruction, NetworkId}; @@ -54,15 +55,29 @@ pub fn interpret_program( program: XCVMProgram, ) -> Result { let mut response = Response::new(); - - for instruction in program.instructions { + let instruction_len = program.instructions.len(); + let mut instruction_iter = program.instructions.into_iter().enumerate(); + while let Some((index, instruction)) = instruction_iter.next() { response = match instruction { - Instruction::Call { encoded } => interpret_call(encoded, response), + Instruction::Call { encoded } => + if index >= instruction_len - 1 { + interpret_call(encoded, response)? + } else { + let response = interpret_call(encoded, response)?; + let instructions: VecDeque = + instruction_iter.map(|(_, instr)| instr).collect(); + let program = XCVMProgram { tag: program.tag, instructions }; + return Ok(response.add_message(wasm_execute( + env.contract.address, + &ExecuteMsg::Execute { program }, + vec![], + )?)) + }, Instruction::Spawn { network, salt, assets, program } => - interpret_spawn(&deps, &env, network, salt, assets, program, response), + interpret_spawn(&deps, &env, network, salt, assets, program, response)?, Instruction::Transfer { to, assets } => - interpret_transfer(&mut deps, &env, to, assets, response), - }?; + interpret_transfer(&mut deps, &env, to, assets, response)?, + }; } Ok(response.add_event(Event::new("xcvm.interpreter.executed").add_attribute( @@ -234,7 +249,11 @@ mod tests { // Make sure that the storage is empty assert_eq!( CONFIG.load(&deps.storage).unwrap(), - Config { registry_address: Addr::unchecked("addr") } + Config { + registry_address: Addr::unchecked("addr"), + network_id: Picasso.into(), + user_id: vec![] + } ); } @@ -320,18 +339,40 @@ mod tests { ) .unwrap(); - let cosmos_msg: CosmosMsg = + let out_msg_1: CosmosMsg = wasm_execute("1234", &"hello world".to_string(), vec![]).unwrap().into(); - let msg = serde_json_wasm::to_string(&cosmos_msg).unwrap(); + let msg = serde_json_wasm::to_string(&out_msg_1).unwrap(); + let instructions = vec![ + XCVMInstruction::Call { encoded: msg.as_bytes().into() }, + XCVMInstruction::Transfer { to: "1234".into(), assets: Funds::empty() }, + XCVMInstruction::Call { encoded: msg.as_bytes().into() }, + XCVMInstruction::Spawn { + network: Picasso.into(), + salt: vec![], + assets: Funds::empty(), + program: XCVMProgram { tag: vec![], instructions: vec![].into() }, + }, + ]; - let program = XCVMProgram { - tag: vec![], - instructions: vec![XCVMInstruction::Call { encoded: msg.as_bytes().into() }].into(), - }; + let program = XCVMProgram { tag: vec![], instructions: instructions.clone().into() }; + let out_msg_2: CosmosMsg = wasm_execute( + "cosmos2contract", + &ExecuteMsg::Execute { + program: XCVMProgram { + tag: vec![], + instructions: instructions[1..].to_owned().into(), + }, + }, + vec![], + ) + .unwrap() + .into(); let res = execute(deps.as_mut(), mock_env(), info.clone(), ExecuteMsg::Execute { program }) .unwrap(); - assert_eq!(res.messages[0].msg, cosmos_msg); + assert_eq!(res.messages[0].msg, out_msg_1); + assert_eq!(res.messages[1].msg, out_msg_2); + assert_eq!(res.messages.len(), 2); } #[test] diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs index 2417a9a2a28..a1669fa87af 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/msg.rs @@ -1,7 +1,6 @@ -use std::collections::VecDeque; - use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use std::collections::VecDeque; use xcvm_core::{Funds, Instruction, NetworkId, Program}; pub type XCVMInstruction = Instruction, String, Funds>; From 7b4fe88d3eb47456e61e95214f9b1e1cd5a9918e Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Fri, 16 Sep 2022 19:51:33 +0200 Subject: [PATCH 46/57] feat(xcvm): temporary burn funds from the interpreter --- .../contracts/interpreter/src/contract.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index f02987d24e8..f99a827d079 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -100,7 +100,7 @@ pub fn interpret_spawn( salt: Vec, assets: Funds, program: XCVMProgram, - response: Response, + mut response: Response, ) -> Result { #[derive(Serialize)] struct SpawnEvent { @@ -143,7 +143,21 @@ pub fn interpret_spawn( amount.apply(response.balance.into()).into() }; - normalized_funds.0.insert(asset_id, amount.into()); + if amount.0 > 0 { + normalized_funds.0.insert(asset_id, amount.into()); + } + } + + // TODO(probably call the router via a Cw20 `send` to spawn the program and do w/e required with the funds) + for (asset_id, amount) in normalized_funds.clone().0 { + let query_msg = AssetRegistryQueryMsg::GetAssetContract(asset_id.into()); + let cw20_address: GetAssetContractResponse = deps.querier.query( + &WasmQuery::Smart { contract_addr: registry_addr.clone(), msg: to_binary(&query_msg)? } + .into(), + )?; + let contract = Cw20Contract(cw20_address.addr); + response = + response.add_message(contract.call(Cw20ExecuteMsg::Burn { amount: amount.0.into() })?); } let data = SpawnEvent { network, salt, assets: normalized_funds, program }; From bf52553fc12c79adb972944a2cf76db7cca3961f Mon Sep 17 00:00:00 2001 From: cor Date: Mon, 19 Sep 2022 15:47:14 +0200 Subject: [PATCH 47/57] feat: expose raw devnet-specs --- .../default.nix} | 20 +++++------ .../{arion-xcvm.nix => devnet-specs/xcvm.nix} | 22 ++++++------ code/Cargo.toml | 11 ------ flake.nix | 36 ++++++++++--------- 4 files changed, 41 insertions(+), 48 deletions(-) rename .nix/{arion-pure.nix => devnet-specs/default.nix} (84%) rename .nix/{arion-xcvm.nix => devnet-specs/xcvm.nix} (93%) diff --git a/.nix/arion-pure.nix b/.nix/devnet-specs/default.nix similarity index 84% rename from .nix/arion-pure.nix rename to .nix/devnet-specs/default.nix index e9adb42ba84..1fd77288713 100644 --- a/.nix/arion-pure.nix +++ b/.nix/devnet-specs/default.nix @@ -45,7 +45,7 @@ pkgs.arion.build { networks."${network-name}" = { }; services = { "${squid-archive-db.name}" = mkComposableContainer - (import ./services/postgres.nix { + (import ../services/postgres.nix { inherit pkgs; database = squid-archive-db; version = "14"; @@ -58,7 +58,7 @@ pkgs.arion.build { }); "${squid-db.name}" = mkComposableContainer - (import ./services/postgres.nix { + (import ../services/postgres.nix { inherit pkgs; database = squid-db; version = "14"; @@ -71,38 +71,38 @@ pkgs.arion.build { }); "${dali-container-name}" = mkComposableContainer - (import ./services/devnet-dali.nix { + (import ../services/devnet-dali.nix { inherit pkgs packages parachainPort relaychainPort; }); ingest = mkComposableContainer - (import ./services/subsquid-substrate-ingest.nix { + (import ../services/subsquid-substrate-ingest.nix { database = squid-archive-db; polkadotEndpoint = parachainEndpoint; prometheusPort = 9090; }); "${gatewayContainerName}" = mkComposableContainer - (import ./services/subsquid-substrate-gateway.nix { + (import ../services/subsquid-substrate-gateway.nix { database = squid-archive-db; port = gatewayPort; }); # NOTE, this one currently seems broken. but it is an optional service anyways. - # explorer = mkComposableContainer (import ./services/subsquid-substrate-explorer.nix { + # explorer = mkComposableContainer (import ../services/subsquid-substrate-explorer.nix { # database = squid-archive-db; # graphqlPort = 4010; # }); "${subsquidGraphqlContainerName}" = mkComposableContainer - (import ./services/subsquid-graphql.nix { + (import ../services/subsquid-graphql.nix { inherit pkgs; database = squid-db; graphqlPort = squidGraphqlPort; }); subsquid-processor = mkComposableContainer - (import ./services/subsquid-processor-dockerfile.nix { + (import ../services/subsquid-processor-dockerfile.nix { inherit subsquidGraphqlContainerName gatewayContainerName gatewayPort parachainEndpoint; database = squid-db; @@ -111,12 +111,12 @@ pkgs.arion.build { # NOTE: Ports are currently not configurable for frontend services frontend-picasso = mkComposableContainer - (import ./services/frontend-picasso.nix { + (import ../services/frontend-picasso.nix { inherit pkgs packages; }); frontend-pablo = mkComposableContainer - (import ./services/frontend-pablo.nix { inherit pkgs packages; }); + (import ../services/frontend-pablo.nix { inherit pkgs packages; }); }; }; }) diff --git a/.nix/arion-xcvm.nix b/.nix/devnet-specs/xcvm.nix similarity index 93% rename from .nix/arion-xcvm.nix rename to .nix/devnet-specs/xcvm.nix index f6a5103ef5b..3670cb25f9b 100644 --- a/.nix/arion-xcvm.nix +++ b/.nix/devnet-specs/xcvm.nix @@ -58,7 +58,7 @@ pkgs.arion.build { services = { # ============ COMMON =============== "${db-container-name}" = mk-composable-container - (import ./services/postgres.nix { + (import ../services/postgres.nix { inherit pkgs; database = default-db; version = "14"; @@ -75,23 +75,23 @@ pkgs.arion.build { }); # ============== COSMOS =============== - "${junod-container-name}" = mk-composable-container - (import ./services/junod.nix { rpcPort = junoRpcPort; }); + "${junod-container-name}" = + mk-composable-container (import ../services/junod.nix { rpcPort = junoRpcPort; }); "${juno-indexer-container-name}" = mk-composable-container - (import ./services/juno-subql-indexer.nix { + (import ../services/juno-subql.nix { inherit pkgs; database = juno-indexer-db; juno = junod-container-name; junoPort = junoRpcPort; }); "${subql-query-container-name}" = mk-composable-container - (import ./services/subql-query.nix { + (import ../services/subql-query.nix { database = juno-indexer-db; subql-node = juno-indexer-container-name; subqlPort = 3000; }); hasura-aggregated = mk-composable-container - (import ./services/hasura.nix { + (import ../services/hasura.nix { inherit pkgs; database = hasura-db; graphql-port = hasuraGraphqlPort; @@ -202,14 +202,14 @@ pkgs.arion.build { # ============== POLKADOT ============== "${dali-container-name}" = mk-composable-container - (import ./services/devnet-dali.nix { + (import ../services/devnet-dali.nix { inherit pkgs; inherit packages; inherit relaychainPort; inherit parachainPort; }); subsquid-indexer = mk-composable-container - (import ./services/subsquid-indexer.nix { + (import ../services/subsquid-indexer.nix { database = composable-indexer-db; redis = redis-container-name; parachain = dali-container-name; @@ -218,18 +218,18 @@ pkgs.arion.build { }); "${subsquid-indexer-gateway-container-name}" = mk-composable-container - (import ./services/subsquid-indexer-gateway.nix { + (import ../services/subsquid-indexer-gateway.nix { database = composable-indexer-db; status = subsquid-status-container-name; graphql-port = subsquidIndexerGateway; }); "${subsquid-status-container-name}" = mk-composable-container - (import ./services/subsquid-indexer-status-service.nix { + (import ../services/subsquid-indexer-status-service.nix { redis = redis-container-name; port = subsquidIndexerStatusService; }); "${redis-container-name}" = - mk-composable-container (import ./services/redis.nix); + mk-composable-container (import ../services/redis.nix); }; }; }) diff --git a/code/Cargo.toml b/code/Cargo.toml index d7136e1af25..6eb2af72205 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -70,7 +70,6 @@ panic = "abort" rpath = false [patch.crates-io] -<<<<<<< HEAD sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-core = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } @@ -80,16 +79,6 @@ sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f1 sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } wasmi-validation = { git = "https://github.com/ComposableFi/wasmi", rev = "cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" } serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } -======= -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } -sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } -sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } -sp-core = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } -sp-debug-derive = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } -sp-externalities = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } -sp-io = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } -sp-runtime = { git = "https://github.com/ComposableFi/substrate", branch = "polkadot-v0.9.27" } ->>>>>>> 1f717b826 (fmt to pass ci) [patch."https://github.com/paritytech/subxt"] subxt-codegen = { git = "https://github.com/paritytech//subxt", rev = "2fe9a1446d32b93a10804db3304ccaac65f764b8" } diff --git a/flake.nix b/flake.nix index c058ffd27e0..6adf3acecc7 100644 --- a/flake.nix +++ b/flake.nix @@ -1028,43 +1028,47 @@ default = developers; }; + + devnet-specs = { + default = import ./.nix/devnet-specs/default.nix { + inherit pkgs; + inherit packages; + }; - apps = let - arion-pure = import ./.nix/arion-pure.nix { + xcvm = import ./.nix/devnet-specs/xcvm.nix { inherit pkgs; inherit packages; }; - arion-up-program = pkgs.writeShellApplication { - name = "devnet-up"; + }; + + apps = let + devnet-default-program = pkgs.writeShellApplication { + name = "devnet-default"; runtimeInputs = [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; text = '' - arion --prebuilt-file ${arion-pure} up --build --force-recreate -V --always-recreate-deps --remove-orphans + arion --prebuilt-file ${devnet-specs.default} up --build --force-recreate -V --always-recreate-deps --remove-orphans ''; }; - devnet-xcvm = import ./.nix/arion-xcvm.nix { - inherit pkgs; - inherit packages; - }; - devnet-xcvm-up-program = pkgs.writeShellApplication { - name = "devnet-xcvm-up"; + devnet-xcvm-program = pkgs.writeShellApplication { + name = "devnet-xcvm"; runtimeInputs = [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; text = '' - arion --prebuilt-file ${devnet-xcvm} up --build --force-recreate -V --always-recreate-deps --remove-orphans + arion --prebuilt-file ${devnet-specs.xcvm} up --build --force-recreate -V --always-recreate-deps --remove-orphans ''; }; in rec { - devnet-up = { + devnet = { type = "app"; - program = "${arion-up-program}/bin/devnet-up"; + program = "${devnet-default-program}/bin/devnet-default"; }; - devnet-xcvm-up = { + devnet-xcvm = { type = "app"; - program = "${devnet-xcvm-up-program}/bin/devnet-xcvm-up"; + program = "${devnet-xcvm-program}/bin/devnet-xcvm"; }; devnet-dali = { From 6fa47f8ed14bca29b52098fb4ff63aba141d6712 Mon Sep 17 00:00:00 2001 From: cor Date: Mon, 19 Sep 2022 18:04:11 +0200 Subject: [PATCH 48/57] fix: delay the pkgs.arion.build call --- .nix/devnet-specs/default.nix | 2 +- .nix/devnet-specs/xcvm.nix | 2 +- flake.nix | 17 +++++------------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.nix/devnet-specs/default.nix b/.nix/devnet-specs/default.nix index 1fd77288713..adf984dde91 100644 --- a/.nix/devnet-specs/default.nix +++ b/.nix/devnet-specs/default.nix @@ -1,5 +1,5 @@ { pkgs, packages, ... }: -pkgs.arion.build { +{ modules = [ ({ pkgs, ... }: let diff --git a/.nix/devnet-specs/xcvm.nix b/.nix/devnet-specs/xcvm.nix index 3670cb25f9b..3fafe14d151 100644 --- a/.nix/devnet-specs/xcvm.nix +++ b/.nix/devnet-specs/xcvm.nix @@ -1,5 +1,5 @@ { pkgs, packages, ... }: -pkgs.arion.build { +{ modules = [ ({ pkgs, ... }: let diff --git a/flake.nix b/flake.nix index 6adf3acecc7..077536066ed 100644 --- a/flake.nix +++ b/flake.nix @@ -1042,24 +1042,17 @@ }; apps = let - devnet-default-program = pkgs.writeShellApplication { - name = "devnet-default"; + mkDevnetProgram = name: spec: pkgs.writeShellApplication { + inherit name; runtimeInputs = [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; text = '' - arion --prebuilt-file ${devnet-specs.default} up --build --force-recreate -V --always-recreate-deps --remove-orphans - ''; - }; - - devnet-xcvm-program = pkgs.writeShellApplication { - name = "devnet-xcvm"; - runtimeInputs = - [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; - text = '' - arion --prebuilt-file ${devnet-specs.xcvm} up --build --force-recreate -V --always-recreate-deps --remove-orphans + arion --prebuilt-file ${pkgs.arion.build spec} up --build --force-recreate -V --always-recreate-deps --remove-orphans ''; }; + devnet-default-program = mkDevnetProgram "devnet-default" devnet-specs.default; + devnet-xcvm-program = mkDevnetProgram "devnet-xcvm" devnet-specs.xcvm; in rec { devnet = { type = "app"; From d8bbaabd667bd38b1a019b23e6c18e22594cc676 Mon Sep 17 00:00:00 2001 From: cor Date: Mon, 19 Sep 2022 19:46:02 +0200 Subject: [PATCH 49/57] fix: remove redundant lambda --- .nix/devnet-specs/default.nix | 8 +++++--- .nix/devnet-specs/xcvm.nix | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.nix/devnet-specs/default.nix b/.nix/devnet-specs/default.nix index adf984dde91..f725ffef4b2 100644 --- a/.nix/devnet-specs/default.nix +++ b/.nix/devnet-specs/default.nix @@ -1,7 +1,7 @@ { pkgs, packages, ... }: { modules = [ - ({ pkgs, ... }: + ( let dali-container-name = "dali-devnet"; subsquidGraphqlContainerName = "subsquid-graphql"; @@ -39,7 +39,8 @@ container // { service = container.service // { networks = [ network-name ]; }; }; - in { + in + { config = { project.name = "composable"; networks."${network-name}" = { }; @@ -119,7 +120,8 @@ (import ../services/frontend-pablo.nix { inherit pkgs packages; }); }; }; - }) + } + ) ]; inherit pkgs; } diff --git a/.nix/devnet-specs/xcvm.nix b/.nix/devnet-specs/xcvm.nix index 3fafe14d151..2b5d1cc8e9d 100644 --- a/.nix/devnet-specs/xcvm.nix +++ b/.nix/devnet-specs/xcvm.nix @@ -1,7 +1,7 @@ { pkgs, packages, ... }: { modules = [ - ({ pkgs, ... }: + ( let db-container-name = "db"; redis-container-name = "subsquid-redis"; @@ -234,5 +234,4 @@ }; }) ]; - inherit pkgs; } From 248ce3f46375fb4b0245926bf39ac266742f67ef Mon Sep 17 00:00:00 2001 From: cor Date: Mon, 19 Sep 2022 20:30:18 +0200 Subject: [PATCH 50/57] test: add utils --- flake.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flake.nix b/flake.nix index 077536066ed..c79e9d5f206 100644 --- a/flake.nix +++ b/flake.nix @@ -1040,6 +1040,17 @@ inherit packages; }; }; + + utils = { + mkDevnetProgram = name: spec: pkgs.writeShellApplication { + inherit name; + runtimeInputs = + [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; + text = '' + arion --prebuilt-file ${pkgs.arion.build spec} up --build --force-recreate -V --always-recreate-deps --remove-orphans + ''; + }; + }; apps = let mkDevnetProgram = name: spec: pkgs.writeShellApplication { From 6d4f473a6b60f8f6ca31edfc5157d7e24d42e9f7 Mon Sep 17 00:00:00 2001 From: cor Date: Mon, 19 Sep 2022 21:27:30 +0200 Subject: [PATCH 51/57] feat: composable overlay --- flake.nix | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index c79e9d5f206..84509f0d1f8 100644 --- a/flake.nix +++ b/flake.nix @@ -47,6 +47,21 @@ gce-input = gce-to-nix service-account-credential-key-file-input; + mkDevnetProgram = {pkgs}: name: spec: pkgs.writeShellApplication { + inherit name; + runtimeInputs = + [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; + text = '' + arion --prebuilt-file ${pkgs.arion.build spec} up --build --force-recreate -V --always-recreate-deps --remove-orphans + ''; + }; + + composableOverlay = nixpkgs.lib.composeManyExtensions [arion-src.overlay (final: prev: { + composable = { + mkDevnetProgram = final.callPackage mkDevnetProgram {}; + }; + })]; + mk-devnet = { pkgs, lib, writeTextFile, writeShellApplication , polkadot-launch, composable-node, polkadot-node, chain-spec }: let @@ -86,8 +101,8 @@ pkgs = import nixpkgs { inherit system; overlays = [ + composableOverlay rust-overlay.overlays.default - arion-src.overlay npm-buildpackage.overlays.default ]; allowUnsupportedSystem = true; # we do not trigger this on mac @@ -1040,30 +1055,11 @@ inherit packages; }; }; - - utils = { - mkDevnetProgram = name: spec: pkgs.writeShellApplication { - inherit name; - runtimeInputs = - [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; - text = '' - arion --prebuilt-file ${pkgs.arion.build spec} up --build --force-recreate -V --always-recreate-deps --remove-orphans - ''; - }; - }; - apps = let - mkDevnetProgram = name: spec: pkgs.writeShellApplication { - inherit name; - runtimeInputs = - [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; - text = '' - arion --prebuilt-file ${pkgs.arion.build spec} up --build --force-recreate -V --always-recreate-deps --remove-orphans - ''; - }; - devnet-default-program = mkDevnetProgram "devnet-default" devnet-specs.default; - devnet-xcvm-program = mkDevnetProgram "devnet-xcvm" devnet-specs.xcvm; + apps = let + devnet-default-program = pkgs.composable.mkDevnetProgram "devnet-default" devnet-specs.default; + devnet-xcvm-program = pkgs.composable.mkDevnetProgram "devnet-xcvm" devnet-specs.xcvm; in rec { devnet = { type = "app"; @@ -1143,6 +1139,8 @@ }; }); in eachSystemOutputs // { + + overlays.default = composableOverlay; nixopsConfigurations = { default = let pkgs = nixpkgs.legacyPackages.x86_64-linux; in import ./.nix/devnet.nix { From 926b3cee82b3ca29f5629b458b3187ebad23423d Mon Sep 17 00:00:00 2001 From: aeryz Date: Tue, 20 Sep 2022 14:20:51 +0200 Subject: [PATCH 52/57] feat(cosmwasm): add rpc for querying contracts Signed-off-by: aeryz --- code/parachain/frame/cosmwasm/rpc/Cargo.toml | 33 +++++++++ code/parachain/frame/cosmwasm/rpc/src/lib.rs | 72 +++++++++++++++++++ .../frame/cosmwasm/runtime-api/Cargo.toml | 25 +++++++ .../frame/cosmwasm/runtime-api/src/lib.rs | 22 ++++++ code/parachain/frame/cosmwasm/src/lib.rs | 34 ++++++++- .../frame/cosmwasm/src/runtimes/wasmi.rs | 1 + code/parachain/node/Cargo.toml | 3 + code/parachain/node/src/rpc.rs | 13 ++-- code/parachain/node/src/runtime.rs | 19 +++++ code/parachain/node/src/service.rs | 9 +-- code/parachain/runtime/dali/Cargo.toml | 2 + code/parachain/runtime/dali/src/lib.rs | 16 +++++ 12 files changed, 240 insertions(+), 9 deletions(-) create mode 100644 code/parachain/frame/cosmwasm/rpc/Cargo.toml create mode 100644 code/parachain/frame/cosmwasm/rpc/src/lib.rs create mode 100644 code/parachain/frame/cosmwasm/runtime-api/Cargo.toml create mode 100644 code/parachain/frame/cosmwasm/runtime-api/src/lib.rs diff --git a/code/parachain/frame/cosmwasm/rpc/Cargo.toml b/code/parachain/frame/cosmwasm/rpc/Cargo.toml new file mode 100644 index 00000000000..9e995c2271f --- /dev/null +++ b/code/parachain/frame/cosmwasm/rpc/Cargo.toml @@ -0,0 +1,33 @@ +[package] +authors = ["Composable Developers"] +edition = "2021" +homepage = "https://composable.finance" +name = "cosmwasm-rpc" +rust-version = "1.56" +version = "0.0.1" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +# substrate primitives +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } + +# local +composable-support = { path = "../../composable-support" } +composable-traits = { path = "../../composable-traits" } +cosmwasm-runtime-api = { path = "../runtime-api" } + +# SCALE +codec = { default-features = false, features = [ + "derive", +], package = "parity-scale-codec", version = "3.0.0" } +scale-info = { version = "2.1.1", default-features = false, features = [ + "derive", +] } + +# rpc +jsonrpsee = { version = "0.14.0", features = ["server", "macros"] } diff --git a/code/parachain/frame/cosmwasm/rpc/src/lib.rs b/code/parachain/frame/cosmwasm/rpc/src/lib.rs new file mode 100644 index 00000000000..4d4a47a97dd --- /dev/null +++ b/code/parachain/frame/cosmwasm/rpc/src/lib.rs @@ -0,0 +1,72 @@ +use codec::Codec; +use composable_support::rpc_helpers::SafeRpcWrapper; +use core::{fmt::Display, str::FromStr}; +use cosmwasm_runtime_api::CosmwasmRuntimeApi; +use jsonrpsee::{ + core::{Error as RpcError, RpcResult}, + proc_macros::rpc, + types::{error::CallError, ErrorObject}, +}; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::HeaderBackend; +use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_std::sync::Arc; + +#[rpc(client, server)] +pub trait CosmwasmApi +where + AccountId: FromStr + Display, +{ + #[method(name = "cosmwasm_query")] + fn query( + &self, + contract: SafeRpcWrapper, + gas: SafeRpcWrapper, + query_request: QueryRequest, + at: Option, + ) -> RpcResult; +} + +pub struct Cosmwasm { + client: Arc, + _marker: sp_std::marker::PhantomData, +} + +impl Cosmwasm { + pub fn new(client: Arc) -> Self { + Self { client, _marker: Default::default() } + } +} + +impl + CosmwasmApiServer<::Hash, AccountId, QueryRequest, Binary> + for Cosmwasm +where + Block: BlockT, + AccountId: Send + Sync + 'static + Codec + FromStr + Display, + QueryRequest: Send + Sync + 'static + Codec, + Binary: Send + Sync + 'static + Codec, + C: Send + Sync + 'static, + C: ProvideRuntimeApi, + C: HeaderBackend, + C::Api: CosmwasmRuntimeApi, +{ + fn query( + &self, + contract: SafeRpcWrapper, + gas: SafeRpcWrapper, + query_request: QueryRequest, + at: Option<::Hash>, + ) -> RpcResult { + let api = self.client.runtime_api(); + let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); + let runtime_api_result = api.query(&at, contract.0, gas.0, query_request); + runtime_api_result.map_err(|e| { + RpcError::Call(CallError::Custom(ErrorObject::owned( + 9876, + "Something wrong", + Some(format!("{:?}", e)), + ))) + }) + } +} diff --git a/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml b/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml new file mode 100644 index 00000000000..a58391d4235 --- /dev/null +++ b/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml @@ -0,0 +1,25 @@ +[package] +authors = ["Composable Developers"] +edition = "2021" +homepage = "https://composable.finance" +name = "cosmwasm-runtime-api" +rust-version = "1.56" +version = "0.0.1" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { default-features = false, features = [ + "derive", +], package = "parity-scale-codec", version = "3.0.0" } +composable-support = { path = "../../composable-support", default-features = false } +composable-traits = { path = "../../composable-traits", default-features = false } +sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } + + +# REVIEW: Does the runtime API need features? +[features] +default = ["std"] +std = ["sp-api/std", "composable-support/std"] diff --git a/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs b/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs new file mode 100644 index 00000000000..339af3fd6e3 --- /dev/null +++ b/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs @@ -0,0 +1,22 @@ +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::too_many_arguments)] +#![allow(clippy::unnecessary_mut_passed)] + +use codec::Codec; + +// Pablo Runtime API declaration. Implemented for each runtime at +// `runtime//src/lib.rs`. +sp_api::decl_runtime_apis! { + pub trait CosmwasmRuntimeApi + where + AccountId: Codec, + QueryRequest: Codec, + Binary: Codec, + { + fn query( + contract: AccountId, + gas: u64, + query_request: QueryRequest, + ) -> Binary; + } +} diff --git a/code/parachain/frame/cosmwasm/src/lib.rs b/code/parachain/frame/cosmwasm/src/lib.rs index a31edc8025c..dd9db821ad3 100644 --- a/code/parachain/frame/cosmwasm/src/lib.rs +++ b/code/parachain/frame/cosmwasm/src/lib.rs @@ -62,6 +62,7 @@ pub mod pallet { }; use alloc::{ collections::{btree_map::Entry, BTreeMap}, + format, string::String, }; use composable_support::abstractions::{ @@ -77,13 +78,14 @@ pub mod pallet { ContractInfo as CosmwasmContractInfo, Env, Event as CosmwasmEvent, MessageInfo, Timestamp, TransactionInfo, }; + pub use cosmwasm_minimal_std::{QueryRequest, QueryResponse}; use cosmwasm_vm::{ executor::{ AllocateInput, AsFunctionName, DeallocateInput, ExecuteInput, InstantiateInput, MigrateInput, QueryInput, ReplyInput, }, memory::PointerOf, - system::{cosmwasm_system_entrypoint, CosmwasmCodeId}, + system::{cosmwasm_system_entrypoint, cosmwasm_system_query, CosmwasmCodeId}, vm::VmMessageCustomOf, }; use cosmwasm_vm_wasmi::{host_functions, new_wasmi_vm, WasmiImportResolver, WasmiVM}; @@ -1223,6 +1225,36 @@ pub mod pallet { } } + /// Query cosmwasm contracts + /// + /// * `contract` the address of contract to query. + /// * `gas` the maximum gas to use, the remaining is refunded at the end of the transaction. + /// * `query_request` the binary query, which should be deserializable to `QueryRequest`. + pub fn query( + contract: AccountIdOf, + gas: u64, + query_request: Vec, + ) -> Result> { + let mut shared = Pallet::::do_create_vm_shared(gas, InitialStorageMutability::ReadOnly); + let info = Pallet::::contract_info(&contract)?; + let query_request: QueryRequest = serde_json::from_slice(&query_request) + .map_err(|e| CosmwasmVMError::Rpc(format!("{}", e)))?; + Pallet::::cosmwasm_call( + &mut shared, + contract.clone(), + contract, + info, + Default::default(), + |vm| { + cosmwasm_system_query(vm, query_request)? + .into_result() + .map_err(|e| CosmwasmVMError::Rpc(format!("{:?}", e)))? + .into_result() + .map_err(|e| CosmwasmVMError::Rpc(e)) + }, + ) + } + impl VMPallet for T { type VmError = CosmwasmVMError; } diff --git a/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs b/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs index 4edb67f77b4..d0fbe21a38e 100644 --- a/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs +++ b/code/parachain/frame/cosmwasm/src/runtimes/wasmi.rs @@ -35,6 +35,7 @@ pub enum CosmwasmVMError { ReadOnlyViolation, OutOfGas, Unsupported, + Rpc(String), } impl core::fmt::Display for CosmwasmVMError { diff --git a/code/parachain/node/Cargo.toml b/code/parachain/node/Cargo.toml index b0254b75346..de000fed494 100644 --- a/code/parachain/node/Cargo.toml +++ b/code/parachain/node/Cargo.toml @@ -38,6 +38,9 @@ lending-rpc = { path = "../frame/lending/rpc" } lending-runtime-api = { path = "../frame/lending/runtime-api" } pablo-rpc = { path = "../frame/pablo/rpc" } pablo-runtime-api = { path = "../frame/pablo/runtime-api" } +cosmwasm-rpc = { path = "../frame/cosmwasm/rpc" } +cosmwasm-runtime-api = { path = "../frame/cosmwasm/runtime-api" } + # FRAME Dependencies frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } diff --git a/code/parachain/node/src/rpc.rs b/code/parachain/node/src/rpc.rs index 98d400841c3..586cc07061a 100644 --- a/code/parachain/node/src/rpc.rs +++ b/code/parachain/node/src/rpc.rs @@ -20,9 +20,9 @@ use sp_runtime::traits::BlakeTwo256; use crate::{ client::{FullBackend, FullClient}, runtime::{ - assets::ExtendWithAssetsApi, crowdloan_rewards::ExtendWithCrowdloanRewardsApi, - ibc::ExtendWithIbcApi, lending::ExtendWithLendingApi, pablo::ExtendWithPabloApi, - BaseHostRuntimeApis, + assets::ExtendWithAssetsApi, cosmwasm::ExtendWithCosmwasmApi, + crowdloan_rewards::ExtendWithCrowdloanRewardsApi, ibc::ExtendWithIbcApi, + lending::ExtendWithLendingApi, pablo::ExtendWithPabloApi, BaseHostRuntimeApis, }, }; @@ -66,7 +66,8 @@ where + ExtendWithCrowdloanRewardsApi + ExtendWithPabloApi + ExtendWithLendingApi - + ExtendWithIbcApi, + + ExtendWithIbcApi + + ExtendWithCosmwasmApi, { use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; @@ -98,6 +99,10 @@ where )?; as ProvideRuntimeApi>::Api::extend_with_ibc_api( + &mut io, deps.clone(), + )?; + + as ProvideRuntimeApi>::Api::extend_with_cosmwasm_api( &mut io, deps, )?; diff --git a/code/parachain/node/src/runtime.rs b/code/parachain/node/src/runtime.rs index 56e3f78f6f3..1cc0f39754d 100644 --- a/code/parachain/node/src/runtime.rs +++ b/code/parachain/node/src/runtime.rs @@ -1,5 +1,6 @@ use assets_rpc::{Assets, AssetsApiServer}; use common::{AccountId, Balance, Index, OpaqueBlock}; +use cosmwasm_rpc::{Cosmwasm, CosmwasmApiServer}; use crowdloan_rewards_rpc::{CrowdloanRewards, CrowdloanRewardsApiServer}; use cumulus_primitives_core::CollectCollationInfo; use ibc_rpc::{IbcApiServer, IbcRpcHandler}; @@ -241,4 +242,22 @@ define_trait! { } } } + + mod cosmwasm { + pub trait ExtendWithCosmwasmApi { + fn extend_with_cosmwasm_api(io, deps) ; + } + + #[cfg(feature = "composable")] + impl for composable_runtime {} + + impl for picasso_runtime {} + + #[cfg(feature = "dali")] + impl for dali_runtime { + fn (io, deps) { + io.merge(Cosmwasm::new(deps.client).into_rpc()) + } + } + } } diff --git a/code/parachain/node/src/service.rs b/code/parachain/node/src/service.rs index 1e84cfeb5ca..04ebeb3122c 100644 --- a/code/parachain/node/src/service.rs +++ b/code/parachain/node/src/service.rs @@ -30,9 +30,9 @@ use crate::{ client::{Client, FullBackend, FullClient}, rpc, runtime::{ - assets::ExtendWithAssetsApi, crowdloan_rewards::ExtendWithCrowdloanRewardsApi, - ibc::ExtendWithIbcApi, lending::ExtendWithLendingApi, pablo::ExtendWithPabloApi, - BaseHostRuntimeApis, + assets::ExtendWithAssetsApi, cosmwasm::ExtendWithCosmwasmApi, + crowdloan_rewards::ExtendWithCrowdloanRewardsApi, ibc::ExtendWithIbcApi, + lending::ExtendWithLendingApi, pablo::ExtendWithPabloApi, BaseHostRuntimeApis, }, }; @@ -287,7 +287,8 @@ where + ExtendWithCrowdloanRewardsApi + ExtendWithPabloApi + ExtendWithLendingApi - + ExtendWithIbcApi, + + ExtendWithIbcApi + + ExtendWithCosmwasmApi, StateBackendFor: StateBackend, Executor: NativeExecutionDispatch + 'static, { diff --git a/code/parachain/runtime/dali/Cargo.toml b/code/parachain/runtime/dali/Cargo.toml index 3a30ddf0e10..7de53b117ba 100644 --- a/code/parachain/runtime/dali/Cargo.toml +++ b/code/parachain/runtime/dali/Cargo.toml @@ -112,6 +112,7 @@ assets-runtime-api = { path = '../../frame/assets/runtime-api', default-features crowdloan-rewards-runtime-api = { path = '../../frame/crowdloan-rewards/runtime-api', default-features = false } lending-runtime-api = { path = '../../frame/lending/runtime-api', default-features = false } pablo-runtime-api = { path = '../../frame/pablo/runtime-api', default-features = false } +cosmwasm-runtime-api = { path = '../../frame/cosmwasm/runtime-api', default-features = false } # Used for runtime benchmarking codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ @@ -303,5 +304,6 @@ std = [ "xcm-executor/std", "xcm/std", "cosmwasm/std", + "cosmwasm-runtime-api/std", "asset-tx-payment/std", ] diff --git a/code/parachain/runtime/dali/src/lib.rs b/code/parachain/runtime/dali/src/lib.rs index a65de05407b..e23fd2c1d7b 100644 --- a/code/parachain/runtime/dali/src/lib.rs +++ b/code/parachain/runtime/dali/src/lib.rs @@ -1542,6 +1542,22 @@ impl_runtime_apis! { } } + impl cosmwasm_runtime_api::CosmwasmRuntimeApi, Vec> for Runtime { + fn query( + contract: AccountId, + gas: u64, + query_request: Vec, + ) -> Vec { + cosmwasm::query::( + contract, + gas, + query_request, + ).map(|resp| resp.0).unwrap_or_else(|_| { + Default::default() + }) + } + } + impl sp_api::Core for Runtime { fn version() -> RuntimeVersion { VERSION From 33942afb6171ca7b68830380cefef14dd580cd88 Mon Sep 17 00:00:00 2001 From: aeryz Date: Wed, 21 Sep 2022 16:22:42 +0200 Subject: [PATCH 53/57] feat(cosmwasm): add rpc for instantiate Signed-off-by: aeryz --- code/Cargo.lock | 888 ++++++++++++------ code/parachain/frame/cosmwasm/rpc/src/lib.rs | 92 +- .../frame/cosmwasm/runtime-api/Cargo.toml | 1 - .../frame/cosmwasm/runtime-api/src/lib.rs | 27 +- code/parachain/frame/cosmwasm/src/lib.rs | 58 +- code/parachain/runtime/dali/src/lib.rs | 35 +- .../cosmwasm/contracts/interpreter/Cargo.toml | 2 +- .../xcvm/cosmwasm/contracts/router/Cargo.toml | 2 +- 8 files changed, 748 insertions(+), 357 deletions(-) diff --git a/code/Cargo.lock b/code/Cargo.lock index dbcc0aebd42..92e37ae64e1 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -162,9 +162,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7" +checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" [[package]] name = "approx" @@ -248,7 +248,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" dependencies = [ "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -457,7 +457,7 @@ checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -676,7 +676,7 @@ dependencies = [ "sp-runtime", "sp-std", "subxt-codegen 0.23.0", - "syn 1.0.99", + "syn 1.0.100", "tokio", ] @@ -723,7 +723,7 @@ dependencies = [ "serde_json", "sha2 0.9.9", "tungstenite 0.15.0", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -793,7 +793,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -854,7 +854,7 @@ dependencies = [ "cc", "cfg-if 1.0.0", "constant_time_eq", - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -937,7 +937,7 @@ dependencies = [ "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", "proc-macro2 1.0.43", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -948,7 +948,7 @@ checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -959,7 +959,7 @@ checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -1097,7 +1097,7 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.13", + "semver 1.0.14", "serde", "serde_json", ] @@ -1247,9 +1247,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.20" +version = "3.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b71c3ce99b7611011217b366d923f1d0a7e07a92bb2dbf1e84508c673ca3bd" +checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" dependencies = [ "atty", "bitflags", @@ -1259,7 +1259,7 @@ dependencies = [ "once_cell", "strsim 0.10.0", "termcolor", - "textwrap 0.15.0", + "textwrap 0.15.1", ] [[package]] @@ -1272,7 +1272,7 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -1447,9 +1447,11 @@ version = "2.3.2" dependencies = [ "assets-rpc", "assets-runtime-api", - "clap 3.2.20", + "clap 3.2.22", "common", "composable-runtime", + "cosmwasm-rpc", + "cosmwasm-runtime-api", "crowdloan-rewards-rpc", "crowdloan-rewards-runtime-api", "cumulus-client-cli", @@ -1722,7 +1724,7 @@ dependencies = [ "base64 0.13.0", "hkdf", "hmac 0.10.1", - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", "rand 0.8.5", "sha2 0.9.9", "time 0.2.27", @@ -1791,6 +1793,28 @@ dependencies = [ "memchr", ] +[[package]] +name = "cosmwasm-crypto" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb0afef2325df81aadbf9be1233f522ed8f6e91df870c764bc44cca2b1415bd" +dependencies = [ + "digest 0.9.0", + "ed25519-zebra", + "k256", + "rand_core 0.6.4", + "thiserror", +] + +[[package]] +name = "cosmwasm-derive" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81b4676a316d3e4636f658d2d3aba9b4b30c3177e311bbda721b56d4a26342f" +dependencies = [ + "syn 1.0.100", +] + [[package]] name = "cosmwasm-minimal-std" version = "0.1.0" @@ -1801,6 +1825,84 @@ dependencies = [ "serde_json", ] +[[package]] +name = "cosmwasm-rpc" +version = "0.0.1" +dependencies = [ + "composable-support", + "composable-traits", + "cosmwasm-runtime-api", + "jsonrpsee 0.14.0", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-blockchain", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "cosmwasm-runtime-api" +version = "0.0.1" +dependencies = [ + "composable-support", + "composable-traits", + "parity-scale-codec", + "sp-api", + "sp-std", +] + +[[package]] +name = "cosmwasm-schema" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88917b0e7c987fd99251f8bb7e06da7d705e7572e0732428b72f8bc1f17b1af5" +dependencies = [ + "cosmwasm-schema-derive", + "schemars", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03bd1495b8bc0130529dad7e69bef8d800654b50a5d5fc150f1e795c4c24c5b4" +dependencies = [ + "proc-macro2 1.0.43", + "quote 1.0.21", + "syn 1.0.100", +] + +[[package]] +name = "cosmwasm-std" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875994993c2082a6fcd406937bf0fca21c349e4a624f3810253a14fa83a3a195" +dependencies = [ + "base64 0.13.0", + "cosmwasm-crypto", + "cosmwasm-derive", + "forward_ref", + "schemars", + "serde", + "serde-json-wasm", + "thiserror", + "uint", +] + +[[package]] +name = "cosmwasm-storage" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d18403b07304d15d304dad11040d45bbcaf78d603b4be3fb5e2685c16f9229b5" +dependencies = [ + "cosmwasm-std", + "serde", +] + [[package]] name = "cosmwasm-vm" version = "0.1.0" @@ -2060,7 +2162,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" dependencies = [ "generic-array 0.14.6", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -2112,7 +2214,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdffe87e1d521a10f9696f833fe502293ea446d7f256c06128293a4119bdf4cb" dependencies = [ "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -2149,14 +2251,14 @@ name = "cumulus-client-cli" version = "0.1.0" source = "git+https://github.com/ComposableFi/cumulus?rev=f730e6747be173e2d4609381edc7929c8671f4d8#f730e6747be173e2d4609381edc7929c8671f4d8" dependencies = [ - "clap 3.2.20", + "clap 3.2.22", "parity-scale-codec", "sc-chain-spec", "sc-cli", "sc-service", "sp-core", "sp-runtime", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -2384,7 +2486,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -2602,7 +2704,7 @@ dependencies = [ "sp-storage", "tokio", "tracing", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -2652,7 +2754,7 @@ checksum = "4033478fbf70d6acf2655ac70da91ee65852d69daf7a67bf7a2f518fb47aafcf" dependencies = [ "byteorder", "digest 0.9.0", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", "zeroize", ] @@ -2665,7 +2767,7 @@ checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" dependencies = [ "byteorder", "digest 0.9.0", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle-ng", "zeroize", ] @@ -2676,6 +2778,60 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" +[[package]] +name = "cw-multi-test" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f9a8ab7c3c29ec93cb7a39ce4b14a05e053153b4a17ef7cf2246af1b7c087e" +dependencies = [ + "anyhow", + "cosmwasm-std", + "cosmwasm-storage", + "cw-storage-plus", + "cw-utils", + "derivative", + "itertools", + "prost 0.9.0", + "schemars", + "serde", + "thiserror", +] + +[[package]] +name = "cw-storage-plus" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "648b1507290bbc03a8d88463d7cd9b04b1fa0155e5eef366c4fa052b9caaac7a" +dependencies = [ + "cosmwasm-std", + "schemars", + "serde", +] + +[[package]] +name = "cw-utils" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dbaecb78c8e8abfd6b4258c7f4fbeb5c49a5e45ee4d910d3240ee8e1d714e1b" +dependencies = [ + "cosmwasm-std", + "schemars", + "serde", + "thiserror", +] + +[[package]] +name = "cw20" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cb782b8f110819a4eb5dbbcfed25ffba49ec16bbe32b4ad8da50a5ce68fec05" +dependencies = [ + "cosmwasm-std", + "cw-utils", + "schemars", + "serde", +] + [[package]] name = "dali-runtime" version = "0.1.0" @@ -2684,6 +2840,7 @@ dependencies = [ "common", "composable-support", "composable-traits", + "cosmwasm-runtime-api", "crowdloan-rewards-runtime-api", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -2807,7 +2964,7 @@ dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", "strsim 0.10.0", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -2818,7 +2975,7 @@ checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5" dependencies = [ "darling_core", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -2844,7 +3001,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" dependencies = [ "data-encoding", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -2864,7 +3021,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -2877,7 +3034,7 @@ dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", "rustc_version 0.4.0", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -2900,9 +3057,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -3027,7 +3184,7 @@ checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3065,7 +3222,7 @@ checksum = "758e2a0cd8a6cdf483e1d369e7d081647e00b88d8953e34d8f2cbba05ae28368" dependencies = [ "curve25519-dalek-ng", "hex", - "rand_core 0.6.3", + "rand_core 0.6.4", "sha2 0.9.9", "zeroize", ] @@ -3084,6 +3241,21 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ed25519-zebra" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403ef3e961ab98f0ba902771d29f842058578bb1ce7e3c59dad5a6a93e784c69" +dependencies = [ + "curve25519-dalek 3.2.0", + "hex", + "rand_core 0.6.4", + "serde", + "sha2 0.9.9", + "thiserror", + "zeroize", +] + [[package]] name = "either" version = "1.8.0" @@ -3102,7 +3274,7 @@ dependencies = [ "ff", "generic-array 0.14.6", "group", - "rand_core 0.6.3", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -3126,7 +3298,7 @@ dependencies = [ "heck 0.4.0", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3152,7 +3324,7 @@ checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3163,14 +3335,14 @@ checksum = "038b1afa59052df211f9efd58f8b1d84c242935ede1c3dbaed26b018a9e06ae2" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" dependencies = [ "atty", "humantime", @@ -3261,7 +3433,7 @@ dependencies = [ "fs-err", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3316,7 +3488,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", "thiserror", ] @@ -3351,7 +3523,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] @@ -3506,14 +3678,19 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "matches", - "percent-encoding 2.1.0", + "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 = "frame-benchmarking" version = "4.0.0-dev" @@ -3543,7 +3720,7 @@ source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e9 dependencies = [ "Inflector", "chrono", - "clap 3.2.20", + "clap 3.2.22", "comfy-table", "frame-benchmarking", "frame-support", @@ -3595,7 +3772,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3681,7 +3858,7 @@ dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3693,7 +3870,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3703,7 +3880,7 @@ source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e9 dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -3919,7 +4096,7 @@ checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -4113,7 +4290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" dependencies = [ "ff", - "rand_core 0.6.3", + "rand_core 0.6.4", "subtle", ] @@ -4134,7 +4311,7 @@ checksum = "729f9bd3449d77e7831a18abfb7ba2f99ee813dfd15b8c2167c9a54ba20aa99d" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -4152,7 +4329,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.3", + "tokio-util 0.7.4", "tracing", ] @@ -4167,9 +4344,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.3" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360d9740069b2f6cbb63ce2dbaa71a20d3185350cbb990d7bebeb9318415eb17" +checksum = "56b224eaa4987c03c30b251de7ef0c15a6a59f34222905850dbc3026dfb24d5f" dependencies = [ "log 0.4.17", "pest", @@ -4225,7 +4402,7 @@ dependencies = [ "http", "httpdate", "mime 0.3.16", - "sha1 0.10.4", + "sha1 0.10.5", ] [[package]] @@ -4394,7 +4571,7 @@ dependencies = [ "serde_json", "serde_qs", "serde_urlencoded", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -4489,9 +4666,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.47" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c495f162af0bf17656d0014a0eded5f3cd2f365fdd204548c2869db89359dc7" +checksum = "237a0714f28b1ee39ccec0770ccb544eb02c9ef2c82bb096230eefcffa6468b0" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -4518,15 +4695,15 @@ dependencies = [ "parity-scale-codec", "primitive-types", "primitives 0.1.0 (git+https://github.com/ComposableFi/beefy-rs?rev=ea3c74c7c1f959ba1b90e2508b1b6c1fd9afc7ee)", - "prost", + "prost 0.10.4", "prost-types", "ripemd", "safe-regex", "serde", "serde_derive", "serde_json", - "sha2 0.10.5", - "sha3 0.10.4", + "sha2 0.10.6", + "sha3 0.10.5", "sp-core", "sp-io", "sp-mmr-primitives", @@ -4553,8 +4730,8 @@ dependencies = [ "ripemd", "scale-info", "serde", - "sha2 0.10.5", - "sha3 0.10.4", + "sha2 0.10.6", + "sha3 0.10.5", "sp-core", "sp-io", "sp-runtime", @@ -4570,7 +4747,7 @@ source = "git+https://github.com/ComposableFi/ibc-rs?rev=13de07663749a59a424d67b dependencies = [ "base64 0.13.0", "bytes 1.2.1", - "prost", + "prost 0.10.4", "prost-types", "serde", "tendermint-proto", @@ -4658,7 +4835,7 @@ dependencies = [ "anyhow", "bytes 1.2.1", "hex", - "prost", + "prost 0.10.4", "ripemd160", "sha2 0.9.9", "sha3 0.9.1", @@ -4693,6 +4870,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "if-addrs" version = "0.7.0" @@ -4762,7 +4949,7 @@ checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -4865,9 +5052,9 @@ checksum = "357376465c37db3372ef6a00585d336ed3d0f11d4345eef77ebcb05865392b21" [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] @@ -4901,9 +5088,9 @@ checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b" [[package]] name = "js-sys" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] @@ -5024,7 +5211,7 @@ dependencies = [ "thiserror", "tokio", "tokio-rustls", - "tokio-util 0.7.3", + "tokio-util 0.7.4", "tracing", "webpki-roots", ] @@ -5045,7 +5232,7 @@ dependencies = [ "thiserror", "tokio", "tokio-rustls", - "tokio-util 0.7.3", + "tokio-util 0.7.4", "tracing", "webpki-roots", ] @@ -5066,7 +5253,7 @@ dependencies = [ "thiserror", "tokio", "tokio-rustls", - "tokio-util 0.7.3", + "tokio-util 0.7.4", "tracing", "webpki-roots", ] @@ -5231,7 +5418,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -5243,7 +5430,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -5327,7 +5514,7 @@ dependencies = [ "soketto", "tokio", "tokio-stream", - "tokio-util 0.7.3", + "tokio-util 0.7.4", "tracing", ] @@ -5341,6 +5528,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "sec1", + "sha2 0.9.9", ] [[package]] @@ -5558,9 +5746,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.132" +version = "0.2.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" [[package]] name = "libloading" @@ -5646,7 +5834,7 @@ dependencies = [ "libp2p-request-response", "libp2p-swarm", "log 0.4.17", - "prost", + "prost 0.10.4", "prost-build", "rand 0.8.5", ] @@ -5673,12 +5861,12 @@ dependencies = [ "multistream-select", "parking_lot 0.12.1", "pin-project", - "prost", + "prost 0.10.4", "prost-build", "rand 0.8.5", "ring", "rw-stream-sink", - "sha2 0.10.5", + "sha2 0.10.6", "smallvec 1.9.0", "thiserror", "unsigned-varint", @@ -5724,7 +5912,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log 0.4.17", - "prost", + "prost 0.10.4", "prost-build", "rand 0.7.3", "smallvec 1.9.0", @@ -5748,11 +5936,11 @@ dependencies = [ "libp2p-swarm", "log 0.4.17", "prometheus-client", - "prost", + "prost 0.10.4", "prost-build", "rand 0.7.3", "regex", - "sha2 0.10.5", + "sha2 0.10.6", "smallvec 1.9.0", "unsigned-varint", "wasm-timer", @@ -5771,7 +5959,7 @@ dependencies = [ "libp2p-swarm", "log 0.4.17", "lru 0.7.8", - "prost", + "prost 0.10.4", "prost-build", "prost-codec", "smallvec 1.9.0", @@ -5796,10 +5984,10 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log 0.4.17", - "prost", + "prost 0.10.4", "prost-build", "rand 0.7.3", - "sha2 0.10.5", + "sha2 0.10.6", "smallvec 1.9.0", "thiserror", "uint", @@ -5874,10 +6062,10 @@ dependencies = [ "lazy_static", "libp2p-core", "log 0.4.17", - "prost", + "prost 0.10.4", "prost-build", "rand 0.8.5", - "sha2 0.10.5", + "sha2 0.10.6", "snow", "static_assertions", "x25519-dalek", @@ -5911,7 +6099,7 @@ dependencies = [ "futures 0.3.24", "libp2p-core", "log 0.4.17", - "prost", + "prost 0.10.4", "prost-build", "unsigned-varint", "void", @@ -5947,7 +6135,7 @@ dependencies = [ "libp2p-swarm", "log 0.4.17", "pin-project", - "prost", + "prost 0.10.4", "prost-build", "prost-codec", "rand 0.8.5", @@ -5971,10 +6159,10 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log 0.4.17", - "prost", + "prost 0.10.4", "prost-build", "rand 0.8.5", - "sha2 0.10.5", + "sha2 0.10.6", "thiserror", "unsigned-varint", "void", @@ -6025,7 +6213,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f54a64b6957249e0ce782f8abf41d97f69330d02bf229f0672d864f0650cc76" dependencies = [ "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -6086,7 +6274,7 @@ dependencies = [ "quicksink", "rw-stream-sink", "soketto", - "url 2.3.0", + "url 2.3.1", "webpki-roots", ] @@ -6331,9 +6519,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ "autocfg 1.1.0", "scopeguard", @@ -6361,18 +6549,18 @@ dependencies = [ [[package]] name = "lru" -version = "0.6.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea2d928b485416e8908cff2d97d621db22b27f7b3b6729e438bcf42c671ba91" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" dependencies = [ - "hashbrown 0.11.2", + "hashbrown 0.12.3", ] [[package]] name = "lru" -version = "0.7.8" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +checksum = "936d98d2ddd79c18641c6709e7bb09981449694e402d1a0f0f657ea8d61f4a51" dependencies = [ "hashbrown 0.12.3", ] @@ -6497,11 +6685,11 @@ dependencies = [ [[package]] name = "memory-lru" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beeb98b3d1ed2c0054bd81b5ba949a0243c3ccad751d45ea898fa8059fa2860a" +checksum = "ce95ae042940bad7e312857b929ee3d11b8f799a80cb7b9c7ec5125516906395" dependencies = [ - "lru 0.6.6", + "lru 0.8.0", ] [[package]] @@ -6645,11 +6833,11 @@ dependencies = [ "byteorder", "data-encoding", "multihash", - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", "serde", "static_assertions", "unsigned-varint", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -6673,10 +6861,10 @@ dependencies = [ "blake2s_simd", "blake3 1.3.1", "core2", - "digest 0.10.3", + "digest 0.10.5", "multihash-derive", - "sha2 0.10.5", - "sha3 0.10.4", + "sha2 0.10.6", + "sha3 0.10.5", "unsigned-varint", ] @@ -6690,7 +6878,7 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", "synstructure", ] @@ -6758,7 +6946,7 @@ checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -6910,6 +7098,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ + "num-bigint 0.4.3", "num-complex", "num-integer", "num-iter", @@ -6956,7 +7145,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -7066,9 +7255,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "opaque-debug" @@ -7105,7 +7294,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -7154,7 +7343,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -7368,7 +7557,7 @@ dependencies = [ "pallet-timestamp", "parity-scale-codec", "proptest", - "rand_core 0.6.3", + "rand_core 0.6.4", "rustc-hex", "scale-info", "serde", @@ -8055,11 +8244,11 @@ dependencies = [ "parachain-info", "parity-scale-codec", "primitives 0.1.0", - "prost", + "prost 0.10.4", "scale-info", "serde", "serde_json", - "sha2 0.10.5", + "sha2 0.10.6", "simple-iavl", "sp-core", "sp-io", @@ -8633,7 +8822,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -8979,9 +9168,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.1.5" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9182e4a71cae089267ab03e67c99368db7cd877baf50f931e5d6d4b71e195ac0" +checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -9000,7 +9189,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -9032,7 +9221,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" dependencies = [ "proc-macro2 1.0.43", - "syn 1.0.99", + "syn 1.0.100", "synstructure", ] @@ -9081,7 +9270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api 0.4.8", + "lock_api 0.4.9", "parking_lot_core 0.8.5", ] @@ -9091,7 +9280,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api 0.4.8", + "lock_api 0.4.9", "parking_lot_core 0.9.3", ] @@ -9240,15 +9429,15 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0560d531d1febc25a3c9398a62a71256c0178f2e3443baedd9ad4bb8c9deb4" +checksum = "cb779fcf4bb850fbbb0edc96ff6cf34fd90c4b1a112ce042653280d9a7364048" dependencies = [ "thiserror", "ucd-trie", @@ -9256,9 +9445,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "905708f7f674518498c1f8d644481440f476d39ca6ecae83319bba7c6c12da91" +checksum = "502b62a6d0245378b04ffe0a7fb4f4419a4815fce813bd8a0ec89a56e07d67b1" dependencies = [ "pest", "pest_generator", @@ -9266,26 +9455,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5803d8284a629cc999094ecd630f55e91b561a1d1ba75e233b00ae13b91a69ad" +checksum = "451e629bf49b750254da26132f1a5a9d11fd8a95a3df51d15c4abd1ba154cb6c" dependencies = [ "pest", "pest_meta", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] name = "pest_meta" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1538eb784f07615c6d9a8ab061089c6c54a344c5b4301db51990ca1c241e8c04" +checksum = "bcec162c71c45e269dfc3fc2916eaeb97feab22993a21bcce4721d08cd7801a6" dependencies = [ "once_cell", "pest", - "sha-1 0.10.0", + "sha1 0.10.5", ] [[package]] @@ -9405,7 +9594,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -9451,9 +9640,9 @@ checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" [[package]] name = "plotters" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "716b4eeb6c4a1d3ecc956f75b43ec2e8e8ba80026413e70a3f41fd3313d3492b" +checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97" dependencies = [ "chrono", "font-kit", @@ -9585,7 +9774,7 @@ name = "polkadot-cli" version = "0.9.27" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.27#b017bad50d360a1c6e3cdf9652bdb85e5f479fea" dependencies = [ - "clap 3.2.20", + "clap 3.2.22", "frame-benchmarking-cli", "futures 0.3.24", "log 0.4.17", @@ -10687,7 +10876,7 @@ version = "0.1.0" dependencies = [ "binance", "chrono", - "clap 3.2.20", + "clap 3.2.22", "custom_derive", "enum_derive", "env_logger", @@ -10796,7 +10985,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", "version_check 0.9.4", ] @@ -10837,9 +11026,9 @@ dependencies = [ [[package]] name = "prometheus" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cface98dfa6d645ea4c789839f176e4b072265d085bfcc48eaa8d137f58d3c39" +checksum = "45c8babc29389186697fe5a2a4859d697825496b83db5d0b65271cdc0488e88c" dependencies = [ "cfg-if 1.0.0", "fnv", @@ -10869,7 +11058,7 @@ checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -10903,6 +11092,16 @@ dependencies = [ "syn 0.15.44", ] +[[package]] +name = "prost" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +dependencies = [ + "bytes 1.2.1", + "prost-derive 0.9.0", +] + [[package]] name = "prost" version = "0.10.4" @@ -10910,7 +11109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" dependencies = [ "bytes 1.2.1", - "prost-derive", + "prost-derive 0.10.1", ] [[package]] @@ -10928,7 +11127,7 @@ dependencies = [ "log 0.4.17", "multimap", "petgraph", - "prost", + "prost 0.10.4", "prost-types", "regex", "tempfile", @@ -10943,11 +11142,24 @@ checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" dependencies = [ "asynchronous-codec", "bytes 1.2.1", - "prost", + "prost 0.10.4", "thiserror", "unsigned-varint", ] +[[package]] +name = "prost-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2 1.0.43", + "quote 1.0.21", + "syn 1.0.100", +] + [[package]] name = "prost-derive" version = "0.10.1" @@ -10958,7 +11170,7 @@ dependencies = [ "itertools", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -10968,7 +11180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" dependencies = [ "bytes 1.2.1", - "prost", + "prost 0.10.4", ] [[package]] @@ -11068,7 +11280,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -11098,7 +11310,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -11127,9 +11339,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom 0.2.7", ] @@ -11221,7 +11433,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -11239,7 +11451,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -11337,7 +11549,7 @@ checksum = "5234cd6063258a5e32903b53b1b6ac043a0541c8adc1f610f67b0326c7a578fa" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -11418,9 +11630,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.11" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" dependencies = [ "base64 0.13.0", "bytes 1.2.1", @@ -11434,11 +11646,11 @@ dependencies = [ "hyper-tls", "ipnet", "js-sys", - "lazy_static", "log 0.4.17", "mime 0.3.16", "native-tls", - "percent-encoding 2.1.0", + "once_cell", + "percent-encoding 2.2.0", "pin-project-lite 0.2.9", "serde", "serde_json", @@ -11446,7 +11658,7 @@ dependencies = [ "tokio", "tokio-native-tls", "tower-service", - "url 2.3.0", + "url 2.3.1", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -11497,11 +11709,11 @@ dependencies = [ [[package]] name = "ripemd" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1facec54cb5e0dc08553501fa740091086d0259ad0067e0d4103448e4cb22ed3" +checksum = "74e2ee464e763f6527991a6d532142e3c2016eb9907cc081401c11862c26a840" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -11633,7 +11845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a632a43487c1332be8e183588079f89b6820fab24e04db49521eacd536837372" dependencies = [ "micromath", - "sha2 0.10.5", + "sha2 0.10.6", ] [[package]] @@ -11703,7 +11915,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.13", + "semver 1.0.14", ] [[package]] @@ -11817,7 +12029,7 @@ version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "814c536dcd27acf03296c618dab7ad62d28e70abd7ba41d3f34a2ce707a2c666" dependencies = [ - "unicode-xid 0.2.3", + "unicode-xid 0.2.4", ] [[package]] @@ -11905,7 +12117,7 @@ dependencies = [ "libp2p", "log 0.4.17", "parity-scale-codec", - "prost", + "prost 0.10.4", "prost-build", "rand 0.7.3", "sc-client-api", @@ -11984,7 +12196,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -11993,7 +12205,7 @@ version = "0.10.0-dev" source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" dependencies = [ "chrono", - "clap 3.2.20", + "clap 3.2.22", "fdlimit", "futures 0.3.24", "hex", @@ -12478,7 +12690,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "prost", + "prost 0.10.4", "prost-build", "rand 0.7.3", "sc-block-builder", @@ -12546,7 +12758,7 @@ dependencies = [ "libp2p", "log 0.4.17", "parity-scale-codec", - "prost", + "prost 0.10.4", "prost-build", "sc-client-api", "sc-network-common", @@ -12568,7 +12780,7 @@ dependencies = [ "log 0.4.17", "lru 0.7.8", "parity-scale-codec", - "prost", + "prost 0.10.4", "prost-build", "sc-client-api", "sc-consensus", @@ -12876,7 +13088,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -12934,9 +13146,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" +checksum = "333af15b02563b8182cd863f925bd31ef8fa86a0e095d30c091956057d436153" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -12948,14 +13160,14 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" +checksum = "53f56acbd0743d29ffa08f911ab5397def774ad01bab3786804cf6ee057fb5e1" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -12989,7 +13201,7 @@ dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", "serde_derive_internals", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -13124,9 +13336,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" dependencies = [ "serde", ] @@ -13155,6 +13367,14 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-json-wasm" +version = "0.4.1" +source = "git+https://github.com/hussein-aitlahcen/serde-json-wasm?rev=1608a13d2a2ba90605d9626a51ff6667aca5a2d6#1608a13d2a2ba90605d9626a51ff6667aca5a2d6" +dependencies = [ + "serde", +] + [[package]] name = "serde_bytes" version = "0.11.7" @@ -13172,7 +13392,7 @@ checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -13183,7 +13403,7 @@ checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -13221,7 +13441,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" dependencies = [ - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", "serde", "thiserror", ] @@ -13234,7 +13454,7 @@ checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -13262,17 +13482,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "sha-1" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.10.3", -] - [[package]] name = "sha1" version = "0.6.1" @@ -13284,13 +13493,13 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006769ba83e921b3085caa8334186b00cf92b4cb1a6cf4632fbccc8eff5c7549" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -13326,13 +13535,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9db03534dff993187064c4e0c05a5708d2a9728ace9a8959b77bedf415dac5" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.3", + "digest 0.10.5", ] [[package]] @@ -13349,11 +13558,11 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaedf34ed289ea47c2b741bb72e5357a209512d67bcd4bda44359e5bf0470f56" +checksum = "e2904bea16a1ae962b483322a1c7b81d976029203aea1f461e51cd7705db7ba9" dependencies = [ - "digest 0.10.3", + "digest 0.10.5", "keccak", ] @@ -13410,7 +13619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" dependencies = [ "digest 0.9.0", - "rand_core 0.6.3", + "rand_core 0.6.4", ] [[package]] @@ -13510,7 +13719,7 @@ source = "git+https://github.com/ComposableFi/simple-avl?rev=452a1126bfb8a861354 dependencies = [ "bytes 1.2.1", "ics23", - "sha2 0.10.5", + "sha2 0.10.6", "tendermint", ] @@ -13608,10 +13817,10 @@ dependencies = [ "blake2", "chacha20poly1305", "curve25519-dalek 4.0.0-pre.1", - "rand_core 0.6.3", + "rand_core 0.6.4", "ring", "rustc_version 0.4.0", - "sha2 0.10.5", + "sha2 0.10.6", "subtle", ] @@ -13638,7 +13847,7 @@ dependencies = [ "httparse", "log 0.4.17", "rand 0.8.5", - "sha-1 0.9.8", + "sha-1", ] [[package]] @@ -13667,7 +13876,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -13893,9 +14102,9 @@ source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e9 dependencies = [ "blake2", "byteorder", - "digest 0.10.3", - "sha2 0.10.5", - "sha3 0.10.4", + "digest 0.10.5", + "sha2 0.10.6", + "sha3 0.10.5", "sp-std", "twox-hash", ] @@ -13908,7 +14117,7 @@ dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", "sp-core-hashing", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -13927,7 +14136,7 @@ source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e9 dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14142,7 +14351,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14340,7 +14549,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14374,9 +14583,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.28.0" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c8a1e645fa0bd3e81a90e592a677f7ada3182ac338c4a71cd9ec0ba911f6abb" +checksum = "b0837b5d62f42082c9d56cd946495ae273a3c68083b637b9153341d5e465146d" dependencies = [ "Inflector", "num-format", @@ -14384,7 +14593,7 @@ dependencies = [ "quote 1.0.21", "serde", "serde_json", - "unicode-xid 0.2.3", + "unicode-xid 0.2.4", ] [[package]] @@ -14496,7 +14705,7 @@ dependencies = [ "memchr", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14536,7 +14745,7 @@ dependencies = [ "quote 1.0.21", "serde", "serde_derive", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14552,7 +14761,7 @@ dependencies = [ "serde_derive", "serde_json", "sha1 0.6.1", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14594,7 +14803,7 @@ dependencies = [ "proc-macro-error", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14616,7 +14825,7 @@ dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", "rustversion", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14680,7 +14889,7 @@ version = "0.1.0" source = "git+https://github.com/polytope-labs/substrate-simnode?branch=polkadot-v0.9.27#a7bae3e69784a81d29ccc47afe6d367adc2b3936" dependencies = [ "anyhow", - "clap 3.2.20", + "clap 3.2.22", "cumulus-pallet-parachain-system", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", @@ -14854,7 +15063,7 @@ dependencies = [ "quote 1.0.21", "scale-info", "subxt-metadata 0.21.0", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14872,7 +15081,7 @@ dependencies = [ "quote 1.0.21", "scale-info", "subxt-metadata 0.22.0", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14889,7 +15098,7 @@ dependencies = [ "quote 1.0.21", "scale-info", "subxt-metadata 0.23.0", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14900,7 +15109,7 @@ dependencies = [ "darling", "proc-macro-error", "subxt-codegen 0.21.0", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14912,7 +15121,7 @@ dependencies = [ "darling", "proc-macro-error", "subxt-codegen 0.22.0", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -14971,9 +15180,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", @@ -14988,8 +15197,8 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", - "unicode-xid 0.2.3", + "syn 1.0.100", + "unicode-xid 0.2.4", ] [[package]] @@ -15052,13 +15261,13 @@ dependencies = [ "futures 0.3.24", "num-traits", "once_cell", - "prost", + "prost 0.10.4", "prost-types", "serde", "serde_bytes", "serde_json", "serde_repr", - "sha2 0.10.5", + "sha2 0.10.6", "signature", "subtle", "subtle-encoding", @@ -15077,7 +15286,7 @@ dependencies = [ "serde_json", "tendermint", "toml", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -15101,7 +15310,7 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost", + "prost 0.10.4", "prost-types", "serde", "serde_bytes", @@ -15129,7 +15338,7 @@ dependencies = [ "tendermint-proto", "thiserror", "time 0.3.14", - "url 2.3.0", + "url 2.3.1", "uuid", "walkdir", ] @@ -15169,28 +15378,28 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" [[package]] name = "thiserror" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1b05ca9d106ba7d2e31a9dab4a64e7be2cce415321966ea3132c49a656e252" +checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8f2591983642de85c921015f3f070c665a197ed69e417af436115e3a1407487" +checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -15327,7 +15536,7 @@ dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", "standback", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -15366,9 +15575,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.0" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89797afd69d206ccd11fb0ea560a44bbb87731d020670e79416d442919257d42" +checksum = "0020c875007ad96677dcc890298f4b942882c5d4eb7cc8f439fc3bf813dc9c95" dependencies = [ "autocfg 1.1.0", "bytes 1.2.1", @@ -15425,7 +15634,7 @@ checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -15470,9 +15679,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" +checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af" dependencies = [ "futures-core", "pin-project-lite 0.2.9", @@ -15543,9 +15752,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ "bytes 1.2.1", "futures-core", @@ -15592,7 +15801,7 @@ checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -15645,7 +15854,7 @@ dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -15752,7 +15961,7 @@ dependencies = [ "smallvec 1.9.0", "thiserror", "tinyvec", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -15785,7 +15994,7 @@ name = "try-runtime-cli" version = "0.10.0-dev" source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" dependencies = [ - "clap 3.2.20", + "clap 3.2.22", "jsonrpsee 0.14.0", "log 0.4.17", "parity-scale-codec", @@ -15830,9 +16039,9 @@ dependencies = [ "httparse", "log 0.4.17", "rand 0.8.5", - "sha-1 0.9.8", + "sha-1", "thiserror", - "url 2.3.0", + "url 2.3.1", "utf-8", ] @@ -15850,9 +16059,9 @@ dependencies = [ "log 0.4.17", "native-tls", "rand 0.8.5", - "sha-1 0.9.8", + "sha-1", "thiserror", - "url 2.3.0", + "url 2.3.1", "utf-8", ] @@ -15872,7 +16081,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 1.0.0", - "digest 0.10.3", + "digest 0.10.5", "rand 0.8.5", "static_assertions", ] @@ -15897,9 +16106,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "uint" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" +checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" dependencies = [ "byteorder", "crunchy", @@ -15933,30 +16142,30 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" [[package]] name = "unicode-normalization" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unicode-xid" @@ -15966,9 +16175,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unicode-xid" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "universal-hash" @@ -16011,13 +16220,13 @@ dependencies = [ [[package]] name = "url" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fe195a4f217c25b25cb5058ced57059824a678474874038dc88d211bf508d3" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", - "idna 0.2.3", - "percent-encoding 2.1.0", + "idna 0.3.0", + "percent-encoding 2.2.0", "serde", ] @@ -16149,7 +16358,7 @@ dependencies = [ "mime 0.3.16", "mime_guess", "multipart", - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", "pin-project", "scoped-tls", "serde", @@ -16183,9 +16392,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if 1.0.0", "serde", @@ -16195,24 +16404,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", "log 0.4.17", "once_cell", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.32" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -16222,9 +16431,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote 1.0.21", "wasm-bindgen-macro-support", @@ -16232,22 +16441,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "wasm-gc-api" @@ -16282,7 +16491,7 @@ dependencies = [ name = "wasm-optimizer" version = "0.1.0" dependencies = [ - "clap 3.2.20", + "clap 3.2.22", "sp-maybe-compressed-blob", "wasm-gc-api", ] @@ -16316,6 +16525,7 @@ dependencies = [ "num-traits", "parity-wasm 0.42.2", "wasmi-validation 0.4.0", + "wasmi-validation 0.4.1", ] [[package]] @@ -16536,9 +16746,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" dependencies = [ "js-sys", "wasm-bindgen", @@ -17008,7 +17218,7 @@ dependencies = [ "Inflector", "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", ] [[package]] @@ -17016,7 +17226,7 @@ name = "xcmp" version = "0.1.0" dependencies = [ "base58", - "clap 3.2.20", + "clap 3.2.22", "env_logger", "hex", "parity-scale-codec", @@ -17030,6 +17240,20 @@ dependencies = [ "tokio", ] +[[package]] +name = "xcvm-asset-registry" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-storage", + "cw-multi-test", + "cw-storage-plus", + "schemars", + "serde", + "thiserror", +] + [[package]] name = "xcvm-core" version = "0.1.0" @@ -17042,6 +17266,46 @@ dependencies = [ "serde", ] +[[package]] +name = "xcvm-interpreter" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-storage", + "cw-multi-test", + "cw-storage-plus", + "cw20", + "num", + "schemars", + "serde", + "serde-json-wasm", + "serde_json", + "thiserror", + "xcvm-asset-registry", + "xcvm-core", +] + +[[package]] +name = "xcvm-router" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-storage", + "cw-multi-test", + "cw-storage-plus", + "cw20", + "hex", + "schemars", + "serde", + "serde-json-wasm", + "thiserror", + "xcvm-asset-registry", + "xcvm-core", + "xcvm-interpreter", +] + [[package]] name = "yamux" version = "0.10.2" @@ -17085,7 +17349,7 @@ checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", - "syn 1.0.99", + "syn 1.0.100", "synstructure", ] diff --git a/code/parachain/frame/cosmwasm/rpc/src/lib.rs b/code/parachain/frame/cosmwasm/rpc/src/lib.rs index 4d4a47a97dd..086fe906df8 100644 --- a/code/parachain/frame/cosmwasm/rpc/src/lib.rs +++ b/code/parachain/frame/cosmwasm/rpc/src/lib.rs @@ -1,5 +1,4 @@ use codec::Codec; -use composable_support::rpc_helpers::SafeRpcWrapper; use core::{fmt::Display, str::FromStr}; use cosmwasm_runtime_api::CosmwasmRuntimeApi; use jsonrpsee::{ @@ -10,21 +9,37 @@ use jsonrpsee::{ use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; -use sp_std::sync::Arc; +use sp_std::{cmp::Ord, collections::btree_map::BTreeMap, sync::Arc}; #[rpc(client, server)] -pub trait CosmwasmApi +pub trait CosmwasmApi where AccountId: FromStr + Display, + AssetId: FromStr + Display + Ord, + Balance: FromStr + Display, { #[method(name = "cosmwasm_query")] fn query( &self, - contract: SafeRpcWrapper, - gas: SafeRpcWrapper, - query_request: QueryRequest, + contract: AccountId, + gas: u64, + query_request: Vec, at: Option, - ) -> RpcResult; + ) -> RpcResult>; + + #[method(name = "cosmwasm_instantiate")] + fn instantiate( + &self, + instantiator: AccountId, + code_id: u64, + salt: Vec, + admin: Option, + label: Vec, + funds: BTreeMap, + gas: u64, + message: Vec, + at: Option, + ) -> RpcResult; } pub struct Cosmwasm { @@ -38,35 +53,62 @@ impl Cosmwasm { } } -impl - CosmwasmApiServer<::Hash, AccountId, QueryRequest, Binary> - for Cosmwasm +fn runtime_error_into_rpc_error(e: impl Display) -> RpcError { + RpcError::Call(CallError::Custom(ErrorObject::owned( + 9876, // no real reason for this value + format!("{}", e), + None::<()>, + ))) +} + +impl + CosmwasmApiServer<::Hash, AccountId, AssetId, Balance, Error> + for Cosmwasm where Block: BlockT, AccountId: Send + Sync + 'static + Codec + FromStr + Display, - QueryRequest: Send + Sync + 'static + Codec, - Binary: Send + Sync + 'static + Codec, + AssetId: Send + Sync + 'static + Codec + FromStr + Display + Ord, + Balance: Send + Sync + 'static + Codec + FromStr + Display, + Error: Send + Sync + 'static + Codec + AsRef<[u8]>, C: Send + Sync + 'static, C: ProvideRuntimeApi, C: HeaderBackend, - C::Api: CosmwasmRuntimeApi, + C::Api: CosmwasmRuntimeApi, { fn query( &self, - contract: SafeRpcWrapper, - gas: SafeRpcWrapper, - query_request: QueryRequest, + contract: AccountId, + gas: u64, + query_request: Vec, + at: Option<::Hash>, + ) -> RpcResult> { + let api = self.client.runtime_api(); + let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); + let runtime_api_result = api + .query(&at, contract, gas, query_request) + .map_err(runtime_error_into_rpc_error)?; + runtime_api_result + .map_err(|e| runtime_error_into_rpc_error(String::from_utf8_lossy(e.as_ref()))) + } + + fn instantiate( + &self, + instantiator: AccountId, + code_id: u64, + salt: Vec, + admin: Option, + label: Vec, + funds: BTreeMap, + gas: u64, + message: Vec, at: Option<::Hash>, - ) -> RpcResult { + ) -> RpcResult { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); - let runtime_api_result = api.query(&at, contract.0, gas.0, query_request); - runtime_api_result.map_err(|e| { - RpcError::Call(CallError::Custom(ErrorObject::owned( - 9876, - "Something wrong", - Some(format!("{:?}", e)), - ))) - }) + let runtime_api_result = api + .instantiate(&at, instantiator, code_id, salt, admin, label, funds, gas, message) + .map_err(runtime_error_into_rpc_error)?; + runtime_api_result + .map_err(|e| runtime_error_into_rpc_error(String::from_utf8_lossy(e.as_ref()))) } } diff --git a/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml b/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml index a58391d4235..aac9d8900dc 100644 --- a/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml +++ b/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml @@ -18,7 +18,6 @@ composable-traits = { path = "../../composable-traits", default-features = false sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } - # REVIEW: Does the runtime API need features? [features] default = ["std"] diff --git a/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs b/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs index 339af3fd6e3..3d7a998ad2a 100644 --- a/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs +++ b/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs @@ -3,20 +3,35 @@ #![allow(clippy::unnecessary_mut_passed)] use codec::Codec; +use sp_std::collections::btree_map::BTreeMap; +#[cfg(not(feature = "std"))] +use sp_std::vec::Vec; -// Pablo Runtime API declaration. Implemented for each runtime at +// Cosmwasm Runtime API declaration. Implemented for each runtime at // `runtime//src/lib.rs`. sp_api::decl_runtime_apis! { - pub trait CosmwasmRuntimeApi + pub trait CosmwasmRuntimeApi where AccountId: Codec, - QueryRequest: Codec, - Binary: Codec, + AssetId: Codec, + Balance: Codec, + Error: Codec { fn query( contract: AccountId, gas: u64, - query_request: QueryRequest, - ) -> Binary; + query_request: Vec, + ) -> Result, Error>; + + fn instantiate( + instantiator: AccountId, + code_id: u64, + salt: Vec, + admin: Option, + label: Vec, + funds: BTreeMap, + gas: u64, + message: Vec, + ) -> Result; } } diff --git a/code/parachain/frame/cosmwasm/src/lib.rs b/code/parachain/frame/cosmwasm/src/lib.rs index dd9db821ad3..e97be6cfd66 100644 --- a/code/parachain/frame/cosmwasm/src/lib.rs +++ b/code/parachain/frame/cosmwasm/src/lib.rs @@ -406,7 +406,8 @@ pub mod pallet { label, funds, message, - ); + ) + .map(|_| ()); Self::refund_gas(outcome, gas, shared.gas.remaining()) } @@ -536,7 +537,7 @@ pub mod pallet { label: ContractLabelOf, funds: FundsOf, message: ContractMessageOf, - ) -> Result<(), CosmwasmVMError> { + ) -> Result, CosmwasmVMError> { let (contract, info) = Self::do_instantiate_phase1( instantiator.clone(), code_id, @@ -545,15 +546,16 @@ pub mod pallet { label, &message, )?; - Self::do_extrinsic_dispatch( + let _ = Self::do_extrinsic_dispatch( shared, EntryPoint::Instantiate, instantiator, - contract, + contract.clone(), info, funds, |vm| cosmwasm_system_entrypoint::(vm, &message), - ) + )?; + Ok(contract) } pub(crate) fn do_extrinsic_execute( @@ -1255,6 +1257,52 @@ pub mod pallet { ) } + pub fn instantiate( + instantiator: AccountIdOf, + code_id: CosmwasmCodeId, + salt: Vec, + admin: Option>, + label: Vec, + funds: BTreeMap, (BalanceOf, KeepAlive)>, + gas: u64, + message: Vec, + ) -> Result, CosmwasmVMError> { + let salt: ContractSaltOf = salt + .try_into() + .map_err(|_| CosmwasmVMError::Rpc(String::from("'salt' is too large")))?; + let label: ContractLabelOf = label + .try_into() + .map_err(|_| CosmwasmVMError::Rpc(String::from("'label' is too large")))?; + let funds: FundsOf = funds + .try_into() + .map_err(|_| CosmwasmVMError::Rpc(String::from("'funds' is too large")))?; + let message: ContractMessageOf = message + .try_into() + .map_err(|_| CosmwasmVMError::Rpc(String::from("'message' is too large")))?; + let mut shared = Pallet::::do_create_vm_shared(gas, InitialStorageMutability::ReadWrite); + Pallet::::do_extrinsic_instantiate( + &mut shared, + instantiator, + code_id, + &salt, + admin, + label, + funds, + message, + ) + } + + pub fn execute( + executor: AccountIdOf, + contract: AccountIdOf, + funds: FundsOf, + gas: u64, + message: ContractMessageOf, + ) -> Result<(), CosmwasmVMError> { + let mut shared = Pallet::::do_create_vm_shared(gas, InitialStorageMutability::ReadWrite); + Pallet::::do_extrinsic_execute(&mut shared, executor, contract, funds, message) + } + impl VMPallet for T { type VmError = CosmwasmVMError; } diff --git a/code/parachain/runtime/dali/src/lib.rs b/code/parachain/runtime/dali/src/lib.rs index e23fd2c1d7b..22e4404cc05 100644 --- a/code/parachain/runtime/dali/src/lib.rs +++ b/code/parachain/runtime/dali/src/lib.rs @@ -1542,19 +1542,42 @@ impl_runtime_apis! { } } - impl cosmwasm_runtime_api::CosmwasmRuntimeApi, Vec> for Runtime { + impl cosmwasm_runtime_api::CosmwasmRuntimeApi> for Runtime { fn query( contract: AccountId, gas: u64, query_request: Vec, - ) -> Vec { - cosmwasm::query::( + ) -> Result, Vec>{ + match cosmwasm::query::( contract, gas, query_request, - ).map(|resp| resp.0).unwrap_or_else(|_| { - Default::default() - }) + ) { + Ok(response) => Ok(response.0), + Err(err) => Err(alloc::format!("{:?}", err).into_bytes()) + } + } + + fn instantiate( + instantiator: AccountId, + code_id: u64, + salt: Vec, + admin: Option, + label: Vec, + funds: BTreeMap, + gas: u64, + message: Vec, + ) -> Result> { + cosmwasm::instantiate::( + instantiator, + code_id, + salt, + admin, + label, + funds, + gas, + message.into() + ).map_err(|err| alloc::format!("{:?}", err).into_bytes()) } } diff --git a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index c969c2cbb29..be774258ecb 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -25,7 +25,7 @@ library = [] cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0" } cw-storage-plus = "0.13.2" -cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } +cw20 = "0.13.2" num = "0.4" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } diff --git a/code/xcvm/cosmwasm/contracts/router/Cargo.toml b/code/xcvm/cosmwasm/contracts/router/Cargo.toml index 37db38b7b90..c99c62bb737 100644 --- a/code/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -22,7 +22,7 @@ library = [] cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0", features = ["abort"] } cw-storage-plus = "0.13.2" -cw20 = { git = "https://github.com/CosmWasm/cw-plus.git" } +cw20 = "0.13.2" hex = "0.4" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } From cc25c88e251249ae1c32318c1899edf86e205301 Mon Sep 17 00:00:00 2001 From: aeryz Date: Thu, 22 Sep 2022 10:14:43 +0200 Subject: [PATCH 54/57] chore(cosmwasm,nix): format Signed-off-by: aeryz --- .nix/devnet-specs/default.nix | 238 +++++----- .nix/devnet-specs/xcvm.nix | 445 +++++++++--------- code/Cargo.lock | 1 - code/Cargo.toml | 2 +- code/parachain/node/Cargo.toml | 4 +- code/parachain/node/src/rpc.rs | 3 +- code/parachain/runtime/dali/Cargo.toml | 2 +- .../contracts/asset-registry/Cargo.toml | 2 +- .../cosmwasm/contracts/interpreter/Cargo.toml | 2 +- .../contracts/interpreter/src/contract.rs | 3 +- .../contracts/interpreter/src/helpers.rs | 25 - .../xcvm/cosmwasm/contracts/router/Cargo.toml | 2 +- flake.nix | 42 +- 13 files changed, 374 insertions(+), 397 deletions(-) delete mode 100644 code/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs diff --git a/.nix/devnet-specs/default.nix b/.nix/devnet-specs/default.nix index f725ffef4b2..0b804e4369d 100644 --- a/.nix/devnet-specs/default.nix +++ b/.nix/devnet-specs/default.nix @@ -1,127 +1,123 @@ -{ pkgs, packages, ... }: -{ +{ pkgs, packages, ... }: { modules = [ - ( - let - dali-container-name = "dali-devnet"; - subsquidGraphqlContainerName = "subsquid-graphql"; - gatewayContainerName = "subsquid-gateway"; - - # NOTE: Do not change this. It is hardcoded in the gateway source file. - # cfr: services/subsquid-substrate-gateway - gatewayPort = 8000; - - squid-archive-db = rec { - name = "squid-archive-db"; - host = name; - user = "squid-archive-user"; - password = "super-secret-squid-archive-pass"; - port = 5432; + (let + dali-container-name = "dali-devnet"; + subsquidGraphqlContainerName = "subsquid-graphql"; + gatewayContainerName = "subsquid-gateway"; + + # NOTE: Do not change this. It is hardcoded in the gateway source file. + # cfr: services/subsquid-substrate-gateway + gatewayPort = 8000; + + squid-archive-db = rec { + name = "squid-archive-db"; + host = name; + user = "squid-archive-user"; + password = "super-secret-squid-archive-pass"; + port = 5432; + }; + + squid-db = rec { + name = "squid-db"; + host = name; + user = "squid-user"; + password = "super-secret-squid-pass"; + port = 5433; + }; + + relaychainPort = 9944; + parachainPort = 9988; + squidGraphqlPort = 4350; + + parachainEndpoint = + "ws://${dali-container-name}:${toString parachainPort}"; + + network-name = "composable_devnet"; + mkComposableContainer = container: + container // { + service = container.service // { networks = [ network-name ]; }; }; - - squid-db = rec { - name = "squid-db"; - host = name; - user = "squid-user"; - password = "super-secret-squid-pass"; - port = 5433; - }; - - relaychainPort = 9944; - parachainPort = 9988; - squidGraphqlPort = 4350; - - parachainEndpoint = - "ws://${dali-container-name}:${toString parachainPort}"; - - network-name = "composable_devnet"; - mkComposableContainer = container: - container // { - service = container.service // { networks = [ network-name ]; }; - }; - in - { - config = { - project.name = "composable"; - networks."${network-name}" = { }; - services = { - "${squid-archive-db.name}" = mkComposableContainer - (import ../services/postgres.nix { - inherit pkgs; - database = squid-archive-db; - version = "14"; - init-scripts = pkgs.writeTextFile { - name = "init"; - text = ""; - executable = false; - destination = "/init.sql"; - }; - }); - - "${squid-db.name}" = mkComposableContainer - (import ../services/postgres.nix { - inherit pkgs; - database = squid-db; - version = "14"; - init-scripts = pkgs.writeTextFile { - name = "init"; - text = ""; - executable = false; - destination = "/init.sql"; - }; - }); - - "${dali-container-name}" = mkComposableContainer - (import ../services/devnet-dali.nix { - inherit pkgs packages parachainPort relaychainPort; - }); - - ingest = mkComposableContainer - (import ../services/subsquid-substrate-ingest.nix { - database = squid-archive-db; - polkadotEndpoint = parachainEndpoint; - prometheusPort = 9090; - }); - - "${gatewayContainerName}" = mkComposableContainer - (import ../services/subsquid-substrate-gateway.nix { - database = squid-archive-db; - port = gatewayPort; - }); - - # NOTE, this one currently seems broken. but it is an optional service anyways. - # explorer = mkComposableContainer (import ../services/subsquid-substrate-explorer.nix { - # database = squid-archive-db; - # graphqlPort = 4010; - # }); - - "${subsquidGraphqlContainerName}" = mkComposableContainer - (import ../services/subsquid-graphql.nix { - inherit pkgs; - database = squid-db; - graphqlPort = squidGraphqlPort; - }); - - subsquid-processor = mkComposableContainer - (import ../services/subsquid-processor-dockerfile.nix { - inherit subsquidGraphqlContainerName gatewayContainerName - gatewayPort parachainEndpoint; - database = squid-db; - graphqlPort = squidGraphqlPort; - }); - - # NOTE: Ports are currently not configurable for frontend services - frontend-picasso = mkComposableContainer - (import ../services/frontend-picasso.nix { - inherit pkgs packages; - }); - - frontend-pablo = mkComposableContainer - (import ../services/frontend-pablo.nix { inherit pkgs packages; }); - }; + in { + config = { + project.name = "composable"; + networks."${network-name}" = { }; + services = { + "${squid-archive-db.name}" = mkComposableContainer + (import ../services/postgres.nix { + inherit pkgs; + database = squid-archive-db; + version = "14"; + init-scripts = pkgs.writeTextFile { + name = "init"; + text = ""; + executable = false; + destination = "/init.sql"; + }; + }); + + "${squid-db.name}" = mkComposableContainer + (import ../services/postgres.nix { + inherit pkgs; + database = squid-db; + version = "14"; + init-scripts = pkgs.writeTextFile { + name = "init"; + text = ""; + executable = false; + destination = "/init.sql"; + }; + }); + + "${dali-container-name}" = mkComposableContainer + (import ../services/devnet-dali.nix { + inherit pkgs packages parachainPort relaychainPort; + }); + + ingest = mkComposableContainer + (import ../services/subsquid-substrate-ingest.nix { + database = squid-archive-db; + polkadotEndpoint = parachainEndpoint; + prometheusPort = 9090; + }); + + "${gatewayContainerName}" = mkComposableContainer + (import ../services/subsquid-substrate-gateway.nix { + database = squid-archive-db; + port = gatewayPort; + }); + + # NOTE, this one currently seems broken. but it is an optional service anyways. + # explorer = mkComposableContainer (import ../services/subsquid-substrate-explorer.nix { + # database = squid-archive-db; + # graphqlPort = 4010; + # }); + + "${subsquidGraphqlContainerName}" = mkComposableContainer + (import ../services/subsquid-graphql.nix { + inherit pkgs; + database = squid-db; + graphqlPort = squidGraphqlPort; + }); + + subsquid-processor = mkComposableContainer + (import ../services/subsquid-processor-dockerfile.nix { + inherit subsquidGraphqlContainerName gatewayContainerName + gatewayPort parachainEndpoint; + database = squid-db; + graphqlPort = squidGraphqlPort; + }); + + # NOTE: Ports are currently not configurable for frontend services + frontend-picasso = mkComposableContainer + (import ../services/frontend-picasso.nix { + inherit pkgs packages; + }); + + frontend-pablo = mkComposableContainer + (import ../services/frontend-pablo.nix { inherit pkgs packages; }); }; - } - ) + }; + }) ]; inherit pkgs; } diff --git a/.nix/devnet-specs/xcvm.nix b/.nix/devnet-specs/xcvm.nix index 2b5d1cc8e9d..9180b2e0139 100644 --- a/.nix/devnet-specs/xcvm.nix +++ b/.nix/devnet-specs/xcvm.nix @@ -1,237 +1,234 @@ -{ pkgs, packages, ... }: -{ +{ pkgs, packages, ... }: { modules = [ - ( - let - db-container-name = "db"; - redis-container-name = "subsquid-redis"; - subsquid-status-container-name = "subsquid-status-service"; - subsquid-indexer-gateway-container-name = "subsquid-indexer-gateway"; - dali-container-name = "dali-devnet"; - junod-container-name = "junod"; - juno-indexer-container-name = "juno-indexer"; - subql-query-container-name = "subql-query"; + (let + db-container-name = "db"; + redis-container-name = "subsquid-redis"; + subsquid-status-container-name = "subsquid-status-service"; + subsquid-indexer-gateway-container-name = "subsquid-indexer-gateway"; + dali-container-name = "dali-devnet"; + junod-container-name = "junod"; + juno-indexer-container-name = "juno-indexer"; + subql-query-container-name = "subql-query"; - hasuraGraphqlPort = 8080; - relaychainPort = 9944; - parachainPort = 9988; - subsquidParachainIndexerPort = 3000; - subsquidIndexerGateway = 8081; - subsquidIndexerStatusService = 60291; - junoRpcPort = 26657; + hasuraGraphqlPort = 8080; + relaychainPort = 9944; + parachainPort = 9988; + subsquidParachainIndexerPort = 3000; + subsquidIndexerGateway = 8081; + subsquidIndexerStatusService = 60291; + junoRpcPort = 26657; - default-db = { - name = "xcvm"; - host = "127.0.0.1"; - user = "xcvm"; - password = "xcvm"; - port = 1337; - }; + default-db = { + name = "xcvm"; + host = "127.0.0.1"; + user = "xcvm"; + password = "xcvm"; + port = 1337; + }; - juno-indexer-db-name = "juno"; - juno-indexer-db = default-db // { - name = juno-indexer-db-name; - host = db-container-name; - }; + juno-indexer-db-name = "juno"; + juno-indexer-db = default-db // { + name = juno-indexer-db-name; + host = db-container-name; + }; - composable-indexer-db-name = "indexer"; - composable-indexer-db = default-db // { - name = composable-indexer-db-name; - host = db-container-name; - }; + composable-indexer-db-name = "indexer"; + composable-indexer-db = default-db // { + name = composable-indexer-db-name; + host = db-container-name; + }; - hasura-db-name = "hasura"; - hasura-db = default-db // { - name = hasura-db-name; - host = db-container-name; - }; + hasura-db-name = "hasura"; + hasura-db = default-db // { + name = hasura-db-name; + host = db-container-name; + }; - network-name = "composable_xcvm_devnet"; - mk-composable-container = container: - container // { - service = container.service // { networks = [ network-name ]; }; - }; - in { - config = { - project.name = "composable_xcvm_devnet"; - networks."${network-name}" = { }; - services = { - # ============ COMMON =============== - "${db-container-name}" = mk-composable-container - (import ../services/postgres.nix { - inherit pkgs; - database = default-db; - version = "14"; - init-scripts = pkgs.writeTextFile { - name = "init"; - text = '' - CREATE DATABASE ${juno-indexer-db-name} WITH OWNER ${default-db.user}; - CREATE DATABASE ${composable-indexer-db-name} WITH OWNER ${default-db.user}; - CREATE DATABASE ${hasura-db-name} WITH OWNER ${default-db.user}; - ''; - executable = false; - destination = "/init.sql"; - }; - }); + network-name = "composable_xcvm_devnet"; + mk-composable-container = container: + container // { + service = container.service // { networks = [ network-name ]; }; + }; + in { + config = { + project.name = "composable_xcvm_devnet"; + networks."${network-name}" = { }; + services = { + # ============ COMMON =============== + "${db-container-name}" = mk-composable-container + (import ../services/postgres.nix { + inherit pkgs; + database = default-db; + version = "14"; + init-scripts = pkgs.writeTextFile { + name = "init"; + text = '' + CREATE DATABASE ${juno-indexer-db-name} WITH OWNER ${default-db.user}; + CREATE DATABASE ${composable-indexer-db-name} WITH OWNER ${default-db.user}; + CREATE DATABASE ${hasura-db-name} WITH OWNER ${default-db.user}; + ''; + executable = false; + destination = "/init.sql"; + }; + }); - # ============== COSMOS =============== - "${junod-container-name}" = - mk-composable-container (import ../services/junod.nix { rpcPort = junoRpcPort; }); - "${juno-indexer-container-name}" = mk-composable-container - (import ../services/juno-subql.nix { - inherit pkgs; - database = juno-indexer-db; - juno = junod-container-name; - junoPort = junoRpcPort; - }); - "${subql-query-container-name}" = mk-composable-container - (import ../services/subql-query.nix { - database = juno-indexer-db; - subql-node = juno-indexer-container-name; - subqlPort = 3000; - }); - hasura-aggregated = mk-composable-container - (import ../services/hasura.nix { - inherit pkgs; - database = hasura-db; - graphql-port = hasuraGraphqlPort; - metadata = let - files = pkgs.linkFarm "metadata" [ - { - name = "remote_schemas.yaml"; - path = pkgs.writeText "remote_schemas.yaml" "[]"; - } - { - name = "actions.graphql"; - path = pkgs.writeText "actions.graphql" ""; - } - { - name = "actions.yaml"; - path = pkgs.writeText "actions.yaml" '' - actions: [] - custom_types: - enums: [] - input_objects: [] - objects: [] - scalars: [] + # ============== COSMOS =============== + "${junod-container-name}" = mk-composable-container + (import ../services/junod.nix { rpcPort = junoRpcPort; }); + "${juno-indexer-container-name}" = mk-composable-container + (import ../services/juno-subql.nix { + inherit pkgs; + database = juno-indexer-db; + juno = junod-container-name; + junoPort = junoRpcPort; + }); + "${subql-query-container-name}" = mk-composable-container + (import ../services/subql-query.nix { + database = juno-indexer-db; + subql-node = juno-indexer-container-name; + subqlPort = 3000; + }); + hasura-aggregated = mk-composable-container + (import ../services/hasura.nix { + inherit pkgs; + database = hasura-db; + graphql-port = hasuraGraphqlPort; + metadata = let + files = pkgs.linkFarm "metadata" [ + { + name = "remote_schemas.yaml"; + path = pkgs.writeText "remote_schemas.yaml" "[]"; + } + { + name = "actions.graphql"; + path = pkgs.writeText "actions.graphql" ""; + } + { + name = "actions.yaml"; + path = pkgs.writeText "actions.yaml" '' + actions: [] + custom_types: + enums: [] + input_objects: [] + objects: [] + scalars: [] + ''; + } + { + name = "allow_list.yaml"; + path = pkgs.writeText "allow_list.yaml" "[]"; + } + { + name = "cron_triggers.yaml"; + path = pkgs.writeText "cron_triggers.yaml" "[]"; + } + { + name = "query_collections.yaml"; + path = pkgs.writeText "query_collections.yaml" "[]"; + } + { + name = "version.yaml"; + path = pkgs.writeText "version.yaml" "version: 3"; + } + { + name = "rest_endpoints.yaml"; + path = pkgs.writeText "rest_endpoints.yaml" "[]"; + } + { + name = "databases"; + path = pkgs.writeTextFile { + name = "databases.yaml"; + text = '' + - name: cosmos + kind: postgres + configuration: + connection_info: + use_prepared_statements: false + database_url: postgres://${default-db.user}:${default-db.password}@${db-container-name}:${ + toString default-db.port + }/${juno-indexer-db-name} + isolation_level: read-committed + tables: + - table: + schema: cosmos + name: blocks + - table: + schema: cosmos + name: events + - table: + schema: cosmos + name: messages + - table: + schema: cosmos + name: transactions + - name: subsquid + kind: postgres + configuration: + connection_info: + use_prepared_statements: false + database_url: postgres://${default-db.user}:${default-db.password}@${db-container-name}:${ + toString default-db.port + }/${composable-indexer-db-name} + isolation_level: read-committed + tables: + - table: + schema: public + name: substrate_block + - table: + schema: public + name: substrate_extrinsic + - table: + schema: public + name: substrate_event ''; - } - { - name = "allow_list.yaml"; - path = pkgs.writeText "allow_list.yaml" "[]"; - } - { - name = "cron_triggers.yaml"; - path = pkgs.writeText "cron_triggers.yaml" "[]"; - } - { - name = "query_collections.yaml"; - path = pkgs.writeText "query_collections.yaml" "[]"; - } - { - name = "version.yaml"; - path = pkgs.writeText "version.yaml" "version: 3"; - } - { - name = "rest_endpoints.yaml"; - path = pkgs.writeText "rest_endpoints.yaml" "[]"; - } - { - name = "databases"; - path = pkgs.writeTextFile { - name = "databases.yaml"; - text = '' - - name: cosmos - kind: postgres - configuration: - connection_info: - use_prepared_statements: false - database_url: postgres://${default-db.user}:${default-db.password}@${db-container-name}:${ - toString default-db.port - }/${juno-indexer-db-name} - isolation_level: read-committed - tables: - - table: - schema: cosmos - name: blocks - - table: - schema: cosmos - name: events - - table: - schema: cosmos - name: messages - - table: - schema: cosmos - name: transactions - - name: subsquid - kind: postgres - configuration: - connection_info: - use_prepared_statements: false - database_url: postgres://${default-db.user}:${default-db.password}@${db-container-name}:${ - toString default-db.port - }/${composable-indexer-db-name} - isolation_level: read-committed - tables: - - table: - schema: public - name: substrate_block - - table: - schema: public - name: substrate_extrinsic - - table: - schema: public - name: substrate_event - ''; - executable = false; - destination = "/databases.yaml"; - }; - } - ]; - in pkgs.stdenv.mkDerivation { - # We can't use the above symlinked farm as the metadata store because it is mounted as a volume. - # Hence, it would be a folder full of dead link from the POV of the container. - name = "metadata"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir $out - cp -rL ${files}/* $out - ''; - }; - }); + executable = false; + destination = "/databases.yaml"; + }; + } + ]; + in pkgs.stdenv.mkDerivation { + # We can't use the above symlinked farm as the metadata store because it is mounted as a volume. + # Hence, it would be a folder full of dead link from the POV of the container. + name = "metadata"; + phases = [ "installPhase" ]; + installPhase = '' + mkdir $out + cp -rL ${files}/* $out + ''; + }; + }); - # ============== POLKADOT ============== - "${dali-container-name}" = mk-composable-container - (import ../services/devnet-dali.nix { - inherit pkgs; - inherit packages; - inherit relaychainPort; - inherit parachainPort; - }); - subsquid-indexer = mk-composable-container - (import ../services/subsquid-indexer.nix { - database = composable-indexer-db; - redis = redis-container-name; - parachain = dali-container-name; - inherit parachainPort; - parachainIndexerPort = subsquidParachainIndexerPort; - }); - "${subsquid-indexer-gateway-container-name}" = - mk-composable-container - (import ../services/subsquid-indexer-gateway.nix { - database = composable-indexer-db; - status = subsquid-status-container-name; - graphql-port = subsquidIndexerGateway; - }); - "${subsquid-status-container-name}" = mk-composable-container - (import ../services/subsquid-indexer-status-service.nix { - redis = redis-container-name; - port = subsquidIndexerStatusService; - }); - "${redis-container-name}" = - mk-composable-container (import ../services/redis.nix); - }; + # ============== POLKADOT ============== + "${dali-container-name}" = mk-composable-container + (import ../services/devnet-dali.nix { + inherit pkgs; + inherit packages; + inherit relaychainPort; + inherit parachainPort; + }); + subsquid-indexer = mk-composable-container + (import ../services/subsquid-indexer.nix { + database = composable-indexer-db; + redis = redis-container-name; + parachain = dali-container-name; + inherit parachainPort; + parachainIndexerPort = subsquidParachainIndexerPort; + }); + "${subsquid-indexer-gateway-container-name}" = mk-composable-container + (import ../services/subsquid-indexer-gateway.nix { + database = composable-indexer-db; + status = subsquid-status-container-name; + graphql-port = subsquidIndexerGateway; + }); + "${subsquid-status-container-name}" = mk-composable-container + (import ../services/subsquid-indexer-status-service.nix { + redis = redis-container-name; + port = subsquidIndexerStatusService; + }); + "${redis-container-name}" = + mk-composable-container (import ../services/redis.nix); }; - }) + }; + }) ]; } diff --git a/code/Cargo.lock b/code/Cargo.lock index 92e37ae64e1..2fa3de7c155 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -16525,7 +16525,6 @@ dependencies = [ "num-traits", "parity-wasm 0.42.2", "wasmi-validation 0.4.0", - "wasmi-validation 0.4.1", ] [[package]] diff --git a/code/Cargo.toml b/code/Cargo.toml index 6eb2af72205..d12d842d1dd 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -70,6 +70,7 @@ panic = "abort" rpath = false [patch.crates-io] +serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-core = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } @@ -78,7 +79,6 @@ sp-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "f sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } wasmi-validation = { git = "https://github.com/ComposableFi/wasmi", rev = "cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" } -serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } [patch."https://github.com/paritytech/subxt"] subxt-codegen = { git = "https://github.com/paritytech//subxt", rev = "2fe9a1446d32b93a10804db3304ccaac65f764b8" } diff --git a/code/parachain/node/Cargo.toml b/code/parachain/node/Cargo.toml index de000fed494..d8a18bbdf98 100644 --- a/code/parachain/node/Cargo.toml +++ b/code/parachain/node/Cargo.toml @@ -32,14 +32,14 @@ pallet-crowdloan-rewards = { path = "../frame/crowdloan-rewards" } assets-rpc = { path = "../frame/assets/rpc" } assets-runtime-api = { path = "../frame/assets/runtime-api" } +cosmwasm-rpc = { path = "../frame/cosmwasm/rpc" } +cosmwasm-runtime-api = { path = "../frame/cosmwasm/runtime-api" } crowdloan-rewards-rpc = { path = "../frame/crowdloan-rewards/rpc" } crowdloan-rewards-runtime-api = { path = "../frame/crowdloan-rewards/runtime-api" } lending-rpc = { path = "../frame/lending/rpc" } lending-runtime-api = { path = "../frame/lending/runtime-api" } pablo-rpc = { path = "../frame/pablo/rpc" } pablo-runtime-api = { path = "../frame/pablo/runtime-api" } -cosmwasm-rpc = { path = "../frame/cosmwasm/rpc" } -cosmwasm-runtime-api = { path = "../frame/cosmwasm/runtime-api" } # FRAME Dependencies diff --git a/code/parachain/node/src/rpc.rs b/code/parachain/node/src/rpc.rs index 586cc07061a..f7da6933833 100644 --- a/code/parachain/node/src/rpc.rs +++ b/code/parachain/node/src/rpc.rs @@ -99,7 +99,8 @@ where )?; as ProvideRuntimeApi>::Api::extend_with_ibc_api( - &mut io, deps.clone(), + &mut io, + deps.clone(), )?; as ProvideRuntimeApi>::Api::extend_with_cosmwasm_api( diff --git a/code/parachain/runtime/dali/Cargo.toml b/code/parachain/runtime/dali/Cargo.toml index 7de53b117ba..72ed115990d 100644 --- a/code/parachain/runtime/dali/Cargo.toml +++ b/code/parachain/runtime/dali/Cargo.toml @@ -109,10 +109,10 @@ transaction-payment-rpc-runtime-api = { package = "pallet-transaction-payment-rp # local RPCs assets-runtime-api = { path = '../../frame/assets/runtime-api', default-features = false } +cosmwasm-runtime-api = { path = '../../frame/cosmwasm/runtime-api', default-features = false } crowdloan-rewards-runtime-api = { path = '../../frame/crowdloan-rewards/runtime-api', default-features = false } lending-runtime-api = { path = '../../frame/lending/runtime-api', default-features = false } pablo-runtime-api = { path = '../../frame/pablo/runtime-api', default-features = false } -cosmwasm-runtime-api = { path = '../../frame/cosmwasm/runtime-api', default-features = false } # Used for runtime benchmarking codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ diff --git a/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index 1f97d6e68db..ed01dfe6f5d 100644 --- a/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -19,8 +19,8 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0" } +cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } diff --git a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index be774258ecb..f3ed6ce1e87 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -22,8 +22,8 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0" } +cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" cw20 = "0.13.2" num = "0.4" diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs index f99a827d079..91f6a785e77 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs +++ b/code/xcvm/cosmwasm/contracts/interpreter/src/contract.rs @@ -148,7 +148,8 @@ pub fn interpret_spawn( } } - // TODO(probably call the router via a Cw20 `send` to spawn the program and do w/e required with the funds) + // TODO(probably call the router via a Cw20 `send` to spawn the program and do w/e required with + // the funds) for (asset_id, amount) in normalized_funds.clone().0 { let query_msg = AssetRegistryQueryMsg::GetAssetContract(asset_id.into()); let cw20_address: GetAssetContractResponse = deps.querier.query( diff --git a/code/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs b/code/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs deleted file mode 100644 index aa613bb06b0..00000000000 --- a/code/xcvm/cosmwasm/contracts/interpreter/src/helpers.rs +++ /dev/null @@ -1,25 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg}; - -use crate::msg::{ExecuteMsg, InstantiateMsg}; - -/// AssetRegistryContract is a wrapper around Addr that provides helpers -/// for working with this as a library. -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] -pub struct InterpreterContract; - -impl InterpreterContract { - pub fn instantiate(registry_addr: String) -> StdResult>(&self, msg: T) -> StdResult { - let msg = to_binary(&msg.into())?; - Ok(WasmMsg::Execute { - contract_addr: self.addr().into(), - msg, - funds: vec![], - } - .into()) - } -} diff --git a/code/xcvm/cosmwasm/contracts/router/Cargo.toml b/code/xcvm/cosmwasm/contracts/router/Cargo.toml index c99c62bb737..9b146b0200c 100644 --- a/code/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -19,8 +19,8 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-storage = "1.0.0" cosmwasm-std = { version = "1.0.0", features = ["abort"] } +cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" cw20 = "0.13.2" hex = "0.4" diff --git a/flake.nix b/flake.nix index 84509f0d1f8..8685c5d8dc2 100644 --- a/flake.nix +++ b/flake.nix @@ -47,20 +47,26 @@ gce-input = gce-to-nix service-account-credential-key-file-input; - mkDevnetProgram = {pkgs}: name: spec: pkgs.writeShellApplication { - inherit name; - runtimeInputs = - [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; - text = '' - arion --prebuilt-file ${pkgs.arion.build spec} up --build --force-recreate -V --always-recreate-deps --remove-orphans - ''; - }; - - composableOverlay = nixpkgs.lib.composeManyExtensions [arion-src.overlay (final: prev: { - composable = { - mkDevnetProgram = final.callPackage mkDevnetProgram {}; + mkDevnetProgram = { pkgs }: + name: spec: + pkgs.writeShellApplication { + inherit name; + runtimeInputs = [ pkgs.arion pkgs.docker pkgs.coreutils pkgs.bash ]; + text = '' + arion --prebuilt-file ${ + pkgs.arion.build spec + } up --build --force-recreate -V --always-recreate-deps --remove-orphans + ''; }; - })]; + + composableOverlay = nixpkgs.lib.composeManyExtensions [ + arion-src.overlay + (final: prev: { + composable = { + mkDevnetProgram = final.callPackage mkDevnetProgram { }; + }; + }) + ]; mk-devnet = { pkgs, lib, writeTextFile, writeShellApplication , polkadot-launch, composable-node, polkadot-node, chain-spec }: @@ -1043,7 +1049,7 @@ default = developers; }; - + devnet-specs = { default = import ./.nix/devnet-specs/default.nix { inherit pkgs; @@ -1056,10 +1062,12 @@ }; }; - apps = let - devnet-default-program = pkgs.composable.mkDevnetProgram "devnet-default" devnet-specs.default; - devnet-xcvm-program = pkgs.composable.mkDevnetProgram "devnet-xcvm" devnet-specs.xcvm; + devnet-default-program = + pkgs.composable.mkDevnetProgram "devnet-default" + devnet-specs.default; + devnet-xcvm-program = + pkgs.composable.mkDevnetProgram "devnet-xcvm" devnet-specs.xcvm; in rec { devnet = { type = "app"; From 737045271428c4efa57f197382323227931d9238 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 23 Sep 2022 12:41:56 +0200 Subject: [PATCH 55/57] chore: upgrade substrate Signed-off-by: aeryz --- code/Cargo.toml | 350 ++++++++++++++++++++++++------------------------ 1 file changed, 175 insertions(+), 175 deletions(-) diff --git a/code/Cargo.toml b/code/Cargo.toml index d12d842d1dd..95103d2bc7b 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -71,13 +71,13 @@ rpath = false [patch.crates-io] serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } -sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-core = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-debug-derive = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } +sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-core = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-debug-derive = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } wasmi-validation = { git = "https://github.com/ComposableFi/wasmi", rev = "cd8c0c775a1d197a35ff3d5c7d6cded3d476411b" } [patch."https://github.com/paritytech/subxt"] @@ -128,171 +128,171 @@ xcm-builder = { git = "https://github.com/ComposableFi/polkadot", branch = "rele xcm-executor = { git = "https://github.com/ComposableFi/polkadot", branch = "release-v0.9.27" } [patch."https://github.com/paritytech/substrate"] -beefy-gadget = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -beefy-gadget-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -beefy-merkle-tree = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -beefy-primitives = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -fork-tree = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-benchmarking-cli = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-election-provider-support = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-executive = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-support = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-support-procedural = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-support-procedural-tools = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-support-procedural-tools-derive = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-system = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-system-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-system-rpc-runtime-api = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -frame-try-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-asset-tx-payment = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-assets = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-aura = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-authority-discovery = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-authorship = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-babe = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-bags-list = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-balances = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-beefy = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-beefy-mmr = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-bounties = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-child-bounties = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-collective = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-democracy = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-election-provider-multi-phase = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-election-provider-support-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-elections-phragmen = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-gilt = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-grandpa = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-identity = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-im-online = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-indices = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-membership = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-mmr = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-mmr-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-multisig = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-nomination-pools = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-offences = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-offences-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-preimage = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-proxy = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-randomness-collective-flip = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-recovery = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-scheduler = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-session = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-session-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-society = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-staking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-staking-reward-curve = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-staking-reward-fn = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-sudo = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-timestamp = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-tips = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-transaction-payment = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-transaction-payment-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-treasury = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-uniques = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-utility = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -pallet-vesting = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -remote-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-allocator = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-authority-discovery = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-basic-authorship = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-block-builder = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-chain-spec = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-chain-spec-derive = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-cli = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-client-api = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-client-db = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus-aura = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus-babe = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus-babe-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus-epochs = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus-manual-seal = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus-slots = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-consensus-uncles = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-executor = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-executor-common = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-executor-wasmi = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-executor-wasmtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-finality-grandpa = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-finality-grandpa-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-informant = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-keystore = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-network = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-network-gossip = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-offchain = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-peerset = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-proposer-metrics = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-rpc-api = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-rpc-server = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-service = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-state-db = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-sync-state-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-sysinfo = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-telemetry = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-tracing = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-tracing-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-transaction-pool = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-transaction-pool-api = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sc-utils = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-api = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-api-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-authority-discovery = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-authorship = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-block-builder = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-blockchain = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-consensus = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-consensus-aura = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-consensus-babe = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-consensus-slots = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-consensus-vrf = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-core = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-core-hashing = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-core-hashing-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-database = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-debug-derive = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-finality-grandpa = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-inherents = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-keyring = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-keystore = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-maybe-compressed-blob = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-mmr-primitives = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-npos-elections = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-offchain = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-panic-handler = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-runtime-interface = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-runtime-interface-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-sandbox = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-serializer = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-session = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-staking = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-state-machine = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-std = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-storage = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-tasks = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-timestamp = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-tracing = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-transaction-pool = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-transaction-storage-proof = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-trie = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-version = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-version-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -sp-wasm-interface = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -substrate-build-script-utils = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -substrate-frame-rpc-system = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -substrate-prometheus-endpoint = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -substrate-state-trie-migration-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -substrate-wasm-builder = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } -try-runtime-cli = { git = "https://github.com/ComposableFi/substrate", rev = "f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" } +beefy-gadget = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +beefy-gadget-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +beefy-merkle-tree = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +beefy-primitives = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +fork-tree = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-benchmarking-cli = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-election-provider-support = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-executive = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-support = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-support-procedural = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-support-procedural-tools = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-support-procedural-tools-derive = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-system = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-system-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-system-rpc-runtime-api = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +frame-try-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-asset-tx-payment = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-assets = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-aura = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-authority-discovery = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-authorship = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-babe = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-bags-list = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-balances = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-beefy = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-beefy-mmr = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-bounties = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-child-bounties = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-collective = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-democracy = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-election-provider-multi-phase = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-election-provider-support-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-elections-phragmen = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-gilt = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-grandpa = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-identity = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-im-online = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-indices = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-membership = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-mmr = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-mmr-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-multisig = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-nomination-pools = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-offences = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-offences-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-preimage = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-proxy = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-randomness-collective-flip = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-recovery = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-scheduler = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-session = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-session-benchmarking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-society = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-staking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-staking-reward-curve = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-staking-reward-fn = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-sudo = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-timestamp = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-tips = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-transaction-payment = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-transaction-payment-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-treasury = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-uniques = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-utility = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +pallet-vesting = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +remote-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-allocator = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-authority-discovery = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-basic-authorship = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-block-builder = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-chain-spec = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-chain-spec-derive = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-cli = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-client-api = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-client-db = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus-aura = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus-babe = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus-babe-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus-epochs = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus-manual-seal = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus-slots = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-consensus-uncles = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-executor = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-executor-common = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-executor-wasmi = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-executor-wasmtime = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-finality-grandpa = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-finality-grandpa-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-informant = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-keystore = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-network = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-network-gossip = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-offchain = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-peerset = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-proposer-metrics = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-rpc-api = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-rpc-server = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-service = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-state-db = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-sync-state-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-sysinfo = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-telemetry = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-tracing = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-tracing-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-transaction-pool = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-transaction-pool-api = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sc-utils = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-api = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-api-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-application-crypto = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-arithmetic = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-authority-discovery = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-authorship = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-block-builder = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-blockchain = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-consensus = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-consensus-aura = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-consensus-babe = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-consensus-slots = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-consensus-vrf = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-core = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-core-hashing = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-core-hashing-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-database = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-debug-derive = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-externalities = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-finality-grandpa = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-inherents = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-io = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-keyring = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-keystore = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-maybe-compressed-blob = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-mmr-primitives = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-npos-elections = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-offchain = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-panic-handler = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-runtime = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-runtime-interface = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-runtime-interface-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-sandbox = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-serializer = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-session = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-staking = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-state-machine = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-std = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-storage = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-tasks = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-timestamp = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-tracing = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-transaction-pool = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-transaction-storage-proof = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-trie = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-version = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-version-proc-macro = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +sp-wasm-interface = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +substrate-build-script-utils = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +substrate-frame-rpc-system = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +substrate-prometheus-endpoint = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +substrate-state-trie-migration-rpc = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +substrate-wasm-builder = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } +try-runtime-cli = { git = "https://github.com/ComposableFi/substrate", rev = "fd75550a935d69b6a4ee4f8a48767557b4c9e801" } From bb4025378fcd95f8ca6e10fb8c59c880ab39f021 Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 23 Sep 2022 12:41:56 +0200 Subject: [PATCH 56/57] chore: upgrade substrate Signed-off-by: aeryz --- .config/dictionaries/technical.dic | 3 + code/Cargo.lock | 344 ++++++++++++++--------------- 2 files changed, 175 insertions(+), 172 deletions(-) diff --git a/.config/dictionaries/technical.dic b/.config/dictionaries/technical.dic index 326469fbddf..46801cb0585 100644 --- a/.config/dictionaries/technical.dic +++ b/.config/dictionaries/technical.dic @@ -234,12 +234,14 @@ protoc PROTOC PTRACE reduxjs +registryaddr rekt resourcemonitor revhash rewardaccumulationhook rewardtrackerstore ripemd +rlib rnix rocksdb ROCKSDB @@ -276,6 +278,7 @@ statemine stdenv structopt styleguide +submessage substituters subwasm subxt diff --git a/code/Cargo.lock b/code/Cargo.lock index 2fa3de7c155..e3f609c944a 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -601,7 +601,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "beefy-primitives", "fnv", @@ -635,7 +635,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -683,7 +683,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "beefy-primitives", "sp-api", @@ -692,7 +692,7 @@ dependencies = [ [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -3671,7 +3671,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", ] @@ -3694,7 +3694,7 @@ checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -3716,7 +3716,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "Inflector", "chrono", @@ -3767,7 +3767,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", @@ -3778,7 +3778,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3794,7 +3794,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "bitflags", "frame-metadata", @@ -3852,7 +3852,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -3864,7 +3864,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.2.1", @@ -3876,7 +3876,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", @@ -3886,7 +3886,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "log 0.4.17", @@ -3903,7 +3903,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -3918,7 +3918,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "sp-api", @@ -3927,7 +3927,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "sp-api", @@ -7573,7 +7573,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -7618,7 +7618,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -7653,7 +7653,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -7669,7 +7669,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -7685,7 +7685,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -7700,7 +7700,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -7724,7 +7724,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7744,7 +7744,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -7759,7 +7759,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "beefy-primitives", "frame-support", @@ -7775,7 +7775,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -7824,7 +7824,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -7860,7 +7860,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -7899,7 +7899,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8009,7 +8009,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8088,7 +8088,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8111,7 +8111,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8124,7 +8124,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8162,7 +8162,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8195,7 +8195,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8287,7 +8287,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "enumflags2", "frame-benchmarking", @@ -8303,7 +8303,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8323,7 +8323,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8417,7 +8417,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8434,7 +8434,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -8452,7 +8452,7 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "jsonrpsee 0.14.0", "parity-scale-codec", @@ -8493,7 +8493,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8508,7 +8508,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -8525,7 +8525,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8544,7 +8544,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "sp-api", @@ -8554,7 +8554,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -8571,7 +8571,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8649,7 +8649,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8683,7 +8683,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8698,7 +8698,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -8712,7 +8712,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8727,7 +8727,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8743,7 +8743,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -8764,7 +8764,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8780,7 +8780,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -8794,7 +8794,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8817,7 +8817,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", @@ -8828,7 +8828,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "sp-arithmetic", @@ -8869,7 +8869,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -8883,7 +8883,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8901,7 +8901,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8920,7 +8920,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-support", "frame-system", @@ -8936,7 +8936,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "jsonrpsee 0.14.0", "pallet-transaction-payment-rpc-runtime-api", @@ -8951,7 +8951,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -8962,7 +8962,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8979,7 +8979,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -8994,7 +8994,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -9059,7 +9059,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-benchmarking", "frame-support", @@ -11605,7 +11605,7 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "env_logger", "jsonrpsee 0.14.0", @@ -12097,7 +12097,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "sp-core", @@ -12108,7 +12108,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "futures 0.3.24", @@ -12135,7 +12135,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "futures-timer", @@ -12158,7 +12158,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -12174,7 +12174,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "impl-trait-for-tuples", "memmap2", @@ -12191,7 +12191,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", @@ -12202,7 +12202,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "chrono", "clap 3.2.22", @@ -12241,7 +12241,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "fnv", "futures 0.3.24", @@ -12269,7 +12269,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "hash-db", "kvdb", @@ -12294,7 +12294,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "futures 0.3.24", @@ -12318,7 +12318,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "futures 0.3.24", @@ -12347,7 +12347,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "fork-tree", @@ -12390,7 +12390,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "jsonrpsee 0.14.0", @@ -12412,7 +12412,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "fork-tree", "parity-scale-codec", @@ -12425,7 +12425,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "assert_matches", "async-trait", @@ -12459,7 +12459,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "futures 0.3.24", @@ -12484,7 +12484,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "sc-client-api", "sp-authorship", @@ -12495,7 +12495,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "lazy_static", "lru 0.7.8", @@ -12522,7 +12522,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "environmental", "parity-scale-codec", @@ -12539,7 +12539,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "parity-scale-codec", @@ -12554,7 +12554,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "cfg-if 1.0.0", "libc", @@ -12574,7 +12574,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "ahash", "async-trait", @@ -12615,7 +12615,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "finality-grandpa", "futures 0.3.24", @@ -12636,7 +12636,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "ansi_term", "futures 0.3.24", @@ -12653,7 +12653,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "hex", @@ -12668,7 +12668,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "asynchronous-codec", @@ -12717,7 +12717,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "bitflags", "futures 0.3.24", @@ -12735,7 +12735,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "ahash", "futures 0.3.24", @@ -12752,7 +12752,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "libp2p", @@ -12772,7 +12772,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "fork-tree", "futures 0.3.24", @@ -12799,7 +12799,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "bytes 1.2.1", "fnv", @@ -12827,7 +12827,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "libp2p", @@ -12840,7 +12840,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "substrate-prometheus-endpoint", @@ -12849,7 +12849,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "hash-db", @@ -12879,7 +12879,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "jsonrpsee 0.14.0", @@ -12902,7 +12902,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "jsonrpsee 0.14.0", @@ -12915,7 +12915,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "directories", @@ -12982,7 +12982,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "parity-scale-codec", @@ -12996,7 +12996,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "jsonrpsee 0.14.0", "parity-scale-codec", @@ -13015,7 +13015,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "libc", @@ -13034,7 +13034,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "chrono", "futures 0.3.24", @@ -13052,7 +13052,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "ansi_term", "atty", @@ -13083,7 +13083,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.43", @@ -13094,7 +13094,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "futures-timer", @@ -13121,7 +13121,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "log 0.4.17", @@ -13134,7 +13134,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "futures-timer", @@ -13853,7 +13853,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "hash-db", "log 0.4.17", @@ -13870,7 +13870,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "blake2", "proc-macro-crate 1.2.1", @@ -13882,7 +13882,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -13895,7 +13895,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "integer-sqrt", "num-traits", @@ -13910,7 +13910,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -13923,7 +13923,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "parity-scale-codec", @@ -13935,7 +13935,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "sp-api", @@ -13947,7 +13947,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "log 0.4.17", @@ -13965,7 +13965,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "futures 0.3.24", @@ -13984,7 +13984,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "parity-scale-codec", @@ -14002,7 +14002,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "merlin", @@ -14025,7 +14025,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -14039,7 +14039,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -14052,7 +14052,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "base58", "bitflags", @@ -14098,7 +14098,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "blake2", "byteorder", @@ -14112,7 +14112,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", @@ -14123,7 +14123,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -14132,7 +14132,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "proc-macro2 1.0.43", "quote 1.0.21", @@ -14142,7 +14142,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "environmental", "parity-scale-codec", @@ -14153,7 +14153,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "finality-grandpa", "log 0.4.17", @@ -14171,7 +14171,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -14185,7 +14185,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures 0.3.24", "hash-db", @@ -14210,7 +14210,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "lazy_static", "sp-core", @@ -14221,7 +14221,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "futures 0.3.24", @@ -14238,7 +14238,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "thiserror", "zstd", @@ -14247,7 +14247,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "parity-scale-codec", @@ -14262,7 +14262,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -14276,7 +14276,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "sp-api", "sp-core", @@ -14286,7 +14286,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "backtrace", "lazy_static", @@ -14296,7 +14296,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "rustc-hash", "serde", @@ -14306,7 +14306,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "either", "hash256-std-hasher", @@ -14328,7 +14328,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -14345,7 +14345,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "Inflector", "proc-macro-crate 1.2.1", @@ -14357,7 +14357,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "parity-scale-codec", @@ -14371,7 +14371,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "serde", "serde_json", @@ -14380,7 +14380,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -14394,7 +14394,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "scale-info", @@ -14405,7 +14405,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "hash-db", "log 0.4.17", @@ -14427,12 +14427,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "impl-serde", "parity-scale-codec", @@ -14445,7 +14445,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "log 0.4.17", "sp-core", @@ -14458,7 +14458,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "futures-timer", @@ -14474,7 +14474,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "sp-std", @@ -14486,7 +14486,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "sp-api", "sp-runtime", @@ -14495,7 +14495,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "async-trait", "log 0.4.17", @@ -14511,7 +14511,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "hash-db", "memory-db", @@ -14527,7 +14527,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "impl-serde", "parity-scale-codec", @@ -14544,7 +14544,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "parity-scale-codec", "proc-macro2 1.0.43", @@ -14555,7 +14555,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "impl-trait-for-tuples", "log 0.4.17", @@ -14844,7 +14844,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "platforms", ] @@ -14852,7 +14852,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.24", @@ -14873,7 +14873,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "futures-util", "hyper 0.14.20", @@ -14944,7 +14944,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "jsonrpsee 0.14.0", "log 0.4.17", @@ -14965,7 +14965,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "ansi_term", "build-helper", @@ -15992,7 +15992,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/ComposableFi/substrate?rev=f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5#f709a3d3b8f116f8b7e92ec56bc1ca5a0409eaa5" +source = "git+https://github.com/ComposableFi/substrate?rev=fd75550a935d69b6a4ee4f8a48767557b4c9e801#fd75550a935d69b6a4ee4f8a48767557b4c9e801" dependencies = [ "clap 3.2.22", "jsonrpsee 0.14.0", From 97a5fc3ec9bdaa75a5fc4de5c4343b9b906e714e Mon Sep 17 00:00:00 2001 From: aeryz Date: Fri, 23 Sep 2022 19:57:43 +0200 Subject: [PATCH 57/57] chore: make ci happy Signed-off-by: aeryz --- code/Cargo.lock | 110 ++++------------ code/parachain/frame/cosmwasm/rpc/Cargo.toml | 2 - code/parachain/frame/cosmwasm/rpc/src/lib.rs | 62 +++++---- .../frame/cosmwasm/runtime-api/Cargo.toml | 5 +- .../frame/cosmwasm/runtime-api/src/lib.rs | 3 +- code/parachain/frame/cosmwasm/src/lib.rs | 2 +- code/parachain/runtime/dali/src/lib.rs | 2 +- .../contracts/asset-registry/Cargo.toml | 5 +- .../contracts/asset-registry/Developing.md | 104 --------------- .../cosmwasm/contracts/interpreter/Cargo.toml | 3 - .../xcvm/cosmwasm/contracts/router/Cargo.toml | 5 +- .../cosmwasm/contracts/router/Developing.md | 104 --------------- scripts/style.sh | 122 ------------------ 13 files changed, 64 insertions(+), 465 deletions(-) delete mode 100644 code/xcvm/cosmwasm/contracts/asset-registry/Developing.md delete mode 100644 code/xcvm/cosmwasm/contracts/router/Developing.md delete mode 100755 scripts/style.sh diff --git a/code/Cargo.lock b/code/Cargo.lock index e3f609c944a..573540b1f47 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -1829,8 +1829,6 @@ dependencies = [ name = "cosmwasm-rpc" version = "0.0.1" dependencies = [ - "composable-support", - "composable-traits", "cosmwasm-runtime-api", "jsonrpsee 0.14.0", "parity-scale-codec", @@ -1845,8 +1843,6 @@ dependencies = [ name = "cosmwasm-runtime-api" version = "0.0.1" dependencies = [ - "composable-support", - "composable-traits", "parity-scale-codec", "sp-api", "sp-std", @@ -1893,16 +1889,6 @@ dependencies = [ "uint", ] -[[package]] -name = "cosmwasm-storage" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d18403b07304d15d304dad11040d45bbcaf78d603b4be3fb5e2685c16f9229b5" -dependencies = [ - "cosmwasm-std", - "serde", -] - [[package]] name = "cosmwasm-vm" version = "0.1.0" @@ -2778,25 +2764,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" -[[package]] -name = "cw-multi-test" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f9a8ab7c3c29ec93cb7a39ce4b14a05e053153b4a17ef7cf2246af1b7c087e" -dependencies = [ - "anyhow", - "cosmwasm-std", - "cosmwasm-storage", - "cw-storage-plus", - "cw-utils", - "derivative", - "itertools", - "prost 0.9.0", - "schemars", - "serde", - "thiserror", -] - [[package]] name = "cw-storage-plus" version = "0.13.4" @@ -4695,7 +4662,7 @@ dependencies = [ "parity-scale-codec", "primitive-types", "primitives 0.1.0 (git+https://github.com/ComposableFi/beefy-rs?rev=ea3c74c7c1f959ba1b90e2508b1b6c1fd9afc7ee)", - "prost 0.10.4", + "prost", "prost-types", "ripemd", "safe-regex", @@ -4747,7 +4714,7 @@ source = "git+https://github.com/ComposableFi/ibc-rs?rev=13de07663749a59a424d67b dependencies = [ "base64 0.13.0", "bytes 1.2.1", - "prost 0.10.4", + "prost", "prost-types", "serde", "tendermint-proto", @@ -4835,7 +4802,7 @@ dependencies = [ "anyhow", "bytes 1.2.1", "hex", - "prost 0.10.4", + "prost", "ripemd160", "sha2 0.9.9", "sha3 0.9.1", @@ -5834,7 +5801,7 @@ dependencies = [ "libp2p-request-response", "libp2p-swarm", "log 0.4.17", - "prost 0.10.4", + "prost", "prost-build", "rand 0.8.5", ] @@ -5861,7 +5828,7 @@ dependencies = [ "multistream-select", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", + "prost", "prost-build", "rand 0.8.5", "ring", @@ -5912,7 +5879,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log 0.4.17", - "prost 0.10.4", + "prost", "prost-build", "rand 0.7.3", "smallvec 1.9.0", @@ -5936,7 +5903,7 @@ dependencies = [ "libp2p-swarm", "log 0.4.17", "prometheus-client", - "prost 0.10.4", + "prost", "prost-build", "rand 0.7.3", "regex", @@ -5959,7 +5926,7 @@ dependencies = [ "libp2p-swarm", "log 0.4.17", "lru 0.7.8", - "prost 0.10.4", + "prost", "prost-build", "prost-codec", "smallvec 1.9.0", @@ -5984,7 +5951,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log 0.4.17", - "prost 0.10.4", + "prost", "prost-build", "rand 0.7.3", "sha2 0.10.6", @@ -6062,7 +6029,7 @@ dependencies = [ "lazy_static", "libp2p-core", "log 0.4.17", - "prost 0.10.4", + "prost", "prost-build", "rand 0.8.5", "sha2 0.10.6", @@ -6099,7 +6066,7 @@ dependencies = [ "futures 0.3.24", "libp2p-core", "log 0.4.17", - "prost 0.10.4", + "prost", "prost-build", "unsigned-varint", "void", @@ -6135,7 +6102,7 @@ dependencies = [ "libp2p-swarm", "log 0.4.17", "pin-project", - "prost 0.10.4", + "prost", "prost-build", "prost-codec", "rand 0.8.5", @@ -6159,7 +6126,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log 0.4.17", - "prost 0.10.4", + "prost", "prost-build", "rand 0.8.5", "sha2 0.10.6", @@ -8244,7 +8211,7 @@ dependencies = [ "parachain-info", "parity-scale-codec", "primitives 0.1.0", - "prost 0.10.4", + "prost", "scale-info", "serde", "serde_json", @@ -11092,16 +11059,6 @@ dependencies = [ "syn 0.15.44", ] -[[package]] -name = "prost" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" -dependencies = [ - "bytes 1.2.1", - "prost-derive 0.9.0", -] - [[package]] name = "prost" version = "0.10.4" @@ -11109,7 +11066,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" dependencies = [ "bytes 1.2.1", - "prost-derive 0.10.1", + "prost-derive", ] [[package]] @@ -11127,7 +11084,7 @@ dependencies = [ "log 0.4.17", "multimap", "petgraph", - "prost 0.10.4", + "prost", "prost-types", "regex", "tempfile", @@ -11142,24 +11099,11 @@ checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" dependencies = [ "asynchronous-codec", "bytes 1.2.1", - "prost 0.10.4", + "prost", "thiserror", "unsigned-varint", ] -[[package]] -name = "prost-derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2 1.0.43", - "quote 1.0.21", - "syn 1.0.100", -] - [[package]] name = "prost-derive" version = "0.10.1" @@ -11180,7 +11124,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" dependencies = [ "bytes 1.2.1", - "prost 0.10.4", + "prost", ] [[package]] @@ -12117,7 +12061,7 @@ dependencies = [ "libp2p", "log 0.4.17", "parity-scale-codec", - "prost 0.10.4", + "prost", "prost-build", "rand 0.7.3", "sc-client-api", @@ -12690,7 +12634,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", + "prost", "prost-build", "rand 0.7.3", "sc-block-builder", @@ -12758,7 +12702,7 @@ dependencies = [ "libp2p", "log 0.4.17", "parity-scale-codec", - "prost 0.10.4", + "prost", "prost-build", "sc-client-api", "sc-network-common", @@ -12780,7 +12724,7 @@ dependencies = [ "log 0.4.17", "lru 0.7.8", "parity-scale-codec", - "prost 0.10.4", + "prost", "prost-build", "sc-client-api", "sc-consensus", @@ -15261,7 +15205,7 @@ dependencies = [ "futures 0.3.24", "num-traits", "once_cell", - "prost 0.10.4", + "prost", "prost-types", "serde", "serde_bytes", @@ -15310,7 +15254,7 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.10.4", + "prost", "prost-types", "serde", "serde_bytes", @@ -17245,8 +17189,6 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cosmwasm-storage", - "cw-multi-test", "cw-storage-plus", "schemars", "serde", @@ -17271,8 +17213,6 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cosmwasm-storage", - "cw-multi-test", "cw-storage-plus", "cw20", "num", @@ -17291,8 +17231,6 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "cosmwasm-storage", - "cw-multi-test", "cw-storage-plus", "cw20", "hex", diff --git a/code/parachain/frame/cosmwasm/rpc/Cargo.toml b/code/parachain/frame/cosmwasm/rpc/Cargo.toml index 9e995c2271f..0529a2084be 100644 --- a/code/parachain/frame/cosmwasm/rpc/Cargo.toml +++ b/code/parachain/frame/cosmwasm/rpc/Cargo.toml @@ -17,8 +17,6 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } # local -composable-support = { path = "../../composable-support" } -composable-traits = { path = "../../composable-traits" } cosmwasm-runtime-api = { path = "../runtime-api" } # SCALE diff --git a/code/parachain/frame/cosmwasm/rpc/src/lib.rs b/code/parachain/frame/cosmwasm/rpc/src/lib.rs index 086fe906df8..3216a329117 100644 --- a/code/parachain/frame/cosmwasm/rpc/src/lib.rs +++ b/code/parachain/frame/cosmwasm/rpc/src/lib.rs @@ -11,37 +11,43 @@ use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; use sp_std::{cmp::Ord, collections::btree_map::BTreeMap, sync::Arc}; -#[rpc(client, server)] -pub trait CosmwasmApi -where - AccountId: FromStr + Display, - AssetId: FromStr + Display + Ord, - Balance: FromStr + Display, -{ - #[method(name = "cosmwasm_query")] - fn query( - &self, - contract: AccountId, - gas: u64, - query_request: Vec, - at: Option, - ) -> RpcResult>; +#[allow(clippy::too_many_arguments)] +mod cosmwasm_api { + use super::*; + #[rpc(client, server)] + pub trait CosmwasmApi + where + AccountId: FromStr + Display, + AssetId: FromStr + Display + Ord, + Balance: FromStr + Display, + { + #[method(name = "cosmwasm_query")] + fn query( + &self, + contract: AccountId, + gas: u64, + query_request: Vec, + at: Option, + ) -> RpcResult>; - #[method(name = "cosmwasm_instantiate")] - fn instantiate( - &self, - instantiator: AccountId, - code_id: u64, - salt: Vec, - admin: Option, - label: Vec, - funds: BTreeMap, - gas: u64, - message: Vec, - at: Option, - ) -> RpcResult; + #[method(name = "cosmwasm_instantiate")] + fn instantiate( + &self, + instantiator: AccountId, + code_id: u64, + salt: Vec, + admin: Option, + label: Vec, + funds: BTreeMap, + gas: u64, + message: Vec, + at: Option, + ) -> RpcResult; + } } +pub use cosmwasm_api::*; + pub struct Cosmwasm { client: Arc, _marker: sp_std::marker::PhantomData, diff --git a/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml b/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml index aac9d8900dc..139230b81a1 100644 --- a/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml +++ b/code/parachain/frame/cosmwasm/runtime-api/Cargo.toml @@ -13,12 +13,9 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { default-features = false, features = [ "derive", ], package = "parity-scale-codec", version = "3.0.0" } -composable-support = { path = "../../composable-support", default-features = false } -composable-traits = { path = "../../composable-traits", default-features = false } sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" } -# REVIEW: Does the runtime API need features? [features] default = ["std"] -std = ["sp-api/std", "composable-support/std"] +std = ["sp-api/std"] diff --git a/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs b/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs index 3d7a998ad2a..42794028ab6 100644 --- a/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs +++ b/code/parachain/frame/cosmwasm/runtime-api/src/lib.rs @@ -7,8 +7,7 @@ use sp_std::collections::btree_map::BTreeMap; #[cfg(not(feature = "std"))] use sp_std::vec::Vec; -// Cosmwasm Runtime API declaration. Implemented for each runtime at -// `runtime//src/lib.rs`. +// Cosmwasm Runtime API declaration. sp_api::decl_runtime_apis! { pub trait CosmwasmRuntimeApi where diff --git a/code/parachain/frame/cosmwasm/src/lib.rs b/code/parachain/frame/cosmwasm/src/lib.rs index e97be6cfd66..2e44e95010b 100644 --- a/code/parachain/frame/cosmwasm/src/lib.rs +++ b/code/parachain/frame/cosmwasm/src/lib.rs @@ -546,7 +546,7 @@ pub mod pallet { label, &message, )?; - let _ = Self::do_extrinsic_dispatch( + Self::do_extrinsic_dispatch( shared, EntryPoint::Instantiate, instantiator, diff --git a/code/parachain/runtime/dali/src/lib.rs b/code/parachain/runtime/dali/src/lib.rs index 22e4404cc05..fa97848656c 100644 --- a/code/parachain/runtime/dali/src/lib.rs +++ b/code/parachain/runtime/dali/src/lib.rs @@ -1576,7 +1576,7 @@ impl_runtime_apis! { label, funds, gas, - message.into() + message ).map_err(|err| alloc::format!("{:?}", err).into_bytes()) } } diff --git a/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml b/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml index ed01dfe6f5d..d4299f8a319 100644 --- a/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/asset-registry/Cargo.toml @@ -15,12 +15,10 @@ crate-type = ["cdylib", "rlib"] [features] # use library feature to disable all instantiate/execute/query exports -backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-std = { version = "1.0.0" } -cosmwasm-storage = "1.0.0" +cosmwasm-std = "1.0.0" cw-storage-plus = "0.13.2" schemars = "0.8.8" serde = { version = "1.0.137", default-features = false, features = ["derive"] } @@ -28,4 +26,3 @@ thiserror = { version = "1.0.31" } [dev-dependencies] cosmwasm-schema = "1.0.0" -cw-multi-test = "0.13.2" diff --git a/code/xcvm/cosmwasm/contracts/asset-registry/Developing.md b/code/xcvm/cosmwasm/contracts/asset-registry/Developing.md deleted file mode 100644 index 0df3a1ed262..00000000000 --- a/code/xcvm/cosmwasm/contracts/asset-registry/Developing.md +++ /dev/null @@ -1,104 +0,0 @@ -# Developing - -If you have recently created a contract with this template, you probably could use some -help on how to build and test the contract, as well as prepare it for production. This -file attempts to provide a brief overview, assuming you have installed a recent -version of Rust already (eg. 1.58.1+). - -## Prerequisites - -Before starting, make sure you have [rustup](https://rustup.rs/) along with a -recent `rustc` and `cargo` version installed. Currently, we are testing on 1.58.1+. - -And you need to have the `wasm32-unknown-unknown` target installed as well. - -You can check that via: - -```sh -rustc --version -cargo --version -rustup target list --installed -# if wasm32 is not listed above, run this -rustup target add wasm32-unknown-unknown -``` - -## Compiling and running tests - -Now that you created your custom contract, make sure you can compile and run it before -making any changes. Go into the repository and do: - -```sh -# this will produce a wasm build in ./target/wasm32-unknown-unknown/release/YOUR_NAME_HERE.wasm -cargo wasm - -# this runs unit tests with helpful backtraces -RUST_BACKTRACE=1 cargo unit-test - -# auto-generate json schema -cargo run --example=schema -``` - -### Understanding the tests - -The main code is in `src/contract.rs` and the unit tests there run in pure rust, -which makes them very quick to execute and give nice output on failures, especially -if you do `RUST_BACKTRACE=1 cargo unit-test`. - -We consider testing critical for anything on a blockchain, and recommend to always keep -the tests up to date. - -## Generating JSON Schema - -While the Wasm calls (`instantiate`, `execute`, `query`) accept JSON, this is not enough -information to use it. We need to expose the schema for the expected messages to the -clients. You can generate this schema by calling `cargo schema`, which will output -4 files in `./schema`, corresponding to the 3 message types the contract accepts, -as well as the internal `State`. - -These files are in standard json-schema format, which should be usable by various -client side tools, either to auto-generate codecs, or just to validate incoming -json wrt. the defined schema. - -## Preparing the Wasm bytecode for production - -Before we upload it to a chain, we need to ensure the smallest output size possible, -as this will be included in the body of a transaction. We also want to have a -reproducible build process, so third parties can verify that the uploaded Wasm -code did indeed come from the claimed rust code. - -To solve both these issues, we have produced `rust-optimizer`, a docker image to -produce an extremely small build output in a consistent manner. The suggest way -to run it is this: - -```sh -docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer:0.12.6 -``` - -Or, If you're on an arm64 machine, you should use a docker image built with arm64. -```sh -docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer-arm64:0.12.6 -``` - -We must mount the contract code to `/code`. You can use a absolute path instead -of `$(pwd)` if you don't want to `cd` to the directory first. The other two -volumes are nice for speedup. Mounting `/code/target` in particular is useful -to avoid docker overwriting your local dev files with root permissions. -Note the `/code/target` cache is unique for each contract being compiled to limit -interference, while the registry cache is global. - -This is rather slow compared to local compilations, especially the first compile -of a given contract. The use of the two volume caches is very useful to speed up -following compiles of the same contract. - -This produces an `artifacts` directory with a `PROJECT_NAME.wasm`, as well as -`checksums.txt`, containing the Sha256 hash of the wasm file. -The wasm file is compiled deterministically (anyone else running the same -docker on the same git commit should get the identical file with the same Sha256 hash). -It is also stripped and minimized for upload to a blockchain (we will also -gzip it in the uploading process to make it even smaller). diff --git a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml index f3ed6ce1e87..7d683c719e4 100644 --- a/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/interpreter/Cargo.toml @@ -18,12 +18,10 @@ crate-type = ["cdylib", "rlib"] [features] # use library feature to disable all instantiate/execute/query exports -backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] cosmwasm-std = { version = "1.0.0" } -cosmwasm-storage = "1.0.0" cw-storage-plus = "0.13.2" cw20 = "0.13.2" num = "0.4" @@ -37,4 +35,3 @@ xcvm-core = { path = "../../../lib/core", features = ["std"] } [dev-dependencies] cosmwasm-schema = "1.0.0" -cw-multi-test = "0.13.2" diff --git a/code/xcvm/cosmwasm/contracts/router/Cargo.toml b/code/xcvm/cosmwasm/contracts/router/Cargo.toml index 9b146b0200c..7412ff415ab 100644 --- a/code/xcvm/cosmwasm/contracts/router/Cargo.toml +++ b/code/xcvm/cosmwasm/contracts/router/Cargo.toml @@ -15,12 +15,10 @@ crate-type = ["cdylib", "rlib"] [features] # use library feature to disable all instantiate/execute/query exports -backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-std = { version = "1.0.0", features = ["abort"] } -cosmwasm-storage = "1.0.0" +cosmwasm-std = "1.0.0" cw-storage-plus = "0.13.2" cw20 = "0.13.2" hex = "0.4" @@ -33,5 +31,4 @@ xcvm-interpreter = { path = "../interpreter", features = ["library"] } [dev-dependencies] cosmwasm-schema = "1.0.0" -cw-multi-test = "0.13.2" serde-json-wasm = { git = "https://github.com/hussein-aitlahcen/serde-json-wasm", rev = "1608a13d2a2ba90605d9626a51ff6667aca5a2d6" } diff --git a/code/xcvm/cosmwasm/contracts/router/Developing.md b/code/xcvm/cosmwasm/contracts/router/Developing.md deleted file mode 100644 index 0df3a1ed262..00000000000 --- a/code/xcvm/cosmwasm/contracts/router/Developing.md +++ /dev/null @@ -1,104 +0,0 @@ -# Developing - -If you have recently created a contract with this template, you probably could use some -help on how to build and test the contract, as well as prepare it for production. This -file attempts to provide a brief overview, assuming you have installed a recent -version of Rust already (eg. 1.58.1+). - -## Prerequisites - -Before starting, make sure you have [rustup](https://rustup.rs/) along with a -recent `rustc` and `cargo` version installed. Currently, we are testing on 1.58.1+. - -And you need to have the `wasm32-unknown-unknown` target installed as well. - -You can check that via: - -```sh -rustc --version -cargo --version -rustup target list --installed -# if wasm32 is not listed above, run this -rustup target add wasm32-unknown-unknown -``` - -## Compiling and running tests - -Now that you created your custom contract, make sure you can compile and run it before -making any changes. Go into the repository and do: - -```sh -# this will produce a wasm build in ./target/wasm32-unknown-unknown/release/YOUR_NAME_HERE.wasm -cargo wasm - -# this runs unit tests with helpful backtraces -RUST_BACKTRACE=1 cargo unit-test - -# auto-generate json schema -cargo run --example=schema -``` - -### Understanding the tests - -The main code is in `src/contract.rs` and the unit tests there run in pure rust, -which makes them very quick to execute and give nice output on failures, especially -if you do `RUST_BACKTRACE=1 cargo unit-test`. - -We consider testing critical for anything on a blockchain, and recommend to always keep -the tests up to date. - -## Generating JSON Schema - -While the Wasm calls (`instantiate`, `execute`, `query`) accept JSON, this is not enough -information to use it. We need to expose the schema for the expected messages to the -clients. You can generate this schema by calling `cargo schema`, which will output -4 files in `./schema`, corresponding to the 3 message types the contract accepts, -as well as the internal `State`. - -These files are in standard json-schema format, which should be usable by various -client side tools, either to auto-generate codecs, or just to validate incoming -json wrt. the defined schema. - -## Preparing the Wasm bytecode for production - -Before we upload it to a chain, we need to ensure the smallest output size possible, -as this will be included in the body of a transaction. We also want to have a -reproducible build process, so third parties can verify that the uploaded Wasm -code did indeed come from the claimed rust code. - -To solve both these issues, we have produced `rust-optimizer`, a docker image to -produce an extremely small build output in a consistent manner. The suggest way -to run it is this: - -```sh -docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer:0.12.6 -``` - -Or, If you're on an arm64 machine, you should use a docker image built with arm64. -```sh -docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer-arm64:0.12.6 -``` - -We must mount the contract code to `/code`. You can use a absolute path instead -of `$(pwd)` if you don't want to `cd` to the directory first. The other two -volumes are nice for speedup. Mounting `/code/target` in particular is useful -to avoid docker overwriting your local dev files with root permissions. -Note the `/code/target` cache is unique for each contract being compiled to limit -interference, while the registry cache is global. - -This is rather slow compared to local compilations, especially the first compile -of a given contract. The use of the two volume caches is very useful to speed up -following compiles of the same contract. - -This produces an `artifacts` directory with a `PROJECT_NAME.wasm`, as well as -`checksums.txt`, containing the Sha256 hash of the wasm file. -The wasm file is compiled deterministically (anyone else running the same -docker on the same git commit should get the identical file with the same Sha256 hash). -It is also stripped and minimized for upload to a blockchain (we will also -gzip it in the uploading process to make it even smaller). diff --git a/scripts/style.sh b/scripts/style.sh deleted file mode 100755 index f02657f6090..00000000000 --- a/scripts/style.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env bash - -NIGHTLY_VERSION="2022-04-18" - -usage() { - cat </dev/null -fi - -for arg in "$@"; do - case $arg in - "--help" | "-h") - usage - exit 0 - ;; - "--check" | "-c") - check="check" - ;; - "--verbose" | "-v") - verbose="verbose" - ;; - *) - echo "Unknown option '$arg'" - usage - exit 1 - ;; - esac -done - -cargo_fmt -taplo_fmt -prettier_fmt