Skip to content

Commit

Permalink
chore: log number of instructions executed for call in AVM. Misc fix. (
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanks12 authored Jan 9, 2025
1 parent 4263b76 commit 44e01f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions yarn-project/simulator/src/avm/avm_simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export class AvmSimulator {
const revertReason = reverted ? await revertReasonFromExplicitRevert(output, this.context) : undefined;
const results = new AvmContractCallResult(reverted, output, machineState.gasLeft, revertReason);
this.log.debug(`Context execution results: ${results.toString()}`);
this.log.debug(`Executed ${instrCounter} instructions`);

this.tallyPrintFunction();
// Return results for processing by calling context
Expand Down
5 changes: 3 additions & 2 deletions yarn-project/simulator/src/avm/journal/journal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ export class AvmPersistableStateManager {
this.publicStorage.acceptAndMerge(forkedState.publicStorage);
this.nullifiers.acceptAndMerge(forkedState.nullifiers);
this.trace.merge(forkedState.trace, reverted);
if (!reverted) {
this.merkleTrees = forkedState.merkleTrees;
if (reverted) {
if (this.doMerkleOperations) {
this.log.debug(
`Rolled back nullifier tree to root ${this.merkleTrees.treeMap.get(MerkleTreeId.NULLIFIER_TREE)!.getRoot()}`,
);
}
} else {
this.merkleTrees = forkedState.merkleTrees;
}
}

Expand Down

0 comments on commit 44e01f4

Please sign in to comment.