Split common crates out into their own repos (#3890)

Squashed commit of the following:

commit 1ba4f80cc0
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Jan 17 11:43:18 2023 +1100

    Bye 1.0.0 beta, hello 0.5.x

commit a862b234b2
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Jan 17 10:54:46 2023 +1100

    Cargo fmt

commit e29f358a9e
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Jan 16 18:21:42 2023 +1100

    It compiles :O

commit 1ee4514b7d
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Jan 16 17:27:10 2023 +1100

    Ethereum hashing

commit 69bdd1d61f
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Jan 16 17:24:58 2023 +1100

    Tree hash et al

commit 7cae5d99d7
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Jan 16 17:21:03 2023 +1100

    Delete crates!

commit dd9ee38084
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Jan 16 17:19:19 2023 +1100

    Delete overrides

commit 0d54534eb4
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Jan 16 17:19:04 2023 +1100

    Crate renames
This commit is contained in:
Michael Sproul
2023-01-17 13:41:34 +11:00
parent 8d8df17551
commit 2b84597525
153 changed files with 395 additions and 10101 deletions

View File

@@ -60,7 +60,7 @@ impl ApiSecret {
// Create and write the secret key to file with appropriate permissions
create_with_600_perms(
&sk_path,
eth2_serde_utils::hex::encode(sk.serialize()).as_bytes(),
serde_utils::hex::encode(sk.serialize()).as_bytes(),
)
.map_err(|e| {
format!(
@@ -75,7 +75,7 @@ impl ApiSecret {
format!(
"{}{}",
PK_PREFIX,
eth2_serde_utils::hex::encode(&pk.serialize_compressed()[..])
serde_utils::hex::encode(&pk.serialize_compressed()[..])
)
.as_bytes(),
)
@@ -90,7 +90,7 @@ impl ApiSecret {
let sk = fs::read(&sk_path)
.map_err(|e| format!("cannot read {}: {}", SK_FILENAME, e))
.and_then(|bytes| {
eth2_serde_utils::hex::decode(&String::from_utf8_lossy(&bytes))
serde_utils::hex::decode(&String::from_utf8_lossy(&bytes))
.map_err(|_| format!("{} should be 0x-prefixed hex", PK_FILENAME))
})
.and_then(|bytes| {
@@ -114,7 +114,7 @@ impl ApiSecret {
let hex =
String::from_utf8(bytes).map_err(|_| format!("{} is not utf8", SK_FILENAME))?;
if let Some(stripped) = hex.strip_prefix(PK_PREFIX) {
eth2_serde_utils::hex::decode(stripped)
serde_utils::hex::decode(stripped)
.map_err(|_| format!("{} should be 0x-prefixed hex", SK_FILENAME))
} else {
Err(format!("unable to parse {}", SK_FILENAME))
@@ -153,7 +153,7 @@ impl ApiSecret {
/// Returns the public key of `self` as a 0x-prefixed hex string.
fn pubkey_string(&self) -> String {
eth2_serde_utils::hex::encode(&self.pk.serialize_compressed()[..])
serde_utils::hex::encode(&self.pk.serialize_compressed()[..])
}
/// Returns the API token.
@@ -205,7 +205,7 @@ impl ApiSecret {
let message =
Message::parse_slice(digest(&SHA256, input).as_ref()).expect("sha256 is 32 bytes");
let (signature, _) = libsecp256k1::sign(&message, &sk);
eth2_serde_utils::hex::encode(signature.serialize_der().as_ref())
serde_utils::hex::encode(signature.serialize_der().as_ref())
}
}
}

View File

@@ -159,7 +159,7 @@ pub async fn create_validators_mnemonic<P: AsRef<Path>, T: 'static + SlotClock,
gas_limit: request.gas_limit,
builder_proposals: request.builder_proposals,
voting_pubkey,
eth1_deposit_tx_data: eth2_serde_utils::hex::encode(&eth1_deposit_data.rlp),
eth1_deposit_tx_data: serde_utils::hex::encode(&eth1_deposit_data.rlp),
deposit_gwei: request.deposit_gwei,
});
}

View File

@@ -358,7 +358,7 @@ impl ApiTester {
let withdrawal_keypair = keypairs.withdrawal.decrypt_keypair(PASSWORD_BYTES).unwrap();
let deposit_bytes =
eth2_serde_utils::hex::decode(&response[i].eth1_deposit_tx_data).unwrap();
serde_utils::hex::decode(&response[i].eth1_deposit_tx_data).unwrap();
let (deposit_data, _) =
decode_eth1_tx_data(&deposit_bytes, E::default_spec().max_effective_balance)

View File

@@ -53,9 +53,9 @@ pub enum Web3SignerObject<'a, T: EthSpec, Payload: ExecPayload<T>> {
Deposit {
pubkey: PublicKeyBytes,
withdrawal_credentials: Hash256,
#[serde(with = "eth2_serde_utils::quoted_u64")]
#[serde(with = "serde_utils::quoted_u64")]
amount: u64,
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
#[serde(with = "serde_utils::bytes_4_hex")]
genesis_fork_version: [u8; 4],
},
RandaoReveal {