Proto/Gas+Pipelining: carbonate signature checking for manager operations
Context
This is a relatively-low hanging fruit to improve the L1-throughput. Until now, the resources consumed by the signature checking for manager operations are over-approximated in the gas model by the infamous Michelson_v1_gas.Cost_of.manager_operation
whose value is 1000 gas units since Delphi. This gas cost is consumed:
- once for each external operation in a batch even if a single signature per batch is checked
- for each internal operation even if internal operations are not signed at all
- independently of the length of the operation and the used signature scheme even if these actually impact the time needed to check the signature (but we are safe because operation size is bounded).
In this MR we increase the precision of the gas model by reusing the work done to benchmark the Michelson CHECK_SIGNATURE
instruction:
- a new signature checking cost is introduced,
- it is only consumed in the validation/application of the first operation of each batch,
- the
manager_operation
constant is decreased by a factor of 10 (from 1000 to 100) to only cover other resource consumption.
I haven't measured it but I expect this to have a huge impact on TPS, especially in scenarios with large batches or with many internal operations. Even for single-operation batches, the cost is largely reduced for the ed25519
and secp256k1
schemes in particular (typically about 800 gas units saved for each signature check).
Manually testing the MR
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rst
for the protocol and the environment,CHANGES.rst
at the root of the repository for everything else). -
Select suitable reviewers using the Reviewers
field below. -
Select as Assignee
the next person who should take action on that MR