Questions tagged [rust]

Questions about the Rust programming language, the primary language used in the Substrate ecosystem.

36 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
1 answer
21 views

error[E0282]: type annotations needed --> /libp2p-noise-0.32.0/src/protocol/x25519.rs:221:45

While running this project https://github.com/jimmychu0807/substrate-offchain-worker-demo I'm geting this error: error[E0282]: type annotations needed --> /libp2p-noise-0.32.0/src/protocol/x25519....
S Miss's user avatar
  • 41
4 votes
0 answers
165 views

How to solve this Failed to compact generated WASM binary.: Error(UnknownOpcode(192))

For one assignment I have run the command cargo build --release so that I can build the pallet. After that I was getting the error After that according to this- Error Building Substrate contract Node(...
Nakul Agrawal's user avatar
3 votes
0 answers
29 views

How to use enum with associated value(s) in ink smart contract

I have an ink smart contract message that takes an enum as argument. The code is shown below; #[derive(Encode, Decode)] #[cfg_attr( feature = "std", derive(Debug, PartialEq, Eq, ...
Ahmad Bolaji's user avatar
3 votes
0 answers
96 views

Not enough data to fill buffer

When running an API function using rust, we get this error: GenericError { reason: "Failed to get unsigned proposals: FailedToDecodeReturnValue { function: \"DKGApi_get_unsigned_proposals\&...
Thomas Braun's user avatar
3 votes
1 answer
81 views

Cargo-contract forcibly calls nightly-2022-06-30 regardless of specified toolchain

I am experiencing an issue when using cargo-contract (version 1.5.1) to build a project (command: cargo +nightly contract build). The specified toolchain is not being recognized, and the process is ...
Yasu Yasu's user avatar
3 votes
1 answer
294 views

build failed with substrate chain on rocksdb in linux

I followed this tutorial https://docs.substrate.io/tutorials/get-started/build-local-blockchain/. I got the below error when run cargo build --release. How can I fix it? cargo build -v --release ...
kayvan jam's user avatar
3 votes
1 answer
102 views

Division operation in `u128` results false value

In my node, Balance type is u128. I have following variable let per_block = 100_000_000_000_000_000_u128; let total = 50_000_000_000_000_000_000_000_u128; let ratio = per_block.checked_div(total); ...
Sudip Ghimire's user avatar
3 votes
0 answers
56 views

NPOS not working after adding the EVM to node config in substrate

I have implemented the NPOS with EVM blockchain using the substrate. NPOS working fine but after adding EVM to Genesis config in node the NPOS is not working and the staking election failed. Smart ...
Muhammad Zaryab Rafique's user avatar
2 votes
3 answers
93 views

Error Bad origin on custom XCM integration

I am building custom XCM pallet. While executing specific call: The destination is of ParaId type. match send_xcm::<T::XcmSender>( (Parent, Junction::Parachain(destination.into()...
Dudo's user avatar
  • 21
2 votes
1 answer
43 views

What is the use of Get trait here?

In the referenda pallet, type Tracks uses two trait, Get and TracksInfo substrate/frame/referenda/src/lib.rs /// Information concerning the different referendum tracks. #[pallet::constant] ...
Amiya Behera's user avatar
2 votes
1 answer
136 views

How can I decode this error message {"ok":{"flags":["Revert"],"data":"0x000110"}}?

I'm using polkadotjs to call my ink! smart contracts and I seem to be having trouble with calls that require parameters. For the call below I am getting the revert flag {"ok":{"flags&...
Jordan Greenberg's user avatar
2 votes
1 answer
113 views

How to fix "module group is private" error when using frame-support-procedural-tools v3.0.0?

I'm trying to use orml-tokens in my Substrate project and encountered the following error: error[E0603]: module `group` is private --> /home/kianoush/.cargo/registry/src/github.com-...
Mr Coder's user avatar
  • 893
1 vote
0 answers
23 views

how to know about token implementation?

I have a questions about Tokens in polkadot ecosystem , If I am on parachain and this parachain A uses a token from another parachain B , if this token implements on_transfer hook does this hook will ...
castle_chain's user avatar
1 vote
0 answers
26 views

How to implement XCM into Mock.rs for tests in Pallet?

How to implement XCM into Morck.rs for tests in Pallet? I use XCM in my Lib.rs calls. I have to implement the following: type XcmSender = XcmRouter; type RuntimeOrigin = RuntimeOrigin; type ...
Dudo's user avatar
  • 33
1 vote
0 answers
34 views

Polkadot-v1.0.0: sc-network is failing to compile

When specifying sc-network as a dependency: sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" } I get a compile error: error[E0433]: ...
Thomas Braun's user avatar
1 vote
0 answers
28 views

I am having issues with implementing swap fees on transfer for DEX

Below is my lib.rs file for the token contract and it uses the Cardinal Cryptography PSP22 sample at https://github.com/Cardinal-Cryptography/PSP22 I am trying to implement swap for the transfer taxes ...
Edinyanga Ottoho's user avatar
1 vote
2 answers
103 views

How to print / output from within async tokio test

I am writing a new test and when I run this code, the println's do not output in the terminal. #[tokio::test] async fn can_fetch_child_keys() { if std::option_env!("TEST_WS").is_none() { ...
Bruno's user avatar
  • 8,260
1 vote
0 answers
19 views

How to Modify static buffer size for my ink smart contract to Resolving 'OutputBufferTooSmall' Error for Larger Vectors in ink smart contract

I'm facing an 'OutputBufferTooSmall' error in my [Language/Framework] code when working with larger vectors. I suspect this is related to the maximum allowed input/output sizes. I need guidance on how ...
UPENDRA SINGH's user avatar
1 vote
0 answers
19 views

"ContractTrapped" Error even with successful cross-contract call

let result_call = ink::env::call::build_call::<Environment>() .call(self.escrow_address) .gas_limit(0) .transferred_value(0) ...
Parth's user avatar
  • 11
1 vote
0 answers
25 views

How to change the gas cost in ink! e2e tests

I want to be able to adjust the gas cost used in specific ink! end-to-end (e2e) tests, but my attempts to do so have consistently resulted in a return value of zero when using the weight_to_fee ...
Brian Ramirez's user avatar
1 vote
1 answer
35 views

Need help in Ink e2e tests

I need help with that code. Can anyone pls help me out ?? mod p{ #[ink(storage)] pub struct Foobar { /// Stores a single `bool` value on the storage. value: ...
Shivam Varshney's user avatar
1 vote
0 answers
20 views

BoundedBTreeMap error with Debug trait

Consider the following snippet #[weight = 100_000_000] //TODO: update weights pub fn test( _origin, _outputs: frame_support::BoundedBTreeSet<JoyBalanceOf<...
mr_bovo's user avatar
  • 171
1 vote
0 answers
54 views

Call a smart contract method from the offchain worker

As the title is descriptive I would like to call a method on a Sample contract deployed to runtime evm, from the off-chain worker. For example: Contract Sample { Public five=5; } Call Sample.five() ...
P.E's user avatar
  • 171
1 vote
0 answers
62 views

Problem to run docker image

I'm trying to run the image pulled from dockerhub: https://hub.docker.com/repository/docker/gertdjali/escrow but doesn't work. I ran the image locally by terminal './scripts/docker_run.sh' as ...
P.E's user avatar
  • 171
1 vote
0 answers
56 views

Best tools & settings for `VSCode` for *offline* Substrate development

Substrate builds are resource intensive. Running some of rust's best-in-class tools like rust-analyzer at least with default settings leads to continuous full use of most resources and take ...
Nuke's user avatar
  • 1,831
0 votes
0 answers
19 views

is it necessary to download all the dependencies and the full target file to compile and build any contract?

due to I have limited internet in my country , I can not download the full building files after I wrote the contract and need to only see if there are any errors and need to run the tests . so if I ...
castle_chain's user avatar
0 votes
0 answers
18 views

When i built my custom pallet i got this error

#! [cfg_attr(not(feature = "std"), no_std)] // Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; #[frame_support::pallet] pub mod pallet { use ...
Preethi M's user avatar
0 votes
0 answers
121 views

Rust Compile Error: Unresolved imports crate::pallet, crate::types::Types::Config

I am working on a Rust project where I have multiple modules. I'm facing an issue with unresolved imports when I try to compile my code. Here's the relevant code structure: types.rs pub mod Types { ...
Mr Coder's user avatar
  • 893
0 votes
1 answer
79 views

Encountered incremental compilation error

I have encountered following error from time to time while compiling substrate-node-template error: internal compiler error: encountered incremental compilation error with mir_built(76e5305fbe3bf3e0-...
metricaez's user avatar
0 votes
0 answers
222 views

Getting rust-analyzer error while running a substrate based chain

My problem Running cargo build does not give any error in terminal but rust-analyzer of Visual studio code gives me 85 errors and 8 warnings. I followed the installation guide from the substrate docs. ...
roynrishingha's user avatar
0 votes
0 answers
38 views

Bags-list pallet test case not running

I am using the polkadot version 0.9.36, I run test cases of all the pallets in the frame by using the cargo test command, every pallet test case is working fine but when I run the bags-list pallet ...
Akash Singh's user avatar
0 votes
0 answers
47 views

Running substrate-node-template throws macOS memory error

I am using substrate-node-template. I don't have any issue building the substrate-node-template in release mode, and when I try to run it the first time it works fine, but if I stop and try to run it ...
nagaraj's user avatar
  • 199
0 votes
1 answer
31 views

Multiple test mock runtimes with slightly different configs based off common base?

We have some custom pallet unit tests that use multiple mock runtimes that are configured slightly differently. The problem is that when we have to make changes to the runtime, we have to apply those ...
Robert La Ferla's user avatar
0 votes
1 answer
36 views

Build fails when trying to create workspace from selected pallets and primitives

I want to put some pallets and primitive code in a workspace. Here is my code https://github.com/zeitgeistpm/external However this does not build, neither workspace builds nor individual components. ...
llvm_ninja's user avatar
0 votes
2 answers
2k views

error: linking with `cc` failed: exit status: 1 (Mac m1)

Not able to build a project because of this issue: error: linking with `cc` failed: exit status: 1 | = note: "cc" "-arch" "arm64" "/var/folders/5w/...
P.E's user avatar
  • 171
0 votes
1 answer
28 views

How can I access a value obtained at runtime in primitives npos elections?

I want to change the weight/score of targets on the basis of values got during runtime, in my research I found the score of a target is being calculated in primitives/npos-elections/phragmen.rs in fn ...
Shubham Gupta's user avatar