Questions tagged [weight]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
0 answers
38 views

ink! contract extrinsics only take 10-11% block weights when stress test

I have an ink! contract project and I'm doing stress test to benchmark the performance of this ink! contract project in a production chain. My stress test includes these steps: Deploy ink! projects ...
user avatar
1 vote
1 answer
99 views

Pre-dispatch Error

I took a look at the check-weight SignedExtention to see what happens when a block is full. It appears that it returns an error InvalidTransaction::ExhaustsResources. It think it puts it back into the ...
user avatar
  • 273
5 votes
1 answer
54 views

Benchmark FRAME pallets

Hello Substrate Experts, at the moment I try to figure out how to benchmark FRAME pallets for our runtime and I have basically three points that are not 100% clear to me. Based on my understanding it'...
user avatar
  • 145
2 votes
2 answers
61 views

Does anybody pays for computation inside hooks?

Hooks can do computation and read/write storage. Operations that usually comes at price. Those hooks return a -> Weight value, but from my understanding nobody is paying for this. It's just used to ...
user avatar
0 votes
1 answer
27 views

Does call.dispatch make `origin` pay the fees to the network?

I'm writing a hook for a pallet, this hook pop Call out of storage and execute them on behalf of a specified user through call.dispatch(origin). My question is: Will dispatch will make origin pay the ...
user avatar
2 votes
1 answer
34 views

Are read/write weight propotional to the size of the data manipulated?

I used to think that each read/write access to storage account for the same weight. But does it ? Or is there a linear relation between the (encoded) size of the data accessed and the price to pay ? ...
user avatar
3 votes
1 answer
34 views

Does `max_block` take into account `base_block`?

I'm writing a hook that will pop Calls out of storage and dispatch them. I want to dispatch as many of those calls as possible in the limits of max_block. My approach was to store the cumulated weight ...
user avatar
0 votes
0 answers
13 views

Transaction pool and Signed Extension Pre dispatch

My understanding is that when a transaction arrives it gets validated against all signed extensions. If the transaction is valid it then moves into the ready queue or future queue depending on the ...
user avatar
  • 273
4 votes
2 answers
39 views

Signed Extensions and Weights

I noticed that signed extensions do not have weights associated to them. Pallets like transaction-payment pallet use signed extension to withdraw fees but we do not apply weights to them. Why?
user avatar
  • 273
1 vote
1 answer
24 views

Is there a way to cap the amount of weight that a type of extrinsic can consume in a block?

My understand in substrate is that there are three types of dispatches, normal, operational, and mandatory. This types of dispatch classes can consume a portion of the total weight in a block. I can ...
user avatar
  • 273
0 votes
1 answer
35 views

Can I add a base fee per extrinsic?

My understanding is that there is a configurable base fee which is the minimum amount that a user pays for ANY transaction. Is there a way to add an additional base fee per extrinsic? This fee should ...
user avatar
  • 273
-3 votes
1 answer
35 views

Transaction would exhaust the block limits

Trying to run transaction in Polkadot.js.org UI This method in UI const insertKeys = async (api: ApiPromise, seed: string, publicKey: string) => { const insert = await api.rpc.author.insertKey(&...
user avatar
  • 234
0 votes
1 answer
27 views

How to query block length using polkadot-js

How can I query the length of a block used for normal transactions? After seeing check_block_length, I would have expected to be able to use allExtrinsicsLen, but this always returns None, even if the ...
user avatar
  • 262
1 vote
1 answer
40 views

What is the polynomial corresponding to WeightToFee in the official library?

About Code: https://github.com/substrate-developer-hub/substrate-parachain-template/blob/main/runtime/src/lib.rs#L130-L145 pub struct WeightToFee; impl WeightToFeePolynomial for WeightToFee { type ...
user avatar
  • 531
2 votes
3 answers
87 views

How do I find the gas consumed by a contracts extrinsic?

I am querying extrinsic data and I am able to fetch gasLimit and gasPrice out of Extrinsic.method.args. But how do I fetch the amount of gas used from an extrinsic?
user avatar
1 vote
1 answer
34 views

Using another pallet calls for FRAME-based benchmarking

I need to mint an NFT and create metaverse for our auction pallet benchmarking. Both of these are handled by external pallet functionality and wondered if there is a FRAME-base benchmarking solution ...
user avatar
3 votes
1 answer
21 views

Adding PaysFee to #[pallet::weight("")] produces unexpected token error

I'm working with the node template and I want a particular type of extrinsic to not have to pay a fee. I followed these instructions but whenever I add another value to the "pallet::weight(10_000)...
user avatar
  • 31
2 votes
1 answer
39 views

How do I request a refund for the purchase of additional weight in XCM ?(not just for instructions that were never dispatched)

XCM version: 3 1. I bought 3_000_000 weight, but it might actually only need 3000 weight, how can I refund the fees of (3_000_000-3000) weight? ParaA::execute_with(|| { let message = Xcm(vec![ ...
user avatar
  • 149
1 vote
1 answer
26 views

How to read the benchmark result?

A benchmark test for function with a param like this: runner_execute { let x in 1..10000000; ... let gas_limit_call = x as u64; }: { ... let call_runner_results = T::Runner::...
user avatar
2 votes
2 answers
58 views

What could happen if the `BlockWeights` is set HIGHER than `MILLISECS_PER_BLOCK` (block time)?

In Substrate docs, it's said: "The maximum block weight should be equivalent to one-third of the target block time, allocating one third for block construction, one third for network propagation, ...
user avatar
  • 124
3 votes
1 answer
64 views

Transaction fee paying fund

I'm interested in systems where transaction fees can be paid for from a fund so that the end users don't have to deal with the chain's native token. This is what I've found so far: https://github.com/...
user avatar
  • 33
2 votes
1 answer
38 views

Do repeated reads of the same storage value add to the total weight?

I have an extrinsic with multiple calls to other pallet functions. As it calls other internal functions, more than one of them access the same storage value (either an actual StorageValue or the same ...
user avatar
  • 411
3 votes
2 answers
42 views

How do I pass a sp_runtime::traits::Hash value into benchmark function

pallet code: use sp_runtime::traits::{AccountIdConversion, Hash}; ....... ....... pub do_something(...) -> DispatchResultWithPostInfo { ...... } pub fn say_hello( ...
user avatar
  • 531
2 votes
1 answer
29 views

Lower resulting weights, for substrate as is, upon benchmarking as compared to the weights file provided

We are using a machine, similar to reference: https://github.com/paritytech/substrate/pull/5848, to benchmark our runtime. To ascertain that our machine is close enough to the reference, we ran ...
user avatar
1 vote
1 answer
48 views

How to provide unchecked weight to a call using Polkadot.js?

Unfortunately, I could not find how to add unchecked weight to a call via Polkadot.js, e.g. within signAndSend or when preparing the unsigned extrinsic. Even in the cookbook example for runtime ...
user avatar
10 votes
3 answers
82 views

What's the impact of underestimating Weights?

What is the impact of underestimating weights? In what way could an adversary make use of this?
user avatar
7 votes
2 answers
71 views

What's the overhead associated with the `#[transactional]` macro?

Substrate has a macro, #[transactional], to ensure that any modifications to storage are not persisted in case of an error during execution. I imagine there's some sort of caching done before ...
user avatar
  • 355
5 votes
1 answer
34 views

fee economics around remark

From looking at the source code, it looks like system pallet's remark extrinsic has null weight. Even though remarks don't add anything in terms of block execution, one could argue it's still having ...
user avatar
5 votes
1 answer
39 views

How do extrinsic weights apply to Raspbery Pi full-nodes?

I'm running a polkadot full-node on a Raspberry Pi 4. While the Substrate Fee system is determined by Weights & Benchmarking, how are different CPU architectures (when compared to the standard ...
user avatar
7 votes
1 answer
95 views

How expensive is it to access storage items?

How expensive are storage reads and writes? Does the cost depend on the size of the item?
user avatar
4 votes
2 answers
51 views

Where should pallet migrations be executed?

I have seen two methods of executing runtime migrations: Execute the migration code directly in the pallet's on_runtime_upgrade hook Create a struct and implement the OnRuntimeUpgrade trait. Include ...
user avatar
  • 213
6 votes
1 answer
53 views

What prevents unsigned transactions from filling up a block?

Following up from this question: Should I include weight for an unsigned call? What exactly prevents multiple of the same calls to a weighted unsigned extrinsic from sequentially filling up a block ...
user avatar
  • 3,180
6 votes
2 answers
30 views

Should I include weight for an unsigned call?

I have an unsigned call in my pallet. Since there will be no fees associated, should I include a weight for it? Example: #[pallet::weight(???)] pub fn submit_metric_unsigned( origin: OriginFor<...
user avatar
  • 3,180
4 votes
1 answer
29 views

Calculate weight of generic dependency

What is the approach to weight calculation in a pallet with a user defined dependency that will do some work, e.g. #[pallet::config] pub trait Config: frame_system::Config { type Handler: Handler; ...
user avatar
  • 411
9 votes
3 answers
94 views

How to generate `WeightInfo` for pallets?

Some pallets configure this field like so : type WeightInfo = pallet_pallet_name::weights::SubstrateWeight<Runtime>; However I've seen some runtimes in which they have an extra WeightInfo module ...
user avatar
4 votes
1 answer
39 views

How do I get weight for my pallet?

I developed a pallet with one extrinsic: #[pallet::weight(0)] pub fn sum(_: OriginFor<T>, values: Vec<u64>) { // Sum up `values` } The Extrinsic accepts a vector and uses it. ...
user avatar
5 votes
2 answers
90 views

Maximum weight in a block?

How do I find the maximum weight available to extrinsics in a block for a substrate-, FRAME-based chain such as Polkadot? I know that there is WEIGHT_PER_SECOND value, but it doesn't answer my ...
user avatar
  • 1,586