@@ -121,6 +121,7 @@ use crate::storage::StoredChainInfo;
121121use crate :: sync_status:: SyncStatusCell ;
122122use mp_block:: commitments:: BlockCommitments ;
123123use mp_block:: commitments:: CommitmentComputationContext ;
124+ use mp_block:: header:: CustomHeader ;
124125use mp_block:: BlockHeaderWithSignatures ;
125126use mp_block:: FullBlockWithoutCommitments ;
126127use mp_block:: TransactionWithReceipt ;
@@ -133,7 +134,6 @@ use mp_transactions::L1HandlerTransactionWithFee;
133134use prelude:: * ;
134135use std:: path:: Path ;
135136use std:: sync:: { Arc , Mutex } ;
136- use mp_block:: header:: CustomHeader ;
137137mod db_version;
138138mod prelude;
139139pub mod storage;
@@ -404,7 +404,6 @@ impl<D: MadaraStorage> MadaraBackend<D> {
404404 pub fn flush ( & self ) -> Result < ( ) > {
405405 self . db . flush ( )
406406 }
407-
408407}
409408
410409impl MadaraBackend < RocksDBStorage > {
@@ -582,7 +581,9 @@ impl<D: MadaraStorage> MadaraBackendWriter<D> {
582581 . context ( "There is no current preconfirmed block" ) ?
583582 . get_full_block_with_classes ( ) ?;
584583
585- if let Some ( state_diff) = state_diff {
584+ if let Some ( mut state_diff) = state_diff {
585+ state_diff. old_declared_contracts =
586+ std:: mem:: replace ( & mut block. state_diff . old_declared_contracts , state_diff. old_declared_contracts ) ;
586587 block. state_diff = state_diff;
587588 }
588589
@@ -652,20 +653,13 @@ impl<D: MadaraStorage> MadaraBackendWriter<D> {
652653 block. header . clone ( ) . into_confirmed_header ( parent_block_hash, commitments. clone ( ) , global_state_root) ;
653654 let block_hash = header. compute_hash ( self . inner . chain_config . chain_id . to_felt ( ) , pre_v0_13_2_hash_override) ;
654655
655- tracing:: info!(
656- "🙇 Block hash {:?} computed for #{}" ,
657- block_hash,
658- block. header. block_number
659- ) ;
656+ tracing:: info!( "🙇 Block hash {:?} computed for #{}" , block_hash, block. header. block_number) ;
660657
661- match self . inner . get_custom_header_with_clear ( true ) {
662- Some ( header) => {
663- let is_valid = header. is_block_hash_as_expected ( & block_hash) ;
664- if !is_valid {
665- tracing:: warn!( "Block hash not as expected for {}" , block. header. block_number) ;
666- }
658+ if let Some ( header) = self . inner . get_custom_header_with_clear ( true ) {
659+ let is_valid = header. is_block_hash_as_expected ( & block_hash) ;
660+ if !is_valid {
661+ tracing:: warn!( "Block hash not as expected for {}" , block. header. block_number) ;
667662 }
668- None => { }
669663 }
670664
671665 // Save the block.
0 commit comments