Skip to content

Commit cbf8691

Browse files
authored
panic if event is not found in the expected blocks (#1880)
1 parent 1cc426c commit cbf8691

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

runtime/integration-tests/src/generic/cases/routers.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,8 @@ fn environment_for_evm<T: Runtime + FudgeSupport>() -> FudgeEnv<T> {
7676
env.parachain_state_mut(|| {
7777
pallet_evm::AccountCodes::<T>::insert(AXELAR_CONTRACT_ADDRESS, AXELAR_CONTRACT_CODE);
7878

79-
utils::evm::mint_balance_into_derived_account::<T>(
80-
AXELAR_CONTRACT_ADDRESS,
81-
cfg(1_000_000_000),
82-
);
83-
utils::evm::mint_balance_into_derived_account::<T>(
84-
get_gateway_h160_account::<T>(),
85-
cfg(1_000_000),
86-
);
79+
utils::evm::mint_balance_into_derived_account::<T>(AXELAR_CONTRACT_ADDRESS, cfg(1));
80+
utils::evm::mint_balance_into_derived_account::<T>(get_gateway_h160_account::<T>(), cfg(1));
8781
});
8882

8983
env
@@ -140,12 +134,9 @@ fn check_submission<T: Runtime>(mut env: impl Env<T>, domain_router: DomainRoute
140134
});
141135

142136
env.pass(Blocks::UntilEvent {
143-
event: expected_event.clone().into(),
137+
event: expected_event.into(),
144138
limit: 3,
145139
});
146-
147-
env.check_event(expected_event)
148-
.expect("expected OutboundMessageExecutionSuccess event");
149140
}
150141

151142
#[test_runtimes(all)]

runtime/integration-tests/src/generic/env.rs

+8
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,23 @@ pub trait Env<T: Runtime>: Default {
111111
)
112112
});
113113

114+
let mut found_event = false;
114115
for i in blocks.range_for(current, slot) {
115116
self.__priv_build_block(i);
116117

117118
if let Blocks::UntilEvent { event, .. } = blocks.clone() {
118119
if self.check_event(event).is_some() {
120+
found_event = true;
119121
break;
120122
}
121123
}
122124
}
125+
126+
if let Blocks::UntilEvent { event, limit } = blocks.clone() {
127+
if !found_event {
128+
panic!("Event {event:?} was not found producing {limit} blocks");
129+
}
130+
}
123131
}
124132

125133
/// Allows to mutate the relay storage state through the closure.

0 commit comments

Comments
 (0)