Skip to content
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

controller::extract_chain_id_from_db() does not properly handle dirty db #121

Closed
heifner opened this issue Apr 21, 2022 · 2 comments · Fixed by #647
Closed

controller::extract_chain_id_from_db() does not properly handle dirty db #121

heifner opened this issue Apr 21, 2022 · 2 comments · Fixed by #647
Assignees
Milestone

Comments

@heifner
Copy link
Member

heifner commented Apr 21, 2022

Seems like we would want to allow any exception to propagate up. And only return an empty optional if db.revision() < 1.

Most importantly this currently causes confusing if the database is dirty because of an unclean shutdown.

Apr 21 02:06:22 eos nodeos[17876]: warn  2022-04-21T02:06:22.015 nodeos    chain_plugin.cpp:1321         plugin_initialize    ] 3110006 plugin_config_exception: Incorrect plugin configuration
Apr 21 02:06:22 eos nodeos[17876]: Genesis state is necessary to initialize fresh blockchain state but genesis state could not be found in the blocks log. Please either load from snapshot or find a blocks log that starts from genesis.
Apr 21 02:06:22 eos nodeos[17876]:     {}
Apr 21 02:06:22 eos nodeos[17876]:     nodeos  chain_plugin.cpp:1154 plugin_initialize
Apr 21 02:06:22 eos nodeos[17876]: error 2022-04-21T02:06:22.015 nodeos    main.cpp:163                  main                 ] 3110006 plugin_config_exception: Incorrect plugin configuration
Apr 21 02:06:22 eos nodeos[17876]: Genesis state is necessary to initialize fresh blockchain state but genesis state could not be found in the blocks log. Please either load from snapshot or find a blocks log that starts from genesis.
Apr 21 02:06:22 eos nodeos[17876]:     {}
Apr 21 02:06:22 eos nodeos[17876]:     nodeos  chain_plugin.cpp:1154 plugin_initialize
Apr 21 02:06:22 eos nodeos[17876]: rethrow
Apr 21 02:06:22 eos nodeos[17876]:     {}
Apr 21 02:06:22 eos nodeos[17876]:     nodeos  chain_plugin.cpp:1321 plugin_initialize

Should use find instead of get and return empty optional if not found.

@spoonincode
Copy link
Member

I kind of wonder if something like the chainid should be stored in chainbase's header so it's possible to interrogate it even when dirty. Or more generally speaking, any write-once sort of data could be stored. Not sure I'm coming up with good uses though 🤔

@arhag arhag moved this to Todo in ENF Engineering Jun 10, 2022
@arhag arhag added this to the Mandel 3.2.0-rc1 milestone Jul 1, 2022
@vladtr vladtr self-assigned this Jul 11, 2022
@vladtr
Copy link
Contributor

vladtr commented Jul 11, 2022

@heifner we should probably still swallow "db_error_code::not_found" so if there is no db it will be created. Edit: probably all except std::system_error exceptions should be propagated

@vladtr vladtr moved this from Todo to Awaiting Review in ENF Engineering Jul 12, 2022
Repository owner moved this from Awaiting Review to Done in ENF Engineering Jul 15, 2022
@stephenpdeos stephenpdeos modified the milestones: Mandel 3.2.0-rc1, Mandel 3.2.0 Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
7 participants