Questions tagged [weight]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
0 answers
121 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
  • 148
0 votes
1 answer
25 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
45 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
48 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
57 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
33 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,364
1 vote
1 answer
33 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
  • 395
0 votes
1 answer
30 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
  • 501
2 votes
1 answer
39 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
34 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
50 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
  • 111
1 vote
1 answer
21 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
74 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
22 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
428 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
3 votes
1 answer
37 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
  • 501
1 vote
1 answer
36 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
  • 111
6 votes
3 answers
163 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
  • 605
2 votes
2 answers
43 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
  • 189
8 votes
1 answer
113 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
  • 605
3 votes
1 answer
102 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
54 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,130
3 votes
3 answers
81 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
  • 372
3 votes
1 answer
48 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
55 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
  • 372
2 votes
1 answer
76 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,130
6 votes
1 answer
66 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
6 votes
1 answer
220 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
91 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
  • 503
7 votes
1 answer
66 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
  • 372
0 votes
1 answer
81 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
  • 501
3 votes
0 answers
43 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
160 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
53 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
  • 503
4 votes
1 answer
124 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
  • 501
0 votes
1 answer
202 views

1010: Invalid Transaction: Transaction would exhaust the block limits

How to specify limit weight for extrinsic?
rust.dev's user avatar
  • 509
5 votes
1 answer
303 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
51 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
198 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
157 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
52 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
  • 167
1 vote
1 answer
81 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,822
0 votes
1 answer
32 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
1 vote
1 answer
59 views

Transaction fees withdraw/deposit in

I made transactions on a simple EVM DEX contract. I initially called the approve method which only triggered balances.withdraw event. I understand that this event is triggered as calling this write-...
Bukks's user avatar
  • 304
0 votes
1 answer
64 views

How to convert Weight to u64 and the other way around

If I wanted to do some basic arithmetic operations on some weight it would be possible to do so using saturating_* methods. But what if I wanted to multiply it with a fraction(e.g. Perbill)? How could ...
Szegoo's user avatar
  • 603
0 votes
1 answer
61 views

How to decrease time it takes to benchmark?

I have the following benchmark that takes a very long time to complete. What measures can I take to improve the time it takes to run the benchmark without losing its effectiveness? on_initialize { ...
Yatusabes's user avatar
  • 766
2 votes
1 answer
66 views

Benchmark weights output

Can someone please explain the following output: Why did the weights generate a zero input? Weight::from_ref_time(0 as u64) What is the fastest way to eyeball this and conclude whether these weights ...
Yatusabes's user avatar
  • 766
1 vote
1 answer
31 views

failed to execute TryRuntime_on_runtime_upgrade: Runtime panicked (Update to 0.9.31 version)

Once we updated to version 0.9.31 and run try-runtime feature cargo run --release --features=try-runtime,mangata-rococo try-runtime --chain=public-testnet --execution=Native on-runtime-upgrade live --...
Michal Danco's user avatar
2 votes
1 answer
48 views

Calculating weight for CPU intensive hooks

This wouldn't be a problem if the CPU-intensive code would be placed inside an extrinsic since we could benchmark it and get the accurate weight for the code. But the problem is that we cannot ...
Szegoo's user avatar
  • 603