Questions tagged [wasm]
The wasm tag has no usage guidance.
103 questions
0
votes
0
answers
6
views
Substrate frame-metadata version Confliction [closed]
There seems to be a frame-metadata crate error where 2 versions are being referenced which is causing the error. The 2 versions are v16.0.0 and v18.0.0. The issue is that the substrate-wasm-builder ...
1
vote
0
answers
23
views
Why is runtime's WASM maximum allocated memory hardcoded to 32MiB?
In sp-core it is defined the maximum memory that can be allocated by the runtime. The current max possible allocation is 32 MiB:
// substrate/primitives/core/src/lib.rs (snip)
/// The maximum number ...
0
votes
1
answer
55
views
Allocate extra WASM memory to generate large chainspecs
In some cases, generating a chainspec may overload the memory allocated by the WASM blob which results in an Requested allocation size is too large error:
❯ staking-node build-spec --disable-default-...
4
votes
2
answers
82
views
Alternative to BlakeTwo256 for WASM Compatibility in a no_std Environment in Rust
I'm developing a Rust script that I need to convert to WebAssembly (WASM). In this script, I'm using the BlakeTwo256 hasher, which is imported from the sp_runtime crate. However, I'm unable to compile ...
0
votes
0
answers
10
views
calldata in the substrate contract ui
how can I get the calldata of the function in the wasm contract in the substrate contract UI ?
I was trying to mimic the behaviour of the upgradeToAndCall() of the solidity,but in that they are ...
0
votes
1
answer
20
views
Suddenly TransactionPaymentApi_query_info is generating wasm errors at block height 21455372 (maybe runtime 1.2.5?)
I was using the following JSON-RPC method to hit query_info, but suddenly got a wasm error from today. Is this an effect of the runtime update?
If so, what changes are needed?
% curl -H "Content-...
0
votes
1
answer
31
views
XVM Ink Wasm to EVM: Contract Reverted. Decoding Failed
I tried to deploy a XVM Wasm contract wrapping around a deployed EVM Solidity contract in my local node.
Steps
Deploy my EVM Solidity contract via Remix connecting to my local node
//SPDX-License-...
1
vote
0
answers
15
views
How can I manage the issue of excessive gas estimation in MetaMask when deploying a dapp contract on my WASM+EVM chain and calling its functions?
i am trying to deploy a dapp contract on my WASM + EVM based substrate chain but while calling the contract functions it gives me high gas estimation, how can i handle this issue?
1
vote
1
answer
52
views
How to debug an extrinsic (the runtime code) after migration to wasm-only execution in Polkadot?
Polkadot is moving away from native execution mode and in the first step they removed the native execution mode. This means that the --execution Native does not work anymore which is the solution in ...
0
votes
1
answer
54
views
IEEE 754 Floating Point Numbers wasm impelementation
We are looking to enable reproducible floating point operations on chain by implementing the IEEE 754 standard as an on-chain wasm function.
As discussed in this stackoverflow post,
substrate does not ...
1
vote
1
answer
81
views
`The trait Deserialize is not implemented for a` GenesisConfig
I am in the process of upgrading a project from version 0.9.42 to 1.6.0, where the BuildGenesisConfig was added and BuildGenesis was deprecated, and I encounter an error (the trait Serialize is not ...
0
votes
0
answers
20
views
Why are any of the `RuntimeApiSubsystemClient` trait methods marked `async` when its not needed?
The trait RuntimeApiSubsystemClient and its implementation DefaultSubsystemClient
(https://github.com/paritytech/polkadot-sdk/blob/c421b87978404954dec4555895d50ef028b73cf0/polkadot/node/subsystem-...
0
votes
0
answers
23
views
is the endpoint TransactionPaymentApi_query_info usable on current Westend testnet?
I was trying to query payment_queryInfo on current Westend testnet, and the following payload used to works at spec 9430.
{
"jsonrpc": "2.0",
"method": "...
2
votes
0
answers
31
views
Is it possible to register parathread with compact.compressed wasm file
In official guides they use wasm built with export-genesis-wasm command to register a parathread/parachain:
https://youtu.be/BaWcQxKRFmM?t=134
https://docs.substrate.io/tutorials/build-a-parachain/...
3
votes
2
answers
36
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 ...
1
vote
1
answer
45
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/...
2
votes
0
answers
41
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
49
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
178
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 ...
1
vote
0
answers
54
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
119
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
61
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
226
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
209
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
109
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
33
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::...
6
votes
1
answer
227
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
83
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
73
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
59
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
121
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
147
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
118
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 ...
2
votes
1
answer
413
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
192
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
77
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
2k
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 ...
4
votes
1
answer
80
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
217
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
2k
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 ...
5
votes
0
answers
204
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
95
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
60
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
69
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
86
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
90
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
96
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
109
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
102
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 ...