Skip to content
Blockchain Association of Cameroon
BAC-L2-SUB-111Substrate / Polkadot SDKExpert

Benchmarking and weights

A call whose cost is underestimated is a denial-of-service attack you priced yourself. Measure, do not estimate.

Level
L2Appchain developer
Duration
4 h
Track
Substrate / Polkadot SDK
Maintainer
Polkadot / Substrate Lead Architect

Learning objectives

  • 01Write a benchmark representing a call's worst case
  • 02Generate measured weights and wire them into the runtime
  • 03Explain the link between weight, fees and block capacity

Guided lab

Benchmark the pallet's calls and replace every placeholder weight with a measured value.

Independent lab

Compare weights obtained on two machines of differing power and draw an operational conclusion.

Security angle

Saturate a block with an underpriced call, then show by measurement that the fix closes the attack.

Assessment

Measured weights wired into the runtime, with the benchmark log attached.