Skip to content

Commit

Permalink
debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Nov 21, 2023
1 parent 5cfbb68 commit bf7dbdf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions yarn-project/aztec.js/src/contract/sent_tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ExtendedNote, GetUnencryptedLogsResponse, PXE, TxHash, TxReceipt, TxSta

import every from 'lodash.every';

import { createDebugLogger } from '../index.js';

/** Options related to waiting for a tx. */
export type WaitOpts = {
/** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
Expand Down Expand Up @@ -66,6 +68,22 @@ export class SentTx {
}
const receipt = await this.waitForReceipt(opts);
if (receipt.status !== TxStatus.MINED) {
{
// A few logs placed here temporarily to help me (@benesjan) debug an issue with intermittent failure of
// 2 pixies test.
// https://github.com/AztecProtocol/aztec-packages/issues/3357
// For whatever reason (according to logs) the tx which appears here as dropped seems to be correctly included
// in a block and the block built and submitted on-chain. I will try to fetch the latest block here and see
// which txs it contains to check if the block source used here has the relevant block. If it doesn't then
// the test is probably misconfigured and an incorrect block source is used (pxe pointing to a different aztec
// node or smt like that) or there is some bigger issue with block sync somewhere.
const blockNum = await this.pxe.getBlockNumber();
const block = await this.pxe.getBlock(blockNum);
const txs = block?.getTxs();
const txHashes = txs?.map(tx => tx.txHash.toString());
const log = createDebugLogger('aztec:sent-tx');
log(`Tx hashes of txs included in the last synced block ${block?.number} are: ${txHashes}`);
}
throw new Error(`Transaction ${await this.getTxHash()} was ${receipt.status}`);
}
if (opts?.debug) {
Expand Down
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 @@ -119,7 +119,7 @@ describe('e2e_2_pxes', () => {
);
};

it('transfers fund 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

0 comments on commit bf7dbdf

Please sign in to comment.