PR Comment: move where truncating address length to 20
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user