lighthouse-pulse/common
Paul Hauner c5c7476518 Web3Signer support for VC (#2522)
[EIP-3030]: https://eips.ethereum.org/EIPS/eip-3030
[Web3Signer]: https://consensys.github.io/web3signer/web3signer-eth2.html

## Issue Addressed

Resolves #2498

## Proposed Changes

Allows the VC to call out to a [Web3Signer] remote signer to obtain signatures.


## Additional Info

### Making Signing Functions `async`

To allow remote signing, I needed to make all the signing functions `async`. This caused a bit of noise where I had to convert iterators into `for` loops.

In `duties_service.rs` there was a particularly tricky case where we couldn't hold a write-lock across an `await`, so I had to first take a read-lock, then grab a write-lock.

### Move Signing from Core Executor

Whilst implementing this feature, I noticed that we signing was happening on the core tokio executor. I suspect this was causing the executor to temporarily lock and occasionally trigger some HTTP timeouts (and potentially SQL pool timeouts, but I can't verify this). Since moving all signing into blocking tokio tasks, I noticed a distinct drop in the "atttestations_http_get" metric on a Prater node:

![http_get_times](https://user-images.githubusercontent.com/6660660/132143737-82fd3836-2e7e-445b-a143-cb347783baad.png)

I think this graph indicates that freeing the core executor allows the VC to operate more smoothly.

### Refactor TaskExecutor

I noticed that the `TaskExecutor::spawn_blocking_handle` function would fail to spawn tasks if it were unable to obtain handles to some metrics (this can happen if the same metric is defined twice). It seemed that a more sensible approach would be to keep spawning tasks, but without metrics. To that end, I refactored the function so that it would still function without metrics. There are no other changes made.

## TODO

- [x] Restructure to support multiple signing methods.
- [x] Add calls to remote signer from VC.
- [x] Documentation
- [x] Test all endpoints
- [x] Test HTTPS certificate
- [x] Allow adding remote signer validators via the API
- [x] Add Altair support via [21.8.1-rc1](https://github.com/ConsenSys/web3signer/releases/tag/21.8.1-rc1)
- [x] Create issue to start using latest version of web3signer. (See #2570)

## Notes

- ~~Web3Signer doesn't yet support the Altair fork for Prater. See https://github.com/ConsenSys/web3signer/issues/423.~~
- ~~There is not yet a release of Web3Signer which supports Altair blocks. See https://github.com/ConsenSys/web3signer/issues/391.~~
2021-09-16 03:26:33 +00:00
..
account_utils Web3Signer support for VC (#2522) 2021-09-16 03:26:33 +00:00
clap_utils Updates to make crates publishable (#2472) 2021-09-03 01:10:25 +00: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 Updates to make crates publishable (#2472) 2021-09-03 01:10:25 +00:00
directory fix default network handling (#2029) 2020-12-08 05:41:10 +00:00
eth2 Web3Signer support for VC (#2522) 2021-09-16 03:26:33 +00:00
eth2_config Improve ergonomics of adding a new network config (#2489) 2021-08-30 23:27:28 +00:00
eth2_interop_keypairs Fix nightly bump num bigint (#2591) 2021-09-12 23:55:20 +00:00
eth2_network_config Updates to make crates publishable (#2472) 2021-09-03 01:10:25 +00:00
eth2_wallet_manager Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +00:00
fallback Improve eth1 fallback logging (#2490) 2021-08-30 00:51:26 +00:00
filesystem Update file permissions (#2499) 2021-09-03 02:41:10 +00:00
hashset_delay Upgrade dependencies (#2513) 2021-08-17 01:00:24 +00:00
lighthouse_metrics Web3Signer support for VC (#2522) 2021-09-16 03:26:33 +00:00
lighthouse_version v1.5.2 (#2595) 2021-09-13 23:01:19 +00:00
lockfile Enable Compatibility with Windows (#2333) 2021-05-19 23:05:16 +00:00
logging Rust 1.54.0 lints (#2483) 2021-07-30 01:11:47 +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 Modify Malloc Tuning (#2398) 2021-06-09 02:30:06 +00:00
monitoring_api Upgrade dependencies (#2513) 2021-08-17 01:00:24 +00:00
sensitive_url Add SensitiveUrl to redact user secrets from endpoints (#2326) 2021-05-04 01:59:51 +00:00
slot_clock Validator monitor support for sync committees (#2476) 2021-08-31 23:31:36 +00:00
target_check Improve compilation error on 32-bit (#2424) 2021-06-30 04:56:22 +00:00
task_executor Web3Signer support for VC (#2522) 2021-09-16 03:26:33 +00:00
test_random_derive Update external deps (#1711) 2020-10-05 08:22:19 +00:00
validator_dir Updates to make crates publishable (#2472) 2021-09-03 01:10:25 +00:00
warp_utils Upgrade dependencies (#2513) 2021-08-17 01:00:24 +00:00
README.md Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00

eth2

Common crates containing eth2-specific logic.