-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit header in MsgUpdateClient events (#8624)
* emit header in update client msg * update CHANGELOG * update spec * fix nil header bug * use JSON encoding for emitting header * Update x/ibc/core/spec/06_events.md * use proto for encoding * add tests * encode to hex before emitting header in event * add comment addressing reasoning for hex encoding * Update CHANGELOG.md Co-authored-by: Federico Kunze <[email protected]> Co-authored-by: Alessio Treglia <[email protected]> Co-authored-by: Federico Kunze <[email protected]>
- Loading branch information
1 parent
a556783
commit a9b034b
Showing
7 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package types_test | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types" | ||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types" | ||
) | ||
|
||
func (suite *TypesTestSuite) TestMarshalHeader() { | ||
|
||
cdc := suite.chainA.App.AppCodec() | ||
h := &ibctmtypes.Header{ | ||
TrustedHeight: types.NewHeight(4, 100), | ||
} | ||
|
||
// marshal header | ||
bz, err := types.MarshalHeader(cdc, h) | ||
suite.Require().NoError(err) | ||
|
||
// unmarshal header | ||
newHeader, err := types.UnmarshalHeader(cdc, bz) | ||
suite.Require().NoError(err) | ||
|
||
suite.Require().Equal(h, newHeader) | ||
|
||
// use invalid bytes | ||
invalidHeader, err := types.UnmarshalHeader(cdc, []byte("invalid bytes")) | ||
suite.Require().Error(err) | ||
suite.Require().Nil(invalidHeader) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters