hyperledger / besu

An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
https://www.hyperledger.org/projects/besu
Apache License 2.0
1.43k stars 759 forks source link

Enable --Xbonsai-limit-trie-logs-enabled by default #7181

Closed siladu closed 1 month ago

siladu commented 1 month ago

PR description

Enable --Xbonsai-limit-trie-logs-enabled by default, unless sync-mode=FULL. More info: https://wiki.hyperledger.org/display/BESU/Limit+Trie+Logs+for+Bonsai

When sync-mode=FULL and data-storage-format=BONSAI you get a config validation error at startup...

besu --sync-mode=FULL --data-storage-format=BONSAI
2024-06-06 17:36:12.806+01:00 | main | INFO  | Besu | Starting Besu
2024-06-06 17:36:13.027+01:00 | main | ERROR | Besu | Failed to start Besu
...
Cannot enable --Xbonsai-limit-trie-logs-enabled with sync mode FULL

I will promote to a Stable option in a separate PR.

This option has been tested on our canaries and by the community since https://github.com/hyperledger/besu/releases/tag/24.3.0

Added a fallback value for the option otherwise specifying --Xbonsai-limit-trie-logs-enabled on the command line, without a value, toggles it back off again.

The minimalist-profile has been updated from bonsai-historical-block-limit=128 to bonsai-historical-block-limit=512 to avoid further code changes and because I believe there is only a ~60MB difference so using 128 has limited value, see https://github.com/hyperledger/besu/issues/6560#issuecomment-1953928253

I will conservatively set Xbonsai-limit-trie-logs-enabled=false in the enterprise profile for now as not sure it is desirable.

Fixed Issue(s)

Fixes https://github.com/hyperledger/besu/pull/6560

Thanks for sending a pull request! Have you done the following?

non-fungible-nelson commented 1 month ago

Commit LGTM - thanks @siladu for the last minute fixes.

matthew1001 commented 2 weeks ago

FYI @siladu in PR https://github.com/hyperledger/besu/pull/7140 I was planning to change the fail-on-start behaviour if FULL sync mode is enabled and bonsai-trie-log-pruning-enabled is set, and instead set bonsai-trie-log-pruning-enabled to false if sync mode is FULL (with a log message to state that the default has been overridden).

Let me know if you have any concerns about that change - maybe via comments in that PR?