Questions tagged [wasm]
The wasm tag has no usage guidance.
103 questions
1
vote
0
answers
45
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
35
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
333
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
82
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
82
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
80
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
86
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
134
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
81
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
99
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
68
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
188
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
391
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
127
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
69
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 ...
3
votes
0
answers
55
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
94
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
147
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 ...
7
votes
5
answers
4k
views
The wasm32-unknown-unknown target is not supported by default
I'm 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
65
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?
6
votes
1
answer
141
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
145
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 relay account ...
5
votes
1
answer
450
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
214
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
442
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 ...
2
votes
2
answers
554
views
Error: failed to instantiate a new WASM module instance: Insufficient resources: cannot create a memf"
I am using Ubuntu 20.04 on windows 10 wsl and when I run the command in my terminals:
./target/release/node-template \
--base-path /tmp/alice \
--chain local \
--alice \
--port 30333 \
--ws-port 9945 \...
3
votes
1
answer
137
views
Provide more details about the compilation target of Polkadot's wasm runtime
I am trying to compile my own runtime, as PoC, but I don't use Rust's toolchain and some things are unclear how to do it at the moment.
With Substrate, you can write your blockchain logic in any ...
0
votes
1
answer
59
views
How to initiate SpreadAllocated storage including other contract reference?
use erc20::Erc20Ref;
use ink_storage::traits::SpreadAllocate;
#[ink(storage)]
#[derive(SpreadAllocate)]
pub struct Bridge {
map: ink_storage::Mapping<AccountId, u32>,
token: Erc20Ref,
}
...
4
votes
1
answer
214
views
How can I pass a Vec<u8> via chain extension to pallet?
I am working on chain extension to call rmrk pallet methods. One of the methods needs a BoundedVec that I need to pass via ink smart contract. What data type can I use to do this on smart contract ...
1
vote
1
answer
30
views
AssemblyScript Contracts with Javascript Standard Library
I am trying to implement a non-Rust contract using WASM.. Can anyone provide an example, please, of a small contract which returns the balance of an account, completely written in TypeScript / ...
1
vote
1
answer
59
views
How to register HostFunction into WASM Runtime?
When I read the code of the wasmtime executor, I can't understand the way to register the HostFunction to the wasm module. What is the role of the sp_wasm_interface::HostFunctionRegistry trait? How is ...
7
votes
1
answer
146
views
Is the WASM blob created from ink! contract always deterministic
The contract's source code is provided during the contract verification on a block explorer (or some other source verifier).
The block explorer needs to compile that source and verify if the generated ...
1
vote
3
answers
131
views
Get "Contract.ContractTrapped" error in Shibuya wasm
Get "Contract.ContractTrapped" erro when call new "xxx" contract from inside an depolyed contract in substrate of Shibuya testnet, bellow is my detailed operation:
1、Here are two ...
0
votes
1
answer
166
views
How can I read JSON files in substrate
I am trying to modify the kitties pallet(https://docs.substrate.io/tutorials/v3/kitties/pt1/) in order to read some json data from an already existing file.
So, I need to read the contents of the file ...
12
votes
2
answers
459
views
Why does Substrate have a Wasm runtime?
Having a Wasm runtime is a key design decision in Substrate's architecture. It's clear that it's a key part of Substrate's forkless upgradability feature, but I'm still curious to understand what ...
1
vote
2
answers
135
views
How can I increase contract memory in pallet-contracts + chain-extension?
I am exposing some external functions to ink! contracts via a chain-extension in pallet-contracts. I am essentially passing a vector of bytes as a parameter to a contract method and directly ...
2
votes
1
answer
34
views
Is it feasible to modify the contracts pallet to integrate it into a non-substrate rust-based blockchain?
Is it feasible to modify the contracts pallet to integrate it into a non-substrate rust-based blockchain? Say one that runs on Tendermint.
1
vote
2
answers
59
views
Are there any tools available for creating a mock version of a contract in JS/TS?
Currently, we use "live" versions of our contracts running on a substrate contracts node in our JavaScript tests. This makes them integration tests and difficult to include in simple GitHub ...
1
vote
2
answers
75
views
How to execute an ELF binary after a successful transaction
I am working on figuring out an efficient way to run an ELF binary after successful transaction. I also want to pass arguments along the execution.
Example: /bin/ping 1.1.1.1
OCW might be a solution, ...
7
votes
2
answers
126
views
How to change the number of heap pages
We are running into an allocator memory error where the number of heap pages appears to be insufficient to run a transaction on our validator (substrate-node).
This is the error in question:
2022-04-...
2
votes
2
answers
559
views
How to enable `std` features in pallets?
I'm trying to implement simple PoW for my node. After debugging all other stuff I've encountered the problem where finality-grandpa and storage do not get compiled because standard library macros are (...
2
votes
1
answer
73
views
large wasm size for polkadot 0.9.17
We have recently upgraded our runtime to polkadot 0.9.17. We noticed the wasm runtime seems too large i.e. 5.3 MB which exceeds the limit.
Is there a way or best approach to reduce the wasm size?
...
2
votes
1
answer
109
views
Collator panicked at 'Storage root must match that calculated.'
We have a few collators for the Kintsugi parachain actively syncing and producing blocks when they suddenly fall-over due to the following error:
Apr 02 21:06:00 ubuntu-s-2vcpu-4gb-amd-fra1-01 ...
8
votes
1
answer
165
views
What is the relationship between `sandbox`, `executor` and `runtime`?
I was recently reading the code for Substrate wasmtime, but I ran into some problems. I don't really understand the difference between runtime and sandbox.
For example, in the runtime.rs file, we can ...
12
votes
2
answers
223
views
Wasm interpreter in pallet-contracts
I have a question about how pallet-contracts interprets a Wasm contract. Are the following assumptions correct?
pallet-contracts interprets contracts through the simple wasmi interpreter
gas metering ...
6
votes
1
answer
222
views
Building a substrate node template with a global cargo `target` directory
I'm trying to build a substrate-node-template with the following command:
cargo build
I have my cargo target-dir set inside a global ~/.cargo/config.toml file:
[build]
target-dir = "/home/foo/....
3
votes
1
answer
53
views
Is the genesis built on the MAC different from the genesis built on Linux
If you register parathread with genesis and WASM generated on the MAC, then run the blockchain on Linux. Will this future run blockchain and fail?
8
votes
1
answer
103
views
Performance of same logic with a contract using pallet-contracts vs. a native pallet (excluding metering)
I'm wondering what is current state of the art of Substrate's pallet-contracts performance as compared to the same functional implementation as a pallet.
I acknowledge that different logic can have ...
13
votes
2
answers
311
views
What is the proper way of executing a runtime upgrade on a parachain?
I would like to upgrade my parachain.
What is the proper way of executing a runtime upgrade on a parachain?
Which RPC method to call?
Should this be applied to collators or rpc-nodes?
2
votes
1
answer
44
views
Using BitcoinDevKit as a pallet dependency
When I add BitcoinDevKit as a dependency to the pallet-template, I get compilation errors within the socks crate that I don't get when compiling BDK standalone. It seems that BDK supports compilation ...