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/JSON-RPC logs regression between 1.10.21 & 1.10.22 #25583

Closed
SLoeuillet opened this issue Aug 24, 2022 · 11 comments · Fixed by #25612 or #25745
Closed

GraphQL/JSON-RPC logs regression between 1.10.21 & 1.10.22 #25583

SLoeuillet opened this issue Aug 24, 2022 · 11 comments · Fixed by #25612 or #25745
Labels

Comments

@SLoeuillet
Copy link

SLoeuillet commented Aug 24, 2022

System information

Geth
Version: 1.10.22-stable
Git Commit: 2de49b0
Architecture: amd64
Go Version: go1.18.5
Operating System: linux
GOPATH=
GOROOT=go

Archive node

Expected behaviour

Doing a complex GraphQL query returns correct data from a block, like in 1.10.21

Actual behaviour

Too much data (logs unrelated to current block)

Steps to reproduce the behaviour

Going to GraphQL UI : http://xxxxx:8545/graphql/ui

Type the following query :

{
  block(number: 15401505) {
    number
    transactions {
      logs {
        account {
          address
        }
      }
    }
  }
}

More details

That block on etherscan : https://etherscan.io/block/15401505

On a 1.10.22 node, this query returns 257386 lines, which is a bit too much (could depend on when you run the request)
On a 1.10.21 node, this query returns 2209 lines, which seems more in the norm

@SLoeuillet
Copy link
Author

createdContract : 163 on both sides
account : 51345 (1.10.22) vs 315 (1.10.21)

@SLoeuillet
Copy link
Author

I suppose it is linked to #25459

@SLoeuillet SLoeuillet changed the title GraphQL regression between 1.10.21 & 1.10.22 GraphQL/JSON-RPC logs regression between 1.10.21 & 1.10.22 Aug 24, 2022
@ryanschneider
Copy link
Contributor

@s1na FYI this regression seems unique to the GraphQL interface, I'm not seeing the same issue w/ eth_getLogs, I still get 316 entries w/ 1.10.23:

> eth.getLogs({"fromBlock":"0xEB0221", "toBlock":"0xEB0221"}).length
315

If I had to guess, I'd say the issue is that the block(number: ) constraint is no longer ends up setting filter.block to the block's hash, but after a quick look at the code I don't see an obvious spot where that happens, but it's been a long time since I've looked at the GraphQL code.

@s1na
Copy link
Contributor

s1na commented Aug 26, 2022

Hey, thanks for reporting it. The problem was that after my changes graphql was returning all of the block logs for each transaction, blowing up the response. If you get a chance to try the linked PR, the issue should be resolved.

@ryanschneider thanks for checking JSON-RPC. After finding the bug I'm confident it only happens for graphql queries that query logs of a transaction. I modified code there so it also utilizes the log cache we added but forgot a check.

@SLoeuillet
Copy link
Author

I would build and test it on monday morning. Thanks for the fix

@SLoeuillet
Copy link
Author

@s1na fix tested on my personal node, works perfectly, thanks

@yiteng-guo
Copy link

@s1na I'm still seeing the regression on my end (build on d30e39b). I ran the following graphql

{
  block(hash: "0xfd29823bf38d3bab5877d4ffeae448755b9da47c7e4e6fac6988e0bed043abd6") {
    number
    transactions {
      hash
      logs {
        account {
          address
        }
        topics
      }
    }
  }
}

no logs returns for 0xe7ac6b6b01f5be91d3dbaf797059e5a18117b25f6960be1b83cefa538dffc330 but this tx does have log https://etherscan.io/tx/0xe7ac6b6b01f5be91d3dbaf797059e5a18117b25f6960be1b83cefa538dffc330#eventlog

@SLoeuillet
Copy link
Author

I confirm that with that very same version d30e39b , logs is sometimes empty, sometimes not

@SLoeuillet
Copy link
Author

geth 1.10.21 :
geth00_15520795.log

geth 1.11.0 d30e39b :
geth01_15520795.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants
@ryanschneider @s1na @SLoeuillet @yiteng-guo and others