Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nightly protocol runtime config includes wrong regular_op_cost #5094

Closed
matklad opened this issue Oct 28, 2021 · 4 comments
Closed

Nightly protocol runtime config includes wrong regular_op_cost #5094

matklad opened this issue Oct 28, 2021 · 4 comments
Assignees
Labels
A-transaction-runtime Area: transaction runtime (transaction and receipts processing, state transition, etc) T-core Team: issues relevant to the core team

Comments

@matklad
Copy link
Contributor

matklad commented Oct 28, 2021

This line is wrong:

"regular_op_cost": 3856371,

It should say this instead:

"regular_op_cost": 2207874,

This'll probably get caught once #4961 is implemented. But I wonder if we should improve, mid-term, how we represent config changes?

Configuration bugs are notorious for causing outages, this is the evidence that "let's just dump config to JSON" is not fool-proof enough.

I think it makes sense to refactor the code to allow storing just diffs, which explicitly say "we change from this value to this value".

I am also 0.7 sure that for source of truth for costs, we should switch from JSON to plain-text readable format from estimator:

https://github.com/near/nearcore/blob/master/runtime/runtime-params-estimator/costs.txt

but that is blocked on #4633

@matklad matklad added A-transaction-runtime Area: transaction runtime (transaction and receipts processing, state transition, etc) T-core Team: issues relevant to the core team labels Oct 28, 2021
@Longarithm
Copy link
Member

Great catch. I see why this happened:

  • first, PR with 123.json was introduced, which was based on older config without regular_op_cost updated
  • then another PR introducing lower regular_op_cost was introduced and merged
  • and then 123.json was merged, but it still was based on old op cost, so it was increased back

This seems to be a good reason to switch to diffs, because the speed of merging different costs indeed may be different, and consequences may be worse if smth like this will leak to mainnet.

For now I will hotfix the cost, because it affects only betanet which is hardforked every day.

near-bulldozer bot pushed a commit that referenced this issue Oct 29, 2021
Fixes cost mentioned in #5094

Test plan
---------
```
% diff nearcore/res/runtime_configs/48.json nearcore/res/runtime_configs/123.json
176c176,177
<       "max_number_input_data_dependencies": 128
---
>       "max_number_input_data_dependencies": 128,
>       "max_functions_number_per_contract": 10000
```
@matklad
Copy link
Contributor Author

matklad commented Nov 1, 2021

@Longarithm Closed?

@Longarithm
Copy link
Member

Yeah, the cost is fixed. I will come back to storing diffs later

@Longarithm
Copy link
Member

Regarding diffs: today I found that max_transaction_size field is taken as default value. If I want to put it into config, I have to put it into each config instead of only the first one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transaction-runtime Area: transaction runtime (transaction and receipts processing, state transition, etc) T-core Team: issues relevant to the core team
Projects
None yet
Development

No branches or pull requests

2 participants