From a60e7422a2c83e4d3c5f4ada33b1a2bbadf7ffb9 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 28 Sep 2021 09:37:23 +0200 Subject: [PATCH 1/2] graphql: add storage slots to access list, fixes #23640 --- graphql/graphql.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graphql/graphql.go b/graphql/graphql.go index 4dd96c4b9db1..a36f589c7a98 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -440,9 +440,13 @@ func (t *Transaction) AccessList(ctx context.Context) (*[]*AccessTuple, error) { accessList := tx.AccessList() ret := make([]*AccessTuple, 0, len(accessList)) for _, al := range accessList { + var sKeys []common.Hash + for _, h := range al.StorageKeys { + sKeys = append(sKeys, h) + } ret = append(ret, &AccessTuple{ address: al.Address, - storageKeys: &al.StorageKeys, + storageKeys: &sKeys, }) } return &ret, nil From 7752cc335a640ac41f7346f4442c5df829143630 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 28 Sep 2021 11:09:31 +0200 Subject: [PATCH 2/2] graphql: convert storage keys to non-nullable list --- graphql/graphql.go | 10 +++------- graphql/schema.go | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/graphql/graphql.go b/graphql/graphql.go index a36f589c7a98..0da9faa95bc5 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -158,14 +158,14 @@ func (l *Log) Data(ctx context.Context) hexutil.Bytes { // AccessTuple represents EIP-2930 type AccessTuple struct { address common.Address - storageKeys *[]common.Hash + storageKeys []common.Hash } func (at *AccessTuple) Address(ctx context.Context) common.Address { return at.address } -func (at *AccessTuple) StorageKeys(ctx context.Context) *[]common.Hash { +func (at *AccessTuple) StorageKeys(ctx context.Context) []common.Hash { return at.storageKeys } @@ -440,13 +440,9 @@ func (t *Transaction) AccessList(ctx context.Context) (*[]*AccessTuple, error) { accessList := tx.AccessList() ret := make([]*AccessTuple, 0, len(accessList)) for _, al := range accessList { - var sKeys []common.Hash - for _, h := range al.StorageKeys { - sKeys = append(sKeys, h) - } ret = append(ret, &AccessTuple{ address: al.Address, - storageKeys: &sKeys, + storageKeys: al.StorageKeys, }) } return &ret, nil diff --git a/graphql/schema.go b/graphql/schema.go index 811c11f6cd06..dfd094a42043 100644 --- a/graphql/schema.go +++ b/graphql/schema.go @@ -72,7 +72,7 @@ const schema string = ` #EIP-2718 type AccessTuple{ address: Address! - storageKeys : [Bytes32!] + storageKeys : [Bytes32!]! } # Transaction is an Ethereum transaction.