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

@@ -213,7 +213,7 @@ mod tests {
access_list.insert_address(Address::from(1));
access_list.insert_storage_key(Address::from(2), H256::from(3));
let mut access_list_call = access_list.clone();
let access_list_call = access_list.clone();
assert_eq!(true, access_list_call.contains_address(&Address::from(1)));
assert_eq!(
true,

View File

@@ -24,6 +24,10 @@ pub const EIP2929_COLD_ACCOUNT_ACCESS_COST: usize = 2600;
pub const EIP2929_WARM_STORAGE_READ_COST: usize = 100;
// Gas per sstore reset
pub const EIP2929_SSTORE_RESET_GAS: usize = 5000 - EIP2929_COLD_SLOAD_COST;
/// Gas per received storage key
pub const EIP2930_ACCESS_LIST_STORAGE_KEY_COST: usize = 1900;
/// Gas per received address
pub const EIP2930_ACCESS_LIST_ADDRESS_COST: usize = 2400;
/// Definition of the cost schedule and other parameterisations for the EVM.
#[derive(Debug)]
@@ -149,6 +153,8 @@ pub struct Schedule {
pub wasm: Option<WasmCosts>,
/// Enable EIP-2929 rules
pub eip2929: bool,
/// Enable EIP-2930 rules for optional access list transactions. it depends on EIP-2929
pub eip2930: bool,
}
/// Wasm cost table
@@ -295,6 +301,7 @@ impl Schedule {
keep_unsigned_nonce: false,
wasm: None,
eip2929: false,
eip2930: false,
}
}
@@ -343,6 +350,7 @@ impl Schedule {
schedule.eip1283 = true;
schedule.eip2929 = true;
schedule.eip2930 = true;
schedule.cold_sload_cost = EIP2929_COLD_SLOAD_COST;
schedule.cold_account_access_cost = EIP2929_COLD_ACCOUNT_ACCESS_COST;
@@ -421,6 +429,7 @@ impl Schedule {
keep_unsigned_nonce: false,
wasm: None,
eip2929: false,
eip2930: false,
}
}