Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): fix ImportReceiptsOp #11216

Merged
merged 18 commits into from
Sep 26, 2024
Merged

fix(cli): fix ImportReceiptsOp #11216

merged 18 commits into from
Sep 26, 2024

Conversation

joshieDo
Copy link
Collaborator

@joshieDo joshieDo commented Sep 25, 2024

closes #10580

  • does not commit to storage unless receipts count and block height match transaction's.
  • bedrock-blocks.rlp or the decoder(didn't look) issues:
    • Block 1 is repeated and out of place - skipped
    • There seems to exist an extra block 105235064 - now we stop once we hit transactions block height
  • Set ExecutionStageCheckpoint to the highest block, otherwise an unwind of the receipts will be attempted on a RW environment.

Tested on commit 2995031

$ op-reth import-receipts-op ../bedrock-receipts.rlp --datadir op-mainnet

(...)
2024-09-25T16:42:11.569980Z  INFO Importing receipt file chunk first_receipts_block=104143590 total_receipts_chunk=753218
2024-09-25T16:42:16.825862Z  WARN skipping receipt from a lower block: 1 previous_block_number=105235064
2024-09-25T16:42:16.913226Z  INFO Importing receipt file chunk first_receipts_block=104896808 total_receipts_chunk=338255
2024-09-25T16:42:16.913249Z  WARN Too many decoded blocks, ignoring the last 1. highest_block_receipts=105235063
2024-09-25T16:42:18.927763Z  INFO Receipt file imported
$ op-reth db --datadir op-mainnet stats

| Segment      | Block Range   | Transaction Range | Shape (columns x rows) | Size      |
|--------------|---------------|-------------------|------------------------|-----------|
| Headers      | 0..=105235063 | N/A               | 3 x 105235064          | 44 GiB    |
| Transactions | 0..=105235063 | 0..=105235055     | 1 x 105235056          | 22 GiB    |
| Receipts     | 0..=105235063 | 0..=105235055     | 1 x 105235056          | 34.2 GiB  |
| ------------ | ------------- | ----------------- | ---------------------- | --------  |
| Total        |               |                   |                        | 100.3 GiB |
(...)

Tested with:

$ b3sum 
09f82818cffa448a6fafa627cf9d9ba600aad5138eabd4488659988068016c43  bedrock-blocks.rlp
927f227dfb52a7ec8008f269cf08af53a8b112ac115ee6c22118ade1cc838b0e  bedrock-receipts.rlp
c25d4a790b011a4e0d84ca4340827be397fb63fe7c874ff4987ea4fb2b725fea world_trie_state_op_mainnet_b2c2b6e7edb919a0b856b9fd9aa02b11ead5305e63cdb33386babd82b9bc4cfe.jsonl
reth init-state ✅ 
reth node --debug.tip 0xeb54d19c714ed434ffb34c50d0619d17890b6b0932042039e2a2dd5ecf3f2e0b ✅ 

@joshieDo joshieDo added C-bug An unexpected or incorrect behavior A-cli Related to the reth CLI A-op-reth Related to Optimism and op-reth labels Sep 25, 2024
@joshieDo joshieDo changed the title fix(cli): fix ImportReceiptsOp for op-mainnet fix(cli): fix ImportReceiptsOp Sep 25, 2024
@joshieDo joshieDo marked this pull request as ready for review September 25, 2024 19:32
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -221,23 +199,54 @@ where
// this ensures the execution outcome and static file producer start at block 1
first_block = 1;
}
highest_block_receipts = first_block + receipts.len() as u64 - 1;

// RLP file may have too many blocks. We ignore the excess, but warn the user.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would this happen?
if the file has more blocks than the bedrock transition block? or duplicated blocks?

There seems to exist an extra block 105235064

Copy link
Collaborator Author

@joshieDo joshieDo Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the file has more blocks than the bedrock transition block?

yes, may have been an user error when exporting the rlp data from the op-geth on defining the range of block data to export

or duplicated blocks?

also seems to be happening here with block 1 at the end of the set. but may just be some EOF wrap issue of the decoder, didnt look.

crates/optimism/cli/src/commands/import_receipts.rs Outdated Show resolved Hide resolved
@joshieDo joshieDo added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit d46f762 Sep 26, 2024
35 checks passed
@joshieDo joshieDo deleted the joshie/import-receipts branch September 26, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI A-op-reth Related to Optimism and op-reth C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken command ImportReceiptsOp
2 participants