Questions tagged [wasm]
The wasm tag has no usage guidance.
92
questions
3
votes
2
answers
22
views
Is there any way to extract "method" and "params" of unchecked extrinsic using ScaleCode/TypeInfo traits?
I'm wondering if there is any way to extract information about method and parameter of Extrinsic(Unchecked/CheckedExtrinsic) using TypeInfo and Scale codec.
In polkadotJs there is toString method on ...
0
votes
0
answers
18
views
Custom RPC Error on sp_api::decl_runtime_apis!
We are adding a custom rpc and following along with
https://github.com/AlexD10S/susbtrate-node-template/blob/rpc-custom-methods/pallets/template/rpc/runtime-api/src/lib.rs
and
https://github.com/...
0
votes
0
answers
16
views
What is the usecase of `PassBy` trait bound
While working on types between Runtime and Host functions, types going from Runtime to host function requires a PassBy trait bound while types going from Host function to Runtime does not need that ...
2
votes
0
answers
27
views
wasm compilation for later rust versions
I am running a parachain on Ubuntu 22.04 jammy. where i am using polkadot 9.43. I see that in release notes it is said that nightly-2023-05-22 was tested for this substrate version https://github.com/...
2
votes
1
answer
42
views
What is default --execution <strategy> and recommended value for node/validator operator?
When executing node as a validator, the documentation states here that there is differents execution strategy available, however as this is optionnal switches, what is default if nothing is set ?
...
1
vote
1
answer
122
views
Why is serde always std-gated in substrate?
I regularly see serde implemented for various structs across the substrate ecosystem, usually in the single-liner form below. Why is that gated behind the std feature? In serde's documentation, it's ...
0
votes
0
answers
44
views
Unable to verify WASM contract in Substrate Astar
I'm encountering difficulties while attempting to verify my WASM smart contract through Astar's Subscan tool. Despite multiple attempts using various options, the verification process remains ...
1
vote
0
answers
28
views
Moonbase parachain collator not producing blocks using zombienet
I am trying to run zombienet tests with 2 polkadot relay chain nodes and 1 parachain collator running the moonbeam binary. The test config is as follows: test.toml
[settings]
timeout = 1000
[...
1
vote
0
answers
54
views
Is 'Ran out of free Wasm instances' a bad symptom?
I develop a custom chain based on Substrate.
The chain business logic involves stateful sessions where the state is managed through
Http and unsigned transactions submitted via Offchain workers.
Until ...
4
votes
2
answers
56
views
WebAssembly runtime file into ValidationCode
I have a CLI tool that gets a WebAssembly runtime file:
let validation_code_content = fs::read_to_string(path_validation_code)
.expect("Should have been able to read the validation code ...
3
votes
2
answers
178
views
Specialization impl does not specialize any associated items
I'm fairly new to Rust and ink! itself.
I'm trying to compile and build an extremely basic PSP22 Contract.
I get the following error when I compile & build:
(running cargo +nightly contract build)
...
5
votes
2
answers
150
views
"ERROR: Loading of original wasm failed" after upgrading rustup
I'm getting the following error when compiling a rust ink! 4.0;
ERROR: Loading of original wasm failed
It's started happening to me after I rustup update and now my rustc versions are:
stable-...
5
votes
1
answer
85
views
Substrate Error after updating from polkadot version polkadot 0.9.30 to polkadot 0.9.42
I have a running chain which was on polkadot-v0.9.30 and updated all the libraries on to polkadot-v0.9.42
No error found while uploading but got error after updating
panicked at 'Sensible defaults ...
3
votes
0
answers
29
views
How can I use complex structure in ink! version3
how can i use the complex structure(like Mapping<String, Vec<Map<String, String>>>) in ink!
#![cfg_attr(not(feature = "std"), no_std)]
use ink_lang as ink;
#[ink::...
4
votes
1
answer
151
views
How to interact between a smart contract written in Solidity from a smart contract written in ink!?
In the repository of the cargo-contract CLI tool, which currently "helps you develop smart contracts in Parity's ink!, which is a Rust eDSL allowing you to write smart contracts for blockchains ...
3
votes
1
answer
61
views
Error while dividing two u128/Balance types
#[ink(storage)]
pub struct Variables {
a: u128,
b: u128,
multiplier: u128
}
impl Variables {
#[ink(constructor)]
pub fn new(a: u128, b: u128) ->...
1
vote
1
answer
67
views
Explain components of Mapping used by Openbrush. Mainly placeholders for the actual type used in the code. Like ApprovalsKey used in bellow example
I am trying to understand the working of upgradeble storage used by openbrush libraries.
I am unable to understand Mapping used in impls of psp34 trait eg
pub operator_approvals: Mapping<(Owner,...
3
votes
1
answer
34
views
Prevent unused imports from bloating up runtime wasm
I recently wrote a pallet that uses a (non-substrate) Rust crate as a dependency.
This crate conveniently supports no-std and Wasm, but it is also quite extensive and there's a lot of code that my ...
2
votes
0
answers
58
views
Failed to compact generated WASM binary in substrate standalone chain [duplicate]
I'm building the substrate standalone chain with this cargo build --release command and facing the issue:
thread 'main' panicked at 'Failed to compact generated WASM binary.: Error(UnknownOpcode(192))...
9
votes
1
answer
117
views
Smart Contract blockspace allocation in Hybrid Chains
In Rob Habermeier's blogpost about Hybrid Chains, he mentions allocating contract execution to a limited fraction of the chain's blockspace.
Is that some functionality that pallet-contracts provides?
...
8
votes
4
answers
143
views
Managing deployment of complex set of wasm contracts
We need to deploy a set of several smart contracts, x-compiled from Solidity to wasm, and maintain that deployment (deploy new contract instances and migrate to them once in a while).
So what we ...
6
votes
1
answer
107
views
cannot create module: instance allocation for this module requires 74376 bytes which exceeds the configured maximum of 65536 bytes
Try in to benchmark node pallets after Polkadot upgrade from 0.9.36 to 0.9.38 and get cannot create module: instance allocation for this module requires 74376 bytes which exceeds the configured ...
0
votes
0
answers
281
views
Error: Service(Client(VersionInvalid("cannot deserialize module: UnknownOpcode(192)"))) [duplicate]
Link:
https://github.com/paritytech/substrate-contracts-node
https://use.ink/getting-started/running-substrate
When I try to run "substrate-contracts-node --dev" I get this error:
...
2
votes
1
answer
224
views
execution failed: execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed. TransactionPaymentApi_query_info
We are currently depositing KSM tokens to our parachain using the following code:
kusamaApi.tx.xcmPallet.limitedReserveTransferAssets(params_here)
When executing the transaction, the KSM tokens are ...
3
votes
1
answer
115
views
Compiling runtime with std targeting wasm32-unknown-unknown
We are exploring how to wrap part of the runtime logic into a re-usable WASM blob that can be wrapped in a JS library.
To do that, we are investigating using wasm-pack and wasm-bindgen. Unfortunately, ...
3
votes
1
answer
75
views
Chatbot Trained on Substrate-based Chains and Repositories for General Reference and Help [closed]
I'd like to propose an idea for creating a general reference and help tool utilizing a chatbot trained on data from Substrate-based chains (e.g., Polkadot, Kusama, Parachains) and their associated ...
10
votes
4
answers
1k
views
ERROR: Loading of original wasm failed
I having some trouble running the Flipper example from the Ink! webpage.
The cargo contract build outputs the following error log:
ERROR: Loading of original wasm failed
Caused by:
0: Loading of ...
3
votes
1
answer
56
views
Implications of invalid encoded extrinsic calls
We are seeing the following error whenever an invalidly encoded but properly signed extrinsic is submitted in our substrate based chain.
{
"jsonrpc": "2.0",
"error&...
6
votes
1
answer
136
views
How to attach debugger to the Runtime WASM
Using lldb (like with VSCode), it is fairly easy to attach it to the client, allowing to debug the client side of the node. However, once the wasmtime is executing the Wasm Runtime, the debugger is ...
15
votes
5
answers
1k
views
cannot run substrate on a fresh macbook m2
I have a brand new macbook m2.
I followed all the steps on https://docs.substrate.io/install/macos
% rustup show
Default host: aarch64-apple-darwin
rustup home: /Users/bear/.rustup
installed ...
4
votes
0
answers
121
views
How to check if a pallet can be compiled to no-std/WASM?
How to check if a pallet can be compiled to no-std/WASM?
I ran:
cargo build --no-default-features --target wasm32-unknown-unknown
But this didn't work. IIUC, we need some ENV to build the pallet to ...
2
votes
1
answer
66
views
`RuntimeError: unreachable` while using polkadot js to do sr25519 sign
await cryptoWaitReady();
const json = JSON.parse(xxx);
const keyring = new Keyring({ ss58Format: 42 });
const pair = keyring.addFromPair(decoded, json.meta, 'sr25519');
// const pair = keyring....
4
votes
1
answer
42
views
How to benchmark a crate's WASM execution performance?
How to benchmark the code's WASM execution performance?
I wrote a crate and want to use it in the runtime.
I want to know its WASM execution time in ms. How can I get that?
2
votes
1
answer
53
views
Modify the Genesis file/WASM after getting the slot but before the parachain creates the block
I want to find a way to check whether the parachain's genesis file/WASM can be changed after getting the slot but before creating the first block by the users who registered the parachain. Is that ...
2
votes
1
answer
63
views
How to generate only the Wasm runtime during compilation?
Normally, when you run cargo build, both the native and Wasm runtime, along with the whole client is generated as part of the build process.
How would you compile just the Wasm runtime, so that you ...
3
votes
2
answers
79
views
Wasm traps in ink contract but not in a `wasm-pack` test
I have a contract that implements some ZKP verification logic with plonk. The verification logic is contained in some other crate that can be compiled to Wasm, and there are wasm-pack tests like this:
...
2
votes
1
answer
71
views
How to debug error codes for ink contracts?
Ink contract Transaction emit errors with hex code. How to map that to the actual error and get a trace of error in the contract?
0
votes
2
answers
101
views
Balance got Reserved while deploying wasm contracts?
i am using pallet-contracts in my substrate based chain when i am deploying the wasm smart-contract some balance is getting reserved.How can i stop this i don't want to reserve the balance,Or is there ...
0
votes
2
answers
95
views
Error Compling Contract
I am just starting with wasm and ink.
I have installed the following dependency:
npm install -g @astar-network/swanky-cli
I am trying to compile the contract flipper and I get the following warnings ...
1
vote
0
answers
32
views
Compiling cumulus v0.9.36 with --no-default-features
When attempting to compile cumulus on branch polkadot-v0.9.36 while disabling standard features, this error occurs:
nologik@nologik-laptop dkg-substrate % cargo check --workspace --no-default-features
...
0
votes
1
answer
30
views
Use criterion for statistic driven benchmarking of Substrate pallets
Criterion version 0.4.0 seems to support WASM builds: https://www.tweag.io/blog/2022-03-03-criterion-rs/#first-class-wasm-support
Can we us it to benchmark extrinsics of Substrate pallets?
7
votes
2
answers
196
views
How is wasmi different from wasmtime?
I found wasmi is a dependency in multiple substrate crates, but there's one crate that also uses wasmtime. How is wasmi different from wasmtime?
1
vote
1
answer
68
views
How forkless runtime upgrades takes place in substrate?
Does code compiled to Wasm enables to forkless runtime upgrades in polkadot substrate development? Someone please explain me how forkless runtime upgrades features enables?
2
votes
1
answer
71
views
Can we update the genesis head wasm after obtaining a slot?
I have some confusion regarding WASM genesis state. I'm not entirely sure what it contains or how to update it once we've acquired a slot.
For some context: assume we have a substrate based chain that ...
0
votes
1
answer
62
views
Could not find `Cargo.lock`
I'm using cross to build my node.
And I got this:
warning: Could not find `Cargo.lock` for `/root/code/darwinia-network/darwinia-2.0/runtime/pangolin/Cargo.toml`, while searching from `/target/x86_64-...
3
votes
1
answer
79
views
How to return uint256 datatype from ink! wasm contract? How to make compatibility with IERC20?
IERC20 interface contains methods with uint256 datatype.
If you try to call ink! wasm contract from Solidity (compiled by solang to target subtrate) you will have an issue.
interface IERC20{
...
1
vote
1
answer
103
views
Unable to decode contract event: Unable to find event [closed]
Ive got this error on my console although transaction was succeeded.
what causes this error..?
1
vote
1
answer
72
views
What is the 'wasm' argument in CodePromise?
I'm building an application that allows anyone to deploy PSP34 using Openbrush contract.
I want to allow users to deploy a new contract from the UI and upload an image to mint the NFT.
I have ...
1
vote
1
answer
93
views
Switch between different Wasm runtimes in case of a bugs
Since the Wasm runtime is stored on-chain under consensus rules, if a bug is discovered, what is the procedure to switch to a different Wasm runtime? What if the bug affects the block production? Does ...
2
votes
1
answer
62
views
Embedding javascript (wasm) in substrate runtime
I have some javascript code that I need to embed in my substrate runtime. It's not possible / practical to rewrite the javascript code in rust. I was wondering if instead it would be possible to ...