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

Add next_key to get_table_rows API #7530

Merged
merged 30 commits into from
Sep 25, 2019
Merged

Add next_key to get_table_rows API #7530

merged 30 commits into from
Sep 25, 2019

Conversation

andriantolie
Copy link
Contributor

@andriantolie andriantolie commented Jun 25, 2019

Change Description

Related to #7313. This PR adds a new field called more2 to the result of get_table_rows chain API. The more2 field contains the key of the next row that wasn't returned in the response in the same format that was expected for the lower_bound and upper_bound fields of the request, i.e.

  • without --key-type -> the more2 field will contain uint64_t of the next row primary key;
  • --key-type sha256 -> the more2 field will contain sha256 of the next row secondary key
  • --key-type float128, the more2 field will contain floating number represented as uint128 of the next row secondary key
  • etc...

This PR removes fixed_key.hpp as it's unused anymore and bring in fixed_bytes.hpp from eosio.cdt.

This PR also introduces breaking API changes for the input of get_table_rows for key-type sha256, ripemd160, i256. It also introduces breaking changes in the representation of uint128 in the JSON response (details below).

A new PR is also added in the FC repo EOSIO/fc#111

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

This PR changes the input of get_table_rows for the following key-type:

  • sha256 -> convert the input to an array of two uint128_t in little endian (which is the same as how fixed_bytes represents the data)
  • i256 -> convert the input to an array of two uint128_t in little endian (which is the same as how fixed_bytes represents the data)
  • ripemd160 -> convert the input to an array of two uint128_t in little endian (which is the same as how fixed_bytes represents the data)
    And this PR changes the way uint128 being represented in the JSON response, from previously being represented as binary, it is now being represented as a decimal which is easier to be understood by the user.

Documentation Additions

  • Documentation Additions

@arhag arhag self-requested a review July 30, 2019 16:08
tests/chain_plugin_tests.cpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/fixed_bytes.hpp Outdated Show resolved Hide resolved
tests/get_table_tests.cpp Show resolved Hide resolved
plugins/chain_plugin/chain_plugin.cpp Outdated Show resolved Hide resolved
@jafri
Copy link
Contributor

jafri commented Jul 31, 2019

Any consideration on giving it a better name like next_key instead of more2?

@andriantolie
Copy link
Contributor Author

Any consideration on giving it a better name like next_key instead of more2?
That sounds good, thanks for the input. I've made the change in this PR.

@tbfleming
Copy link
Contributor

The float128_t aliasing problem also occurs in existing consensus-handling code. For now, keep the float128_t handling as is, but fix the other aliasing problems. float128_t fixes can come later: #7960

@andriantolie
Copy link
Contributor Author

@tbfleming Thanks for the feedback. I've updated my PR to fix the strict alias violation.

Copy link
Contributor

@arhag arhag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update the fc submodule to the latest master that will include the changes in EOSIO/fc#111.

@@ -51,7 +52,7 @@ struct permission {
template<typename>
struct resolver_factory;

// see specializations for uint64_t and double in source file
// see specializations for uint64_t, uint128_t and double in source file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment can be reverted because there is no longer a need for a specialization for uint128_t.

@andriantolie andriantolie merged commit 15ea194 into develop Sep 25, 2019
@arhag arhag deleted the gh7313 branch September 25, 2019 01:40
@aclark-b1 aclark-b1 added the documentation Requires attention from documentation team. e.g. documentation is expected to be generated. label Aug 5, 2020
@b1bart b1bart changed the title Add more2 to get_table_rows API Add next_key to get_table_rows API Aug 5, 2020
@aclark-b1
Copy link

Docs team - I don't believe this change ever made it into our documentation. Can you please add it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Requires attention from documentation team. e.g. documentation is expected to be generated. needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants