lighthouse/beacon_node
Michael Sproul 249f85f1d9 Improve HTTP API error messages + tweaks (#4595)
## Issue Addressed

Closes #3404 (mostly)

## Proposed Changes

- Remove all uses of Warp's `and_then` (which backtracks) in favour of `then` (which doesn't).
- Bump the priority of the `POST` method for `v2/blocks` to `P0`. Publishing a block needs to happen quickly.
- Run the new SSZ POST endpoints on the beacon processor. I think this was missed in between merging #4462 and #4504/#4479.
- Fix a minor issue in the validator registrations endpoint whereby an error from spawning the task on the beacon processor would be dropped.

## Additional Info

I've tested this manually and can confirm that we no longer get the dreaded `Unsupported endpoint version` errors for queries like:

```
$ curl -X POST -H "Content-Type: application/json" --data @block.json "http://localhost:5052/eth/v2/beacon/blocks" | jq
{
  "code": 400,
  "message": "BAD_REQUEST: WeakSubjectivityConflict",
  "stacktraces": []
}
```

```
$ curl -X POST -H "Content-Type: application/octet-stream" --data @block.json "http://localhost:5052/eth/v2/beacon/blocks" | jq
{
  "code": 400,
  "message": "BAD_REQUEST: invalid SSZ: OffsetOutOfBounds(572530811)",
  "stacktraces": []
}
```

```
$ curl "http://localhost:5052/eth/v2/validator/blocks/7067595"
{"code":400,"message":"BAD_REQUEST: invalid query: Invalid query string","stacktraces":[]}
```

However, I can still trigger it by leaving off the `Content-Type`. We can re-test this aspect with #4575.
2023-08-14 04:06:37 +00:00
..
beacon_chain Fix some typos (#4565) 2023-08-14 00:29:43 +00:00
beacon_processor Use BeaconProcessor for API requests (#4462) 2023-08-08 23:30:15 +00:00
builder_client Tidy formatting of Reqwest errors (#4336) 2023-06-27 01:06:50 +00:00
client Use BeaconProcessor for API requests (#4462) 2023-08-08 23:30:15 +00:00
eth1 Replace ganache-cli with anvil (#3555) 2023-05-15 07:22:02 +00:00
execution_layer Fix some typos (#4565) 2023-08-14 00:29:43 +00:00
genesis Replace ganache-cli with anvil (#3555) 2023-05-15 07:22:02 +00:00
http_api Improve HTTP API error messages + tweaks (#4595) 2023-08-14 04:06:37 +00:00
http_metrics upgrade to libp2p 0.52 (#4431) 2023-08-02 00:59:34 +00:00
lighthouse_network Improve transport connection errors (#4540) 2023-08-10 00:10:09 +00:00
network Use BeaconProcessor for API requests (#4462) 2023-08-08 23:30:15 +00:00
operation_pool Fix some typos (#4565) 2023-08-14 00:29:43 +00:00
src Use BeaconProcessor for API requests (#4462) 2023-08-08 23:30:15 +00:00
store Cache target attester balances for unrealized FFG progression calculation (#4362) 2023-06-30 01:13:06 +00:00
tests Appease Clippy 1.68 and refactor http_api (#4068) 2023-03-13 01:40:03 +00:00
timer Use async code when interacting with EL (#3244) 2022-07-03 05:36:50 +00:00
Cargo.toml Move the BeaconProcessor into a new crate (#4435) 2023-07-10 07:45:54 +00:00