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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
actually commit
Thunkar committed Dec 9, 2024
commit 92ba76967a25231f5cdceb7a24109489cde8d86e
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) {
@@ -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 });