Cost of: of hashing 1 block of data.
Cost of: of hashing 1 block of data.
This cost is used as a baseline to connect cost units with absolute time. The block validation have 1000000 of cost units budget, and we want this to correspond to 1 second. Thus we can assume 1 cost unit == 1 micro-second.
It takes approximately 1 micro-seconds on average to compute hash of 128 bytes block on MacBook Pro (16-inch, 2019) 2.3 GHz 8-Core Intel Core i9.
Thus per block cost of Blake2b256 hashing can be limited by 1 cost units. However, on a less powerful processor it may take much more time, so we add a factor of 3 for that. Additionally, the interpreter has overhead so that performing 1000 of hashes in a tight loop is 3-4 times faster than doing the same via ErgoTreeEvaluator. Thus we should add another factor of 2 and this takes place for all operations. So we will use a total factor of 10 to convert actual operation micro-seconds time (obtained via benchmarking) to cost unit estimation (used for cost prediction).
Cost_in_units = time_in_micro-seconds * 7 = 7
NOTE, 128 is the size of message chunk processed by Blake2b256 algorithm.
sigmastate.interpreter.ErgoTreeEvaluator.DataBlockSize
Unique id of the node class used in serialization of ErgoTree.
Unique id of the node class used in serialization of ErgoTree.