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

Consider using decode_all for get_contract_storage #1804

Closed
ascjones opened this issue Jun 12, 2023 · 0 comments · Fixed by #1897
Closed

Consider using decode_all for get_contract_storage #1804

ascjones opened this issue Jun 12, 2023 · 0 comments · Fixed by #1897
Labels
A-ink_storage [ink_storage] Work Item C-discussion An issue for discussion for a given topic.

Comments

@ascjones
Copy link
Collaborator

ascjones commented Jun 12, 2023

Raised by @DamianStraszak.

At the moment get_contract_storage uses scale::Decode::decode, which can succeed even if not all bytes are consumed. This would be an issue where corrupted or invalid bytes in a storage cell are successfully decoded, but the expectation is that this should fail.

We should investigate using decode_all instead which will fail if there are bytes remaining in the input after decoding successfully.

Note that this may technically be a "breaking" change if existing contracts are (ab)using this behaviour, so will require some communication if we go ahead with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ink_storage [ink_storage] Work Item C-discussion An issue for discussion for a given topic.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant