@@ -221,7 +221,7 @@ mod tests {
221221 }
222222
223223 #[ tokio:: test]
224- async fn test_validate_one_rollup_fee_exceeds_balance ( ) {
224+ async fn test_validate_one_rollup_fee_exceeds_limit ( ) {
225225 // create the client.
226226 let handle = tokio:: runtime:: Handle :: current ( ) ;
227227 let manager = TaskManager :: new ( handle) ;
@@ -258,6 +258,72 @@ mod tests {
258258 PoolConfig :: default ( ) ,
259259 ) ;
260260
261+ // prepare a transaction with random input.
262+ let tx = ScrollTxEnvelope :: Legacy ( Signed :: new_unchecked (
263+ TxLegacy {
264+ gas_limit : 55_000 ,
265+ gas_price : 7 ,
266+ input : Bytes :: from ( random_iter :: < u8 > ( ) . take ( 100 ) . collect :: < Vec < _ > > ( ) ) ,
267+ ..Default :: default ( )
268+ } ,
269+ Signature :: new ( U256 :: ZERO , U256 :: ZERO , false ) ,
270+ Default :: default ( ) ,
271+ ) ) ;
272+ let pool_tx =
273+ ScrollPooledTransaction :: new ( Recovered :: new_unchecked ( tx, signer) , 120 * 1024 ) ;
274+
275+ // add the transaction in the pool and expect to hit `InsufficientFunds` error.
276+ let err = pool. add_transaction ( TransactionOrigin :: Local , pool_tx) . await . unwrap_err ( ) ;
277+ assert ! ( matches!(
278+ err. kind,
279+ PoolErrorKind :: InvalidTransaction ( InvalidPoolTransactionError :: Consensus (
280+ InvalidTransactionError :: GasUintOverflow
281+ ) )
282+ ) ) ;
283+
284+ // explicitly drop the manager here otherwise the `TransactionValidationTaskExecutor` will
285+ // drop all validation tasks.
286+ drop ( manager) ;
287+ }
288+
289+ #[ tokio:: test]
290+ async fn test_validate_one_rollup_fee_exceeds_balance ( ) {
291+ // create the client.
292+ let handle = tokio:: runtime:: Handle :: current ( ) ;
293+ let manager = TaskManager :: new ( handle) ;
294+ let blob_store = NoopBlobStore :: default ( ) ;
295+ let signer = Default :: default ( ) ;
296+ let client =
297+ MockEthProvider :: < ScrollPrimitives , _ > :: new ( ) . with_chain_spec ( SCROLL_DEV . clone ( ) ) ;
298+ let hash = B256 :: random ( ) ;
299+
300+ // load a header, block, signer and the L1_GAS_PRICE_ORACLE_ADDRESS storage.
301+ client. add_header ( hash, Header :: default ( ) ) ;
302+ client. add_block ( hash, ScrollBlock :: default ( ) ) ;
303+ client. add_account ( signer, ExtendedAccount :: new ( 0 , U256 :: from ( 400_000 ) ) ) ;
304+ client. add_account (
305+ L1_GAS_PRICE_ORACLE_ADDRESS ,
306+ ExtendedAccount :: new ( 0 , U256 :: from ( 400_000 ) ) . extend_storage (
307+ ( 0u8 ..8 ) . map ( |k| ( B256 :: from ( U256 :: from ( k) ) , U256 :: from ( u32:: MAX ) ) ) ,
308+ ) ,
309+ ) ;
310+
311+ // create the validation task.
312+ let validator = TransactionValidationTaskExecutor :: eth_builder ( client)
313+ . no_eip4844 ( )
314+ . build_with_tasks ( manager. executor ( ) , blob_store)
315+ . map ( |validator| {
316+ ScrollTransactionValidator :: new ( validator) . require_l1_data_gas_fee ( true )
317+ } ) ;
318+
319+ // create the pool.
320+ let pool = ScrollTransactionPool :: new (
321+ validator,
322+ CoinbaseTipOrdering :: < ScrollPooledTransaction > :: default ( ) ,
323+ NoopBlobStore :: default ( ) ,
324+ PoolConfig :: default ( ) ,
325+ ) ;
326+
261327 // prepare a transaction with random input.
262328 let tx = ScrollTxEnvelope :: Legacy ( Signed :: new_unchecked (
263329 TxLegacy {
@@ -278,7 +344,7 @@ mod tests {
278344 err. kind,
279345 PoolErrorKind :: InvalidTransaction (
280346 InvalidPoolTransactionError :: Consensus ( InvalidTransactionError :: InsufficientFunds ( GotExpectedBoxed ( expected) ) )
281- ) if * expected == GotExpected { got: U256 :: from( 400000 ) , expected: U256 :: from_limbs ( [ 384999 , 1 , 0 , 0 ] ) }
347+ ) if * expected == GotExpected { got: U256 :: from( 400000 ) , expected: U256 :: from ( 4205858031847u64 ) }
282348 ) ) ;
283349
284350 // explicitly drop the manager here otherwise the `TransactionValidationTaskExecutor` will
0 commit comments