File tree 3 files changed +16
-8
lines changed
sequencer-client/src/sequencer
3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,6 @@ describe('e2e_lending_contract', () => {
87
87
const account = new Account ( aztecRpcServer , privateKey , new AuthWitnessAccountContract ( privateKey ) ) ;
88
88
const deployTx = await account . deploy ( ) ;
89
89
await deployTx . wait ( { interval : 0.1 } ) ;
90
- // wallet = await account.getWallet();
91
90
wallet = new AuthWitnessEntrypointWallet (
92
91
aztecRpcServer ,
93
92
( await account . getEntrypoint ( ) ) as unknown as IAuthWitnessAccountEntrypoint ,
Original file line number Diff line number Diff line change @@ -572,6 +572,8 @@ describe('e2e_token_contract', () => {
572
572
it . skip ( 'transfer into account to overflow' , ( ) => {
573
573
// This should already be covered by the mint case earlier. e.g., since we cannot mint to overflow, there is not
574
574
// a way to get funds enough to overflow.
575
+ // Require direct storage manipulation for us to perform a nice explicit case though.
576
+ // See https://github.com/AztecProtocol/aztec-packages/issues/1259
575
577
} ) ;
576
578
} ) ;
577
579
} ) ;
@@ -703,7 +705,12 @@ describe('e2e_token_contract', () => {
703
705
expect ( await asset . methods . balance_of_private ( { address : accounts [ 1 ] . address } ) . view ( ) ) . toEqual ( balance1 ) ;
704
706
} ) ;
705
707
706
- it . skip ( 'transfer into account to overflow' , ( ) => { } ) ;
708
+ it . skip ( 'transfer into account to overflow' , ( ) => {
709
+ // This should already be covered by the mint case earlier. e.g., since we cannot mint to overflow, there is not
710
+ // a way to get funds enough to overflow.
711
+ // Require direct storage manipulation for us to perform a nice explicit case though.
712
+ // See https://github.com/AztecProtocol/aztec-packages/issues/1259
713
+ } ) ;
707
714
708
715
it ( 'transfer on behalf of other without approval' , async ( ) => {
709
716
const balance0 = await asset . methods . balance_of_private ( { address : accounts [ 0 ] . address } ) . view ( ) ;
Original file line number Diff line number Diff line change @@ -149,12 +149,7 @@ export class Sequencer {
149
149
150
150
// Only accept processed transactions that are not double-spends
151
151
// public functions emitting nullifiers would pass earlier check but fail here
152
- const isDoubleSpends = await Promise . all (
153
- processedTxs . map ( async tx => await this . isTxDoubleSpend ( tx as unknown as Tx ) ) ,
154
- ) ;
155
- const doubleSpends = processedTxs . filter ( ( tx , index ) => isDoubleSpends [ index ] ) . map ( tx => tx . hash ) ;
156
- await this . p2pClient . deleteTxs ( doubleSpends ) ;
157
- const processedValidTxs = processedTxs . filter ( ( tx , index ) => ! isDoubleSpends [ index ] ) ;
152
+ const processedValidTxs = await this . takeValidProcessedTxs ( processedTxs ) ;
158
153
159
154
if ( processedValidTxs . length === 0 ) {
160
155
this . log ( 'No txs processed correctly to build block. Exiting' ) ;
@@ -258,6 +253,13 @@ export class Sequencer {
258
253
return validTxs ;
259
254
}
260
255
256
+ protected async takeValidProcessedTxs ( txs : ProcessedTx [ ] ) {
257
+ const isDoubleSpends = await Promise . all ( txs . map ( async tx => await this . isTxDoubleSpend ( tx as unknown as Tx ) ) ) ;
258
+ const doubleSpends = txs . filter ( ( tx , index ) => isDoubleSpends [ index ] ) . map ( tx => tx . hash ) ;
259
+ await this . p2pClient . deleteTxs ( doubleSpends ) ;
260
+ return txs . filter ( ( tx , index ) => ! isDoubleSpends [ index ] ) ;
261
+ }
262
+
261
263
/**
262
264
* Returns whether the previous block sent has been mined, and all dependencies have caught up with it.
263
265
* @returns Boolean indicating if our dependencies are synced to the latest block.
You can’t perform that action at this time.
0 commit comments