Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeilaWang committed Oct 22, 2024
1 parent 67c60d5 commit e6f1ff0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions yarn-project/p2p/src/tx_validator/data_validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ describe('TxDataValidator', () => {

it('rejects txs with mismatch revertible execution requests', async () => {
const goodTxs = mockTxs(3);
const badTxs = mockTxs(5);
const badTxs = mockTxs(4);
badTxs[0].data.forPublic!.end.publicCallStack[0].callContext.msgSender = AztecAddress.random();
badTxs[1].data.forPublic!.end.publicCallStack[1].callContext.contractAddress = AztecAddress.random();
badTxs[2].data.forPublic!.end.publicCallStack[0].callContext.functionSelector = FunctionSelector.random();
badTxs[4].data.forPublic!.end.publicCallStack[0].callContext.isStaticCall =
!badTxs[4].enqueuedPublicFunctionCalls[0].callContext.isStaticCall;
badTxs[3].data.forPublic!.end.publicCallStack[0].callContext.isStaticCall =
!badTxs[3].enqueuedPublicFunctionCalls[0].callContext.isStaticCall;

await expect(validator.validateTxs([...badTxs, ...goodTxs])).resolves.toEqual([goodTxs, badTxs]);
});
Expand Down
4 changes: 1 addition & 3 deletions yarn-project/pxe/src/kernel_prover/kernel_prover.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '@aztec/circuit-types';
import {
CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS,
FunctionData,
FunctionSelector,
MAX_NOTE_HASHES_PER_CALL,
MAX_NOTE_HASHES_PER_TX,
Expand Down Expand Up @@ -61,8 +60,7 @@ describe('Kernel Prover', () => {
: NoteHash.empty(),
0,
);
const functionData = FunctionData.empty();
functionData.selector = new FunctionSelector(fnName.charCodeAt(0));
publicInputs.callContext.functionSelector = new FunctionSelector(fnName.charCodeAt(0));
return new PrivateExecutionResult(
Buffer.alloc(0),
VerificationKey.makeFake().toBuffer(),
Expand Down
9 changes: 7 additions & 2 deletions yarn-project/txe/src/oracle/txe_oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,12 @@ export class TXE implements TypedOracle {
this.setFunctionSelector(functionSelector);
this.setCalldata(args);

const callContext = new CallContext(this.contractAddress, targetContractAddress, functionSelector, isStaticCall);
const callContext = new CallContext(
/* msgSender */ currentContractAddress,
targetContractAddress,
functionSelector,
isStaticCall,
);

const executionResult = await this.executePublicFunction(args, callContext, this.sideEffectsCounter);

Expand Down Expand Up @@ -726,7 +731,7 @@ export class TXE implements TypedOracle {
this.setFunctionSelector(functionSelector);

const callContext = new CallContext(
this.contractAddress,
/* msgSender */ currentContractAddress,
targetContractAddress,
FunctionSelector.fromField(new Fr(PUBLIC_DISPATCH_SELECTOR)),
isStaticCall,
Expand Down

0 comments on commit e6f1ff0

Please sign in to comment.