diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 68e58b27cb..4666cc9f2e 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -819,7 +819,9 @@ func BuildContractAddress(codeID, instanceID uint64) sdk.AccAddress { contractID := make([]byte, 16) binary.BigEndian.PutUint64(contractID[:8], codeID) binary.BigEndian.PutUint64(contractID[8:], instanceID) - return Module(types.ModuleName, contractID) + // 20 bytes to work with Cosmos SDK 0.42 (0.43 pushes for 32 bytes) + // TODO: remove truncate if we update to 0.43 before wasmd 1.0 + return Module(types.ModuleName, contractID)[:20] } // Hash and Module is taken from https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-rc2/types/address/hash.go @@ -838,10 +840,7 @@ func Hash(typ string, key []byte) []byte { assertNil(err) _, err = hasher.Write(key) assertNil(err) - hashed := hasher.Sum(nil) - // 20 bytes to work with Cosmos SDK 0.42 (0.43 pushes for 32 bytes) - // TODO: remove truncate if we update to 0.43 before wasmd 1.0 - return hashed[:20] + return hasher.Sum(nil) } // Module is a specialized version of a composed address for modules. Each module account