lighthouse/common
Mac L d06f87486a Support duplicate keys in HTTP API query strings (#2908)
## Issues Addressed

Closes #2739
Closes #2812

## Proposed Changes

Support the deserialization of query strings containing duplicate keys into their corresponding types.
As `warp` does not support this feature natively (as discussed in #2739), it relies on the external library [`serde_array_query`](https://github.com/sigp/serde_array_query) (written by @michaelsproul)

This is backwards compatible meaning that both of the following requests will produce the same output:
```
curl "http://localhost:5052/eth/v1/events?topics=head,block"
```
```
curl "http://localhost:5052/eth/v1/events?topics=head&topics=block"
```

## Additional Info

Certain error messages have changed slightly.  This only affects endpoints which accept multiple values.
For example:
```
{"code":400,"message":"BAD_REQUEST: invalid query: Invalid query string","stacktraces":[]}
```
is now
```
{"code":400,"message":"BAD_REQUEST: unable to parse query","stacktraces":[]}
```


The serve order of the endpoints `get_beacon_state_validators` and `get_beacon_state_validators_id` have flipped:
```rust
.or(get_beacon_state_validators_id.boxed())
.or(get_beacon_state_validators.boxed())
``` 
This is to ensure proper error messages when filter fallback occurs due to the use of the `and_then` filter.

## Future Work
- Cleanup / remove filter fallback behaviour by substituting `and_then` with `then` where appropriate.
- Add regression tests for HTTP API error messages.

## Credits
- @mooori for doing the ground work of investigating possible solutions within the existing Rust ecosystem.
- @michaelsproul for writing [`serde_array_query`](https://github.com/sigp/serde_array_query) and for helping debug the behaviour of the `warp` filter fallback leading to incorrect error messages.
2022-01-20 09:14:19 +00:00
..
account_utils Update zeroize_derive (#2625) 2021-09-25 05:58:37 +00:00
clap_utils Bump crate versions (#2829) 2021-12-02 14:29:57 +11:00
compare_fields Check for unused deps in CI (#1262) 2020-06-14 10:59:50 +10:00
compare_fields_derive Update external deps (#1711) 2020-10-05 08:22:19 +00:00
deposit_contract Bump crate versions (#2829) 2021-12-02 14:29:57 +11:00
directory Add background file logging (#2762) 2021-11-30 03:25:32 +00:00
eth2 Support duplicate keys in HTTP API query strings (#2908) 2022-01-20 09:14:19 +00:00
eth2_config Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
eth2_interop_keypairs Fix nightly bump num bigint (#2591) 2021-09-12 23:55:20 +00:00
eth2_network_config Update to spec v1.1.8 (#2893) 2022-01-19 00:24:19 +00:00
eth2_wallet_manager Remove unused deps (#2592) 2021-09-30 04:31:42 +00:00
fallback Improve eth1 fallback logging (#2490) 2021-08-30 00:51:26 +00:00
filesystem Fix linting error on Windows (#2759) 2021-11-01 07:44:42 +00:00
hashset_delay Update Lighthouse Dependencies (#2818) 2021-11-18 05:08:42 +00:00
lighthouse_metrics Additional networking metrics (#2549) 2021-12-22 06:17:14 +00:00
lighthouse_version v2.1.0 (#2928) 2022-01-20 03:39:41 +00:00
lockfile 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00
logging 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00
lru_cache Keep track of failed head chains and prevent re-lookups (#1534) 2020-08-18 03:54:09 +00:00
malloc_utils Enable mallinfo2 behind feature flag (#2864) 2021-12-15 20:39:50 +00:00
monitoring_api 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00
sensitive_url Add SensitiveUrl to redact user secrets from endpoints (#2326) 2021-05-04 01:59:51 +00:00
slot_clock Avoid penalizing peers for delays during processing (#2894) 2022-01-12 02:36:24 +00:00
target_check Improve compilation error on 32-bit (#2424) 2021-06-30 04:56:22 +00:00
task_executor [Merge] Implement execution_layer (#2635) 2021-12-02 14:26:51 +11:00
test_random_derive Update external deps (#1711) 2020-10-05 08:22:19 +00:00
validator_dir 1.57.0 lints (#2850) 2021-12-03 04:44:30 +00:00
warp_utils Support duplicate keys in HTTP API query strings (#2908) 2022-01-20 09:14:19 +00:00
README.md Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00

eth2

Common crates containing eth2-specific logic.