Skip to main content

Questions tagged [weight]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Dynamic function weights

Are dynamic weights possible to implement? When running benchmarks, the weights are returned. But there are parameters that are updateable while the blockchain is running and within on_initialize the ...
Bob Linux's user avatar
  • 113
1 vote
1 answer
34 views

Best practices for generating and importing pallet weights

As far as I understand, weights for a runtime's pallets can be generated in two ways: Altogether by using this script provided by the polkadot-sdk, with the output typically stored in the runtime ...
magecnion's user avatar
  • 242
0 votes
1 answer
56 views

How to start block on_finalize before we reach block time?

I am currently trying to understand how we could improve our block production performance at Avail. By looking at this answer on a previous question, I get that for a 6 second block time, we allocate ...
Leouarz's user avatar
  • 353
0 votes
2 answers
59 views

Wrong Proposal Weight in collective pallet tests

I have a pallet using the propose extrinsic of the collective pallet. one of the parameter of this extrinsic is length_bound which I define as follows: let proposal_len:u32 = proposal.using_encoded(|p|...
Kazunobu Ndong's user avatar
0 votes
0 answers
25 views

Whitelisted keys when benchmarking extrinsic calls

There are a few storage keys that are always whitelisted before each benchmarking pallet extrinsic call (:transaction_level, :extrinsic_index, and :intrablock_entropy), apart from the whitelisted keys ...
lime's user avatar
  • 121
5 votes
1 answer
132 views

How to handle blocks with more than u16 events?

We load tested our chain by calling the remark with events extrinsics. We used batch to have more than 33K transactions in multiple batches in one block. The block was processed correctly even if it ...
Leouarz's user avatar
  • 353
3 votes
0 answers
129 views

Unable to fully utilize block capacity when performing load testing

I'm currently running load tests on my local parachain which includes Frontier integration for EVM compatibility. During these tests, I'm sending thousands of transactions via the RPC endpoint. ...
magecnion's user avatar
  • 242
0 votes
1 answer
38 views

Weight consumed inside the on_idle hook?

The documentation of the on_idle hook states that "Any implementation should always respect _remaining_weight and never consume (and therefore return) more than this amount." In the ...
Benjamin Gallois's user avatar
1 vote
1 answer
53 views

No way to do a runtime-upgrade after we upgraded our mainnet chain to version 0.9.31 version

Recently in Ternoa mainnet we performed a RU(runtime upgrade) to upgrade our versions to polkato-v0.9.31. In system pallet substrate have introduced new extrinsic set_code in this version which ...
Immanuel John's user avatar
1 vote
1 answer
55 views

What are the best refTime and proofSize for making AsMultiTx?

Our's Environment Use sidecar (v17.0.0) Use Tx-wrapper-core (v7.0.1) https://github.com/paritytech/txwrapper-core Polkadot node v1.0.0 Use Westend(testnet) and Polkadot(mainnet) Since being updated ...
hs1228's user avatar
  • 45
2 votes
1 answer
90 views

How do set the appropriate refTime and proofSize when create asMulti?

We had a big problem after upgrading weight -> weight v2. I understood that weight v2 uses refTime and proofSize. However, I wonder if there is a way to properly look up these two values. We are ...
hs1228's user avatar
  • 45
2 votes
1 answer
35 views

Witness data for Benchmarking

I have been looking into the hrmp pallets where some of the extrinsics needs to have a witness data variable provided as a parameter. Example: /// Total number of opening channels must be provided as ...
Alex Bean's user avatar
  • 5,722
1 vote
1 answer
42 views

Weight for an extrinsic that schedule another call in the future?

I have an extrinsic for a poll that will end in the future. I used scheduller pallet to make the end of the poll execute. The end of the poll is then made by a root call. Should I add the weight of ...
Xavier's user avatar
  • 415
0 votes
1 answer
36 views

Does ExtrinsicBaseWeight apply even when we return 0 weight from extrinsic?

If we return Weight::zero() for an extrinsic that returns DispatchResultWithPostInfo, does that mean that we discard extrinsic base weight which is included for every transaction?
b0zero's user avatar
  • 533
2 votes
1 answer
93 views

Transaction pool management

I have to send thousands of transactions to a custom substrate chain, it will probably take a few days to process all of them. Of course I can't just send all the transactions at once because they ...
Valentin Fernandez's user avatar
0 votes
0 answers
37 views

extrinsic consuming ~100% of the available weights in a block

if we ignore PoV, is there anything preventing a single extrinsic from consuming ~100% of the available (execution time) weights in a block?
Bernardo Rodrigues's user avatar
3 votes
1 answer
66 views

Dispatch of extrinsic that has prevalidate function which emits events and modifies storage

TLDR: How to implement a substrate unsigned call, which performs storage modifications and emits events during it's validation? If transaction fails, it seems like it leaves garbage in runtime, due ...
Klapeyron's user avatar
  • 136
1 vote
1 answer
26 views

How to generate database weights?

As a chain grows the DB operations should get costlier. Is there a standard procedure that outlines how to generate these weights? Or should we continue using the default substrate weights for this ...
Purple_Turtle's user avatar
2 votes
0 answers
30 views

Are onchain storage reads cheaper from offchain worker versus from extrinsic?

Are reads from offchain workers less expensive than reads from extrinsics? I am determining how to do some large, asynchronous processing of data and determining whether the reads in this process see ...
Justin Frevert's user avatar
3 votes
1 answer
78 views

Quadratic complexity in Benchmarking

I am trying to understand if quadratic complexity is bad (gives inaccurate results) when used for benchmarking: I have a pallet whose weight would ideally depend on x * y where x and y are lengths of ...
Purple_Turtle's user avatar
2 votes
1 answer
27 views

Weight syntax on pallet_balances

In pallet_balances I found this syntax for annotating weight and it confused me a bit : #[pallet::call(weight(<T as Config<I>>::WeightInfo))] impl<T: Config<I>, I: 'static> ...
Purple_Turtle's user avatar
7 votes
1 answer
548 views

What is proof size?

What is the definition of proof size? What factors influence the size of a proof? What are the steps involved in calculating the proof size? (the benchmark performs various tasks, but it also ...
AurevoirXavier's user avatar
  • 10.5k
3 votes
1 answer
43 views

What are the consequences of overestimating weight?

What happens if the value of #[weight] I choose is higher than the real life weight usage? According to frame documentation, it says : Fees are then based on the worst case weight. If the actual call ...
b0zero's user avatar
  • 533
1 vote
1 answer
51 views

Db weights in Runtime

I see that the DB weights (Rocks or Parity) are directly imported as constants in the runtime code. This means that whenever the runtime is built, it will use those constants. Why was this approach ...
lime's user avatar
  • 121
6 votes
3 answers
165 views

Error WeightNotComputable - XCM Transaction

I am getting the XCM error of WeightNotComputable. What could be the cause of this? Here is the XCM code which fails.
Snowmead's user avatar
  • 625
2 votes
2 answers
52 views

How to ensure a call is the first to execute in a block?

As the title mention, I would like to know what would be the best way to ensure that an extrinsic can be executed only if it's the first call in the block (ignoring timestamp). It also need to work ...
Leouarz's user avatar
  • 353
8 votes
1 answer
147 views

Support WeightV2 in a substrate chain?

I started working from the substrate-parachain-template and added the pallet_contracts to the runtime. When I open the Contracts UI, I'm getting the error message that states the node does not support ...
Snowmead's user avatar
  • 625
3 votes
1 answer
108 views

Rationale on Moonbeam's GAS_PER_SECOND

I'm trying to understand the rationale behind Moonbeam's GAS_PER_SECOND: /// Current approximation of the gas/s consumption considering /// EVM execution over compiled WASM (on 4.4Ghz CPU). /// Given ...
Bernardo Rodrigues's user avatar
4 votes
1 answer
80 views

What is the difference between `RuntimeBlockWeights` vs `BlockWeights`?

I notice that in the node-template there is BlockWeights and some differences in weights compared to the "kitchensink" runtime where we have RuntimeBlockWeights. What is the difference ...
Bruno's user avatar
  • 8,365
4 votes
3 answers
98 views

Custom benchmarks for external pallets

We use some external pallets that are highly configurable. The weight of the extrinsics in these pallets is highly dependent on the callback supplied in the config, and the existing benchmarks don't ...
Sander's user avatar
  • 412
3 votes
1 answer
49 views

Reading from storage in weight annotation

We have an extrinsic where the complexity is dictated by the number of items held in storage. Is it appropriate to read from storage in the weight annotation? See for example: pub trait Tree<...
Gregory Hill's user avatar
2 votes
1 answer
59 views

Estimated proof size less than measured

I was running some benchmark, and noticed that the estimated proof size was less than the measured size, despite MaxEncodedLen being used in this crate. The estimation of 0 is clearly wrong, but this ...
Sander's user avatar
  • 412
2 votes
1 answer
105 views

What is Dev Mode? And how can I use it?

I heard there is something called Dev Mode in Substrate for pallet development. What is Dev Mode? And how can I use it?
Bruno's user avatar
  • 8,365
6 votes
1 answer
76 views

Benchmarking multiple instances

We have two instances of a pallet with different runtime configurations. How can we run the benchmarks separately to generate two distinct sets of weights? As far as I can tell this is not possible ...
Gregory Hill's user avatar
7 votes
1 answer
260 views

Prepare pallets for Weights v2

I am trying to prepare the pallets for Weights v2 at Encointer and a couple of questions arose. Where can I find documentation on what exactly has to be done in terms of bounded types? What is the ...
pifragile's user avatar
4 votes
2 answers
111 views

What should be the maximum size of a `BoundedVec`?

What is the recommended maximum number of bytes to store within a BoundedVec? I am currently having the following struct: #[derive( parity_scale_codec::Decode, parity_scale_codec::Encode, ...
Chralt's user avatar
  • 543
7 votes
1 answer
70 views

Proof Skipped in benchmark

We're updating our weights to weights 2.0 but we're getting a lot of Proof Skipped lines in the output. What is the impact of this, and how do we fix it? Example output: /// Proof Skipped: Escrow ...
Sander's user avatar
  • 412
0 votes
1 answer
95 views

Why do most parachains have a MAXIMUM_BLOCK_WEIGHT of 0.5 seconds? [duplicate]

From my survey of a few parachains, the definition I find for MAXIMUM_BLOCK_WEIGHT is often 0.5 seconds of compute : /// Maximum weight per block pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::...
b0zero's user avatar
  • 533
3 votes
0 answers
45 views

How can I get an instruction's XCM base weight for Kusama and other substrate chains through Polkadot JS?

I can get instruction's XCM base weight from code (for example, WithdrawAsset instruction), but I can't found how to get this value from PolkadotJS. How can I get an instruction's XCM base weight for ...
Vitaly Peryatin's user avatar
3 votes
2 answers
191 views

expected struct `Weight`, found integer

I was making parity-bridges-common compatible to the stable version of polkadot-v0.9.32. I'm getting the error: expected struct Weight , found integer. Because earlier the weight in the frame-support ...
Arunjot Singh's user avatar
1 vote
1 answer
72 views

How to store a bounded map inside `StorageValue`?

I need to query a specific account id associated with a Balance in a pool of 10_000 account ids. But I also need to iterate over all account ids in a reasonable amount of computation time. So my ...
Chralt's user avatar
  • 543
4 votes
1 answer
140 views

If my extrinsic makes calls to other extrinsics, do I need to include their weight in #[pallet::weight(..)]?

If I have some extrinsic with weight W and I call another pallet function inside it which has weight X, does it mean I have to annotate my function's weight as W + X? What happens if I don't? For eg: ...
b0zero's user avatar
  • 533
0 votes
1 answer
353 views

1010: Invalid Transaction: Transaction would exhaust the block limits

How to specify limit weight for extrinsic?
rust.dev's user avatar
  • 519
5 votes
1 answer
361 views

How to calculate fee for XCM transfer?

I know there is a plenty of XCM transfer cases: RelayChain to ParaChain ParaChain to RelayChain ParaChain to ParaChain (Non-native token) with xTokens pallet ParaChain to ParaChain (Non-native token) ...
Vitaly Peryatin's user avatar
1 vote
1 answer
53 views

In the runtime chain extension, should we be charging weight if we are reading a `StorageMap`?

If we have the storage map DummyStorageMap in pallet-example And we read its value under the key key by calling DummyStorageMap::<T>::get(key) in the runtime chain extension (https://paritytech....
aang114's user avatar
  • 43
4 votes
1 answer
348 views

what is the maximum size of a block?

Just for some analysis purpose i need to know what can be the maximum size limit of a block can have like 2MB or 5MB and is there any doc how we can customise it as per our need if its possible?
Deepak Chaudhary's user avatar
2 votes
2 answers
197 views

Update Runtime sudo transaction exhausted (Substrate)

I am trying to reimplement one of the Substrate tutorials: https://docs.substrate.io/tutorials/get-started/upgrade-a-running-network/ But I am stuck with an issue - where it says to do Scheduler -> ...
Gogosama's user avatar
2 votes
2 answers
67 views

Number of and writes of StorageMap drain

I was wondering about the number of reads and writes when draining a StorageMap which consists of n items. Is the answer (n, 1) or (n, n)?
0x5hmoo's user avatar
  • 189
1 vote
1 answer
115 views

What reference hardware can a parachain use to benchmark & generate weights?

The 2022 tracking issue for Substrate benchmarks mentions that Polkadot uses this reference hardware of this specification to generate weights: Reference Hardware The transaction weights in Polkadot ...
Nuke's user avatar
  • 1,842
0 votes
1 answer
36 views

PostDispatch: Report Actual Weight but Charge Different Fee

Given the following extrinsic #[pallet::weight(<T as Config>::WeightInfo::foo(*hint))] fn foo(hint: u32) { let real = get_real(); if real > hint { return <Error<T>>::...
nbaztec's user avatar
  • 197