Quantisation

Is a name of the process of calculating contract processing costs and checking that it is within a limit. Some operations with contracts processing have a price in quanta (single: quantum). To calculate the amount of work necessary to check and register the contract, we create Quantiser class and pass its instance to the contract instance to check it. The Quantiser can do two operations: calculate amount oif work needed/performed and keeping the limit. If the limit is exceeded, the quantizer must add an error to the Contract and effectively and immediately interrupt checking procedure (using an exception). It is crucial than to check are performed after meeting the limit. If the limit is not set, quantiser just counts the work and report it.

Work quanta

Note that these basic values are subject to change and should be made as configurable parameters in the code

operation cost in quanta remarks
Check 2048 bits signature 1
Check 4096 bits signature 8
Check an applicable permission 1 performed only if the permission could be applied with given keys
Check a split_join permission 2 in addition to the permission check cost
Revoke a version 20
Register a version 20
Check a referenced version 1 only performed to the referencedItems

Reference check costs

If a reference is in use (e.g. mentioned in applicable permissions), its evaluation adds additional costs:

operation cost in quanta remarks
Check single field defined/undefined 1
Check role match 4
Check any other fields conditional expression 2

Relation to TU/U

The TU (also named just “U” in the user-visible interfaces) costs of any transactions are calculated as the total of the costs of these basic operations, divided by the quanta-per-tu ratio and then ceiled to the nearest integer number. The quanta-per-tu ratio is currently fixed at 200, but may be changed together with the primitive operation costs.

Implementation notes

The single Quantiser instance should be used to perform all approval operations to properly account work performed and limit processing as needed.