Skip to content

Commit

Permalink
Fixes ethereum-events tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thadouk authored and ivan-cholakov committed Mar 22, 2023
1 parent 9e1884b commit 7c1f365
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
20 changes: 10 additions & 10 deletions pallets/ethereum-transactions/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ parameter_types! {
}

impl Config for TestRuntime {
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type Call = RuntimeCall;
type AccountToBytesConvert = U64To32BytesConverter;
type ValidatorManagerContractAddress = TestValidatorManagerContractAddress;
type WeightInfo = ();
Expand All @@ -84,16 +84,16 @@ impl system::Config for TestRuntime {
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
Expand All @@ -106,13 +106,13 @@ impl system::Config for TestRuntime {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

pub type Extrinsic = TestXt<Call, ()>;
pub type Extrinsic = TestXt<RuntimeCall, ()>;

impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for TestRuntime
where
Call: From<LocalCall>,
RuntimeCall: From<LocalCall>,
{
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
type Extrinsic = Extrinsic;
}

Expand Down Expand Up @@ -150,7 +150,7 @@ impl session::Config for TestRuntime {
type Keys = UintAuthorityId;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type SessionHandler = (AVN,);
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = u64;
type ValidatorIdOf = ConvertInto;
type NextSessionRotation = session::PeriodicSessions<Period, Offset>;
Expand Down Expand Up @@ -212,7 +212,7 @@ impl EthereumTransactions {
// TODO [TYPE: test refactoring][PRI: medium]: move this to a centralized pallet of test
// utilities, when we do that refactoring, and apply it to all emitted system event
// assertions.
pub fn event_emitted(event: &Event) -> bool {
pub fn event_emitted(event: &RuntimeEvent) -> bool {
return System::events().iter().any(|a| a.event == *event)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod test_set_publish_root_contract {
use super::*;

struct Context {
origin: Origin,
origin: RuntimeOrigin,
new_contract_address: H160,
}

Expand Down Expand Up @@ -70,8 +70,10 @@ mod test_set_publish_root_contract {
fn origin_is_not_root() {
let mut ext = ExtBuilder::build_default().with_genesis_config().as_externality();
ext.execute_with(|| {
let context: Context =
Context { origin: Origin::signed(Default::default()), ..Default::default() };
let context: Context = Context {
origin: RuntimeOrigin::signed(Default::default()),
..Default::default()
};

assert_noop!(context.dispatch_set_publish_root_contract(), BadOrigin);
assert_ne!(
Expand Down
10 changes: 5 additions & 5 deletions pallets/ethereum-transactions/src/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ mod submit_candidate_for_tier1 {
assert_eq!(EthereumTransactions::event_count(), 0);

assert_ok!(call_submit_candidate_for_tier1(expected_candidate, context.from));
let event = mock::Event::EthereumTransactions(
let event = mock::RuntimeEvent::EthereumTransactions(
crate::Event::<TestRuntime>::TransactionReadyToSend {
transaction_id: context.tx_id,
sender: context.from,
Expand Down Expand Up @@ -509,7 +509,7 @@ mod set_eth_tx_hash_for_dispatched_tx {
}

fn call_set_eth_tx_hash_for_dispatched_tx(
origin: Origin,
origin: RuntimeOrigin,
tx_id: TransactionId,
submitter: AccountId,
eth_tx_hash: EthereumTransactionHash,
Expand Down Expand Up @@ -569,7 +569,7 @@ mod set_eth_tx_hash_for_dispatched_tx {
context.hash
));

let event = mock::Event::EthereumTransactions(
let event = mock::RuntimeEvent::EthereumTransactions(
crate::Event::<TestRuntime>::EthereumTransactionHashAdded {
transaction_id: context.tx_id,
transaction_hash: context.hash,
Expand Down Expand Up @@ -600,7 +600,7 @@ mod set_eth_tx_hash_for_dispatched_tx {
// untouched
assert_noop!(
call_set_eth_tx_hash_for_dispatched_tx(
Origin::signed(Default::default()),
RuntimeOrigin::signed(Default::default()),
context.tx_id,
context.submitter,
context.hash,
Expand Down Expand Up @@ -1264,7 +1264,7 @@ mod unreserve_transaction_tests {
);
assert_noop!(
EthereumTransactions::unreserve_transaction(
Origin::signed(Default::default()),
RuntimeOrigin::signed(Default::default()),
context.transaction_type.clone()
),
BadOrigin
Expand Down

0 comments on commit 7c1f365

Please sign in to comment.