I have no idea why this call uses such a lot proof size (around 4MB).
It looks like it doesn't change too many storage items.
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityI have no idea why this call uses such a lot proof size (around 4MB).
It looks like it doesn't change too many storage items.
You can see where the bulk part comes from:
BridgePolkadotGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(4000012), added: 4000507, mode: MaxEncodedLen)
It is using the MaxEncodedLen
of that type to calculate the worst-case proof size. You configured MaxBridgedAuthorities
to be 100k.
That means it will assume the worst case to have 100k entries in the authority set - therefore resulting in 4 MB, which seems to be in line with 40 byte per authority from here.
I am not sure why 100k (or if that is a good number) but it should be possible to do post-dispatch correction with the unused_proof_size
function to refund the unused Proof weight.
The MaxEncodedLen
is used since that represents the worst case. Note that benchmarking always has to consider the worst case scenario. There exists an alternative benchmarking mode; measured
that will use the size of the actual accessed storage elements and add some overhead estimations on top. It looks like this: #[pov_mode = Measured]
but should not be needed in 99% of cases.
MaxEncodedLen
to calculate the size?
Jun 16 at 14:26
STEPS: 2, REPEAT: 1
that does not make any sense. It should indeed depend on s
, which it also does in polkadot-v0.9.40. I will extend the answer later.
Jun 16 at 15:49