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

Update eos rodeos key_value.hpp and abieos module based on CDT 📦 #10889

Closed
wants to merge 2 commits into from

Conversation

plroblox
Copy link

@plroblox plroblox commented Nov 15, 2021

Change Description

This PR is an add-on for previous #10864, here the change in abieos submodule is included in this PR.

eos rodeos key_value.hpp at [develop-boxed] is behind CDT version at [develop-boxed], and that key_value.hpp in CDT libraries/eosiolib/contracts/eosio/ was renamed as table.hpp in EOSIO/eosio.cdt#996 last November, so now CDT [master] and CDT [develop] does NOT have key_value.hpp any more.

Here the proposed code change is based on the latest table.hpp in CDT [develop] branch.

Change Type

Select ONE:

  • Documentation
  • Stability bug fix
  • Other
  • Other - special case

Testing Changes

Select ANY that apply:

  • New Tests
  • Existing Tests
  • Test Framework
  • CI System
  • Other

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

@heifner
Copy link
Contributor

heifner commented Nov 16, 2021

What is the associated abieos PR?

@plroblox
Copy link
Author

See EOSIO/abieos#139

Comment on lines 758 to 759
int32_t itr_stat = static_cast<typename iterator::status>(tbl->environment.kv_it_prev(itr, &found_key_size, &found_value_size));
return {itr, static_cast<typename iterator::status>(itr_stat), this};
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need to do the same static_cast twice.

Copy link
Author

Choose a reason for hiding this comment

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

modified

public:
enum class status {
iterator_ok = 0, // Iterator is positioned at a key-value pair
iterator_erased = -1, // The key-value pair that the iterator used to be positioned at was erased
iterator_end = -2, // Iterator is out-of-bounds
};

iterator() = default;
iterator_base() = default;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to have itr == 0 && itr_stat == iterator_endas a class invariant; i.e. whenever, you set itr to 0, also set itr_stat to iterator_end. This will simplify a lot of the compare code.

Copy link
Author

Choose a reason for hiding this comment

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

Add is_end() method

@heifner heifner changed the title Update eos rodeos key_value.hpp and abieos module based on CDT Update eos rodeos key_value.hpp and abieos module based on CDT 📦 Nov 29, 2021
@plroblox
Copy link
Author

This PR is obsolete, see #11004

@plroblox plroblox closed this Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants