Skip to content

Commit 4a0d34d

Browse files
committed
Add in source to event
1 parent b1c8a41 commit 4a0d34d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/sequencer/src/protocol/production/sequencing/TransactionExecutionService.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ async function decodeTransaction(
111111
}
112112

113113
function extractEvents(
114-
runtimeResult: RuntimeContextReducedExecutionResult
114+
runtimeResult: RuntimeContextReducedExecutionResult,
115+
source: string
115116
): { eventName: string; data: Field[] }[] {
116117
return runtimeResult.events.reduce(
117118
(acc, event) => {
@@ -120,13 +121,14 @@ function extractEvents(
120121
eventName: event.eventName,
121122
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
122123
data: event.eventType.toFields(event.event),
124+
source: source,
123125
};
124126
acc.push(obj);
125127
}
126128
return acc;
127129
},
128130
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
129-
[] as { eventName: string; data: Field[] }[]
131+
[] as { eventName: string; data: Field[]; source: string }[]
130132
);
131133
}
132134

@@ -314,7 +316,7 @@ export class TransactionExecutionService {
314316
async (hook, hookArgs) => await hook.beforeTransaction(hookArgs),
315317
"beforeTx"
316318
);
317-
const beforeHookEvents = extractEvents(beforeTxHookResult);
319+
const beforeHookEvents = extractEvents(beforeTxHookResult, "beforeTxHook");
318320

319321
await recordingStateService.applyStateTransitions(
320322
beforeTxHookResult.stateTransitions
@@ -364,7 +366,7 @@ export class TransactionExecutionService {
364366
async (hook, hookArgs) => await hook.afterTransaction(hookArgs),
365367
"afterTx"
366368
);
367-
const afterHookEvents = extractEvents(afterTxHookResult);
369+
const afterHookEvents = extractEvents(afterTxHookResult, "afterTxHook");
368370
await recordingStateService.applyStateTransitions(
369371
afterTxHookResult.stateTransitions
370372
);
@@ -378,7 +380,7 @@ export class TransactionExecutionService {
378380
appChain.setProofsEnabled(previousProofsEnabled);
379381

380382
// Extract sequencing results
381-
const runtimeResultEvents = extractEvents(runtimeResult);
383+
const runtimeResultEvents = extractEvents(runtimeResult, "runtime");
382384
const stateTransitions = this.buildSTBatches(
383385
[
384386
beforeTxHookResult.stateTransitions,

0 commit comments

Comments
 (0)