-
Notifications
You must be signed in to change notification settings - Fork 622
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
Investigate unrealistic base cost of DataReceiptCreationConfig
#4482
Comments
To be clear, the current cost of 4.5Tgas is also unrealistically high. See #3279 for a discussion on this. |
From the first sight, difference is explained by taking IO costs into account: But there is conflicting info here: |
Data receipt fee estimation depends on its place in the vector of metrics: https://github.com/near/nearcore/blob/master/runtime/runtime-params-estimator/src/cases.rs#L536 Consider an example:
Computation of DataReceipt fees based on Also, if we cleanup data by re-creating Supposed explanation:
I currently suspect It makes sense to use separate
To do so, I plan to understand more deeply what exactly causes the difference by profiling tools. |
@Longarithm is it correct that |
There is also a curious dependency between fees and accounts number.
UPD: added row for 100K accounts |
@bowenwang1996
Though I'm not entirely sure that all these operations are called ~1000 times, as we expect in the measurement. nearcore/runtime/runtime/src/lib.rs Line 914 in 28d9b7d
I need to double-check this. cc @olonho @matklad Note that we don't consider bytes cost here, in which I see no discrepancies. |
@Longarithm is the base cost calculated based on some trivial data or through some statistical method? It looks like this involves at most 4 storage operations and it should not be more expensive than 4 storage writes of [some trivial data]. Also it seems to me that this fee depends on the shape of the trie, but we also have a separate |
This explains lots of discrepancies that we are observing: https://near.zulipchat.com/#narrow/stream/295306-dev-contract-runtime/topic/fees.20.26.20state.20size/near/247505050 |
**Idea** We currently reuse the same `RuntimeTestbed` for computing metrics in `calls_helper`. Presumably it saved some time (actually not a lot), and allowed us to skip initialization of testbed. But this led to issues with fees computation: #4482 (comment) Explanation: https://near.zulipchat.com/#narrow/stream/295306-dev-contract-runtime/topic/fees.20.26.20state.20size/near/248169740 So we need to create separate testbeds with different `/tmp/data` folders. **Testing** Check for discrepancies in resulting `RuntimeConfig`s
Closing, because we have a decent explanation for the issue, and it was fixed in #4647. |
Stabilize features lowering costs for new release: * #4795 * #4865 Quality control: * We run param estimator several times and got consistent results: * beginning of Sep 2021, my GCP instance https://hackmd.io/w6ODyKjUReuuofXTuqdyFQ * end of Sep 2021, @matklad instance #4778 (comment) * The current fee values are explained: * Data receipt costs - investigated here #4482, the reason was relatively explained and the observed issue was fixed. Note that we don't know the exact root cause, but we assume that it is related to a separate fee (touching_trie_node) for taking store size into account. This fee is problematic because it assumes the constant height of a trie, but we treat it as a separate problem. * Ecrecover cost - follow links from this one: #4778 (comment)
In recent
runtime-params-estimator
launches,DataReceiptCreationConfig
base cost is 50 TGas, which is unrealistically high comparing to current cost of 4.5 TGas.Examples:
#4231
#4455
cc @bowenwang1996 @olonho
The text was updated successfully, but these errors were encountered: