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 @@ -148,12 +148,7 @@ export class Sequencer {
148
148
149
149
// Only accept processed transactions that are not double-spends
150
150
// public functions emitting nullifiers would pass earlier check but fail here
151
- const isDoubleSpends = await Promise . all (
152
- processedTxs . map ( async tx => await this . isTxDoubleSpend ( tx as unknown as Tx ) ) ,
153
- ) ;
154
- const doubleSpends = processedTxs . filter ( ( tx , index ) => isDoubleSpends [ index ] ) . map ( tx => tx . hash ) ;
155
- await this . p2pClient . deleteTxs ( doubleSpends ) ;
156
- const processedValidTxs = processedTxs . filter ( ( tx , index ) => ! isDoubleSpends [ index ] ) ;
151
+ const processedValidTxs = await this . takeValidProcessedTxs ( processedTxs ) ;
157
152
158
153
if ( processedValidTxs . length === 0 ) {
159
154
this . log ( 'No txs processed correctly to build block. Exiting' ) ;
@@ -257,6 +252,13 @@ export class Sequencer {
257
252
return validTxs ;
258
253
}
259
254
255
+ protected async takeValidProcessedTxs ( txs : ProcessedTx [ ] ) {
256
+ const isDoubleSpends = await Promise . all ( txs . map ( async tx => await this . isTxDoubleSpend ( tx as unknown as Tx ) ) ) ;
257
+ const doubleSpends = txs . filter ( ( tx , index ) => isDoubleSpends [ index ] ) . map ( tx => tx . hash ) ;
258
+ await this . p2pClient . deleteTxs ( doubleSpends ) ;
259
+ return txs . filter ( ( tx , index ) => ! isDoubleSpends [ index ] ) ;
260
+ }
261
+
260
262
/**
261
263
* Returns whether the previous block sent has been mined, and all dependencies have caught up with it.
262
264
* @returns Boolean indicating if our dependencies are synced to the latest block.
You can’t perform that action at this time.
0 commit comments