Fixes validation for SkipCheckIfFeeless extension (#3993)

During validation, `SkipCheckIfFeeless` should check if the call is
`feeless` and delegate to the wrapped extension if not.
This commit is contained in:
gupnik
2024-04-09 14:05:46 +05:30
committed by GitHub
parent d733c77ee2
commit 0e27b881a4
3 changed files with 48 additions and 2 deletions
@@ -14,7 +14,9 @@
// limitations under the License.
use super::*;
use crate::mock::{pallet_dummy::Call, DummyExtension, PreDispatchCount, Runtime, RuntimeCall};
use crate::mock::{
pallet_dummy::Call, DummyExtension, PreDispatchCount, Runtime, RuntimeCall, ValidateCount,
};
use frame_support::dispatch::DispatchInfo;
#[test]
@@ -31,3 +33,20 @@ fn skip_feeless_payment_works() {
.unwrap();
assert_eq!(PreDispatchCount::get(), 1);
}
#[test]
fn validate_works() {
assert_eq!(ValidateCount::get(), 0);
let call = RuntimeCall::DummyPallet(Call::<Runtime>::aux { data: 1 });
SkipCheckIfFeeless::<Runtime, DummyExtension>::from(DummyExtension)
.validate(&0, &call, &DispatchInfo::default(), 0)
.unwrap();
assert_eq!(ValidateCount::get(), 1);
let call = RuntimeCall::DummyPallet(Call::<Runtime>::aux { data: 0 });
SkipCheckIfFeeless::<Runtime, DummyExtension>::from(DummyExtension)
.validate(&0, &call, &DispatchInfo::default(), 0)
.unwrap();
assert_eq!(ValidateCount::get(), 1);
}