Skip to content

Commit

Permalink
confusion: removing the debuglogger make jest works
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Sep 5, 2023
1 parent 0a4b2fd commit 92c0b18
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
10 changes: 3 additions & 7 deletions yarn-project/acir-simulator/src/client/private_execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,7 @@ describe('Private Execution test suite', () => {
const result = await runSimulator({ args, abi: parentAbi });

expect(result.callStackItem.publicInputs.returnValues[0]).toEqual(new Fr(privateIncrement));
expect(oracle.getFunctionABI.mock.calls[0].map(a => a.toBuffer())).toEqual(
[childAddress, childSelector].map(a => a.toBuffer()),
);
expect(oracle.getFunctionABI.mock.calls[0]).toEqual([childAddress, childSelector]);
expect(oracle.getPortalContractAddress.mock.calls[0]).toEqual([childAddress]);
expect(result.nestedExecutions).toHaveLength(1);
expect(result.nestedExecutions[0].callStackItem.publicInputs.returnValues[0]).toEqual(new Fr(privateIncrement));
Expand Down Expand Up @@ -673,9 +671,7 @@ describe('Private Execution test suite', () => {
const result = await runSimulator({ args, abi: parentAbi });

expect(result.callStackItem.publicInputs.returnValues[0]).toEqual(argsHash);
expect(oracle.getFunctionABI.mock.calls[0].map(a => a.toBuffer())).toEqual(
[testAddress, testCodeGenSelector].map(a => a.toBuffer()),
);
expect(oracle.getFunctionABI.mock.calls[0]).toEqual([testAddress, testCodeGenSelector]);
expect(oracle.getPortalContractAddress.mock.calls[0]).toEqual([testAddress]);
expect(result.nestedExecutions).toHaveLength(1);
expect(result.nestedExecutions[0].callStackItem.publicInputs.returnValues[0]).toEqual(argsHash);
Expand Down Expand Up @@ -819,7 +815,7 @@ describe('Private Execution test suite', () => {
);

expect(result.enqueuedPublicFunctionCalls).toHaveLength(1);
expect(result.enqueuedPublicFunctionCalls[0].toBuffer()).toEqual(publicCallRequest.toBuffer());
expect(result.enqueuedPublicFunctionCalls[0]).toEqual(publicCallRequest);
expect(result.callStackItem.publicInputs.publicCallStack[0]).toEqual(publicCallRequestHash);
});
});
Expand Down
6 changes: 2 additions & 4 deletions yarn-project/foundation/src/abi/function_selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { keccak } from '@aztec/foundation/crypto';
import { Fr } from '@aztec/foundation/fields';
import { BufferReader } from '@aztec/foundation/serialize';

import { createDebugLogger } from '../log/logger.js';

/**
* A function selector is the first 4 bytes of the hash of a function signature.
*/
Expand All @@ -14,7 +12,6 @@ export class FunctionSelector {
* The size of the function selector in bytes.
*/
public static SIZE = 4;
protected logger = createDebugLogger('aztec:foundation:function-selector');

constructor(/** number representing the function selector */ public value: number) {
if (value > 2 ** (FunctionSelector.SIZE * 8) - 1) {
Expand Down Expand Up @@ -102,7 +99,8 @@ export class FunctionSelector {
static fromNameAndParameters(name: string, parameters: ABIParameter[]) {
const signature = decodeFunctionSignature(name, parameters);
const selector = FunctionSelector.fromSignature(signature);
selector.logger(`Function selector for ${signature} is ${selector}`);
// If using the debug logger here it kill the typing in the `server_world_state_synchroniser` and jest tests.
// console.log(`Function selector for ${signature} is ${selector}`);
return selector;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SerialQueue } from '@aztec/foundation/fifo';
import { DebugLogger, createDebugLogger } from '@aztec/foundation/log';
import { createDebugLogger } from '@aztec/foundation/log';
import { L2Block, L2BlockDownloader, L2BlockSource } from '@aztec/types';

import { MerkleTreeOperations, MerkleTrees } from '../index.js';
Expand Down Expand Up @@ -28,7 +28,7 @@ export class ServerWorldStateSynchroniser implements WorldStateSynchroniser {
private merkleTreeDb: MerkleTrees,
private l2BlockSource: L2BlockSource,
config: WorldStateConfig,
private log: DebugLogger = createDebugLogger('aztec:world_state'),
private log = createDebugLogger('aztec:world_state'),
) {
this.l2BlockDownloader = new L2BlockDownloader(
l2BlockSource,
Expand Down

0 comments on commit 92c0b18

Please sign in to comment.