mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
chore(primitives): Compact TxType Unit Table Test (#5325)
This commit is contained in:
@@ -116,6 +116,29 @@ impl Compact for TxType {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_txtype_to_compat() {
|
||||
let cases = vec![
|
||||
(TxType::Legacy, 0, vec![]),
|
||||
(TxType::EIP2930, 1, vec![]),
|
||||
(TxType::EIP1559, 2, vec![]),
|
||||
(TxType::EIP4844, 3, vec![EIP4844_TX_TYPE_ID]),
|
||||
#[cfg(feature = "optimism")]
|
||||
(TxType::DEPOSIT, 3, vec![DEPOSIT_TX_TYPE_ID]),
|
||||
];
|
||||
|
||||
for (tx_type, expected_identifier, expected_buf) in cases {
|
||||
let mut buf = vec![];
|
||||
let identifier = tx_type.to_compact(&mut buf);
|
||||
assert_eq!(
|
||||
identifier, expected_identifier,
|
||||
"Unexpected identifier for TxType {:?}",
|
||||
tx_type
|
||||
);
|
||||
assert_eq!(buf, expected_buf, "Unexpected buffer for TxType {:?}", tx_type);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_txtype_from_compact() {
|
||||
let cases = vec![
|
||||
|
||||
Reference in New Issue
Block a user