nearcore icon indicating copy to clipboard operation
nearcore copied to clipboard

Make it clear which costs have safety multiplier

Open matklad opened this issue 2 years ago • 3 comments

Some of our costs are multiplied by 3 to have an extra safety margin, and some are not. This isn't reflected today in production code.

Eg, here:

https://github.com/near/nearcore/blob/845a8ec079fa417dcca50e9a2acbfd086b196f73/core/primitives/res/runtime_configs/50.json

we see premultiplied costs. I think the rule is "regular_op_cost and all ExtCosts are multipled, all action costs are not multiplied", but I am not entirely sure. If the rule is that simple, we should just document it. If the rule is more complex, or if we want to change it in the future, we might want to move it into code somehow. If we do move it to code, we need to make sure that multiplication rules might change depending on the protocol version.

We have remainings of the safety multiplication code here:

https://github.com/near/nearcore/blob/5de73b06e0921b636bfc8dffafa029054ba110a2/core/primitives-core/src/config.rs#L397

matklad avatar Feb 23 '22 13:02 matklad

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 24 '22 18:05 stale[bot]

@jakmeier did we do something about this when transitioning to parameters?

https://github.com/near/nearcore/blob/master/core/primitives/src/runtime/parameter_table.rs

matklad avatar Jul 28 '22 10:07 matklad

Not really. The parameter table links parameters and fees. The plan was to use this to display more information on the output of continuous estimation. But we decided that the state of continuous estimation was already sufficient and we should not spend more time on it for now.

jakmeier avatar Aug 09 '22 08:08 jakmeier