-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
eth_getLogs should not show removed events in some cases #12584
Comments
This is the kind of thing that makes me think that it's dealing with specific block hashes: https://github.com/ethereum/go-ethereum/blob/16bf471151a2e3c65499e0e9ae913e31d634826e/eth/filters/filter.go#L232-L236 That's for all pathways where it's gathering logs other than by specific block hash. For each block number, it fetches the blocks from the backend as well as the expected "header" information for that block, then filters and merges that data to form the final log output. For specific block hashes it uses |
Further notes on this:
|
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: #12584
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: #12584
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: #12584
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: filecoin-project#12584
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: #12584
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: #12584
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: #12584
* subscribe-type calls always wants future reverts but only historical reverts when a tipset is specified * get-type calls only want reverts when a tipset is specified Add a new Fill() method to avoid the unnecessary install + remove step for get- type calls. Closes: filecoin-project#12584
TheGraph seems to have an expectation that eth_getLogs doesn't return reverted events, at least past a particular point (it recommends running against a finalised chain for this reason I believe). So, it's running into trouble with a response like this for an
eth_getLogs
with{ "fromBlock":"0x3E2831", "toBlock":"0x3E2831" }
on a node that experienced a reorg at epoch 4073521 which resulted in reverted logs:JSON log output
The first event has
"removed": true
and the remainder have the expected"removed": false
. It then sees 2 different block hashes:0x9bdcfa3dcf978b56901e94e2b6ac6e220d27f957e7113d614e522a47e78496cb
and the canonical0x94b6432ae5fa4183633d1f4a40de651e09492b5d1fa6bbb707db340899e81814
and it seems to try reconciling or at least following them somehow and gets confused.I think a thorough client should be filtering these out, regardless, but we are likely bumping up against an Ethereum expectation that we are not properly handling. It's a bit tricky to figure out the precise go-ethereum behaviour from the code (I guess I could spend more time digging), but my guess (slightly educated by the code) is that when you ask for a block by a hash then it fetches precisely those, otherwise when you fetch by a block number (or range of numbers) it gets the canonical hashes for those ranges and works with that. i.e. it does a translation from block number (including the specials,
"finalized"
,"safe"
, etc.) to block hash and works with that. The block hash in this case is the currently known canonical hash for that block number, regardless of how far back in history it is.Given that, I think the expected behaviour is:
"blockHash":"0x..."
and that tipset is reverted, return those events and they will all be"removed":true
."removed":false
events, either by filtering them at the source or filtering before returning to the user.Additionally worth checking:
eth_getBlockReceipts
should be OK I think because we re-execute tipsets to extract the events instead of using the indexeth_*filter
APIs are likely impacted because they are essentially the same, need to check those to make sure what action, if any needs to be taken.eth_subscribe
is a live view, I think it's expected that these flip-flop for re-orgsGetActorEventsRaw
andSubscribeActorEventsRaw
should probably get the same treatment, the logic holds for them too I think, if you ask for an epoch then only give the canonical chain tipset for that epoch.Ref: graphprotocol/graph-node#5661
The text was updated successfully, but these errors were encountered: