You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: payload.rs
    path of file: ./repos/reth/crates/rpc/rpc-engine-api/tests/it
    
    the code of the file until where you have to start completion: //! Some payload tests

use alloy_rlp::{Decodable, Error as RlpError};
use assert_matches::assert_matches;
use reth_interfaces::test_utils::generators::{
    self, random_block, random_block_range, random_header, Rng,
};
use reth_primitives::{
    bytes::{Bytes, BytesMut},
    proofs, Block, SealedBlock, TransactionSigned, Withdrawals, B256, U256,
};
use reth_rpc_types::engine::{
    ExecutionPayload, ExecutionPayloadBodyV1, ExecutionPayloadV1, PayloadError,
};
use reth_rpc_types_compat::engine::payload::{
    convert_standalone_withdraw_to_withdrawal, convert_to_payload_body_v1, try_block_to_payload,
    try_block_to_payload_v1, try_into_sealed_block, try_payload_v1_to_block,
};

fn transform_block<F: FnOnce(Block) -> Block>(src: S
    
fn payload_validation() {
    let mut rng = generators::rng();
    let parent = rng.gen();
    let block = random_block(&mut rng, 100, Some(parent), Some(3), Some(0));

    // Valid extra data
    let block_with_valid_extra_data = transform_block(block.clone(), |mut b| {
        b.header.extra_data = BytesMut::zeroed(32).freeze().into();
        b
    });

    assert_matches!(try_into_sealed_block(block_with_valid_extra_data, None), Ok(_));

    // Invalid extra data
    let block_with_invalid_extra_data: Bytes = BytesMut::zeroed(33).freeze();
    let invalid_extra_data_block = transform_block(block.clone(), |mut b| {
        b.header.extra_data = block_with_invalid_extra_data.clone().into();
        b
    });
    assert_matches!(

        try_into_sealed_block(invalid_extra_data_block,None),
        Err(PayloadError::ExtraData(data)) if data == block_with_invalid_extra_data
    );

    // Zero base fee
    let block_with_zero_base_fee = transform_block(block.clone(), |mut b| {
        b.header.base_fee_per_gas = Some(0);
        b
    });
    assert_matches!(

        try_into_sealed_block(block_with_zero_base_fee,None),
        Err(PayloadError::BaseFee(val)) if val.is_zero()
    );

    // Invalid encoded transactions
    let mut payload_with_invalid_txs: ExecutionPayloadV1 = try_block_to_payload_v1(block.clone());

    payload_with_invalid_txs.transactions.iter_mut().for_each(|tx| {
        *tx = Bytes::new().into();
    });
    let payload_with_invalid_txs = try_payload_v1_to_block(payload_with_invalid_txs);
    assert_matches!(payload_with_invalid_txs, Err(PayloadError::Decode(RlpError::InputTooShort)));

    // Non empty ommers
    let block_with_ommers = transform_block(block.clone(), |mut b| {
        b.ommers.push(random_header(&mut rng, 100, None).unseal());
        b
    });
    assert_matches!(
        try_into_sealed_block(block_with_ommers.clone(),None),

        Err(PayloadError::BlockHash { consensus, .. })
            if consensus == block_with_ommers.block_hash()
    );

    // None zero difficulty
    let block_with_difficulty = transform_block(block.clone(), |mut b| {
        b.header.difficulty = U256::from(1);
        b
    });
    assert_matches!(
        try_into_sealed_block(block_with_difficulty.clone(),None),
        Err(PayloadError::BlockHash { consensus, .. }) if consensus == block_with_difficulty.block_hash()

    );

    // None zero nonce
    let block_with_nonce = transform_block(block.clone(), |mut b| {
        b.header.nonce = 1;
        b
    });
    assert_matches!(
        try_into_sealed_block(block_with_nonce.clone(),None),
        Err(PayloadError::BlockHash { consensus, .. }) if consensus == block_with_nonce.block_hash()

    );

    // Valid block
    let valid_block = block;
    assert_matches!(TryInto::<SealedBlock>::try_into(valid_block), Ok(_));
}