2

Trying to play around with pallet-collective and I see this : pallet collective length bound

I have no clue what to set as a lengthBound: Compact<u32>. Bonus question: Why do proposers need to specify a lengthbound in the first place?

1 Answer 1

0

The lengthBound should be set to some value greater than the size of the encoded proposal. In practice, it should be fine to set it equal to or just above the encoded call data size. This can be found from the polkadot.js field encoded call data if you fill out the fields to submit the same extrinsic you want to submit via the council. It will be the length in bytes of the hex-encoded "encoded call data".

Encoded call data

As to the question of why this is necessary, it's because the proposal may need to be stored before being voted on, and the manner in which it's passed into the pallet doesn't allow a quick lookup of the proposal's size. The weight of the submitted extrinsic needs to be able to be calculated cheaply, which means the user needs to submit this extra data, which is then checked during execution.

In an actual application, the frontend would always calculate this lengthBound behind the scenes before submitting an extrinsic, so it should come at no real usability cost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.