Add arithmetic dispatch errors. (#8726)

* Add arithmetic dispatch errors.

* Replace custom overflow errors.

* Replace custom underflow and division by zero errors.

* Replace overflow/underflow in token error.

* Add token and arithmetic errors in dispatch error equality test.

* Trigger CI.
This commit is contained in:
Shaun Wang
2021-05-10 20:14:02 +12:00
committed by GitHub
parent 655ebc95fb
commit 2a38b23062
12 changed files with 88 additions and 60 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ macro_rules! decl_tests {
($test:ty, $ext_builder:ty, $existential_deposit:expr) => {
use crate::*;
use sp_runtime::{FixedPointNumber, traits::{SignedExtension, BadOrigin}};
use sp_runtime::{ArithmeticError, FixedPointNumber, traits::{SignedExtension, BadOrigin}};
use frame_support::{
assert_noop, assert_storage_noop, assert_ok, assert_err, StorageValue,
traits::{
@@ -523,7 +523,7 @@ macro_rules! decl_tests {
assert_err!(
Balances::transfer(Some(1).into(), 2, u64::max_value()),
Error::<$test, _>::Overflow,
ArithmeticError::Overflow,
);
assert_eq!(Balances::free_balance(1), u64::max_value());