5

I would like to know the recommended way to benchmark a chain extension, and then how to charge the calculated weight. According to this document, we need to write benchmarks.

1 Answer 1

1

The benchmark docs are the best place to start, and good examples of benchman.rs files in Substrate as reference. Your goal is to create worst case scenario weights for using your chain extension, as it (like all other pallet logic) cannot be allowed to consume more time to execute than the block allows. As you may be simply a directly calling other properly bechmarked pallet's logic, it could be as simple as a 1 to 1 mapping plus the slight extra overhead the chain extension itself calling this vs. directly. Conversely, this may add significant new logic and more complete benchmarking to match.

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.