@@ -6,7 +6,6 @@ import { times } from '@aztec/foundation/collection';
66import { sleep } from '@aztec/foundation/sleep' ;
77import { unfreeze } from '@aztec/foundation/types' ;
88import type { LibP2PService , P2PClient } from '@aztec/p2p' ;
9- import type { BlockBuilder } from '@aztec/sequencer-client' ;
109import type { CppPublicTxSimulator , PublicTxResult } from '@aztec/simulator/server' ;
1110import { BlockProposal } from '@aztec/stdlib/p2p' ;
1211import { ReExFailedTxsError , ReExStateMismatchError , ReExTimeoutError } from '@aztec/stdlib/validators' ;
@@ -170,30 +169,28 @@ describe('e2e_p2p_reex', () => {
170169 node : AztecNodeService ,
171170 stub : ( tx : Tx , originalSimulate : ( tx : Tx ) => Promise < PublicTxResult > ) => Promise < PublicTxResult > ,
172171 ) => {
173- const blockBuilder : BlockBuilder = ( node as any ) . sequencer . sequencer . blockBuilder ;
172+ const blockBuilder : any = ( node as any ) . sequencer . sequencer . blockBuilder ;
174173 const originalCreateDeps = blockBuilder . makeBlockBuilderDeps . bind ( blockBuilder ) ;
175- jest
176- . spyOn ( blockBuilder , 'makeBlockBuilderDeps' )
177- . mockImplementation ( async ( ...args : Parameters < BlockBuilder [ 'makeBlockBuilderDeps' ] > ) => {
178- const deps = await originalCreateDeps ( ...args ) ;
179- t . logger . warn ( 'Creating mocked processor factory' ) ;
180- const simulator : CppPublicTxSimulator = ( deps . processor as any ) . publicTxSimulator ;
181- const originalSimulate = simulator . simulate . bind ( simulator ) ;
182- // We only stub the simulate method if it's NOT the first time we see the tx
183- // so the proposer works fine, but we cause the failure in the validators.
184- jest . spyOn ( simulator , 'simulate' ) . mockImplementation ( ( tx : Tx ) => {
185- const txHash = tx . getTxHash ( ) . toString ( ) ;
186- if ( seenTxs . has ( txHash ) ) {
187- t . logger . warn ( 'Calling stubbed simulate for tx' , { txHash } ) ;
188- return stub ( tx , originalSimulate ) ;
189- } else {
190- seenTxs . add ( txHash ) ;
191- t . logger . warn ( 'Calling original simulate for tx' , { txHash } ) ;
192- return originalSimulate ( tx ) ;
193- }
194- } ) ;
195- return deps ;
174+ jest . spyOn ( blockBuilder , 'makeBlockBuilderDeps' ) . mockImplementation ( async ( ...args : any [ ] ) => {
175+ const deps = await originalCreateDeps ( ...args ) ;
176+ t . logger . warn ( 'Creating mocked processor factory' ) ;
177+ const simulator : CppPublicTxSimulator = ( deps . processor as any ) . publicTxSimulator ;
178+ const originalSimulate = simulator . simulate . bind ( simulator ) ;
179+ // We only stub the simulate method if it's NOT the first time we see the tx
180+ // so the proposer works fine, but we cause the failure in the validators.
181+ jest . spyOn ( simulator , 'simulate' ) . mockImplementation ( ( tx : Tx ) => {
182+ const txHash = tx . getTxHash ( ) . toString ( ) ;
183+ if ( seenTxs . has ( txHash ) ) {
184+ t . logger . warn ( 'Calling stubbed simulate for tx' , { txHash } ) ;
185+ return stub ( tx , originalSimulate ) ;
186+ } else {
187+ seenTxs . add ( txHash ) ;
188+ t . logger . warn ( 'Calling original simulate for tx' , { txHash } ) ;
189+ return originalSimulate ( tx ) ;
190+ }
196191 } ) ;
192+ return deps ;
193+ } ) ;
197194 } ;
198195
199196 // Have the public tx processor take an extra long time to process the tx, so the validator times out
0 commit comments