lighthouse/beacon_node/eth2_libp2p
blacktemplar 3408de8151 Avoid string initialization in network metrics and replace by &str where possible (#1898)
## Issue Addressed

NA

## Proposed Changes

Removes most of the temporary string initializations in network metrics and replaces them by directly using `&str`. This further improves on PR https://github.com/sigp/lighthouse/pull/1895.

For the subnet id handling the current approach uses a build script to create a static map. This has the disadvantage that the build script hardcodes the number of subnets. If we want to use more than 64 subnets we need to adjust this in the build script.

## Additional Info

We still have some string initializations for the enum `PeerKind`. To also replace that by `&str` I created a PR in the libp2p dependency: https://github.com/sigp/rust-libp2p/pull/91. Either we wait with merging until this dependency PR is merged (and all conflicts with the newest libp2p version are resolved) or we just merge as is and I will create another PR when the dependency is ready.
2020-11-18 23:31:37 +00:00
..
src Avoid string initialization in network metrics and replace by &str where possible (#1898) 2020-11-18 23:31:37 +00:00
tests Gossipsub scoring (#1668) 2020-11-12 01:48:28 +00:00
Cargo.toml Avoid string initialization in network metrics and replace by &str where possible (#1898) 2020-11-18 23:31:37 +00:00