@@ -6,7 +6,6 @@ use crate::authority::authority_per_epoch_store::{
66} ;
77use crate :: authority:: transaction_deferral:: DeferralKey ;
88use crate :: checkpoints:: BuilderCheckpointSummary ;
9- use crate :: consensus_handler:: SequencedConsensusTransactionKind ;
109use crate :: epoch:: randomness:: SINGLETON_KEY ;
1110use dashmap:: DashMap ;
1211use fastcrypto_tbls:: { dkg_v1, nodes:: PartyId } ;
@@ -23,9 +22,7 @@ use sui_types::crypto::RandomnessRound;
2322use sui_types:: error:: SuiResult ;
2423use sui_types:: execution:: ExecutionTimeObservationKey ;
2524use sui_types:: messages_checkpoint:: { CheckpointContents , CheckpointSequenceNumber } ;
26- use sui_types:: messages_consensus:: {
27- AuthorityIndex , ConsensusTransaction , ConsensusTransactionKind ,
28- } ;
25+ use sui_types:: messages_consensus:: AuthorityIndex ;
2926use sui_types:: {
3027 base_types:: { ConsensusObjectSequenceKey , ObjectID } ,
3128 digests:: TransactionDigest ,
@@ -193,14 +190,6 @@ impl ConsensusCommitOutput {
193190 }
194191
195192 pub fn defer_transactions (
196- & mut self ,
197- key : DeferralKey ,
198- transactions : Vec < VerifiedSequencedConsensusTransaction > ,
199- ) {
200- self . deferred_txns . push ( ( key, transactions) ) ;
201- }
202-
203- pub fn defer_transactions_v2 (
204193 & mut self ,
205194 key : DeferralKey ,
206195 transactions : Vec < VerifiedExecutableTransaction > ,
@@ -301,14 +290,11 @@ impl ConsensusCommitOutput {
301290 batch. insert_batch ( & tables. next_shared_object_versions_v2 , next_versions) ?;
302291 }
303292
304- // TODO(consensus-handler-rewrite): delete the old structures once commit handler rewrite is complete
305- batch. delete_batch ( & tables. deferred_transactions , & self . deleted_deferred_txns ) ?;
306293 batch. delete_batch (
307294 & tables. deferred_transactions_v2 ,
308295 & self . deleted_deferred_txns ,
309296 ) ?;
310297
311- batch. insert_batch ( & tables. deferred_transactions , self . deferred_txns ) ?;
312298 batch. insert_batch (
313299 & tables. deferred_transactions_v2 ,
314300 self . deferred_txns_v2 . into_iter ( ) . map ( |( key, txs) | {
@@ -402,10 +388,6 @@ impl ConsensusCommitOutput {
402388pub ( crate ) struct ConsensusOutputCache {
403389 // deferred transactions is only used by consensus handler so there should never be lock contention
404390 // - hence no need for a DashMap.
405- // TODO(consensus-handler-rewrite): remove this once we no longer need to support the old consensus handler
406- pub ( crate ) deferred_transactions :
407- Mutex < BTreeMap < DeferralKey , Vec < VerifiedSequencedConsensusTransaction > > > ,
408-
409391 pub ( crate ) deferred_transactions_v2 :
410392 Mutex < BTreeMap < DeferralKey , Vec < VerifiedExecutableTransaction > > > ,
411393
@@ -423,10 +405,6 @@ impl ConsensusOutputCache {
423405 epoch_start_configuration : & EpochStartConfiguration ,
424406 tables : & AuthorityEpochTables ,
425407 ) -> Self {
426- let deferred_transactions = tables
427- . get_all_deferred_transactions ( )
428- . expect ( "load deferred transactions cannot fail" ) ;
429-
430408 let deferred_transactions_v2 = tables
431409 . get_all_deferred_transactions_v2 ( )
432410 . expect ( "load deferred transactions cannot fail" ) ;
@@ -439,7 +417,6 @@ impl ConsensusOutputCache {
439417 let executed_in_epoch_cache_capacity = 50_000 ;
440418
441419 Self {
442- deferred_transactions : Mutex :: new ( deferred_transactions) ,
443420 deferred_transactions_v2 : Mutex :: new ( deferred_transactions_v2) ,
444421 user_signatures_for_checkpoints : Default :: default ( ) ,
445422 executed_in_epoch : RwLock :: new ( DashMap :: with_shard_amount ( 2048 ) ) ,
@@ -915,94 +892,7 @@ impl ConsensusOutputQuarantine {
915892 . next ( )
916893 }
917894
918- pub ( super ) fn load_initial_object_debts (
919- & self ,
920- epoch_store : & AuthorityPerEpochStore ,
921- current_round : Round ,
922- for_randomness : bool ,
923- transactions : & [ VerifiedSequencedConsensusTransaction ] ,
924- ) -> SuiResult < impl IntoIterator < Item = ( ObjectID , u64 ) > > {
925- let protocol_config = epoch_store. protocol_config ( ) ;
926- let tables = epoch_store. tables ( ) ?;
927- let default_per_commit_budget = protocol_config
928- . max_accumulated_txn_cost_per_object_in_mysticeti_commit_as_option ( )
929- . unwrap_or ( 0 ) ;
930- let ( hash_table, db_table, per_commit_budget) = if for_randomness {
931- (
932- & self . congestion_control_randomness_object_debts ,
933- & tables. congestion_control_randomness_object_debts ,
934- protocol_config
935- . max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit_as_option ( )
936- . unwrap_or ( default_per_commit_budget) ,
937- )
938- } else {
939- (
940- & self . congestion_control_object_debts ,
941- & tables. congestion_control_object_debts ,
942- default_per_commit_budget,
943- )
944- } ;
945- let mut shared_input_object_ids: Vec < _ > = transactions
946- . iter ( )
947- . filter_map ( |tx| {
948- match & tx. 0 . transaction {
949- SequencedConsensusTransactionKind :: External ( ConsensusTransaction {
950- kind : ConsensusTransactionKind :: CertifiedTransaction ( tx) ,
951- ..
952- } ) => Some ( itertools:: Either :: Left (
953- tx. shared_input_objects ( ) . map ( |obj| obj. id ) ,
954- ) ) ,
955- SequencedConsensusTransactionKind :: External ( ConsensusTransaction {
956- kind : ConsensusTransactionKind :: UserTransaction ( tx) ,
957- ..
958- // Bug fix that required a protocol flag.
959- } ) if protocol_config. use_mfp_txns_in_load_initial_object_debts ( ) => Some (
960- itertools:: Either :: Right ( tx. shared_input_objects ( ) . map ( |obj| obj. id ) ) ,
961- ) ,
962- _ => None ,
963- }
964- } )
965- . flatten ( )
966- . collect ( ) ;
967- shared_input_object_ids. sort ( ) ;
968- shared_input_object_ids. dedup ( ) ;
969-
970- let results = do_fallback_lookup (
971- & shared_input_object_ids,
972- |object_id| {
973- if let Some ( debt) = hash_table. get ( object_id) {
974- CacheResult :: Hit ( Some ( debt. into_v1 ( ) ) )
975- } else {
976- CacheResult :: Miss
977- }
978- } ,
979- |object_ids| {
980- db_table
981- . multi_get ( object_ids)
982- . expect ( "db error" )
983- . into_iter ( )
984- . map ( |debt| debt. map ( |debt| debt. into_v1 ( ) ) )
985- . collect ( )
986- } ,
987- ) ;
988-
989- Ok ( results
990- . into_iter ( )
991- . zip ( shared_input_object_ids)
992- . filter_map ( |( debt, object_id) | debt. map ( |debt| ( debt, object_id) ) )
993- . map ( move |( ( round, debt) , object_id) | {
994- // Stored debts already account for the budget of the round in which
995- // they were accumulated. Application of budget from future rounds to
996- // the debt is handled here.
997- assert ! ( current_round > round) ;
998- let num_rounds = current_round - round - 1 ;
999- let debt = debt. saturating_sub ( per_commit_budget * num_rounds) ;
1000- ( object_id, debt)
1001- } ) )
1002- }
1003-
1004- // TODO: Remove the above version and rename this without _v2
1005- pub ( crate ) fn load_initial_object_debts_v2 (
895+ pub ( crate ) fn load_initial_object_debts (
1006896 & self ,
1007897 epoch_store : & AuthorityPerEpochStore ,
1008898 current_round : Round ,
0 commit comments