ledgerwatch / erigon

Ethereum implementation on the efficiency frontier
GNU Lesser General Public License v3.0
3.03k stars 1.04k forks source link

Raise the limit of debug_accountRange to 8192 (if storage not requested) #10753

Closed wtdcode closed 1 week ago

wtdcode commented 1 week ago

debug_accountRange is one of the cool rpc methods erigon provides. However, the hardcoded limit 256 makes it supper inefficient. In my personal benchmark, raising the limit to 8192 could boost the indexing process 3-4x faster and thus this PR raises the default limit.

I could understand the security consideration of the DDoS attack on this parameter. But it's an RPC method under the debug namespace, which is not common for external usage, and both limits impose similar database pressure. Therefore, it should be mostly safe to raise the limit to a moderate value.

AskAlexSharov commented 1 week ago

@wtdcode what does indexing process do?

wtdcode commented 1 week ago

@wtdcode what does indexing process do?

Iterate the database to get all existing accounts.

AskAlexSharov commented 1 week ago

@wtdcode with storage?

wtdcode commented 1 week ago

@wtdcode with storage?

No, plain account addreses.

AskAlexSharov commented 1 week ago

i think main problem of debug_accountRange - it doesn't limit amount of storage keys (including all storage if request). @wtdcode can we have 2 constants? one for excludeStorage=true another excludeStorage=false?

wtdcode commented 1 week ago

i think main problem of debug_accountRange - it doesn't limit amount of storage keys (including all storage if request). @wtdcode can we have 2 constants? one for excludeStorage=true another excludeStorage=false?

Make sense, let me add the constants.

wtdcode commented 1 week ago

Done

wtdcode commented 1 week ago

@AskAlexSharov Any blocker?

AskAlexSharov commented 1 week ago

CI is red because of https://github.com/ledgerwatch/erigon/pull/10774