@@ -5,6 +5,7 @@ use assert_matches::assert_matches;
5
5
use mempool_test_utils:: starknet_api_test_utils:: {
6
6
create_executable_tx,
7
7
test_resource_bounds_mapping,
8
+ VALID_L2_GAS_MAX_PRICE_PER_UNIT ,
8
9
} ;
9
10
use pretty_assertions:: assert_eq;
10
11
use rstest:: { fixture, rstest} ;
@@ -49,8 +50,8 @@ impl MempoolContent {
49
50
self . tx_queue . as_ref ( ) . unwrap ( ) . assert_eq_priority_queue ( & mempool. tx_queue ) ;
50
51
}
51
52
52
- fn _assert_eq_transaction_pending_queue_content ( & self , mempool : & Mempool ) {
53
- self . tx_queue . as_ref ( ) . unwrap ( ) . _assert_eq_pending_queue ( & mempool. tx_queue ) ;
53
+ fn assert_eq_transaction_pending_queue_content ( & self , mempool : & Mempool ) {
54
+ self . tx_queue . as_ref ( ) . unwrap ( ) . assert_eq_pending_queue ( & mempool. tx_queue ) ;
54
55
}
55
56
56
57
fn _assert_eq_transaction_queues_content ( & self , mempool : & Mempool ) {
@@ -104,7 +105,7 @@ impl MempoolContentBuilder {
104
105
self
105
106
}
106
107
107
- fn _with_pending_queue < Q > ( mut self , queue_txs : Q ) -> Self
108
+ fn with_pending_queue < Q > ( mut self , queue_txs : Q ) -> Self
108
109
where
109
110
Q : IntoIterator < Item = TransactionReference > ,
110
111
{
@@ -964,6 +965,37 @@ fn test_account_nonces_removal_in_commit_block(mut mempool: Mempool) {
964
965
expected_mempool_content. assert_eq_account_nonces ( & mempool) ;
965
966
}
966
967
968
+ // Update gas price threshold tests.
969
+
970
+ #[ rstest]
971
+ fn test_update_gas_price_threshold ( ) {
972
+ // Setup.
973
+ let txs =
974
+ [ & add_tx_input ! ( ) . tx , & add_tx_input ! ( ) . tx ] . map ( TransactionReference :: new) ;
975
+ let ( priority_txs, pending_txs) = ( [ txs[ 0 ] ] , [ txs[ 1 ] ] ) ;
976
+ let mut mempool: Mempool = MempoolContentBuilder :: new ( )
977
+ . with_priority_queue ( priority_txs)
978
+ . with_pending_queue ( pending_txs)
979
+ . build ( )
980
+ . into ( ) ;
981
+
982
+ // Test.
983
+ // All txs should be in the pending queue.
984
+ mempool. _update_gas_price_threshold ( VALID_L2_GAS_MAX_PRICE_PER_UNIT + 2 ) ;
985
+
986
+ // Assert.
987
+ let expected_mempool_content = MempoolContentBuilder :: new ( ) . with_pending_queue ( txs) . build ( ) ;
988
+ expected_mempool_content. assert_eq_transaction_pending_queue_content ( & mempool) ;
989
+
990
+ // Test.
991
+ // All txs should be in the pending queue.
992
+ mempool. _update_gas_price_threshold ( VALID_L2_GAS_MAX_PRICE_PER_UNIT - 2 ) ;
993
+
994
+ // Assert.
995
+ let expected_mempool_content = MempoolContentBuilder :: new ( ) . with_priority_queue ( txs) . build ( ) ;
996
+ expected_mempool_content. assert_eq_transaction_priority_queue_content ( & mempool) ;
997
+ }
998
+
967
999
// Flow tests.
968
1000
969
1001
#[ rstest]
0 commit comments