-
Notifications
You must be signed in to change notification settings - Fork 443
fix(params): SetBytes should not alter the value bytes #4905
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
Conversation
SetBytes is used by the IBC contract to store the commitment bytes. Then the relayer submit the proof of existence of those bytes to the counter party chain, but if the value bytes are different, the proof cannot be verified. This PR updates SetBytes to use directly the store instead of passing by the common `set` method, preventing the value to be aminoJSON encoded. Removed GetRaw/SetRaw since GetBytes/SetBytes can be used as a replacement.
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hi @tbruyelle . Are you able to fix the failed CI checks? |
Thank you for pointing that out; I hadn't spotted it. I'll take a look. |
|
@jefft0 Tests are fixed, ty |
Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
|
I opened this PR (#4926) as an alternative that achieves the goal of the original while maintaining the previous API and ensuring consistency with other calls in this library. |
Since |
|
GetRaw was an exception. GetString is more similar to other type-based getters. My PR (#4926) implements the necessary changes while maintaining consistency. If you dislike the current API with the needed declaration, we could consider changing it for all types, not just for String as you did here. |
You mean |
|
The key point is that
SetString("foo", "bar")
GetRaw("foo.string")
This PR's approach may simplify a codebase that only ever uses a single type, but it breaks consistency for users who rely on multiple types and expect a uniform API. |
|
Merged #4905 so we can move forward, thank you. |
@moul Where does this take place? I've never seen anything like it before. It is potentially problematic because if the key is modified like this, it could compromise the proof verification process. |
…4926) Alternative for #4905 Kept: - Removed GetRaw/SetRaw since they were unused. - SetBytes to use directly the store, preventing the value to be aminoJSON encoded. Updated: - Preserve API consistency. --------- Signed-off-by: moul <94029+moul@users.noreply.github.com> Co-authored-by: Thomas Bruyelle <thomas.bruyelle@tendermint.com>


SetBytes is used by the IBC contract to store the commitment bytes. Then the relayer submit the proof of existence of those bytes to the counter party chain, but if the value bytes are different, the proof cannot be verified.
This PR updates
SetBytesto use directly the store instead of passing by the commonsetmethod, preventing the value to be aminoJSON encoded.Removed
GetRaw/SetRawsinceGetBytes/SetBytescan be used as a replacement.Note: I can't use
SetRawfrom gno code.EDIT: added an other feature which is the deletion of value when
SetBytesis invoked with a nil value. This is also required to remove the traces of packet commitments in IBC.