Skip to content

Commit

Permalink
fix: require storageKeys value broken bincode serialization from allo…
Browse files Browse the repository at this point in the history
…y-rs#955 (alloy-rs#1058)

* fix: broken bincode serialization from alloy-rs#955

* remove optional in alloy-serde

* resolve matt's comments

* get rid of broken test

* fix cargo fmt

* enforce storage key

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
2 people authored and j75689 committed Aug 1, 2024
1 parent 95f1bb6 commit c7a9311
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions crates/eips/src/eip2930.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use alloc::vec::Vec;
use alloy_primitives::{Address, B256, U256};
use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
use core::{mem, ops::Deref};

/// A list of addresses and storage keys that the transaction plans to access.
/// Accesses outside the list are possible, but become more expensive.
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, RlpDecodable, RlpEncodable)]
Expand All @@ -19,8 +18,6 @@ pub struct AccessListItem {
/// Account addresses that would be loaded at the start of execution
pub address: Address,
/// Keys of storage that would be loaded at the start of execution
// In JSON, we have to accept `null` for storage key, which is interpreted as an empty array.
#[cfg_attr(feature = "serde", serde(deserialize_with = "alloy_serde::null_as_default"))]
pub storage_keys: Vec<B256>,
}

Expand Down Expand Up @@ -146,24 +143,8 @@ pub struct AccessListWithGasUsed {

#[cfg(all(test, feature = "serde"))]
mod tests {
use serde_json::json;

use super::*;

#[test]
fn access_list_null_storage_keys() {
let json = json!([
{
"address": "0x81b7bdd5b89c90b63f604fc7cdd17035cb939707",
"storageKeys": null,
}
]);

let access_list = serde_json::from_value::<AccessList>(json).unwrap();
assert_eq!(access_list.len(), 1);
assert_eq!(access_list[0].storage_keys, Vec::<B256>::default());
}

#[test]
fn access_list_serde() {
let list = AccessList(vec![
Expand Down

0 comments on commit c7a9311

Please sign in to comment.