attestantio/go-eth2-client

ValidatorsProvider.Validators returns wrong 404 errors - bug?

Closed this issue · 4 comments

Thanks for great work!

Now the problem: After deploying my project, I've noticed that ValidatorsProvider.Validators call returns a lot of 404 errors. The input argument is like:

opts := &api.ValidatorsOpts{
		Common: api.CommonOpts{
			Timeout: time.Second * time.Duration(cfg.ValidatorsTimeoutSeconds),
		},
		State:   stateID,
		Indices: nil,
		PubKeys: validatorPubKeys,
	}

Where stateID is a slot number (i.e. "8718143"), while validatorPubKeys contains public key slice of variable length (I've tried with up to 1,500 keys). The client communicates with a Lighthouse node, which is fully synced, and it definitely includes history long before the requested slot ("8718143"). Also, the instance reports finalized epoch (via EventsProvider) that is significantly after the requested slot. In short: the requested slot is definitely contained by the server.

When it comes to public keys, almost all (if not all) of them were active in this moment in time (slot 8718143).

Based on everything said, the client should not return 404; it should either return the data, or some other error if there's one. But it does, and it does it a lot. The question is in what circumstances 404 errors are returned, and how we should handle them?

Just to mention: I'm able to get the data manually by using curl and invoking the same endpoint on the same instance.

Thanks!

Please can you run the client with trace logging and send an example log where it returns a 404 that it shouldn't? That should help me to understand the issue.

I will provide asap.

Meanwhile, is there any documentation about 404 errors? What they should mean in this particular call? For example, if I made call for a certain slot and list of validator public keys, as in my original post above, and I get 404 how to interpret it? To be more precise:

  • Does it strictly mean that requested state ID (slot number) is not found, or it may also mean that state ID is found, but some/all validators are not?
  • If I request 100 validators and it turns out that 10 of them cannot be found, will I get 404?

Thanks!

The official specification is at https://ethereum.github.io/beacon-APIs/#/Beacon/getStateValidators however it may not define all situations, and not all consensus nodes will follow the spec perfectly. Ideally the consensus node will return 404 if the state cannot be found, and apart from that will return an array of some sort, but it's the type of thing that would need to be tested against all implementations to confirm that they work as expected.

Thank you very much for the answers!

Regarding my original problem - getting suspicious 404 - it looks that it was caused by me trying to query slots without blocks. Also, I've provided false info by mistake that manual (curl) queries do return some results. In short - my report was wrong, so I'm closing this one.

Thanks for trying to help!