Skip to content

Commit 327d14a

Browse files
committed
Check for overflow
1 parent a243529 commit 327d14a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

contracts/staking/src/contract.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use cosmwasm_std::{
22
entry_point, to_json_binary, BankMsg, Coin, Decimal, Decimal256, Deps, DepsMut,
33
DistributionMsg, Env, MessageInfo, QuerierWrapper, QueryResponse, Response, StakingMsg,
4-
StdError, StdResult, Uint128, Uint256, WasmMsg,
4+
StdError, StdResult, Uint128, Uint256, WasmMsg, StdErrorKind
55
};
66

77
use crate::errors::{StakingError, Unauthorized};
@@ -340,9 +340,8 @@ pub fn _bond_all_tokens(
340340
match updated {
341341
Ok(_) => {}
342342
// if it is below the minimum, we do a no-op (do not revert other state from withdrawal)
343-
Err(..) => return Ok(Response::default()),
344-
// TODO: actually add an enum case later to fix this logic
345-
//Err(e) => return Err(e.into()),
343+
Err(e) if e.kind() == StdErrorKind::Overflow => return Ok(Response::default()),
344+
Err(e) => return Err(e.into()),
346345
}
347346

348347
// and bond them to the validator

0 commit comments

Comments
 (0)