@@ -25,6 +25,7 @@ struct Ctx<'a> {
2525 events_id : Address ,
2626 profile : ProfileContractClient < ' a > ,
2727 owner : Address ,
28+ fee_account : Address ,
2829 applicant : Address ,
2930 token_addr : Address ,
3031}
@@ -69,6 +70,7 @@ fn setup<'a>() -> Ctx<'a> {
6970 events_id,
7071 profile,
7172 owner,
73+ fee_account,
7274 applicant,
7375 token_addr,
7476 }
@@ -217,7 +219,10 @@ fn event_id_overflow_reverts() {
217219 let ctx = setup ( ) ;
218220 let env = & ctx. env ;
219221
220- // Set the stored next_event_id to u64::MAX so the increment overflows.
222+ let token = token:: Client :: new ( env, & ctx. token_addr ) ;
223+ let owner_balance_before = token. balance ( & ctx. owner ) ;
224+ let fee_balance_before = token. balance ( & ctx. fee_account ) ;
225+
221226 env. as_contract ( & ctx. events_id , || {
222227 storage:: set_next_event_id ( env, u64:: MAX ) ;
223228 } ) ;
@@ -243,6 +248,25 @@ fn event_id_overflow_reverts() {
243248 . expect ( "event creation should fail when next_event_id overflows" )
244249 . unwrap ( ) ;
245250 assert_eq ! ( err, crate :: errors:: Error :: EventIdOverflow ) ;
251+
252+ // Verify transaction rollback: no funds moved, no event persisted.
253+ assert_eq ! (
254+ token. balance( & ctx. owner) ,
255+ owner_balance_before,
256+ "owner balance unchanged after failed create_event"
257+ ) ;
258+ assert_eq ! (
259+ token. balance( & ctx. fee_account) ,
260+ fee_balance_before,
261+ "fee account balance unchanged after failed create_event"
262+ ) ;
263+ env. as_contract ( & ctx. events_id , || {
264+ let next_id = storage:: get_next_event_id ( env, 0 ) ;
265+ assert_eq ! (
266+ next_id, u64 :: MAX ,
267+ "next_event_id unchanged after failed create_event"
268+ ) ;
269+ } ) ;
246270}
247271
248272/// Events-side OpSeen is namespaced by the authorizing caller: a permissionless
0 commit comments