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

Ensure pre-cancun payload does not have blob transactions #4670

Closed
1 task done
Tracked by #4812
Rjected opened this issue Sep 19, 2023 · 2 comments · Fixed by #4779 or #4845
Closed
1 task done
Tracked by #4812

Ensure pre-cancun payload does not have blob transactions #4670

Rjected opened this issue Sep 19, 2023 · 2 comments · Fixed by #4779 or #4845
Assignees
Labels
A-consensus Related to the consensus engine A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior

Comments

@Rjected
Copy link
Member

Rjected commented Sep 19, 2023

Describe the bug

The hive pyspec test cancun/eip4844_blobs/blob_txs/blob_type_tx_pre_fork/001-fork=ShanghaiToCancunAtTime15k-one_blob_tx fails because we do not return INVALID_PARAMS when processing a new payload that is pre-cancun and has blob transactions:

starting client with Engine API.
>> (39bd7642) {"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0x0",true]}
<< (39bd7642) {"jsonrpc":"2.0","result":{"hash":"0xdf0226638d1c7c0d615b99312f146907d55bb74ef58b1d97587661f20c9929cf","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0x173839ea3b84b69affb8b1547337a7ea366e2087eb29c0fd7a1837fa00225b3f","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x0","number":"0x0","gasLimit":"0x16345785d8a0000","gasUsed":"0x0","timestamp":"0x0","extraData":"0x00","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","baseFeePerGas":"0x7","withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","totalDifficulty":"0x0","uncles":[],"transactions":[],"size":"0x220","withdrawals":[]},"id":1}
>> (39bd7642) {"jsonrpc":"2.0","id":1,"method":"engine_newPayloadV2","params":[{"parentHash":"0xdf0226638d1c7c0d615b99312f146907d55bb74ef58b1d97587661f20c9929cf","feeRecipient":"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba","stateRoot":"0x173839ea3b84b69affb8b1547337a7ea366e2087eb29c0fd7a1837fa00225b3f","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","prevRandao":"0x0000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x1","gasLimit":"0x16345785d8a0000","gasUsed":"0x0","timestamp":"0xc","extraData":"0x","baseFeePerGas":"0x7","blockHash":"0xddb94557fe85c2e7eef0534ae3bfd879b6fbeb56f2da5fd894c9ccafbbfb3078","transactions":["0x03f885018080078252089400000000000000000000000000000000000001000180c001e1a0010000000000000000000000000000000000000000000000000000000000000001a0a8f4757869fbb831ba4ed3a7c8f868b0e2e0c1eda97937aab035560fffdedf3ca019d9b041540e3d6f5f56dc29deb8834a08171e92037cf567b922357e70f8e54a"],"withdrawals":[]}]}
<< (39bd7642) {"jsonrpc":"2.0","result":{"status":"INVALID","latestValidHash":null,"validationError":"blockhash mismatch, want 0xddb9…3078, got 0xf658…a833"},"id":1}
fixture expected rpc error code: -32602 but none was returned from client in test cancun/eip4844_blobs/blob_txs/blob_type_tx_pre_fork/001-fork=ShanghaiToCancunAtTime15k-one_blob_tx
failing tests:
reth/cancun/eip4844_blobs/blob_txs/blob_type_tx_pre_fork/001-fork=ShanghaiToCancunAtTime15k-one_blob_tx: fixture expected rpc error code: -32602 but none was returned from client

We may need to change how we use try_into_sealed_block and change ensure_well_formed_payload to support this. We will need to add a variant to BeaconOnNewPayloadError that maps to INVALID_PARAMS_CODE:

EngineApiError::NewPayload(ref err) => match err {
BeaconOnNewPayloadError::Internal(_) |
BeaconOnNewPayloadError::EngineUnavailable => INTERNAL_ERROR_CODE,
},
// Any other server error

We should probably verify this property after transactions are parsed, which is why I suggest doing this in ensure_well_formed_payload. We could also just check the EIP-2718 prefix before they're decoded, when they are still stored as Bytes in the ExecutionPayload:

pub block_hash: H256,
pub transactions: Vec<Bytes>,
}

But doing this after decoding seems like the best solution.

Steps to reproduce

Run hive:

./hive --client reth --sim "pyspec" --sim.limit "/cancun/eip4844_blobs/blob_txs/blob_type_tx_pre_fork/001-fork=ShanghaiToCancunAtTime15k-one_blob_tx"

Node logs

No response

Platform(s)

No response

What version/commit are you on?

No response

What database version are you on?

No response

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
@Rjected Rjected added C-bug An unexpected or incorrect behavior A-rpc Related to the RPC implementation A-consensus Related to the consensus engine labels Sep 19, 2023
@mattsse
Copy link
Collaborator

mattsse commented Sep 19, 2023

I suggest doing this in ensure_well_formed_payload

sgtm!

@Rjected
Copy link
Member Author

Rjected commented Sep 27, 2023

Reviving this issue as the test was changed to require an INVALID response, so we now fail it
ethereum/execution-spec-tests@47cf407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Related to the consensus engine A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior
Projects
Archived in project
2 participants