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

FIP-46 make walk time configurable for the node #370

Merged
merged 5 commits into from Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion libraries/chain/include/eosio/chain/config.hpp
Expand Up @@ -124,7 +124,6 @@ namespace eosio {
*/
const static int producer_repetitions = 12;
const static int max_producers = 125;

const static size_t maximum_tracked_dpos_confirmations = 1024; ///<
static_assert(maximum_tracked_dpos_confirmations >= ((max_producers * 2 / 3) + 1) * producer_repetitions,
"Settings never allow for DPOS irreversibility");
Expand Down
24 changes: 21 additions & 3 deletions plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
Expand Up @@ -48,7 +48,21 @@ namespace eosio {
namespace chain_apis {
struct empty {
};
const uint32_t WALKVALUE = 1000 * 10;

//FIP-46 begin
/*
* These 2 constants are added to provide those who host an API node the ability to modify these values
* if there is ever a need to provide API nodes increased time for processing of table information within read only getters.
* In FIO we provide 1 second of processing time to an API node for the processing of secondary index information,
* this provides API nodes the ability to return reliable results when tables contain up to tens of thousdands of rows per secondary index.
* EOSIO historically used a single constant WALKTIME for both primary key and secondary key reads, which were both set to 100 milliseconds, this
* limited the number of rows per secondary index to something well under 5k rows per secondary index for reliable results in
* a read only getter. SEE EOS ISSUE #3965 https://github.com/EOSIO/eos/issues/3965
*/
const static int SECONDARY_INDEX_MAX_READ_TIME_MICROSECONDS = 1000 * 100; //1 second read time permitted on secondary indices
ericbutz marked this conversation as resolved.
Show resolved Hide resolved
const static int PRIMARY_INDEX_MAX_READ_TIME_MICROSECONDS = 1000 * 10; //100 milliseconds read time permitted for pirmary indices.
//FIP-46 end

struct permission {
name perm_name;
name parent;
Expand Down Expand Up @@ -942,7 +956,9 @@ namespace eosio {

auto walk_table_row_range = [&](auto itr, auto end_itr) {
auto cur_time = fc::time_point::now();
auto end_time = cur_time + fc::microseconds(WALKVALUE); /// 100ms max time
//FIP-46 begin
auto end_time = cur_time + fc::microseconds(SECONDARY_INDEX_MAX_READ_TIME_MICROSECONDS);
//FIP-46 end
vector<char> data;
for (unsigned int count = 0; cur_time <= end_time && count < p.limit &&
itr != end_itr; ++itr, cur_time = fc::time_point::now()) {
Expand Down Expand Up @@ -1028,7 +1044,9 @@ namespace eosio {

auto walk_table_row_range = [&](auto itr, auto end_itr) {
auto cur_time = fc::time_point::now();
auto end_time = cur_time + fc::microseconds(WALKVALUE); /// 100ms max time
//FIP-46 begin
auto end_time = cur_time + fc::microseconds(PRIMARY_INDEX_MAX_READ_TIME_MICROSECONDS);
//FIP-46 end
vector<char> data;
for (unsigned int count = 0; cur_time <= end_time && count < p.limit &&
itr != end_itr; ++count, ++itr, cur_time = fc::time_point::now()) {
Expand Down