Skip to content

Commit

Permalink
Add type 1 and 2 txn for easy RLP encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Sep 26, 2023
1 parent 916ce0d commit 50e174a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions evm/src/generation/mpt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ impl Default for AccountRlp {
}
}

#[derive(RlpEncodable, RlpDecodable, Debug)]
pub struct AccessListItemRlp {
pub address: Address,
pub storage_keys: Vec<U256>,
}

#[derive(RlpEncodable, RlpDecodable, Debug)]
pub struct LegacyTransactionRlp {
pub nonce: U256,
Expand All @@ -46,6 +52,37 @@ pub struct LegacyTransactionRlp {
pub s: U256,
}

#[derive(RlpEncodable, RlpDecodable, Debug)]
pub struct AccessListTransactionRlp {
pub chain_id: u64,
pub nonce: U256,
pub gas_price: U256,
pub gas: U256,
pub to: Address,
pub value: U256,
pub data: Bytes,
pub access_list: Vec<AccessListItemRlp>,
pub y_parity: U256,
pub r: U256,
pub s: U256,
}

#[derive(RlpEncodable, RlpDecodable, Debug)]
pub struct FeeMarketTransactionRlp {
pub chain_id: u64,
pub nonce: U256,
pub max_priority_fee_per_gas: U256,
pub max_fee_per_gas: U256,
pub gas: U256,
pub to: Address,
pub value: U256,
pub data: Bytes,
pub access_list: Vec<AccessListItemRlp>,
pub y_parity: U256,
pub r: U256,
pub s: U256,
}

#[derive(RlpEncodable, RlpDecodable, Debug)]
pub struct LogRlp {
pub address: Address,
Expand Down

0 comments on commit 50e174a

Please sign in to comment.