Closed 0x3bfc closed 1 year ago
@0x3bfc for writing tests for this I'd suggest to create helper function like this:
fn validate_amount(amount: U256) -> Result<(), ExitError> {
if amount > U256::from(u128::MAX) {
return Err(ExitError::Other(Cow::from("ERR_INVALID_AMOUNT")));
}
Ok(())
}
And then you'll be able to cover the function with tests.
Before I merge it, you need to sign all the commits with your @aurora.dev e-mail. Really important.
Description
The
exitToNear
andexitToEthereum
precompiles may panic if the input amount is greater than2^128
when cast from aU256
tou128
.