It compiles :O

This commit is contained in:
Michael Sproul
2023-01-16 18:21:42 +11:00
parent 1ee4514b7d
commit e29f358a9e
53 changed files with 331 additions and 362 deletions

View File

@@ -9,7 +9,7 @@ use types::{Epoch, Hash256, PublicKeyBytes, Slot};
#[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct InterchangeMetadata {
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub interchange_format_version: u64,
pub genesis_validators_root: Hash256,
}
@@ -27,7 +27,7 @@ pub struct InterchangeData {
#[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct SignedBlock {
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub slot: Slot,
#[serde(skip_serializing_if = "Option::is_none")]
pub signing_root: Option<Hash256>,
@@ -37,9 +37,9 @@ pub struct SignedBlock {
#[serde(deny_unknown_fields)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct SignedAttestation {
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub source_epoch: Epoch,
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
pub target_epoch: Epoch,
#[serde(skip_serializing_if = "Option::is_none")]
pub signing_root: Option<Hash256>,

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 {