Skip to content

Commit

Permalink
Merge pull request #1816 from CosmWasm/fix-address-exists-error-message
Browse files Browse the repository at this point in the history
Fix misleading error message for duplicate address on instantiate2
  • Loading branch information
webmaster128 committed Feb 29, 2024
2 parents 9e44af1 + 8e184df commit 96e2b91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ func (k Keeper) instantiate(
}
contractAddress := addressGenerator(ctx, codeID, codeInfo.CodeHash)
if k.HasContractInfo(ctx, contractAddress) {
return nil, nil, types.ErrDuplicate.Wrap("instance with this code id, sender and label exists: try a different label")
// This case must only happen for instantiate2 because instantiate is based on a counter in state.
// So we create an instantiate2 specific error message here even though technically this function
// is used for both cases.
return nil, nil, types.ErrDuplicate.Wrap("contract address already exists, try a different combination of creator, checksum and salt")
}

// check account
Expand Down

0 comments on commit 96e2b91

Please sign in to comment.