Questions tagged [rust]

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

30 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
1 answer
18 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
132 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
25 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
88 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
0 answers
55 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
272 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
88 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
52 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
1 answer
39 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
111 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
84 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
  • 873
1 vote
0 answers
17 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
29 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,130
1 vote
0 answers
14 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
14 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
22 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
29 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
19 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
51 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
59 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
49 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,822
0 votes
0 answers
50 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
  • 873
0 votes
1 answer
63 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
189 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
37 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
28 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
27 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