Skip to content

Commit

Permalink
Merge pull request #1002 from CosmWasm/942_fix_genmsg
Browse files Browse the repository at this point in the history
Fix genesis message tooling
  • Loading branch information
alpe authored Sep 19, 2022
2 parents b99168f + 0b400d6 commit 9ec8091
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion x/wasm/client/cli/genesis_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"errors"
"fmt"

"github.com/CosmWasm/wasmd/x/wasm/ioutils"

"github.com/CosmWasm/wasmd/x/wasm/keeper"

"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -283,7 +285,15 @@ func GetAllCodes(state *types.GenesisState) []CodeMeta {
creator := sdk.MustAccAddressFromBech32(msg.Sender)
accessConfig = state.Params.InstantiateDefaultPermission.With(creator)
}
hash := sha256.Sum256(msg.WASMByteCode)
bz := msg.WASMByteCode
if ioutils.IsGzip(msg.WASMByteCode) {
var err error
bz, err = ioutils.Uncompress(msg.WASMByteCode, uint64(types.MaxWasmSize))
if err != nil {
panic(fmt.Sprintf("failed to unzip wasm binary: %s", err))
}
}
hash := sha256.Sum256(bz)
all = append(all, CodeMeta{
CodeID: seq,
Info: types.CodeInfo{
Expand Down

0 comments on commit 9ec8091

Please sign in to comment.