Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Aug 23, 2024
1 parent 3749211 commit 0d948db
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions yarn-project/end-to-end/src/e2e_prover/full.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ describe('full_prover', () => {
logger.info(
`Starting test using function: ${provenAssets[0].address}:${provenAssets[0].methods.balance_of_private.selector}`,
);
const privateBalance = await provenAssets[0].methods.balance_of_private(accounts[0].address).simulate();
const privateBalance = await provenAssets[0].methods.balance_of_private(accounts[0].address).simulate({
// Tx validation is skipped here because the simulation fails the proof validation
skipTxValidation: true,
});
const privateSendAmount = privateBalance / 2n;
expect(privateSendAmount).toBeGreaterThan(0n);
const privateInteraction = provenAssets[0].methods.transfer(accounts[1].address, privateSendAmount);

const publicBalance = await provenAssets[1].methods.balance_of_public(accounts[0].address).simulate();
const publicBalance = await provenAssets[1].methods.balance_of_public(accounts[0].address).simulate({
// Tx validation is skipped here because the simulation fails the proof validation
skipTxValidation: true,
});
const publicSendAmount = publicBalance / 2n;
expect(publicSendAmount).toBeGreaterThan(0n);
const publicInteraction = provenAssets[1].methods.transfer_public(
Expand Down
8 changes: 6 additions & 2 deletions yarn-project/end-to-end/src/simulators/token_simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ export class TokenSimulator {
}
}

async checkPrivate() {
async checkPrivate(
skipTxValidation: boolean = false,
) {
// Private calls
const defaultLookups = [];
const nonDefaultLookups = [];
Expand All @@ -133,7 +135,9 @@ export class TokenSimulator {
defaultCalls.push(this.token.methods.balance_of_private(address).request());
}
const results = (
await Promise.all(chunk(defaultCalls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate()))
await Promise.all(chunk(defaultCalls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate({
skipTxValidation,
})))
).flat();
for (let i = 0; i < defaultLookups.length; i++) {
expect(results[i]).toEqual(this.balanceOfPrivate(defaultLookups[i]));
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/pxe_service/pxe_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ export class PXEService implements PXE {
txRequest: TxExecutionRequest,
simulatePublic: boolean,
msgSender: AztecAddress | undefined = undefined,
skipTxValidation: boolean = true, // TODO(#7956): make the default be false
skipTxValidation: boolean = false,
scopes?: AztecAddress[],
): Promise<SimulatedTx> {
return await this.jobQueue.put(async () => {
Expand Down

0 comments on commit 0d948db

Please sign in to comment.