mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Split common crates out into their own repos (#3890)
## Proposed Changes Split out several crates which now exist in separate repos under `sigp`. - [`ssz` and `ssz_derive`](https://github.com/sigp/ethereum_ssz) - [`tree_hash` and `tree_hash_derive`](https://github.com/sigp/tree_hash) - [`ethereum_hashing`](https://github.com/sigp/ethereum_hashing) - [`ethereum_serde_utils`](https://github.com/sigp/ethereum_serde_utils) - [`ssz_types`](https://github.com/sigp/ssz_types) For the published crates see: https://crates.io/teams/github:sigp:crates-io?sort=recent-updates. ## Additional Info - [x] Need to work out how to handle versioning. I was hoping to do 1.0 versions of several crates, but if they depend on `ethereum-types 0.x` that is not going to work. EDIT: decided to go with 0.5.x versions. - [x] Need to port several changes from `tree-states`, `capella`, `eip4844` branches to the external repos.
This commit is contained in:
@@ -13,7 +13,7 @@ tokio = { version = "1.14.0", features = ["time", "rt-multi-thread", "macros"] }
|
||||
logging = { path = "../common/logging" }
|
||||
|
||||
[dependencies]
|
||||
tree_hash = "0.4.1"
|
||||
tree_hash = "0.5.0"
|
||||
clap = "2.33.3"
|
||||
slashing_protection = { path = "./slashing_protection" }
|
||||
slot_clock = { path = "../common/slot_clock" }
|
||||
@@ -46,7 +46,7 @@ lighthouse_version = { path = "../common/lighthouse_version" }
|
||||
warp_utils = { path = "../common/warp_utils" }
|
||||
warp = "0.3.2"
|
||||
hyper = "0.14.4"
|
||||
eth2_serde_utils = "0.1.1"
|
||||
ethereum_serde_utils = "0.5.0"
|
||||
libsecp256k1 = "0.7.0"
|
||||
ring = "0.16.19"
|
||||
rand = { version = "0.8.5", features = ["small_rng"] }
|
||||
|
||||
@@ -18,7 +18,7 @@ r2d2_sqlite = "0.21.0"
|
||||
serde = "1.0.116"
|
||||
serde_derive = "1.0.116"
|
||||
serde_json = "1.0.58"
|
||||
eth2_serde_utils = "0.1.1"
|
||||
ethereum_serde_utils = "0.5.0"
|
||||
filesystem = { path = "../../common/filesystem" }
|
||||
arbitrary = { version = "1.0", features = ["derive"], optional = true }
|
||||
|
||||
|
||||
@@ -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>,
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(ð1_deposit_data.rlp),
|
||||
eth1_deposit_tx_data: serde_utils::hex::encode(ð1_deposit_data.rlp),
|
||||
deposit_gwei: request.deposit_gwei,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -365,7 +365,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)
|
||||
|
||||
@@ -54,9 +54,9 @@ pub enum Web3SignerObject<'a, T: EthSpec, Payload: AbstractExecPayload<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 {
|
||||
|
||||
Reference in New Issue
Block a user