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

Optimism Holocene basefee calculation error #13121

Closed
1 task done
mininny opened this issue Dec 4, 2024 · 1 comment · Fixed by #13122
Closed
1 task done

Optimism Holocene basefee calculation error #13121

mininny opened this issue Dec 4, 2024 · 1 comment · Fixed by #13122
Labels
C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled

Comments

@mininny
Copy link
Contributor

mininny commented Dec 4, 2024

Describe the bug

Hey team, I encountered another issue as I was syncing op-reth on devnet.

"Invalid block error on new payload" invalid_hash=0x95cb046404c2c833b4640791483e2140e98c2604ed80e0f4ef0ac6db3c1c18df invalid_number=12777315 validation_err="block base fee mismatch: got 254, expected 253

op-reth split from the chain because it was seeing different block base fee and was not syncing further. Here's a debugging I did:

I wanted to do some fix for this, but it seemed like the rust crate for eip1559 was separated and is generalized from the details like holocene.
And the chain_spec.base_fee_params_at_timestamp only takes timestamp as a parameter, so it cannot derive the holocene parameterse from extraData.

Please let me know if my understanding of the reth codebase or how the baseFee calculation works is incorrect, or if you need any more detail. :)


I have another reth node running on the same network, but that one didn't err out on this block, but on the later one. I'm not yet sure why the reth nodes would have different results in the same block.


Steps to reproduce

Example block data:

{"jsonrpc":"2.0","id":1,"result":{"baseFeePerGas":"0xfe","blobGasUsed":"0x0","difficulty":"0x0","excessBlobGas":"0x0","extraData":"0x00000000fa0000003c","gasLimit":"0x1c9c380","gasUsed":"0xab4b","hash":"0xffd62af222ed370d41449c1a75d0d9d3742316881f293dad3cc0d2a26326d9a8","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x4200000000000000000000000000000000000011","mixHash":"0x9ebe65dbf9004d5e78d08d476fc723111561f5986dea985c1bc16b73e3e47649","nonce":"0x0000000000000000","number":"0xc2f1e6","parentBeaconBlockRoot":"0xfdcb206a49776709f5e909773f9f3cfb9457723a6eeb242149b84f5939befb83","parentHash":"0x4fe1b4a3b6cb54449b7f28417a0bf2fd75ad1ad6cd56c57ffd2bbe22f0db8ecb","receiptsRoot":"0x18a4e317a67eadcafbc7599dcc696993cc9ed34449b0319d4c3561a9633d0ebc","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x350","stateRoot":"0x07831c61b19940f6cf8575155f0b52e516068501406780bfeaf2fe205ad0dd0c","timestamp":"0x673cc51c","transactions":[{"blockHash":"0xffd62af222ed370d41449c1a75d0d9d3742316881f293dad3cc0d2a26326d9a8","blockNumber":"0xc2f1e6","from":"0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001","gas":"0xf4240","gasPrice":"0x0","hash":"0x00181298718a2be8eb9f490158497f8f91cbedf02cd74121f962691cf599799d","input":"0x440a5e2000001db0000d2730000000000000000100000000673cc4d000000000006c7ec80000000000000000000000000000000000000000000000000000000cc6aabdef0000000000000000000000000000000000000000000000000000000000000d3815c2f0b467f486146c9adf9e88710c122afba3ab16958784a50deedfd80be37200000000000000000000000019cc7073150d9f5888f09e0e9016d2a39667df14","nonce":"0xc2f1e7","to":"0x4200000000000000000000000000000000000015","transactionIndex":"0x0","value":"0x0","type":"0x7e","v":"0x0","r":"0x0","s":"0x0","sourceHash":"0xed6207fa816c9462ef72064ecfab60e0d375ebecdd6a4b01c46a30941d339b10","mint":"0x0","depositReceiptVersion":"0x1"}],"transactionsRoot":"0xa16461e422ad06c29b76af3559ce371335fff09d247096d3a5c2b24f0d6d9972","uncles":[],"withdrawals":[],"withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"}}

where the eip1559 parameters are:

elasticity: 6 or 60
denominator: 250

Node logs

ts=2024-12-03T09:47:10.721481793Z level=warn target=consensus::engine message="Bad block with hash" hash=0x636b3573d256c807e2e5245d815de748bb1381648088b62f69999b4dd099de5a header="Header { parent_hash: 0xffd62af222ed370d41449c1a75d0d9d3742316881f293dad3cc0d2a26326d9a8, ommers_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, beneficiary: 0x4200000000000000000000000000000000000011, state_root: 0x86eed9e2ce31741df59c7ee211f6a5c572b7293a5d12ae49b054c42aa310a5eb, transactions_root: 0x0fe5ed7db198d059c6c8cb3ba364699f94df57efc17a5d23eee5c38f6c46db60, receipts_root: 0x169042307b19c065650d24ba5163efc6ffd5bc9ce1e017cff429888784be9dd1, logs_bloom: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, difficulty: 0, number: 12775911, gas_limit: 30000000, gas_used: 43851, timestamp: 1732035870, extra_data: 0x00000000fa0000003c, mix_hash: 0x9ebe65dbf9004d5e78d08d476fc723111561f5986dea985c1bc16b73e3e47649, nonce: 0x0000000000000000, base_fee_per_gas: Some(254), withdrawals_root: Some(0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421), blob_gas_used: Some(0), excess_blob_gas: Some(0), parent_beacon_block_root: Some(0xfdcb206a49776709f5e909773f9f3cfb9457723a6eeb242149b84f5939befb83), requests_hash: None, target_blobs_per_block: None }"
ts=2024-12-03T09:47:10.721473438Z level=warn target=engine::tree message="Invalid block error on new payload" invalid_hash=0x636b3573d256c807e2e5245d815de748bb1381648088b62f69999b4dd099de5a invalid_number=12775911 validation_err="block base fee mismatch: got 254, expected 253"
ts=2024-12-03T09:47:10.721408401Z level=warn target=engine::tree message="Failed to validate header 0x636b3573d256c807e2e5245d815de748bb1381648088b62f69999b4dd099de5a against parent: block base fee mismatch: got 254, expected 253" block="SealedBlockWithSenders { block: SealedBlock { header: SealedHeader { hash: 0x636b3573d256c807e2e5245d815de748bb1381648088b62f69999b4dd099de5a, header: Header { parent_hash: 0xffd62af222ed370d41449c1a75d0d9d3742316881f293dad3cc0d2a26326d9a8, ommers_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, beneficiary: 0x4200000000000000000000000000000000000011, state_root: 0x86eed9e2ce31741df59c7ee211f6a5c572b7293a5d12ae49b054c42aa310a5eb, transactions_root: 0x0fe5ed7db198d059c6c8cb3ba364699f94df57efc17a5d23eee5c38f6c46db60, receipts_root: 0x169042307b19c065650d24ba5163efc6ffd5bc9ce1e017cff429888784be9dd1, logs_bloom: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, difficulty: 0, number: 12775911, gas_limit: 30000000, gas_used: 43851, timestamp: 1732035870, extra_data: 0x00000000fa0000003c, mix_hash: 0x9ebe65dbf9004d5e78d08d476fc723111561f5986dea985c1bc16b73e3e47649, nonce: 0x0000000000000000, base_fee_per_gas: Some(254), withdrawals_root: Some(0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421), blob_gas_used: Some(0), excess_blob_gas: Some(0), parent_beacon_block_root: Some(0xfdcb206a49776709f5e909773f9f3cfb9457723a6eeb242149b84f5939befb83), requests_hash: None, target_blobs_per_block: None } }, body: BlockBody { transactions: [TransactionSigned { hash: OnceLock(<uninit>), signature: PrimitiveSignature { y_parity: false, r: 0, s: 0 }, transaction: Deposit(TxDeposit { source_hash: 0x5852c8756ec14b0d84b527480eccdaf64dd222a8255486ce3b1fb37200f35138, from: 0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001, to: Call(0x4200000000000000000000000000000000000015), mint: None, value: 0, gas_limit: 1000000, is_system_transaction: false, input: 0x440a5e2000001db0000d2730000000000000000200000000673cc4d000000000006c7ec80000000000000000000000000000000000000000000000000000000cc6aabdef0000000000000000000000000000000000000000000000000000000000000d3815c2f0b467f486146c9adf9e88710c122afba3ab16958784a50deedfd80be37200000000000000000000000019cc7073150d9f5888f09e0e9016d2a39667df14 }) }], ommers: [], withdrawals: Some(Withdrawals([])) } }, senders: [0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001] }"

Platform(s)

Mac (Intel), Mac (Apple Silicon)

What version/commit are you on?

v1.1.2

What database version are you on?

not known

Which chain / network are you on?

Optimism sepolia devnet: 11155421

What type of node are you running?

Full via --full flag

What prune config do you use, if any?

None

If you've built Reth from source, provide the full command you used

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@mininny mininny added C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled labels Dec 4, 2024
@mininny mininny changed the title Holocene basefee calculation error Optimism Holocene basefee calculation error Dec 4, 2024
@mattsse
Copy link
Collaborator

mattsse commented Dec 4, 2024

thanks @mininny we indeed were missing one check in a consensus function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants