-
Notifications
You must be signed in to change notification settings - Fork 103
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
fix(x/ecocredit): Fix GetSignBytes with correct codec #1480
Conversation
) | ||
|
||
func init() { | ||
RegisterLegacyAminoCodec(legacy.Cdc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to register the global legacy.Cdc, though it also doesn't hurt
Codecov Report
@@ Coverage Diff @@
## main #1480 +/- ##
==========================================
- Coverage 78.38% 78.38% -0.01%
==========================================
Files 248 248
Lines 18690 18687 -3
==========================================
- Hits 14651 14648 -3
Misses 3173 3173
Partials 866 866
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, opened #1481 to follow up on the rest of the messages
@clevinson i'm just going to push the rest of the message fixes to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for finding this @AmauryM!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -76,7 +76,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
- [#1337](https://github.com/regen-network/regen-ledger/pull/1337) Add `AddCreditType` msg-based gov proposal | |||
- [#1346](https://github.com/regen-network/regen-ledger/pull/1346) Add `RemoveAllowedDenom` msg-based gov proposal | |||
- [#1349](https://github.com/regen-network/regen-ledger/pull/1349) Add `UpdateBasketFees` msg-based gov proposal | |||
- [#1465](https://github.com/regen-network/regen-ledger/pull/1465) Renamed to `UpdateBasketFee` | |||
- [#1465](https://github.com/regen-network/regen-ledger/pull/1465) Renamed to `UpdateBasketFee` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@technicallyty do you have an auto-format setting enabled? The spaces here and below were intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, i thought those were formatting errors 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. We can revise in another pull request.
Thanks @AmauryM and @technicallyty 🙏 |
Description
While debugging regen-js, I noticed a bug in regen-ledger amino signing. Basically, in GetSignBytes, we're always using
ecocredit.ModuleCdc.MustMarshalJSON
. Unfortunately, this ModuleCdc doesn't get registered with any msgs, see here.This results in a level of nesting that's being cut-off when serializing into JSON:
This bug also happened in the past in the SDK, read https://medium.com/confio/authz-and-ledger-signing-an-executive-summary-8754a0dc2a88 for more info.
The proposed fix is to make sure that the
ModuleCdc
that is used in GetSignBytes went through the modele'sRegisterLegacyAminoCodec
.This is a consensus-breaking change. The same change needs to be done to all Msgs (I only did a poc on MsgSend). It's not a security issue, but more an annoyance, as without this change, the CosmJS+Amino+RegenLedger integration unfortunately won't work, see regen-network/regen-js#41 (comment).
Closes: #1481
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change