File tree Expand file tree Collapse file tree 5 files changed +50
-29
lines changed
packages/rs-drive-abci/src/abci Expand file tree Collapse file tree 5 files changed +50
-29
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,4 @@ pub enum AbciError {
9090 /// Generic with code should only be used in tests
9191 #[ error( "invalid state transition error: {0}" ) ]
9292 InvalidStateTransition ( #[ from] ConsensusError ) ,
93-
94- /// Drive storage root hash is not matching with app hash stored in PlatformState
95- #[ error( "drive and platform state app hash mismatch" ) ]
96- AppHashMismatch {
97- /// Storage root hash
98- drive_storage_root_hash : [ u8 ; 32 ] ,
99- /// App hash stored in PlatformState
100- platform_state_app_hash : [ u8 ; 32 ] ,
101- } ,
10293}
Original file line number Diff line number Diff line change @@ -67,10 +67,19 @@ where
6767 ) ) ;
6868 }
6969
70- // TODO: document this
70+ // We had a chain halt on mainnet on block 32326. Compaction happened
71+ // and transaction.commit() returned an error. Due to a bug in tenderdash,
72+ // validators just proceeded on next block without committing data but keeping
73+ // updated cache. To keep consistency with mainnet chain we have to skip
74+ // commit of this block now on.
7175 // TODO: verify that chain id is evo1
7276 if !( app. platform ( ) . config . network == Network :: Dash && block_height == 32326 ) {
73- app. commit_transaction ( platform_version) ?;
77+ // This is simplified solution until we have a better way to handle
78+ // We still have caches in memory that corresponds to the data that
79+ // we weren't able to commit. Solution is to restart the Drive, so all caches
80+ // will be restored from the disk and try to process this block again
81+ app. commit_transaction ( platform_version)
82+ . expect ( "commit transaction" ) ;
7483 }
7584
7685 app. platform ( )
Original file line number Diff line number Diff line change @@ -42,16 +42,23 @@ where
4242 )
4343 . unwrap ( ) ?;
4444
45- // TODO: Document this
45+ // We had a chain halt on mainnet on block 32326. Compaction happened
46+ // and transaction.commit() returned an error. Due to a bug in tenderdash,
47+ // validators just proceeded on next block without committing data but keeping
48+ // updated cache. To keep consistency with mainnet chain we allow app hashes to be
49+ // different for this block.
4650 // TODO: verify that chain id is evo1
4751 #[ allow( clippy:: collapsible_if) ]
4852 if !( app. platform ( ) . config . network == Network :: Dash && last_block_height == 32326 ) {
53+ // App hash in memory must be equal to app hash on disk
4954 if drive_storage_root_hash != platform_state_app_hash {
50- return Err ( AbciError :: AppHashMismatch {
51- drive_storage_root_hash,
52- platform_state_app_hash,
53- }
54- . into ( ) ) ;
55+ // We panic because we can't recover from this situation.
56+ // Better to restart the Drive, so we might self-heal the node
57+ // reloading state form the disk
58+ panic ! (
59+ "drive and platform state app hash mismatch: drive_storage_root_hash: {:?}, platform_state_app_hash: {:?}" ,
60+ drive_storage_root_hash, platform_state_app_hash
61+ ) ;
5562 }
5663 }
5764
Original file line number Diff line number Diff line change @@ -54,16 +54,23 @@ where
5454 )
5555 . unwrap ( ) ?;
5656
57- // TODO: Document this
57+ // We had a chain halt on mainnet on block 32326. Compaction happened
58+ // and transaction.commit() returned an error. Due to a bug in tenderdash,
59+ // validators just proceeded on next block without committing data but keeping
60+ // updated cache. To keep consistency with mainnet chain we allow app hashes to be
61+ // different for this block.
5862 // TODO: verify that chain id is evo1
5963 #[ allow( clippy:: collapsible_if) ]
6064 if !( app. platform ( ) . config . network == Network :: Dash && request. height == 32327 ) {
65+ // App hash in memory must be equal to app hash on disk
6166 if drive_storage_root_hash != platform_state_app_hash {
62- return Err ( AbciError :: AppHashMismatch {
63- drive_storage_root_hash,
64- platform_state_app_hash,
65- }
66- . into ( ) ) ;
67+ // We panic because we can't recover from this situation.
68+ // Better to restart the Drive, so we might self-heal the node
69+ // reloading state form the disk
70+ panic ! (
71+ "drive and platform state app hash mismatch: drive_storage_root_hash: {:?}, platform_state_app_hash: {:?}" ,
72+ drive_storage_root_hash, platform_state_app_hash
73+ ) ;
6774 }
6875 }
6976
Original file line number Diff line number Diff line change @@ -198,16 +198,23 @@ where
198198 )
199199 . unwrap ( ) ?;
200200
201- // TODO: Document this
201+ // We had a chain halt on mainnet on block 32326. Compaction happened
202+ // and transaction.commit() returned an error. Due to a bug in tenderdash,
203+ // validators just proceeded on next block without committing data but keeping
204+ // updated cache. To keep consistency with mainnet chain we allow app hashes to be
205+ // different for this block.
202206 // TODO: verify that chain id is evo1
203207 #[ allow( clippy:: collapsible_if) ]
204208 if !( app. platform ( ) . config . network == Network :: Dash && request. height == 32327 ) {
209+ // App hash in memory must be equal to app hash on disk
205210 if drive_storage_root_hash != platform_state_app_hash {
206- return Err ( AbciError :: AppHashMismatch {
207- drive_storage_root_hash,
208- platform_state_app_hash,
209- }
210- . into ( ) ) ;
211+ // We panic because we can't recover from this situation.
212+ // Better to restart the Drive, so we might self-heal the node
213+ // reloading state form the disk
214+ panic ! (
215+ "drive and platform state app hash mismatch: drive_storage_root_hash: {:?}, platform_state_app_hash: {:?}" ,
216+ drive_storage_root_hash, platform_state_app_hash
217+ ) ;
211218 }
212219 }
213220
You can’t perform that action at this time.
0 commit comments