Questions tagged [wasm]
The wasm tag has no usage guidance.
78
questions
1
vote
0
answers
20
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) ->...
2
votes
1
answer
50
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,...
2
votes
1
answer
22
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 ...
1
vote
1
answer
25
views
i get a error when running dev node and tranfer coin to test address
it is logs when i click tranfer in local web (use : https://github.com/substrate-developer-hub/substrate-front-end-template)
2023-05-08 07:55:45 🎁 Prepared block for proposing at 230 [hash: ...
1
vote
0
answers
54
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))...
7
votes
1
answer
65
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?
...
7
votes
4
answers
133
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 ...
5
votes
1
answer
90
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
268
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:
...
1
vote
1
answer
49
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 ...
1
vote
1
answer
61
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, ...
1
vote
1
answer
49
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 ...
4
votes
2
answers
286
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 ...
2
votes
1
answer
36
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&...
4
votes
1
answer
75
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 ...
14
votes
5
answers
958
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 ...
2
votes
0
answers
69
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 ...
1
vote
1
answer
25
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....
3
votes
1
answer
22
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?
1
vote
1
answer
33
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
38
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 ...
2
votes
2
answers
71
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:
...
1
vote
1
answer
55
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?
4
votes
2
answers
84
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
78
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 ...
0
votes
0
answers
22
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
25
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?
6
votes
2
answers
114
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
44
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?
1
vote
1
answer
55
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
45
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-...
1
vote
1
answer
66
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
69
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
62
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
78
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
55
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 ...
0
votes
1
answer
96
views
Expected input with 32 bytes (256 bits), found 48 bytes
I have a solidity smart contract that I compile using Solang to substrate wasm.
contract Pool {
address xxx;
constructor(address _test){
xxx = _test;
}
function callFoo(address _test) external ...
1
vote
1
answer
156
views
Cannot run benchmarking: "Did not find the benchmarking metadata."
I have problems with trying to benchmark my custom pallet. I tried different scenarios and received different errors:
Using the same binary:
I built my node with cargo build --release --features ...
2
votes
1
answer
93
views
unreachable` instruction executed when running overhead benchmark
for some reason running overhead benchmarks fails in our parachain.
cargo run --release --features=runtime-benchmarks benchmark overhead --chain local
results with following stacktrace
Error: Client(...
1
vote
0
answers
57
views
Another Benchmarking Wasm error [closed]
I asked a similar question a month ago here, and the answer/explanation was found in a failing cargo t -p pallet-nft --features runtime-benchmarks command.
This time, the building part works, the ...
2
votes
0
answers
40
views
How to solve the error secp256k1-sys v0.4.2? [duplicate]
I'm adding a pallet2 to pallet1's runtime cargo.toml then I'm getting this error.
Thanks in advance!!
Compiling secp256k1-sys v0.4.2
error: the wasm32-unknown-unknown target is not supported by ...
1
vote
1
answer
65
views
Benchmarking Wasm error
I am trying to do benchmarking for my pallet,but I get the following error:
Error executing and verifying runtime benchmark: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction ...
2
votes
1
answer
98
views
What are the design decisions behind Runtime memory management
Why is the Runtime memory management designed such that the Host manages the memory shared with the Wasm Runtime (imports memory + allocation functions)? Since the Host might need to store things onto ...
5
votes
5
answers
1k
views
the wasm32-unknown-unknown target is not supported by default
I am attempting to implement a custom pallet, but I keep running into this compile error:
error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js"...
0
votes
1
answer
42
views
Does Polkadot's Runtime/Wasm support any form of concurrency
I just want to confirm that Polkadot's Runtime does not support concurrency since it targets WebAssembly MVP?
5
votes
1
answer
103
views
Best way to handle Solidity's `uint256` in ink!
I have been working on creating a guide to port Solidity smart contracts to ink! smart contracts. I was hoping for some input on how to best handle Solidity's uint256 in ink!.
Solidity is optimized ...
1
vote
1
answer
103
views
Runtime panic when teleporting dot from relay to parachain locally
I'm trying to enforce a "same native token" rule for the relay and all future parachains in my local environment. For this, I must first configure my parachain to accept teleports from a ...
5
votes
1
answer
279
views
Is possible to extract the runtime version from WASM file?
Is possible to extract the runtime version from the WASM file?
Sometimes, I want to verify the WASM file's content locally.
2
votes
2
answers
164
views
Contract storage needs nested orderbooks; best practice way to structure dapp?
For my dapp I need storage which can reference a mutable amount of events, all of which have their own orderbook. Expanded, it looks something like this:
CoreStorage {
coin_storage: CoinStore, //...
1
vote
1
answer
312
views
"Rust WASM toolchain not installed" with v0.9.25
I recently upgraded a fork of the Node Template to v0.9.25 and now I am getting an error about the Wasm toolchain not being installed. Per the official Substrate documentation, the failing build is ...