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:
Michael Sproul
2023-04-28 01:15:40 +00:00
parent 7456e1e8fa
commit c11638c36c
162 changed files with 469 additions and 10669 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())
}
}
}