diff --git a/.github/workflows/pr-workflow.ymlpp] b/.github/workflows/pr-workflow.yml similarity index 96% rename from .github/workflows/pr-workflow.ymlpp] rename to .github/workflows/pr-workflow.yml index fd10c098036..c49bd2c13d9 100644 --- a/.github/workflows/pr-workflow.ymlpp] +++ b/.github/workflows/pr-workflow.yml @@ -576,20 +576,10 @@ jobs: echo "build-all-benchmarks-packages" ${{ needs.build-all-benchmarks-packages.outputs.ok }} echo "build-product-darwin" ${{ needs.build-product-darwin.outputs.ok }} echo "devnet-integration-tests" ${{ needs.devnet-integration-tests.outputs.ok }} - - if: | - ${{ - needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-production-deps.outputs.ok == 'true' && needs.build-all-misc-packages.outputs.ok == 'true' && needs.build-all-docs-packages.outputs.ok == 'true' && needs.build-all-ci-packages.outputs.ok == 'true' && needs.build-all-benchmarks-packages.outputs.ok == 'true' - && needs.build-product-darwin.outputs.ok == 'true' - && needs.devnet-integration-tests.outputs.ok == 'true' - }} + - if: ${{ needs.nix-flake-check.outputs.ok == 'true' && needs.dependency-review.outputs.ok == 'true' && needs.build-all-production-deps.outputs.ok == 'true' && needs.build-all-misc-packages.outputs.ok == 'true' && needs.build-all-docs-packages.outputs.ok == 'true' && needs.build-all-ci-packages.outputs.ok == 'true' && needs.build-all-benchmarks-packages.outputs.ok == 'true' && needs.build-product-darwin.outputs.ok == 'true' && needs.devnet-integration-tests.outputs.ok == 'true' }} run: | echo "All dependencies built well" - - if: | - ${{ - needs.nix-flake-check.outputs.ok != 'true' || needs.dependency-review.outputs.ok != 'true' || needs.build-all-production-deps.outputs.ok != 'true' || needs.build-all-misc-packages.outputs.ok != 'true' || needs.build-all-docs-packages.outputs.ok != 'true' || needs.build-all-ci-packages.outputs.ok != 'true' || needs.build-all-benchmarks-packages.outputs.ok != 'true' - || needs.build-product-darwin.outputs.ok != 'true' - || needs.devnet-integration-tests.outputs.ok != 'true' - }} + - if: ${{ needs.nix-flake-check.outputs.ok != 'true' || needs.dependency-review.outputs.ok != 'true' || needs.build-all-production-deps.outputs.ok != 'true' || needs.build-all-misc-packages.outputs.ok != 'true' || needs.build-all-docs-packages.outputs.ok != 'true' || needs.build-all-ci-packages.outputs.ok != 'true' || needs.build-all-benchmarks-packages.outputs.ok != 'true' || needs.build-product-darwin.outputs.ok != 'true' || needs.devnet-integration-tests.outputs.ok != 'true' }} run: | echo "Some of dependencies (see jobs graph or needs attribute) failed to build" exit 42 diff --git a/code/Cargo.lock b/code/Cargo.lock index e95c3843b8a..7ef9f713971 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -1748,7 +1748,7 @@ dependencies = [ [[package]] name = "composable" -version = "7.10023.1" +version = "7.10024.0" dependencies = [ "color-eyre", "composable-node", @@ -1773,7 +1773,7 @@ dependencies = [ [[package]] name = "composable-node" -version = "7.10023.1" +version = "7.10024.0" dependencies = [ "assets-rpc", "assets-runtime-api", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "composable-runtime" -version = "7.10023.1" +version = "7.10024.0" dependencies = [ "assets-runtime-api", "common", @@ -1951,7 +1951,7 @@ dependencies = [ [[package]] name = "composable-runtime-wasm" -version = "7.10023.1" +version = "7.10024.0" dependencies = [ "composable-runtime", ] @@ -9996,7 +9996,7 @@ dependencies = [ [[package]] name = "picasso-runtime" -version = "7.10023.1" +version = "7.10024.0" dependencies = [ "assets-runtime-api", "common", @@ -10094,7 +10094,7 @@ dependencies = [ [[package]] name = "picasso-runtime-wasm" -version = "7.10023.1" +version = "7.10024.0" dependencies = [ "picasso-runtime", ] diff --git a/code/Cargo.toml b/code/Cargo.toml index 13c9412264f..49b52279233 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -6,7 +6,7 @@ name = "composable" version = { workspace = true } [workspace.package] -version = "7.10023.1" +version = "7.10024.0" [[bin]] name = "composable" diff --git a/code/parachain/frame/cosmwasm/src/lib.rs b/code/parachain/frame/cosmwasm/src/lib.rs index 121d18b8bd2..43611e6ff2e 100644 --- a/code/parachain/frame/cosmwasm/src/lib.rs +++ b/code/parachain/frame/cosmwasm/src/lib.rs @@ -157,7 +157,6 @@ pub mod pallet { pub enum Error { Instrumentation, VmCreation, - ContractTrapped, ContractHasNoInfo, CodeDecoding, CodeValidation, @@ -187,6 +186,12 @@ pub mod pallet { OutOfGas, InvalidSalt, InvalidAccount, + Interpreter, + VirtualMachine, + AccountConversionFailure, + Aborted, + ReadOnlyViolation, + Rpc, } #[pallet::config] @@ -706,20 +711,29 @@ impl Pallet { initial_gas: u64, remaining_gas: u64, ) -> DispatchResultWithPostInfo { - log::info!(target: "runtime::contracts", "outcome: {:?}", outcome); + log::debug!(target: "runtime::contracts", "outcome: {:?}", outcome); let post_info = PostDispatchInfo { actual_weight: Some(Weight::from_ref_time(initial_gas.saturating_sub(remaining_gas))), pays_fee: Pays::Yes, }; match outcome { Ok(()) => Ok(post_info), - Err(e) => { - let e = match e { + Err(error) => { + log::info!(target: "runtime::contracts", "executing contract error with {}", &error); + let error = match error { CosmwasmVMError::Pallet(e) => e, CosmwasmVMError::OutOfGas => Error::::OutOfGas, - _ => Error::::ContractTrapped, + CosmwasmVMError::Interpreter(_) => Error::::Interpreter, + CosmwasmVMError::VirtualMachine(_) => Error::::VirtualMachine, + CosmwasmVMError::AccountConversionFailure => + Error::::AccountConversionFailure, + CosmwasmVMError::Aborted(_) => Error::::Aborted, + CosmwasmVMError::ReadOnlyViolation => Error::::ReadOnlyViolation, + CosmwasmVMError::Unsupported => Error::::Unsupported, + CosmwasmVMError::Rpc(_) => Error::::Rpc, + CosmwasmVMError::Ibc(_) => Error::::Ibc, }; - Err(DispatchErrorWithPostInfo { error: e.into(), post_info }) + Err(DispatchErrorWithPostInfo { error: error.into(), post_info }) }, } } diff --git a/code/parachain/runtime/composable/src/version.rs b/code/parachain/runtime/composable/src/version.rs index 2ebaf195659..64dbdef2951 100644 --- a/code/parachain/runtime/composable/src/version.rs +++ b/code/parachain/runtime/composable/src/version.rs @@ -13,7 +13,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 10023, + spec_version: 10024, impl_version: 3, apis: RUNTIME_API_VERSIONS, transaction_version: 2, diff --git a/code/parachain/runtime/picasso/src/version.rs b/code/parachain/runtime/picasso/src/version.rs index a671be28854..34ae85a5ee2 100644 --- a/code/parachain/runtime/picasso/src/version.rs +++ b/code/parachain/runtime/picasso/src/version.rs @@ -16,7 +16,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 10023, + spec_version: 10024, impl_version: 2, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/docs/docs/products/cosmwasm/deploy-and-run-cosmwasm-contracts-with-pdjs.md b/docs/docs/products/cosmwasm/deploy-and-run-cosmwasm-contracts-with-pdjs.md new file mode 100644 index 00000000000..38b03f2c9c5 --- /dev/null +++ b/docs/docs/products/cosmwasm/deploy-and-run-cosmwasm-contracts-with-pdjs.md @@ -0,0 +1,27 @@ +# Overview + +Follow this guide to upload, initialize and execute cw20 contract on local Picasso Rococo DevNet. + +## Prerequisites + +You successfully run simple transaction and observe events using Polkadot.js one one of Composable or Picasso runtimes. + +It does not require you to know CosmWasm contracts well, but general awareness would be super useful. + +You have installed Nix using Zero-to-Nix guide and successfully run package from `composable` registry. + +## Steps + +1. Run `nix run composable#devnet-picasso` +2. Download [cw20](https://github.com/CosmWasm/cw-plus/releases/download/v1.0.1/cw20_base.wasm) contract +3. Click `Direct Link` in devnet startup output on one of nodes to open Polkadot.js. +4. Go to `Developer -> Extrinsics -> cosmwasm -> upload -> file upload` , input `cw20_base.wasm` file and `Submit Transaction`. +5. Observe `cosmwasm.Uploaded.codeId` in events. +6. Call `cosmwasm -> instantiate` with `codeId` from event, gas `10000000000`, message `{ "decimals" : 18, "initial_balances": [], "name" : "SHIB", "symbol" : "SHIB", "mint": {"minter" : "5yNZjX24n2eg7W6EVamaTXNQbWCwchhThEaSWB7V3GRjtHeL"} }`, salt and labels to unique random numbers like `0x1234` and `0x4321`, other fields `0x`. +7. Observe `cosmwasm.Instantiated` event and click icon to copy `contract` address. +8. `cosmwasm -> execute` , put `contract` address from event, gas `10000000000`, message `{ "mint" : { "amount" : "123456789", "recipient" : "5yNZjX24n2eg7W6EVamaTXNQbWCwchhThEaSWB7V3GRjtHeL" }}`, other fields `0x`. +9. Observe `cosmwasm.Executed` execution success. + +### Testnet + +Repeat steps on testnet. diff --git a/inputs/paritytech/zombienet/default.nix b/inputs/paritytech/zombienet/default.nix index 21fbc2a02b9..697f24519e2 100644 --- a/inputs/paritytech/zombienet/default.nix +++ b/inputs/paritytech/zombienet/default.nix @@ -31,7 +31,7 @@ in with prelude; rec { env = [{ name = "RUST_LOG"; value = - "info,runtime=debug,parachain=trace,cumulus-collator=trace,aura=trace,xcm=trace,pallet_ibc=trace,hyperspace=trace,hyperspace_parachain=trace,ics=trace,ics::routing=trace,ics::channel=trace" + "info,runtime::contracts=debug,runtime=debug,parachain=trace,cumulus-collator=trace,aura=trace,xcm=trace,pallet_ibc=trace,hyperspace=trace,hyperspace_parachain=trace,ics=trace,ics::routing=trace,ics::channel=trace" # RUST_LOG does not eats extra comma well, so fixed conditionally + (if rust_log_add != null then "," + rust_log_add else ""); }];