Skip to content

Commit

Permalink
chore: fix maddia comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Sep 12, 2023
1 parent 6745288 commit b2c8bef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 0 additions & 1 deletion yarn-project/end-to-end/src/e2e_lending_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ describe('e2e_lending_contract', () => {
const account = new Account(aztecRpcServer, privateKey, new AuthWitnessAccountContract(privateKey));
const deployTx = await account.deploy();
await deployTx.wait({ interval: 0.1 });
// wallet = await account.getWallet();
wallet = new AuthWitnessEntrypointWallet(
aztecRpcServer,
(await account.getEntrypoint()) as unknown as IAuthWitnessAccountEntrypoint,
Expand Down
9 changes: 8 additions & 1 deletion yarn-project/end-to-end/src/e2e_token_contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ describe('e2e_token_contract', () => {
it.skip('transfer into account to overflow', () => {
// This should already be covered by the mint case earlier. e.g., since we cannot mint to overflow, there is not
// a way to get funds enough to overflow.
// Require direct storage manipulation for us to perform a nice explicit case though.
// See https://github.com/AztecProtocol/aztec-packages/issues/1259
});
});
});
Expand Down Expand Up @@ -703,7 +705,12 @@ describe('e2e_token_contract', () => {
expect(await asset.methods.balance_of_private({ address: accounts[1].address }).view()).toEqual(balance1);
});

it.skip('transfer into account to overflow', () => {});
it.skip('transfer into account to overflow', () => {
// This should already be covered by the mint case earlier. e.g., since we cannot mint to overflow, there is not
// a way to get funds enough to overflow.
// Require direct storage manipulation for us to perform a nice explicit case though.
// See https://github.com/AztecProtocol/aztec-packages/issues/1259
});

it('transfer on behalf of other without approval', async () => {
const balance0 = await asset.methods.balance_of_private({ address: accounts[0].address }).view();
Expand Down
14 changes: 8 additions & 6 deletions yarn-project/sequencer-client/src/sequencer/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,7 @@ export class Sequencer {

// Only accept processed transactions that are not double-spends
// public functions emitting nullifiers would pass earlier check but fail here
const isDoubleSpends = await Promise.all(
processedTxs.map(async tx => await this.isTxDoubleSpend(tx as unknown as Tx)),
);
const doubleSpends = processedTxs.filter((tx, index) => isDoubleSpends[index]).map(tx => tx.hash);
await this.p2pClient.deleteTxs(doubleSpends);
const processedValidTxs = processedTxs.filter((tx, index) => !isDoubleSpends[index]);
const processedValidTxs = await this.takeValidProcessedTxs(processedTxs);

if (processedValidTxs.length === 0) {
this.log('No txs processed correctly to build block. Exiting');
Expand Down Expand Up @@ -257,6 +252,13 @@ export class Sequencer {
return validTxs;
}

protected async takeValidProcessedTxs(txs: ProcessedTx[]) {
const isDoubleSpends = await Promise.all(txs.map(async tx => await this.isTxDoubleSpend(tx as unknown as Tx)));
const doubleSpends = txs.filter((tx, index) => isDoubleSpends[index]).map(tx => tx.hash);
await this.p2pClient.deleteTxs(doubleSpends);
return txs.filter((tx, index) => !isDoubleSpends[index]);
}

/**
* Returns whether the previous block sent has been mined, and all dependencies have caught up with it.
* @returns Boolean indicating if our dependencies are synced to the latest block.
Expand Down

0 comments on commit b2c8bef

Please sign in to comment.