mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
* chore: port over remaining types from ethp2p https://github.com/Rjected/ethp2p/ * replace fastrlp with reth_rlp * use correct type for tx messages * encoding / decoding still todo * derive Default for AccessList * export receipts * also add Hash to more types * fix receipts tests * remove unused receipts test imports * add convenience methods on transaction * add block body * move blockbody to eth-wire, uncomment wire type * uncomment rest of messages * TODO: refactor tests and make tests pass * use U128 instead of Uint for td * expose wire types * use reth_eth_wire instead of ethp2p * expose Signature * refactor pooled transaction tests * fix hash calculation * do not hash the entire buffer * uncomment block test and make clippy happy * module-level documentation for message types * apply a clippy fix * cargo fmt * actually make clippy happy * use H256 instead of [u8; 32] * use partition in split_transaction_by_hashes instead of peekable Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
32 lines
1.2 KiB
Rust
32 lines
1.2 KiB
Rust
//! Decoding tests for [`NewBlock`]
|
|
use reth_eth_wire::NewBlock;
|
|
use reth_rlp::Decodable;
|
|
use std::{fs, path::PathBuf};
|
|
|
|
#[test]
|
|
fn decode_new_block_network() {
|
|
let network_data_path =
|
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/new_block_network_rlp");
|
|
let data = fs::read_to_string(network_data_path).expect("Unable to read file");
|
|
let hex_data = hex::decode(data.trim()).unwrap();
|
|
let _txs = NewBlock::decode(&mut &hex_data[..]).unwrap();
|
|
}
|
|
|
|
#[test]
|
|
fn decode_new_block_network_bsc_one() {
|
|
let network_data_path =
|
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/bsc_new_block_network_one");
|
|
let data = fs::read_to_string(network_data_path).expect("Unable to read file");
|
|
let hex_data = hex::decode(data.trim()).unwrap();
|
|
let _txs = NewBlock::decode(&mut &hex_data[..]).unwrap();
|
|
}
|
|
|
|
#[test]
|
|
fn decode_new_block_network_bsc_two() {
|
|
let network_data_path =
|
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/bsc_new_block_network_two");
|
|
let data = fs::read_to_string(network_data_path).expect("Unable to read file");
|
|
let hex_data = hex::decode(data.trim()).unwrap();
|
|
let _txs = NewBlock::decode(&mut &hex_data[..]).unwrap();
|
|
}
|