AntelopeIO / leap

C++ implementation of the Antelope protocol
Other
116 stars 70 forks source link

Improve error messages in case of failure at Leap startup. #1696

Open greg7mdp opened 11 months ago

greg7mdp commented 11 months ago

There are a number of possible issues which can cause Leap to fail to start correctly, and in general the printed message is the text (often duplicated) from the C++ exception thrown when the error was detected .

For example when trying to open an incompatible state database:

warn  2023-09-28T22:00:00.790 nodeos    chain_plugin.cpp:1109         plugin_initialize    ] 13 N5boost10wrapexceptISt12system_errorEE: "state" database format not compatible with this version of chainbase.: Database format not compatible with this version of chainbase
rethrow "state" database format not compatible with this version of chainbase.: Database format not compatible with this version of chainbase: 
    {"what":"\"state\" database format not compatible with this version of chainbase.: Database format not compatible with this version of chainbase"}
    nodeos  chain_plugin.cpp:1109 plugin_initialize

appbase: exception thrown during plugin "" initialization.
"state" database format not compatible with this version of chainbase.: Database format not compatible with this version of chainbase
info  2023-09-28T22:00:00.790 nodeos    main.cpp:155                  operator()           ] nodeos version v4.1.0-dev v4.1.0-dev-78453357fc8e0c0d8ecff665e33716bfc5f588ea-dirty
info  2023-09-28T22:00:00.790 nodeos    main.cpp:62                   log_non_default_opti ] Non-default options: data-dir = main, config-dir = mainconfig, plugin = eosio::chain_api_plugin, plugin = eosio::producer_plugin, plugin = eosio::producer_api_plugin, plugin = eosio::net_plugin, plugin = eosio::http_plugin, access-control-allow-origin = *, http-validate-host = false, verbose-http-errors, plugin = eosio::db_size_api_plugin, blocks-dir = "./blocks", chain-state-db-size-mb = 40000, eos-vm-oc-cache-size-mb = 1024, eos-vm-oc-compile-threads = 2, eos-vm-oc-enable = true, p2p-peer-address = peer.main.alohaeos.com:9876, p2p-peer-address = p2p.eosargentina.io:9876, p2p-peer-address = p2p.genereos.io:9876, p2p-peer-address = eos.defibox.xyz:9876, p2p-peer-address = p2p.eos.cryptolions.io:9876, p2p-peer-address = p2p.donates2eden.io:9876, p2p-peer-address = p2p.eos42.io:9876, p2p-peer-address = mainnet.eosamsterdam.net:9876, p2p-peer-address = mainnet.eosarabia.net:3571, p2p-peer-address = p2p2.eoseoul.io:30333, p2p-peer-address = p2p.eosflare.io:9876, p2p-peer-address = p2p.bitmars.one:8080, p2p-peer-address = p2p.eos.detroitledger.tech:1337, p2p-peer-address = peer.eosio.sg:9876, p2p-peer-address = eos.seed.eosnation.io:9876, p2p-peer-address = peer1.eosphere.io:9876, p2p-peer-address = p2p.eossweden.org:9876, p2p-peer-address = eos.p2p.eosusa.io:9882, sync-fetch-span = 1000, snapshots-dir = "snapshots"
error 2023-09-28T22:00:00.790 nodeos    main.cpp:209                  main                 ] 13 N5boost10wrapexceptISt12system_errorEE: "state" database format not compatible with this version of chainbase.: Database format not compatible with this version of chainbase
rethrow "state" database format not compatible with this version of chainbase.: Database format not compatible with this version of chainbase: 
    {"what":"\"state\" database format not compatible with this version of chainbase.: Database format not compatible with this version of chainbase"}
    nodeos  chain_plugin.cpp:1109 plugin_initialize

We should attempt to provide more user-friendly diagnostics, in particular:

bhazzard commented 10 months ago

Requires design proposal documenting the error cases, how they can be detected, and the messages to display for each.