AccessList in JSONRPC. And enabling github action tests (#255)

* Enabling github action tests
* Fix failing tests
* AccessList to Option in json
* failing rust example removed
* AccessList for jsonrpc
* Tx type as sequence, AccessList as type
This commit is contained in:
rakita
2021-02-08 14:55:03 +01:00
committed by GitHub
parent f40e198eb7
commit 6b4e56b214
22 changed files with 144 additions and 81 deletions

View File

@@ -24,7 +24,8 @@ use heapsize::HeapSizeOf;
use rlp::{self, DecoderError, Rlp, RlpStream};
use std::{convert::TryInto, ops::Deref};
pub type AccessList = Vec<(H160, Vec<H256>)>;
pub type AccessListItem = (H160, Vec<H256>);
pub type AccessList = Vec<AccessListItem>;
use super::TypedTxId;

View File

@@ -16,6 +16,7 @@
//! Transaction Id.
use ethereum_types::U64;
use serde_repr::*;
use std::convert::TryFrom;
@@ -34,6 +35,15 @@ impl TypedTxId {
_ => None,
}
}
#[allow(non_snake_case)]
pub fn from_U64_id(n: &U64) -> Option<Self> {
match n.0[0] {
0x0 => Some(Self::Legacy),
0x1 => Some(Self::AccessList),
_ => None,
}
}
}
impl Default for TypedTxId {

View File

@@ -38,20 +38,6 @@ pub struct TypedTransactionView<'a> {
impl<'a> TypedTransactionView<'a> {
/// Creates new view onto valid transaction rlp.
/// Use the `view!` macro to create this view in order to capture debugging info.
///
/// # Example
///
/// ```
/// #[macro_use]
/// extern crate common_types as types;
///
/// use types::views::{TransactionView};
///
/// fn main() {
/// let bytes : &[u8] = &[];
/// let tx_view = view!(TransactionView, bytes);
/// }
/// ```
pub fn new(rlp: ViewRlp<'a>) -> TypedTransactionView<'a> {
let transaction_type = Self::extract_transaction_type(&rlp.rlp);
TypedTransactionView {