Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: print out gas at start and end of each enqueued call #9377

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading