Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Oct 20, 2024
1 parent 13fed3d commit 83c0a38
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions substrate/frame/revive/src/evm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,15 @@ mod test {
use crate::{
evm::*,
test_utils::*,
tests::{ExtBuilder, RuntimeCall, Test},
tests::{ExtBuilder, RuntimeCall, RuntimeOrigin, Test},
};
use frame_support::{error::LookupError, traits::fungible::Mutate};
use pallet_revive_fixtures::compile_module;
use rlp::Encodable;
use sp_runtime::{traits::Checkable, MultiAddress, MultiSignature};
use sp_runtime::{
traits::{Checkable, DispatchTransaction},
MultiAddress, MultiSignature,
};
type AccountIdOf<T> = <T as frame_system::Config>::AccountId;

/// A simple account that can sign transactions
Expand Down Expand Up @@ -436,8 +439,7 @@ mod test {
}
}

type Ex =
UncheckedExtrinsic<MultiAddress<AccountId32, u32>, RuntimeCall, MultiSignature, Extra>;
type Ex = UncheckedExtrinsic<MultiAddress<AccountId32, u32>, MultiSignature, Extra>;
struct TestContext;

impl traits::Lookup for TestContext {
Expand Down Expand Up @@ -514,11 +516,15 @@ mod test {
});

let encoded_len = call.encoded_size();
let result = Ex::new(call, None).unwrap().check(&TestContext {})?;
let (account_id, extra) = result.signed.unwrap();
let uxt: Ex = generic::UncheckedExtrinsic::new_bare(call).into();
let result: CheckedExtrinsic<_, _, _> = uxt.check(&TestContext {})?;
let (account_id, extra): (AccountId32, SignedExtra) = match result.format {
ExtrinsicFormat::Signed(signer, extra) => (signer, extra),
_ => unreachable!(),
};

extra.clone().pre_dispatch(
&account_id,
extra.clone().validate_and_prepare(
RuntimeOrigin::signed(account_id),
&result.function,
&result.function.get_dispatch_info(),
encoded_len,
Expand Down

0 comments on commit 83c0a38

Please sign in to comment.