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

renaming to align with x/wasm naming #4091

Merged
merged 6 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/light-clients/08-wasm/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newStoreCodeCmd() *cobra.Command {

msg := &types.MsgStoreCode{
Signer: clientCtx.GetFromAddress().String(),
WASMByteCode: code,
WasmByteCode: code,
}

if err := msg.ValidateBasic(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion modules/light-clients/08-wasm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (k Keeper) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*type
}

ctx := sdk.UnwrapSDKContext(goCtx)
codeHash, err := k.storeWasmCode(ctx, msg.WASMByteCode)
codeHash, err := k.storeWasmCode(ctx, msg.WasmByteCode)
if err != nil {
return nil, errorsmod.Wrap(err, "failed to store wasm bytecode")
}
Expand Down
2 changes: 1 addition & 1 deletion modules/light-clients/08-wasm/types/client_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (cs ClientState) Validate() error {
if lenCodeHash == 0 {
return errorsmod.Wrap(ErrInvalidCodeHash, "code hash cannot be empty")
}
if lenCodeHash > 32 { // sha256 output is 256 bits long
if lenCodeHash != 32 { // sha256 output is 256 bits long
Copy link
Contributor

Choose a reason for hiding this comment

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

only nit pertains to err message used here, doesn't really give indication that 32 refers to # of bytes.

return errorsmod.Wrapf(ErrInvalidCodeHash, "expected 32, got %d", lenCodeHash)
}

Expand Down
4 changes: 2 additions & 2 deletions modules/light-clients/08-wasm/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ var _ sdk.Msg = (*MsgStoreCode)(nil)
func NewMsgStoreCode(signer string, code []byte) *MsgStoreCode {
return &MsgStoreCode{
Signer: signer,
WASMByteCode: code,
WasmByteCode: code,
}
}

// ValidateBasic implements sdk.Msg
func (m MsgStoreCode) ValidateBasic() error {
if len(m.WASMByteCode) == 0 {
if len(m.WasmByteCode) == 0 {
return ErrWasmEmptyCode
}

Expand Down
72 changes: 35 additions & 37 deletions modules/light-clients/08-wasm/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions proto/ibc/lightclients/wasm/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package ibc.lightclients.wasm.v1;
option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types";

import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";

// Msg defines the ibc/08-wasm Msg service.
service Msg {
Expand All @@ -19,12 +18,12 @@ message MsgStoreCode {
option (cosmos.msg.v1.signer) = "signer";

string signer = 1;
// WASMByteCode can be raw or gzip compressed
bytes wasm_byte_code = 2 [(gogoproto.customname) = "WASMByteCode"];
// wasm byte code of light client contract. It can be raw or gzip compressed
bytes wasm_byte_code = 2;
Copy link
Member

Choose a reason for hiding this comment

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

didn't you want to keep the gogoproto custom name?

https://github.com/CosmWasm/wasmd/blob/main/proto/cosmwasm/wasm/v1/tx.proto#L83

Copy link
Contributor Author

@crodriguezvega crodriguezvega Jul 20, 2023

Choose a reason for hiding this comment

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

Oh, I thought you preferred to have the field name as WasmByteCode. I will merge the PR now, but let me know if you'd like me to change this, and I will do in a follow up.

}

// MsgStoreCodeResponse defines the response type for the StoreCode rpc
message MsgStoreCodeResponse {
// Checksum is the sha256 hash of the stored code
// the sha256 hash of the stored code
bytes checksum = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See here.

Copy link
Member

Choose a reason for hiding this comment

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

ditto on protodoc lowercase nit

}
Loading