Skip to content

Commit

Permalink
Fix misleading error message for duplicate address on instantiate2
Browse files Browse the repository at this point in the history
Chaning the label does not help avoiding the collision. Only creator,
checksum and salt is typically used.
  • Loading branch information
webmaster128 committed Feb 29, 2024
1 parent 9e44af1 commit 8e184df
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 8e184df

Please sign in to comment.