Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql: add storage slots to access list #23650

Merged
merged 2 commits into from
Sep 28, 2021
Merged

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Sep 28, 2021

I'm not really certain why it didn't work previously, but for some reason, this fixes it.

$ cat query.json 

{"query":"query getAccessList($blockNumber: Long = 5000628) { block(number: $blockNumber) {  transactionAt(index: 71) { accessList { address storageKeys } }  }}","variables":null,"operationName":"getAccessList"}

Without this PR:

curl -X POST 'http://localhost:8545/graphql' -H 'Content-Type: application/json'  --data @query.json | jq . 
{
  "data": {
    "block": {
      "transactionAt": {
        "accessList": [
          {
            "address": "0x57b96462b8d236cfec75dc9c0e0dcee20a22a7dd",
            "storageKeys": []
          },
          {
            "address": "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6",
            "storageKeys": []
          },
          {
            "address": "0x4774be14b1e81eb9f78f5d58b061f796fb2c744f",
            "storageKeys": []
          }
        ]
      }
    }
  }
}

With this PR:

$ curl -X POST 'http://localhost:8545/graphql' -H 'Content-Type: application/json'  --data @query.json | jq . 
{
  "data": {
    "block": {
      "transactionAt": {
        "accessList": [
          {
            "address": "0x57b96462b8d236cfec75dc9c0e0dcee20a22a7dd",
            "storageKeys": [
              "0x0000000000000000000000000000000000000000000000000000000000000006",
              "0x0000000000000000000000000000000000000000000000000000000000000007",
              "0x0000000000000000000000000000000000000000000000000000000000000008",
              "0x0000000000000000000000000000000000000000000000000000000000000009",
              "0x000000000000000000000000000000000000000000000000000000000000000a",
              "0x000000000000000000000000000000000000000000000000000000000000000c"
            ]
          },
          {
            "address": "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6",
            "storageKeys": []
          },
          {
            "address": "0x4774be14b1e81eb9f78f5d58b061f796fb2c744f",
            "storageKeys": []
          }
        ]
      }
    }
  }
}

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

al := al would also fix it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be even better to change the type of AccessTuple.storageKeys to non-pointer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, PTAL

@fjl fjl changed the title graphql: add storage slots to access list, fixes #23640 graphql: add storage slots to access list Sep 28, 2021
@fjl fjl merged commit 42bc194 into ethereum:master Sep 28, 2021
@fjl fjl removed the status:triage label Sep 28, 2021
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Sep 28, 2021
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this pull request Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Graphql service return empty accessList's storageKeys on goerli network data where it should not
4 participants