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

fix: use synched block number to sync notes #10545

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_2_pxes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('e2e_2_pxes', () => {
});

// TODO #10296
it.skip('transfers funds from user A to B via PXE A followed by transfer from B to A via PXE B', async () => {
it('transfers funds from user A to B via PXE A followed by transfer from B to A via PXE B', async () => {
const initialBalance = 987n;
const transferAmount1 = 654n;
const transferAmount2 = 323n;
Expand Down
13 changes: 12 additions & 1 deletion yarn-project/end-to-end/src/fixtures/token_utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// docs:start:token_utils
import { type AztecAddress, type DebugLogger, type Wallet } from '@aztec/aztec.js';
import { type AztecAddress, type DebugLogger, type Wallet, retryUntil } from '@aztec/aztec.js';
import { TokenContract } from '@aztec/noir-contracts.js';

export async function deployToken(adminWallet: Wallet, initialAdminBalance: bigint, logger: DebugLogger) {
Expand Down Expand Up @@ -37,6 +37,17 @@ export async function expectTokenBalance(
expectedBalance: bigint,
logger: DebugLogger,
) {
// Check if the wallet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the wallet... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, didn't save the file properly.

To address the overall comment, the Circuit execution failed error seems to happen when validating a read request in the kernel, so I assumed it's because we haven't synched the balances properly (kernel verification happens with a stale header). Even if PXE

You made me think, hope you're happy. The problem is in a misalignment between what's read in the simulation (that uses notes seen up to aztecNode.getBlockNumber()) and the kernels (that checks read requests up to synchronizer.getSynchedBlockNumber). I'm gonna test this theory by forcing simulation to use only the synched blockNumber!

const blockNumber = await wallet.getBlockNumber();
await retryUntil(
async () => {
const status = await wallet.getSyncStatus();
return blockNumber <= status.blocks;
},
'pxe synch',
3600,
1,
);
// Then check the balance
const contractWithWallet = await TokenContract.at(token.address, wallet);
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@
"engines": {
"node": ">=18"
}
}
}
Loading