test: rm reth-pirmitives block tests (#13850)

This commit is contained in:
Matthias Seitz
2025-01-18 13:45:44 +01:00
committed by GitHub
parent 264105e177
commit cef0c927c9
2 changed files with 22 additions and 198 deletions

View File

@ -908,7 +908,9 @@ pub mod serde_bincode_compat {
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::{constants::LEGACY_TX_TYPE_ID, Transaction as _, TxEip1559, TxLegacy};
use alloy_consensus::{
constants::LEGACY_TX_TYPE_ID, Block, Transaction as _, TxEip1559, TxLegacy,
};
use alloy_eips::{
eip2718::{Decodable2718, Encodable2718},
eip7702::constants::SECP256K1N_HALF,
@ -944,6 +946,25 @@ mod tests {
assert!(recover_signer_unchecked(signature, hash).is_some());
}
#[test]
fn encode_decode_raw_block() {
let bytes = hex!("f90288f90218a0fe21bb173f43067a9f90cfc59bbb6830a7a2929b5de4a61f372a9db28e87f9aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a061effbbcca94f0d3e02e5bd22e986ad57142acabf0cb3d129a6ad8d0f8752e94a0d911c25e97e27898680d242b7780b6faef30995c355a2d5de92e6b9a7212ad3aa0056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008003834c4b408252081e80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842806be9da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f869f86702842806be9e82520894658bdf435d810c91414ec09147daa6db624063798203e880820a95a040ce7918eeb045ebf8c8b1887ca139d076bda00fa828a07881d442a72626c42da0156576a68e456e295e4c9cf67cf9f53151f329438916e0f24fc69d6bbb7fbacfc0c0");
let bytes_buf = &mut bytes.as_ref();
let block = Block::<TransactionSigned>::decode(bytes_buf).unwrap();
let mut encoded_buf = Vec::with_capacity(bytes.len());
block.encode(&mut encoded_buf);
assert_eq!(bytes[..], encoded_buf);
}
#[test]
fn empty_block_rlp() {
let body = alloy_consensus::BlockBody::<TransactionSigned>::default();
let mut buf = Vec::new();
body.encode(&mut buf);
let decoded = alloy_consensus::BlockBody::decode(&mut buf.as_slice()).unwrap();
assert_eq!(body, decoded);
}
#[test]
fn test_decode_empty_typed_tx() {
let input = [0x80u8];