Updates to make crates publishable (#2472)

## Issue Addressed

Related to: #2259

Made an attempt at all the necessary updates here to publish the crates to crates.io. I incremented the minor versions on all the crates that have been previously published. We still might run into some issues as we try to publish because I'm not able to test this out but I think it's a good starting point.

## Proposed Changes

- Add description and license to `ssz_types` and `serde_util`
- rename `serde_util` to `eth2_serde_util`
- increment minor versions
- remove path dependencies
- remove patch dependencies 

## Additional Info
Crates published: 

- [x] `tree_hash` -- need to publish `tree_hash_derive` and `eth2_hashing` first
- [x] `eth2_ssz_types` -- need to publish `eth2_serde_util` first
- [x] `tree_hash_derive`
- [x] `eth2_ssz`
- [x] `eth2_ssz_derive`
- [x] `eth2_serde_util`
- [x] `eth2_hashing`


Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
realbigsean
2021-09-03 01:10:25 +00:00
parent 5a3bcd2904
commit 50321c6671
88 changed files with 682 additions and 433 deletions

View File

@@ -13,9 +13,9 @@ tokio = { version = "1.10.0", features = ["time", "rt-multi-thread", "macros"] }
deposit_contract = { path = "../common/deposit_contract" }
[dependencies]
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
eth2_config = { path = "../common/eth2_config" }
tree_hash = "0.1.1"
tree_hash = "0.3.0"
clap = "2.33.3"
eth2_interop_keypairs = { path = "../common/eth2_interop_keypairs" }
slashing_protection = { path = "./slashing_protection" }
@@ -41,7 +41,7 @@ parking_lot = "0.11.0"
exit-future = "0.2.0"
filesystem = { path = "../common/filesystem" }
libc = "0.2.79"
eth2_ssz_derive = "0.1.0"
eth2_ssz_derive = "0.2.1"
hex = "0.4.2"
deposit_contract = { path = "../common/deposit_contract" }
bls = { path = "../crypto/bls" }
@@ -56,7 +56,7 @@ lighthouse_version = { path = "../common/lighthouse_version" }
warp_utils = { path = "../common/warp_utils" }
warp = { git = "https://github.com/paulhauner/warp ", branch = "cors-wildcard" }
hyper = "0.14.4"
serde_utils = { path = "../consensus/serde_utils" }
eth2_serde_utils = "0.1.0"
libsecp256k1 = "0.6.0"
ring = "0.16.19"
rand = "0.7.3"

View File

@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
tempfile = "3.1.0"
types = { path = "../../consensus/types" }
tree_hash = "0.1.1"
tree_hash = "0.3.0"
rusqlite = { version = "0.25.3", features = ["bundled"] }
r2d2 = "0.8.9"
r2d2_sqlite = "0.18.0"
@@ -15,7 +15,7 @@ parking_lot = "0.11.0"
serde = "1.0.116"
serde_derive = "1.0.116"
serde_json = "1.0.58"
serde_utils = { path = "../../consensus/serde_utils" }
eth2_serde_utils = "0.1.0"
filesystem = { path = "../../common/filesystem" }
[dev-dependencies]

View File

@@ -8,7 +8,7 @@ use types::{Epoch, Hash256, PublicKeyBytes, Slot};
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct InterchangeMetadata {
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
pub interchange_format_version: u64,
pub genesis_validators_root: Hash256,
}
@@ -24,7 +24,7 @@ pub struct InterchangeData {
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct SignedBlock {
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
pub slot: Slot,
#[serde(skip_serializing_if = "Option::is_none")]
pub signing_root: Option<Hash256>,
@@ -33,9 +33,9 @@ pub struct SignedBlock {
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct SignedAttestation {
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
pub source_epoch: Epoch,
#[serde(with = "serde_utils::quoted_u64::require_quotes")]
#[serde(with = "eth2_serde_utils::quoted_u64::require_quotes")]
pub target_epoch: Epoch,
#[serde(skip_serializing_if = "Option::is_none")]
pub signing_root: Option<Hash256>,

View File

@@ -355,7 +355,7 @@ impl<T: SlotClock, E: EthSpec> BeaconNodeFallback<T, E> {
// status of nodes that were previously not-synced.
if candidate.status(RequireSynced::Yes).await.is_err() {
// There exists a race-condition that could result in `refresh_status` being called
// when the status does not require refreshing anymore. This deemed is an
// when the status does not require refreshing anymore. This is deemed an
// acceptable inefficiency.
futures.push(candidate.refresh_status(
self.slot_clock.as_ref(),

View File

@@ -57,7 +57,7 @@ impl ApiSecret {
fs::write(
&sk_path,
serde_utils::hex::encode(&sk.serialize()).as_bytes(),
eth2_serde_utils::hex::encode(&sk.serialize()).as_bytes(),
)
.map_err(|e| e.to_string())?;
fs::write(
@@ -65,7 +65,7 @@ impl ApiSecret {
format!(
"{}{}",
PK_PREFIX,
serde_utils::hex::encode(&pk.serialize_compressed()[..])
eth2_serde_utils::hex::encode(&pk.serialize_compressed()[..])
)
.as_bytes(),
)
@@ -75,7 +75,7 @@ impl ApiSecret {
let sk = fs::read(&sk_path)
.map_err(|e| format!("cannot read {}: {}", SK_FILENAME, e))
.and_then(|bytes| {
serde_utils::hex::decode(&String::from_utf8_lossy(&bytes))
eth2_serde_utils::hex::decode(&String::from_utf8_lossy(&bytes))
.map_err(|_| format!("{} should be 0x-prefixed hex", PK_FILENAME))
})
.and_then(|bytes| {
@@ -99,7 +99,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) {
serde_utils::hex::decode(stripped)
eth2_serde_utils::hex::decode(stripped)
.map_err(|_| format!("{} should be 0x-prefixed hex", SK_FILENAME))
} else {
Err(format!("unable to parse {}", SK_FILENAME))
@@ -138,7 +138,7 @@ impl ApiSecret {
/// Returns the public key of `self` as a 0x-prefixed hex string.
fn pubkey_string(&self) -> String {
serde_utils::hex::encode(&self.pk.serialize_compressed()[..])
eth2_serde_utils::hex::encode(&self.pk.serialize_compressed()[..])
}
/// Returns the API token.
@@ -178,7 +178,7 @@ impl ApiSecret {
let message =
Message::parse_slice(digest(&SHA256, input).as_ref()).expect("sha256 is 32 bytes");
let (signature, _) = libsecp256k1::sign(&message, &sk);
serde_utils::hex::encode(signature.serialize_der().as_ref())
eth2_serde_utils::hex::encode(signature.serialize_der().as_ref())
}
}
}

View File

@@ -152,7 +152,7 @@ pub async fn create_validators<P: AsRef<Path>, T: 'static + SlotClock, E: EthSpe
description: request.description.clone(),
graffiti: request.graffiti.clone(),
voting_pubkey,
eth1_deposit_tx_data: serde_utils::hex::encode(&eth1_deposit_data.rlp),
eth1_deposit_tx_data: eth2_serde_utils::hex::encode(&eth1_deposit_data.rlp),
deposit_gwei: request.deposit_gwei,
});
}

View File

@@ -334,7 +334,7 @@ impl ApiTester {
let withdrawal_keypair = keypairs.withdrawal.decrypt_keypair(PASSWORD_BYTES).unwrap();
let deposit_bytes =
serde_utils::hex::decode(&response[i].eth1_deposit_tx_data).unwrap();
eth2_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)