@@ -21,7 +21,6 @@ import (
2121 gethTypes "github.com/scroll-tech/go-ethereum/core/types"
2222 "github.com/scroll-tech/go-ethereum/crypto"
2323 "github.com/scroll-tech/go-ethereum/crypto/kzg4844"
24- "github.com/scroll-tech/go-ethereum/ethclient"
2524 "github.com/scroll-tech/go-ethereum/log"
2625 "github.com/scroll-tech/go-ethereum/rpc"
2726 "github.com/stretchr/testify/assert"
@@ -34,7 +33,6 @@ import (
3433
3534 bridgeAbi "scroll-tech/rollup/abi"
3635 "scroll-tech/rollup/internal/config"
37- "scroll-tech/rollup/internal/orm"
3836 "scroll-tech/rollup/mock_bridge"
3937)
4038
@@ -136,7 +134,6 @@ func TestSender(t *testing.T) {
136134 setupEnv (t )
137135 t .Run ("test new sender" , testNewSender )
138136 t .Run ("test send and retrieve transaction" , testSendAndRetrieveTransaction )
139- t .Run ("test fallback gas limit" , testFallbackGasLimit )
140137 t .Run ("test access list transaction gas limit" , testAccessListTransactionGasLimit )
141138 t .Run ("test resubmit zero gas price transaction" , testResubmitZeroGasPriceTransaction )
142139 t .Run ("test resubmit non-zero gas price transaction" , testResubmitNonZeroGasPriceTransaction )
@@ -190,7 +187,7 @@ func testSendAndRetrieveTransaction(t *testing.T) {
190187 if txBlob [i ] != nil {
191188 blobs = []* kzg4844.Blob {txBlob [i ]}
192189 }
193- hash , err := s .SendTransaction ("0" , & common.Address {}, nil , blobs , 0 )
190+ hash , err := s .SendTransaction ("0" , & common.Address {}, nil , blobs )
194191 assert .NoError (t , err )
195192 txs , err := s .pendingTransactionOrm .GetPendingOrReplacedTransactionsBySenderType (context .Background (), s .senderType , 1 )
196193 assert .NoError (t , err )
@@ -214,63 +211,6 @@ func testSendAndRetrieveTransaction(t *testing.T) {
214211 }
215212}
216213
217- func testFallbackGasLimit (t * testing.T ) {
218- for i , txType := range txTypes {
219- sqlDB , err := db .DB ()
220- assert .NoError (t , err )
221- assert .NoError (t , migrate .ResetDB (sqlDB ))
222-
223- cfgCopy := * cfg .L2Config .RelayerConfig .SenderConfig
224- cfgCopy .TxType = txType
225- cfgCopy .Confirmations = rpc .LatestBlockNumber
226- s , err := NewSender (context .Background (), & cfgCopy , signerConfig , "test" , "test" , types .SenderTypeUnknown , db , nil )
227- assert .NoError (t , err )
228-
229- client , err := ethclient .Dial (cfgCopy .Endpoint )
230- assert .NoError (t , err )
231-
232- var blobs []* kzg4844.Blob
233- if txBlob [i ] != nil {
234- blobs = []* kzg4844.Blob {txBlob [i ]}
235- }
236- // FallbackGasLimit = 0
237- txHash0 , err := s .SendTransaction ("0" , & common.Address {}, nil , blobs , 0 )
238- assert .NoError (t , err )
239- tx0 , _ , err := client .TransactionByHash (context .Background (), txHash0 )
240- assert .NoError (t , err )
241- assert .Greater (t , tx0 .Gas (), uint64 (0 ))
242-
243- assert .Eventually (t , func () bool {
244- var txs []orm.PendingTransaction
245- txs , err = s .pendingTransactionOrm .GetPendingOrReplacedTransactionsBySenderType (context .Background (), s .senderType , 100 )
246- assert .NoError (t , err )
247- return len (txs ) == 0
248- }, 30 * time .Second , time .Second )
249-
250- // FallbackGasLimit = 100000
251- patchGuard := gomonkey .ApplyPrivateMethod (s , "estimateGasLimit" ,
252- func (contract * common.Address , data []byte , sidecar * gethTypes.BlobTxSidecar , gasPrice , gasTipCap , gasFeeCap , blobGasFeeCap * big.Int ) (uint64 , * gethTypes.AccessList , error ) {
253- return 0 , nil , errors .New ("estimateGasLimit error" )
254- },
255- )
256-
257- txHash1 , err := s .SendTransaction ("1" , & common.Address {}, nil , blobs , 100000 )
258- assert .NoError (t , err )
259- tx1 , _ , err := client .TransactionByHash (context .Background (), txHash1 )
260- assert .NoError (t , err )
261- assert .Equal (t , uint64 (100000 ), tx1 .Gas ())
262-
263- assert .Eventually (t , func () bool {
264- txs , err := s .pendingTransactionOrm .GetPendingOrReplacedTransactionsBySenderType (context .Background (), s .senderType , 100 )
265- assert .NoError (t , err )
266- return len (txs ) == 0
267- }, 30 * time .Second , time .Second )
268-
269- s .Stop ()
270- patchGuard .Reset ()
271- }
272- }
273-
274214func testResubmitZeroGasPriceTransaction (t * testing.T ) {
275215 for i , txType := range txTypes {
276216 if txBlob [i ] != nil {
@@ -605,10 +545,10 @@ func testResubmitNonceGappedTransaction(t *testing.T) {
605545 if txBlob [i ] != nil {
606546 blobs = []* kzg4844.Blob {txBlob [i ]}
607547 }
608- _ , err = s .SendTransaction ("test-1" , & common.Address {}, nil , blobs , 0 )
548+ _ , err = s .SendTransaction ("test-1" , & common.Address {}, nil , blobs )
609549 assert .NoError (t , err )
610550
611- _ , err = s .SendTransaction ("test-2" , & common.Address {}, nil , blobs , 0 )
551+ _ , err = s .SendTransaction ("test-2" , & common.Address {}, nil , blobs )
612552 assert .NoError (t , err )
613553
614554 s .checkPendingTransaction ()
@@ -649,7 +589,7 @@ func testCheckPendingTransactionTxConfirmed(t *testing.T) {
649589 return nil
650590 })
651591
652- _ , err = s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ), 0 )
592+ _ , err = s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ))
653593 assert .NoError (t , err )
654594
655595 txs , err := s .pendingTransactionOrm .GetPendingOrReplacedTransactionsBySenderType (context .Background (), s .senderType , 1 )
@@ -691,7 +631,7 @@ func testCheckPendingTransactionResubmitTxConfirmed(t *testing.T) {
691631 return nil
692632 })
693633
694- originTxHash , err := s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ), 0 )
634+ originTxHash , err := s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ))
695635 assert .NoError (t , err )
696636
697637 txs , err := s .pendingTransactionOrm .GetPendingOrReplacedTransactionsBySenderType (context .Background (), s .senderType , 1 )
@@ -751,7 +691,7 @@ func testCheckPendingTransactionReplacedTxConfirmed(t *testing.T) {
751691 return nil
752692 })
753693
754- txHash , err := s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ), 0 )
694+ txHash , err := s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ))
755695 assert .NoError (t , err )
756696
757697 txs , err := s .pendingTransactionOrm .GetPendingOrReplacedTransactionsBySenderType (context .Background (), s .senderType , 1 )
@@ -821,7 +761,7 @@ func testCheckPendingTransactionTxMultipleTimesWithOnlyOneTxPending(t *testing.T
821761 return nil
822762 })
823763
824- _ , err = s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ), 0 )
764+ _ , err = s .SendTransaction ("test" , & common.Address {}, nil , randBlobs (1 ))
825765 assert .NoError (t , err )
826766
827767 txs , err := s .pendingTransactionOrm .GetPendingOrReplacedTransactionsBySenderType (context .Background (), s .senderType , 1 )
@@ -895,7 +835,7 @@ func testBlobTransactionWithBlobhashOpContractCall(t *testing.T) {
895835 assert .NoError (t , err )
896836 defer s .Stop ()
897837
898- _ , err = s .SendTransaction ("0" , & testContractsAddress , data , blobs , 0 )
838+ _ , err = s .SendTransaction ("0" , & testContractsAddress , data , blobs )
899839 assert .NoError (t , err )
900840
901841 var txHash common.Hash
@@ -953,10 +893,10 @@ func testSendBlobCarryingTxOverLimit(t *testing.T) {
953893 assert .NoError (t , err )
954894
955895 for i := 0 ; i < int (cfgCopy .MaxPendingBlobTxs ); i ++ {
956- _ , err = s .SendTransaction ("0" , & common.Address {}, nil , randBlobs (1 ), 0 )
896+ _ , err = s .SendTransaction ("0" , & common.Address {}, nil , randBlobs (1 ))
957897 assert .NoError (t , err )
958898 }
959- _ , err = s .SendTransaction ("0" , & common.Address {}, nil , randBlobs (1 ), 0 )
899+ _ , err = s .SendTransaction ("0" , & common.Address {}, nil , randBlobs (1 ))
960900 assert .ErrorIs (t , err , ErrTooManyPendingBlobTxs )
961901 s .Stop ()
962902}
0 commit comments