-
Notifications
You must be signed in to change notification settings - Fork 71
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
[4.0] Restore read-mode=speculative #986
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,11 +120,17 @@ Config Options for eosio::chain_plugin: | |
applied to them (may specify multiple | ||
times) | ||
--read-mode arg (=head) Database read mode ("head", | ||
"irreversible"). | ||
"speculative", "irreversible"). | ||
In "head" mode: database contains state | ||
changes up to the head block; | ||
transactions received by the node are | ||
relayed if valid. | ||
In "speculative" mode: (DEPRECATED: | ||
head mode recommended) database | ||
contains state changes by transactions | ||
in the blockchain up to the head block | ||
as well as some transactions not yet | ||
included in the blockchain. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you specify if a transaction will be replayed, to be consistent with the other two's description? |
||
In "irreversible" mode: database | ||
contains state changes up to the last | ||
irreversible block; transactions | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,9 +270,7 @@ struct controller_impl { | |
prev = fork_db.root(); | ||
} | ||
|
||
if ( read_mode == db_read_mode::HEAD ) { | ||
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot"); | ||
} | ||
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this should always be asserted even for IRREVERSIBLE mode. |
||
|
||
head = prev; | ||
|
||
|
@@ -1635,7 +1633,7 @@ struct controller_impl { | |
if ( trx->is_transient() ) { | ||
// remove trx from pending block by not canceling 'restore' | ||
trx_context.undo(); // this will happen automatically in destructor, but make it more explicit | ||
} else if ( pending->_block_status == controller::block_status::ephemeral ) { | ||
} else if ( read_mode != db_read_mode::SPECULATIVE && pending->_block_status == controller::block_status::ephemeral ) { | ||
// An ephemeral block will never become a full block, but on a producer node the trxs should be saved | ||
// in the un-applied transaction queue for execution during block production. For a non-producer node | ||
// save the trxs in the un-applied transaction queue for use during block validation to skip signature | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ namespace eosio { namespace chain { | |
|
||
enum class db_read_mode { | ||
HEAD, | ||
SPECULATIVE, | ||
IRREVERSIBLE | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ namespace chain { | |
std::ostream& operator<<(std::ostream& osm, eosio::chain::db_read_mode m) { | ||
if ( m == eosio::chain::db_read_mode::HEAD ) { | ||
osm << "head"; | ||
} else if ( m == eosio::chain::db_read_mode::SPECULATIVE ) { | ||
osm << "speculative"; | ||
} else if ( m == eosio::chain::db_read_mode::IRREVERSIBLE ) { | ||
osm << "irreversible"; | ||
} | ||
|
@@ -70,8 +72,10 @@ void validate(boost::any& v, | |
// one string, it's an error, and exception will be thrown. | ||
std::string const& s = validators::get_single_string(values); | ||
|
||
if ( s == "head" ) { | ||
if ( s == "head" ) { | ||
v = boost::any(eosio::chain::db_read_mode::HEAD); | ||
} else if ( s == "speculative" ) { | ||
v = boost::any(eosio::chain::db_read_mode::SPECULATIVE); | ||
} else if ( s == "irreversible" ) { | ||
v = boost::any(eosio::chain::db_read_mode::IRREVERSIBLE); | ||
} else { | ||
|
@@ -286,8 +290,9 @@ void chain_plugin::set_program_options(options_description& cli, options_descrip | |
("sender-bypass-whiteblacklist", boost::program_options::value<vector<string>>()->composing()->multitoken(), | ||
"Deferred transactions sent by accounts in this list do not have any of the subjective whitelist/blacklist checks applied to them (may specify multiple times)") | ||
("read-mode", boost::program_options::value<eosio::chain::db_read_mode>()->default_value(eosio::chain::db_read_mode::HEAD), | ||
"Database read mode (\"head\", \"irreversible\").\n" | ||
"Database read mode (\"head\", \"speculative\", \"irreversible\").\n" | ||
"In \"head\" mode: database contains state changes up to the head block; transactions received by the node are relayed if valid.\n" | ||
"In \"speculative\" mode: (DEPRECATED: head mode recommended) database contains state changes by transactions in the blockchain up to the head block as well as some transactions not yet included in the blockchain.\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. place it after irreversible |
||
"In \"irreversible\" mode: database contains state changes up to the last irreversible block; " | ||
"transactions received via the P2P network are not relayed and transactions cannot be pushed via the chain API.\n" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As speculative is deprecated, place it after irreversible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done