Add support for beaconAPI in lcli functions (#3252)

## Issue Addressed

NA

## Proposed Changes

Modifies `lcli skip-slots` and `lcli transition-blocks` allow them to source blocks/states from a beaconAPI and also gives them some more features to assist with benchmarking.

## Additional Info

Breaks the current `lcli skip-slots` and `lcli transition-blocks` APIs by changing some flag names. It should be simple enough to figure out the changes via `--help`.

Currently blocked on #3263.
This commit is contained in:
Paul Hauner
2022-08-09 06:05:13 +00:00
parent 68bd7cae21
commit a688621919
10 changed files with 607 additions and 143 deletions

View File

@@ -1,5 +1,6 @@
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use std::fmt;
use std::str::FromStr;
use url::Url;
#[derive(Debug)]
@@ -9,6 +10,12 @@ pub enum SensitiveError {
RedactError(String),
}
impl fmt::Display for SensitiveError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self)
}
}
// Wrapper around Url which provides a custom `Display` implementation to protect user secrets.
#[derive(Clone, PartialEq)]
pub struct SensitiveUrl {
@@ -54,6 +61,14 @@ impl<'de> Deserialize<'de> for SensitiveUrl {
}
}
impl FromStr for SensitiveUrl {
type Err = SensitiveError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Self::parse(s)
}
}
impl SensitiveUrl {
pub fn parse(url: &str) -> Result<Self, SensitiveError> {
let surl = Url::parse(url).map_err(SensitiveError::ParseError)?;