feat/#76 implement roll back to#130
Conversation
Codecov Report
@@ Coverage Diff @@
## master #130 +/- ##
==========================================
+ Coverage 95.64% 95.68% +0.04%
==========================================
Files 72 72
Lines 1217 1252 +35
Branches 155 162 +7
==========================================
+ Hits 1164 1198 +34
- Misses 53 54 +1
Continue to review full report at Codecov.
|
f136f49 to
5c80bc5
Compare
|
Let's implement this feature without introduce breaking change in the protected async rollbackTo(blockNumber: number): Promise<void> {
this.log.debug('-- roll back to block number:', blockNumber);
// - [ ] TODO alter current index state
// - [ ] TODO revert all change from blockNumber to current blockNumber
// Aloxide Updater will create a snapshot of data when applying a last irreversible block
// doing so we can quickly roll back to the last irreversible block state
// This is only applied to Aloxide data
}
public async handleBlock(nextBlock: NextBlock, isReplay: boolean): Promise<number | null> {
try {
return super.handleBlock(nextBlock, isReplay);
} catch (e) {
if (e instanceof MismatchedBlockHashError) {
// roll back to the last irreversible blocks
// - [ ] TODO explain why it must be the last irreversible block
// - [ ] what hapen if the rollbackTo took too long to execute
await this.rollbackTo(this.lastIrreversibleBlockNumber);
return this.lastIrreversibleBlockNumber + 1;
}
throw e;
}
} |
b7c2de1 to
76508d8
Compare
|
@manh-vv please help me review again!. |
manh-vv
left a comment
There was a problem hiding this comment.
Please have a direct talk if you have any questions about my comments.
76508d8 to
1b0086f
Compare
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #130 +/- ##
==========================================
+ Coverage 95.64% 95.68% +0.04%
==========================================
Files 72 72
Lines 1217 1252 +35
Branches 155 162 +7
==========================================
+ Hits 1164 1198 +34
- Misses 53 54 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Require lecle/demux-js#2 to be merged first