Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

fix upper_bound bug in chain_plugin; update cleos to use fixed upper_bound correctly #6273

Closed
arhag opened this issue Nov 8, 2018 · 1 comment
Assignees
Labels

Comments

@arhag
Copy link
Contributor

arhag commented Nov 8, 2018

See the comment here: #6070 (comment)

Change get_table_rows_ex to set upper (within the if statement checking if upper_bound was specified by the caller) using the upper_bound function rather than the lower_bound function.

Change get_table_rows_by_seckey to set upper (within the if statement checking if upper_bound was specified by the caller) using the upper_bound function rather than the lower_bound function. However the upper_bound function should be passed a tuple that includes a third argument std::numeric_limits<uint64_t>::max().

Change get_table_by_scope to set upper (within the if statement branch that asserts that upper_bound was specified by the caller) using the upper_bound function rather than the lower_bound function and with a tuple boost::make_tuple(p.code, scope, std::numeric_limits<uint64_t>::max()) passed to the upper_bound function.

Set lower_bound_lookup_tuple and upper_bound_lookup_tuple appropriately based on passed in RPC arguments. Ensure lower_bound_lookup_tuple <= upper_bound_lookup_tuple. Then the lower and upper iterators in all cases should just be:

auto lower = idx.lower_bound( lower_bound_lookup_tuple );
auto upper = idx.upper_bound( upper_bound_lookup_tuple );

Audit all uses of lower_bound and upper_bound in cleos and update them as appropriate to work with the corrected upper_bound implementation in chain_plugin.

@arhag arhag added the bug label Nov 8, 2018
@arhag arhag self-assigned this Nov 8, 2018
arhag added a commit that referenced this issue Nov 9, 2018
arhag added a commit that referenced this issue Nov 9, 2018
#6273

Still need to request larger range than necessary and do additional 
checks just so v1.5.0 of cleos can still work with nodeos versions older 
than v1.5.0.
@arhag
Copy link
Contributor Author

arhag commented Nov 10, 2018

Resolved by #6285.

@arhag arhag closed this as completed Nov 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant