Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/float/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum FloatError {
#[error(transparent)]
AlloySolTypes(#[from] alloy::sol_types::Error),
#[error("Decimal Float error: {0:?}")]
DecimalFloat(DecimalFloat::DecimalFloatErrors),
DecimalFloat(Box<DecimalFloat::DecimalFloatErrors>),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
#[error("Decimal Float error selector: {0:?}")]
DecimalFloatSelector(Result<DecimalFloatErrorSelector, FixedBytes<4>>),
#[error(transparent)]
Expand Down
2 changes: 1 addition & 1 deletion crates/float/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
}
ExecutionResult::Revert { output, .. } => {
if let Ok(error) = DecimalFloat::DecimalFloatErrors::abi_decode(output.as_ref()) {
return Err(FloatError::DecimalFloat(error));
return Err(FloatError::DecimalFloat(Box::new(error)));
}

Err(FloatError::Revert(output))
Expand Down
16 changes: 8 additions & 8 deletions crates/float/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ mod tests {
let err = Float::parse("1e3000000000".to_string()).unwrap_err();
assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::ExponentOverflow(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::ExponentOverflow(_))
));
}

Expand Down Expand Up @@ -1477,7 +1477,7 @@ mod tests {

assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::ExponentOverflow(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::ExponentOverflow(_))
));
}

Expand All @@ -1495,7 +1495,7 @@ mod tests {

assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::ExponentOverflow(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::ExponentOverflow(_))
));
}

Expand Down Expand Up @@ -1750,7 +1750,7 @@ mod tests {

assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::DivisionByZero(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::DivisionByZero(_))
));
}

Expand All @@ -1763,7 +1763,7 @@ mod tests {
let err = (near_max_exp * one_e_two).unwrap_err();
assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::ExponentOverflow(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::ExponentOverflow(_))
));
}

Expand All @@ -1776,7 +1776,7 @@ mod tests {
let err = (near_max_exp / one_e_neg_hundred).unwrap_err();
assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::ExponentOverflow(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::ExponentOverflow(_))
));
}

Expand All @@ -1791,7 +1791,7 @@ mod tests {
let err = (near_min_exp * one_e_neg_three).unwrap_err();
assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::ExponentUnderflow(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::ExponentUnderflow(_))
));
}

Expand Down Expand Up @@ -1820,7 +1820,7 @@ mod tests {
let err = Float::from_fixed_decimal(U256::MAX, 1).unwrap_err();
assert!(matches!(
err,
FloatError::DecimalFloat(DecimalFloatErrors::LossyConversionToFloat(_))
FloatError::DecimalFloat(e) if matches!(*e, DecimalFloatErrors::LossyConversionToFloat(_))
));
}

Expand Down
Loading