Skip to main content

Questions tagged [rust]

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

40 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
1 answer
24 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
3 votes
0 answers
35 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
105 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
93 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
322 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
0 answers
62 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
110 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
46 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
32 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 ...
the dev's user avatar
  • 477
2 votes
1 answer
155 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
141 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
  • 923
1 vote
0 answers
26 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
29 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
43 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
34 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
227 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,315
1 vote
0 answers
21 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
37 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
24 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
  • 181
1 vote
0 answers
64 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
  • 181
1 vote
0 answers
58 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,842
0 votes
0 answers
11 views

When i tried to add the third well known node, it shows is added but it's not?

I am following the Authorize Specific Nodes and i tried to add the third known node, but i couldn't. It said it was added but it seems it did not even though i tried to added again it said it is ...
NXHM's user avatar
  • 1
0 votes
0 answers
16 views

How to get the ink! examples working

I have been banging my head in over the last couple of days trying to understand Rust and ink! I would really like to start writing smart contracts in the substrate ecosystem but I can't even get the ...
HAGO's user avatar
  • 1
0 votes
1 answer
29 views

Substrate Build failures

As someone new to rust and substrate, I have noticed that besides the simple "build a blockchain" tutorial most fail during the build process. To avoid that I even tried grabbing specific ...
Faisal's user avatar
  • 1
0 votes
1 answer
42 views

Compilation Error with Substrate on Rust Nightly: #![feature] May Not Be Used on the Stable Release Channel

I'm working on a Substrate-based blockchain project and encountering a compilation error when trying to build my node runtime. The error indicates that nightly features are being used while the stable ...
Mr Coder's user avatar
  • 923
0 votes
0 answers
51 views

Bittensor Subtensor Chain

Does anyone know how to run a public subtensor node and synchronize with Bittensor network on nakamoto instead of the current finney ? There are some nodes currently running on nakamoto chain. I am ...
kapitankot's user avatar
0 votes
1 answer
32 views

How to increment Uniques Pallet T::ItemId

I have following substrate pallet implementation to split an Item and create new Items #[pallet::call_index(26)] #[pallet::weight(T::WeightInfo::split())] pub fn split( ...
Kalanamith's user avatar
0 votes
1 answer
23 views

How to declare runtime api?

I have a runtime constant declared in a pallet like this: /// How much space there is on the network. #[pallet::constant] type TotalSpacePledged: Get<u128>; Source code ...
abhi3700's user avatar
  • 131
0 votes
0 answers
21 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
24 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
180 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
  • 923
0 votes
0 answers
96 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
244 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
33 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
39 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
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