TypedTransaction (EIP-2718) and Optional access list (EIP-2930) (#135)

This commit is contained in:
rakita
2020-12-10 16:42:05 +01:00
committed by draganrakita
parent 1bce9fa76d
commit fb975731bb
83 changed files with 1858 additions and 805 deletions

View File

@@ -18,12 +18,14 @@
use std::{io::Write, ops};
use common_types::{engines::epoch::Transition as EpochTransition, receipt::Receipt, BlockNumber};
use common_types::{
engines::epoch::Transition as EpochTransition, receipt::TypedReceipt, BlockNumber,
};
use ethereum_types::{H256, H264, U256};
use heapsize::HeapSizeOf;
use kvdb::PREFIX_LEN as DB_PREFIX_LEN;
use rlp;
use rlp_derive::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
use rlp_derive::{RlpDecodable, RlpEncodable};
use crate::db::Key;
@@ -235,15 +237,27 @@ impl HeapSizeOf for TransactionAddress {
}
/// Contains all block receipts.
#[derive(Clone, RlpEncodableWrapper, RlpDecodableWrapper)]
#[derive(Clone)]
pub struct BlockReceipts {
/// Block receipts
pub receipts: Vec<Receipt>,
pub receipts: Vec<TypedReceipt>,
}
impl rlp::Encodable for BlockReceipts {
fn rlp_append(&self, s: &mut rlp::RlpStream) {
TypedReceipt::rlp_append_list(s, &self.receipts);
}
}
impl rlp::Decodable for BlockReceipts {
fn decode(rlp: &rlp::Rlp) -> Result<Self, rlp::DecoderError> {
Ok(BlockReceipts::new(TypedReceipt::decode_rlp_list(rlp)?))
}
}
impl BlockReceipts {
/// Create new block receipts wrapper.
pub fn new(receipts: Vec<Receipt>) -> Self {
pub fn new(receipts: Vec<TypedReceipt>) -> Self {
BlockReceipts { receipts: receipts }
}
}