Skip to content

Conversation

@kamilsa
Copy link
Contributor

@kamilsa kamilsa commented Sep 10, 2020

Referenced issues

Fixes #514 . Fixed copy of #518

Description of the Change

Same as in #518

Benefits

Fixes issue with getting value from storage using ext_storage_get

Possible Drawbacks

None

@iceseer iceseer self-requested a review September 10, 2020 07:58
// already scale-encoded
trie.put(key, value);
auto put_res = trie.put(key, value);
BOOST_ASSERT_MSG(put_res, "Trie put was failed");
Copy link
Contributor

Choose a reason for hiding this comment

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

Better add logging, assert will be silent in release mode.

// already scale-encoded
trie.put(key, value);
auto put_res = trie.put(key, value);
BOOST_ASSERT_MSG(put_res, "Trie put was failed");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
BOOST_ASSERT_MSG(put_res, "Trie put was failed");
BOOST_ASSERT_MSG(put_res, "Trie put failed");


} else {
logger_->trace("ext_get_storage_into. Key hex: {} Value: empty",
logger_->trace("ext_storage_get_version_1( {} ) => not found",
Copy link
Contributor

Choose a reason for hiding this comment

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

Not found is not the only error, so perhaps better to consider it.

Comment on lines 298 to 300
auto encoded = scale::encode(option).value();

return memory_->storeBuffer(encoded);
Copy link
Contributor

Choose a reason for hiding this comment

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

rval?
return memory_->storeBuffer(scale::encode(option).value());

Copy link
Contributor

Choose a reason for hiding this comment

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

Also this code will be executed in the case !option. Is it wright?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean .value() will be failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also this code will be executed in the case !option. Is it wright?

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean .value() will be failed.

scale::encode never fails)) we should change signature of this function later

Signed-off-by: kamilsa <kamilsa16@gmail.com>
Copy link
Contributor

@Harrm Harrm left a comment

Choose a reason for hiding this comment

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

Anxious about encode(...).value(), the rest is fine.

@kamilsa kamilsa merged commit 5cb8a8d into master Sep 10, 2020
@kamilsa kamilsa deleted the pull/518 branch September 10, 2020 08:30
Harrm pushed a commit that referenced this pull request Oct 19, 2020
* storage extension: Fix return type of get

* Fix storage extenstion test

Signed-off-by: kamilsa <kamilsa16@gmail.com>

* Fix review issues

Signed-off-by: kamilsa <kamilsa16@gmail.com>

Co-authored-by: Florian Franzen <Florian.Franzen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing genesis

4 participants