impl fastrlp traits for AccessList (#1456)

* impl fastrlp traits for AccessListItem
 * impl Hash for AccessListItem
 * impl Hash for AccessList
This commit is contained in:
Dan Cline 2022-07-06 14:44:07 -04:00 committed by GitHub
parent dc01d0c9ed
commit bc9d4b48b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -2,6 +2,10 @@ use super::{eip2718::TypedTransaction, normalize_v};
use crate::types::{ use crate::types::{
Address, Bytes, Signature, SignatureError, Transaction, TransactionRequest, H256, U256, U64, Address, Bytes, Signature, SignatureError, Transaction, TransactionRequest, H256, U256, U64,
}; };
use fastrlp::{
RlpDecodable as FastRlpDecodable, RlpDecodableWrapper as FastRlpDecodableWrapper,
RlpEncodable as FastRlpEncodable, RlpEncodableWrapper as FastRlpEncodableWrapper,
};
use rlp::{Decodable, RlpStream}; use rlp::{Decodable, RlpStream};
use rlp_derive::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper}; use rlp_derive::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -18,10 +22,13 @@ const NUM_EIP2930_FIELDS: usize = 8;
Clone, Clone,
PartialEq, PartialEq,
Eq, Eq,
Hash,
Serialize, Serialize,
Deserialize, Deserialize,
RlpEncodableWrapper, RlpEncodableWrapper,
RlpDecodableWrapper, RlpDecodableWrapper,
FastRlpEncodableWrapper,
FastRlpDecodableWrapper,
)] )]
pub struct AccessList(pub Vec<AccessListItem>); pub struct AccessList(pub Vec<AccessListItem>);
@ -51,7 +58,18 @@ impl TransactionRequest {
/// Access list item /// Access list item
#[derive( #[derive(
Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize, RlpEncodable, RlpDecodable, Debug,
Default,
Clone,
PartialEq,
Eq,
Hash,
Serialize,
Deserialize,
RlpEncodable,
RlpDecodable,
FastRlpEncodable,
FastRlpDecodable,
)] )]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct AccessListItem { pub struct AccessListItem {