polkadot-sdk icon indicating copy to clipboard operation
polkadot-sdk copied to clipboard

[After Transaction Extension PR] CheckMetadataHash transaction extension benchmark.

Open gui1117 opened this issue 1 year ago • 1 comments

After https://github.com/paritytech/polkadot-sdk/pull/3685

The transaction extensions cost is:

  • 3 match. each match is a 2 variant match.
  • 1 call to array_bytes::hex2array_unchecked to convert a hexadecimal string into a 32 bytes array.
  • (a debug log which converts a 32 bytes array to hex string, but I think it shouldn't be part of benchmark no?

So I feel introducing a new pallet to have it benchmarked is overkill.

In this PR:

  • I removed the array_bytes::hex2array_unchecked call and changed to a const implementation.
  • I set the weight of the transaction extension to 0: it is basically 3 boolean condition.

Alternative 1:

  • put this transaction extension into frame-system and have its benchmark part of system extension benchmarks.

Alternative 2:

  • do the new pallet and benchmark stuff.

cc @georgepisaltu

gui1117 avatar Aug 08 '24 07:08 gui1117