Skip to content

Commit 26429ec

Browse files
committed
wrap param errors
1 parent a0af92f commit 26429ec

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

x/btcbridge/types/params.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func validateVaults(vaults []*Vault) error {
217217
}
218218

219219
if vaultMap[v.Address] {
220-
return ErrInvalidParams
220+
return errorsmod.Wrapf(ErrInvalidParams, "duplicate vault")
221221
}
222222

223223
vaultMap[v.Address] = true
@@ -235,7 +235,7 @@ func validateVaults(vaults []*Vault) error {
235235
}
236236

237237
if v.AssetType == AssetType_ASSET_TYPE_UNSPECIFIED {
238-
return ErrInvalidParams
238+
return errorsmod.Wrapf(ErrInvalidParams, "invalid asset type")
239239
}
240240
}
241241

@@ -244,7 +244,7 @@ func validateVaults(vaults []*Vault) error {
244244

245245
func validateWithdrawParams(withdrawParams *WithdrawParams) error {
246246
if withdrawParams.MaxUtxoNum == 0 || withdrawParams.BtcBatchWithdrawPeriod == 0 || withdrawParams.MaxBtcBatchWithdrawNum == 0 {
247-
return ErrInvalidParams
247+
return errorsmod.Wrapf(ErrInvalidParams, "invalid withdrawal params")
248248
}
249249

250250
return nil
@@ -253,17 +253,17 @@ func validateWithdrawParams(withdrawParams *WithdrawParams) error {
253253
// validateProtocolParams validates the given protocol limits and fees
254254
func validateProtocolParams(protocolLimits *ProtocolLimits, protocolFees *ProtocolFees) error {
255255
if protocolLimits.BtcMinWithdraw > protocolLimits.BtcMaxWithdraw {
256-
return ErrInvalidParams
256+
return errorsmod.Wrapf(ErrInvalidParams, "minimum btc withdrawal amount must not be greater than maximum withdrawal amount")
257257
}
258258

259259
if (protocolFees.DepositFee != 0 || protocolFees.WithdrawFee != 0) && len(protocolFees.Collector) == 0 {
260-
return ErrInvalidParams
260+
return errorsmod.Wrapf(ErrInvalidParams, "invalid protocol fee params")
261261
}
262262

263263
if len(protocolFees.Collector) != 0 {
264264
_, err := sdk.AccAddressFromBech32(protocolFees.Collector)
265265
if err != nil {
266-
return ErrInvalidParams
266+
return errorsmod.Wrapf(ErrInvalidParams, "invalid protocol fee collector")
267267
}
268268
}
269269

@@ -273,11 +273,11 @@ func validateProtocolParams(protocolLimits *ProtocolLimits, protocolFees *Protoc
273273
// validateTSSParams validates the given TSS params
274274
func validateTSSParams(params *TSSParams) error {
275275
if params.DkgTimeoutPeriod == 0 {
276-
return ErrInvalidParams
276+
return errorsmod.Wrapf(ErrInvalidParams, "invalid dkg timeout period")
277277
}
278278

279279
if params.ParticipantUpdateTransitionPeriod == 0 {
280-
return ErrInvalidParams
280+
return errorsmod.Wrapf(ErrInvalidParams, "invalid participant update transition period")
281281
}
282282

283283
return nil

0 commit comments

Comments
 (0)