Skip to content

Commit

Permalink
chore: print out gas at start and end of each enqueued call (#9377)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanks12 authored Oct 24, 2024
1 parent eb7bc6b commit 29c0b95
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion yarn-project/simulator/src/public/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export class PublicExecutor {
const selector = executionRequest.callContext.functionSelector;
const fnName = await getPublicFunctionDebugName(this.worldStateDB, address, selector, executionRequest.args);

PublicExecutor.log.verbose(`[AVM] Executing public external function ${fnName}@${address}.`);
PublicExecutor.log.verbose(
`[AVM] Executing public external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`,
);
const timer = new Timer();

const innerCallTrace = new PublicSideEffectTrace(startSideEffectCounter);
Expand Down Expand Up @@ -132,6 +134,12 @@ export class PublicExecutor {
avmResult,
);

PublicExecutor.log.verbose(
`[AVM] ${fnName} simulation complete. Reverted=${avmResult.reverted}. Consumed ${
allocatedGas.l2Gas - avmContext.machineState.gasLeft.l2Gas
} L2 gas, ending with ${avmContext.machineState.gasLeft.l2Gas} L2 gas left.`,
);

return publicExecutionResult;
}
}
Expand Down

0 comments on commit 29c0b95

Please sign in to comment.