-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
ADR 004 Implementation #5519
Comments
Thanks @alexanderbez - glad to review and/or update the ADR if anything needs to be revised. |
quoting from ADR
this is not really a O(1). The amount of leaves in the tree increases iavl height and the complexity of the query. i was doing some profiling while working on this issue #5461, and the difference can be significant. note that inserting multiple values also degrades iavl write performance. so the described griefing vector is still there, it is not straightforward to say what would be worth, storing a single object with all denominations or allow the creation of unlimited separate objects. it definitely makes sense to benchmark proposed change. |
Agreed on benchmarking. This is a DoS vector we don't consider in general, I suspect it might also appear in other places. |
i was looking at different merkle trees wrt write perf, and iavl doesn't seem to scale well when when tree grows in size, e.g if one can find a cheap way to insert multiple unique keys into the same tree - blockchain performance will decrease significantly. Below is a plot for the time it takes to commit 10,000 entries with a key of size 30 bytes, value 100 bytes. Only at 2 mil unique keys it takes 12s to commit 10,000 keys. And beyond that it even worse. Reads degrade as well, i don't have plots for them though. it is a bit speculative, and i don't know how practical such DoS scenario is but maybe you can find it interesting. more at https://github.com/dshulyak/merklecmp, but you can also get similar results by tweaking benchmark in iavl repo. |
Nice stats @dshulyak! It is well known that amino and IAVL are the two biggest culprits by far in terms of performance and IO bottlenecks, with us already starting to address the former. I would love to see more discussion around IAVL alternatives. |
2 Points that I should have made at ADR stage, but:
|
This is just an invariant check, right? Or does the state machine use the total balance (as calculated by iteration) in a transaction directly? If the former, it doesn't seem substantially different to me than the existent DoS vector of just making many accounts (though the gas costs likely differ somewhat). |
Correct, these are just the invariants for the total balance and per-coin balances |
Do full nodes / validators run the invariants by default? I'm trying to understand the precise DoS concern and/or change from the current state of affairs. |
No, there is an invariant mode for nodes. The default is to not run the invariants. |
Summary
Implement ADR 004.
Please cross-reference to any other issues/milestones as necessary.
/cc @cwgoes @fedekunze @jackzampolin
For Admin Use
The text was updated successfully, but these errors were encountered: