-
Notifications
You must be signed in to change notification settings - Fork 679
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fork-network): fix delayed receipt handling (#12798)
There are a few problems with the way the fork-network tool handles delayed receipts that we want to write to the altered DB: 1. We were trying to parse them as a `Receipt` when now they're stored as `ReceiptOrStateStoredReceipt` 2. We were deleting delayed receipts (to write them again modified) with a `TrieKey::DelayedReceipt { index }` starting from 0 and incrementing by 1 each time. But the first one we see probably doesn't start at index 0, since it'll be at wherever the indices are in the source chain (probably mainnet) 3. We were assuming the trie iter will return the receipts in their queued order, which is not the case. So we're storing them in the end possibly in the wrong order So here we fix all 3. We fix no. 2 by just removing trie items with the raw key we already have. And we fix no. 3 by adding an "index" field to the delayed receipt `StateRecord` in a backwards-compatible way, and then we write the same indices we read, and make sure to write a correct value for the `TrieKey::DelayedReceiptIndices` key at the end. While we're at it, we also fix no. 3 for the genesis startup mechanism that uses serialized `StateRecords` in `GenesisStateApplier::apply()`
- Loading branch information
1 parent
7a4d954
commit 94513ac
Showing
13 changed files
with
178 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.