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

66
.github/workflows/publish-crate.yml vendored Normal file
View File

@ -0,0 +1,66 @@
name: Publish Crate
on:
push:
tags:
- tree-hash-v*
- tree-hash-derive-v*
- eth2-ssz-v*
- eth2-ssz-derive-v*
- eth2-ssz-types-v*
- eth2-serde-util-v*
- eth2-hashing-v*
env:
CARGO_API_TOKEN: ${{ secrets.CARGO_API_TOKEN }}
jobs:
extract-tag:
runs-on: ubuntu-latest
steps:
- name: Extract tag
run: echo "::set-output name=TAG::$(echo ${GITHUB_REF#refs/tags/})"
id: extract_tag
outputs:
TAG: ${{ steps.extract_tag.outputs.TAG }}
publish-crate:
runs-on: ubuntu-latest
needs: [extract-tag]
env:
TAG: ${{ needs.extract-tag.outputs.TAG }}
steps:
- uses: actions/checkout@v2
- name: Update Rust
run: rustup update stable
- name: Cargo login
run: |
echo "${CARGO_API_TOKEN}" | cargo login
- name: publish tree hash
if: startsWith(env.TAG, 'tree-hash-v')
run: |
./scripts/ci/publish.sh consensus/tree_hash tree_hash "$TAG"
- name: publish tree hash derive
if: startsWith(env.TAG, 'tree-hash-derive-v')
run: |
./scripts/ci/publish.sh consensus/tree_hash_derive tree_hash_derive "$TAG"
- name: publish eth2 ssz
if: startsWith(env.TAG, 'eth2-ssz-v')
run: |
./scripts/ci/publish.sh consensus/ssz eth2_ssz "$TAG"
- name: publish eth2 ssz derive
if: startsWith(env.TAG, 'eth2-ssz-derive-v')
run: |
./scripts/ci/publish.sh consensus/ssz_derive eth2_ssz_derive "$TAG"
- name: publish ssz types
if: startsWith(env.TAG, 'eth2-ssz-types-v')
run: |
./scripts/ci/publish.sh consensus/ssz_types eth2_ssz_types "$TAG"
- name: publish serde util
if: startsWith(env.TAG, 'eth2-serde-util-v')
run: |
./scripts/ci/publish.sh consensus/serde_utils eth2_serde_utils "$TAG"
- name: publish eth2 hashing
if: startsWith(env.TAG, 'eth2-hashing-v')
run: |
./scripts/ci/publish.sh crypto/eth2_hashing eth2_hashing "$TAG"

437
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -86,12 +86,3 @@ members = [
"validator_client",
"validator_client/slashing_protection",
]
[patch]
[patch.crates-io]
tree_hash = { path = "consensus/tree_hash" }
tree_hash_derive = { path = "consensus/tree_hash_derive" }
eth2_ssz = { path = "consensus/ssz" }
eth2_ssz_derive = { path = "consensus/ssz_derive" }
eth2_ssz_types = { path = "consensus/ssz_types" }
eth2_hashing = { path = "crypto/eth2_hashing" }

View File

@ -15,8 +15,8 @@ dirs = "3.0.1"
environment = { path = "../lighthouse/environment" }
deposit_contract = { path = "../common/deposit_contract" }
libc = "0.2.79"
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
hex = "0.4.2"
rayon = "1.4.1"
eth2_network_config = { path = "../common/eth2_network_config" }

View File

@ -36,7 +36,7 @@ task_executor = { path = "../common/task_executor" }
genesis = { path = "genesis" }
eth2_network_config = { path = "../common/eth2_network_config" }
eth2_libp2p = { path = "./eth2_libp2p" }
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
serde = "1.0.116"
clap_utils = { path = "../common/clap_utils" }
hyper = "0.14.4"

View File

@ -33,12 +33,12 @@ serde_json = "1.0.58"
slog = { version = "2.5.2", features = ["max_level_trace"] }
sloggers = "1.0.1"
slot_clock = { path = "../../common/slot_clock" }
eth2_hashing = "0.1.0"
eth2_ssz = "0.1.2"
eth2_ssz_types = { path = "../../consensus/ssz_types" }
eth2_ssz_derive = "0.1.0"
eth2_hashing = "0.2.0"
eth2_ssz = "0.3.0"
eth2_ssz_types = "0.2.0"
eth2_ssz_derive = "0.2.1"
state_processing = { path = "../../consensus/state_processing" }
tree_hash = "0.1.1"
tree_hash = "0.3.0"
types = { path = "../../consensus/types" }
tokio = "1.10.0"
eth1 = { path = "../eth1" }

View File

@ -17,7 +17,7 @@ eth2_libp2p = { path = "../eth2_libp2p" }
parking_lot = "0.11.0"
prometheus = "0.11.0"
types = { path = "../../consensus/types" }
tree_hash = "0.1.1"
tree_hash = "0.3.0"
eth2_config = { path = "../../common/eth2_config" }
slot_clock = { path = "../../common/slot_clock" }
serde = "1.0.116"
@ -35,7 +35,7 @@ eth1 = { path = "../eth1" }
genesis = { path = "../genesis" }
task_executor = { path = "../../common/task_executor" }
environment = { path = "../../lighthouse/environment" }
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
lazy_static = "1.4.0"
lighthouse_metrics = { path = "../../common/lighthouse_metrics" }
time = "0.2.22"

View File

@ -19,10 +19,10 @@ serde = { version = "1.0.116", features = ["derive"] }
hex = "0.4.2"
types = { path = "../../consensus/types"}
merkle_proof = { path = "../../consensus/merkle_proof"}
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
tree_hash = "0.1.1"
eth2_hashing = "0.1.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
tree_hash = "0.3.0"
eth2_hashing = "0.2.0"
parking_lot = "0.11.0"
slog = "2.5.2"
tokio = { version = "1.10.0", features = ["full"] }

View File

@ -9,11 +9,11 @@ discv5 = { version = "0.1.0-beta.9", features = ["libp2p"] }
unsigned-varint = { version = "0.6.0", features = ["codec"] }
types = { path = "../../consensus/types" }
hashset_delay = { path = "../../common/hashset_delay" }
eth2_ssz_types = { path = "../../consensus/ssz_types" }
eth2_ssz_types = "0.2.0"
serde = { version = "1.0.116", features = ["derive"] }
serde_derive = "1.0.116"
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
slog = { version = "2.5.2", features = ["max_level_trace"] }
lighthouse_version = { path = "../../common/lighthouse_version" }
tokio = { version = "1.10.0", features = ["time", "macros"] }

View File

@ -16,9 +16,9 @@ eth1 = { path = "../eth1"}
rayon = "1.4.1"
state_processing = { path = "../../consensus/state_processing" }
merkle_proof = { path = "../../consensus/merkle_proof" }
eth2_ssz = "0.1.2"
eth2_hashing = "0.1.0"
tree_hash = "0.1.1"
eth2_ssz = "0.3.0"
eth2_hashing = "0.2.0"
tree_hash = "0.3.0"
tokio = { version = "1.10.0", features = ["full"] }
parking_lot = "0.11.0"
slog = "2.5.2"

View File

@ -27,14 +27,14 @@ lighthouse_metrics = { path = "../../common/lighthouse_metrics" }
lazy_static = "1.4.0"
warp_utils = { path = "../../common/warp_utils" }
slot_clock = { path = "../../common/slot_clock" }
eth2_ssz = { path = "../../consensus/ssz" }
eth2_ssz = "0.3.0"
bs58 = "0.4.0"
futures = "0.3.8"
[dev-dependencies]
store = { path = "../store" }
environment = { path = "../../lighthouse/environment" }
tree_hash = "0.1.1"
tree_hash = "0.3.0"
sensitive_url = { path = "../../common/sensitive_url" }
[[test]]

View File

@ -25,9 +25,9 @@ state_processing = { path = "../../consensus/state_processing" }
slot_clock = { path = "../../common/slot_clock" }
slog = { version = "2.5.2", features = ["max_level_trace"] }
hex = "0.4.2"
eth2_ssz = "0.1.2"
eth2_ssz_types = { path = "../../consensus/ssz_types" }
tree_hash = "0.1.1"
eth2_ssz = "0.3.0"
eth2_ssz_types = "0.2.0"
tree_hash = "0.3.0"
futures = "0.3.7"
error-chain = "0.12.4"
tokio = { version = "1.10.0", features = ["full"] }

View File

@ -13,8 +13,8 @@ lighthouse_metrics = { path = "../../common/lighthouse_metrics" }
parking_lot = "0.11.0"
types = { path = "../../consensus/types" }
state_processing = { path = "../../consensus/state_processing" }
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
rayon = "1.5.0"
serde = "1.0.116"
serde_derive = "1.0.116"

View File

@ -13,9 +13,9 @@ db-key = "0.0.5"
leveldb = { version = "0.8.6", default-features = false }
parking_lot = "0.11.0"
itertools = "0.10.0"
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
tree_hash = "0.1.1"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
tree_hash = "0.3.0"
types = { path = "../../consensus/types" }
state_processing = { path = "../../consensus/state_processing" }
slog = "2.5.2"

View File

@ -10,7 +10,7 @@ clap = "2.33.3"
eth2_libp2p = { path = "../beacon_node/eth2_libp2p" }
types = { path = "../consensus/types" }
eth2_network_config = { path = "../common/eth2_network_config" }
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
slog = "2.5.2"
sloggers = "1.0.1"
tokio = "1.10.0"

View File

@ -12,4 +12,4 @@ hex = "0.4.2"
dirs = "3.0.1"
types = { path = "../../consensus/types" }
eth2_network_config = { path = "../eth2_network_config" }
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"

View File

@ -14,6 +14,6 @@ hex = "0.4.2"
[dependencies]
types = { path = "../../consensus/types"}
eth2_ssz = "0.1.2"
tree_hash = "0.1.1"
eth2_ssz = "0.3.0"
tree_hash = "0.3.0"
ethabi = "12.0.0"

View File

@ -14,7 +14,7 @@ hex = "0.4.2"
reqwest = { version = "0.11.0", features = ["json","stream"] }
eth2_libp2p = { path = "../../beacon_node/eth2_libp2p" }
proto_array = { path = "../../consensus/proto_array", optional = true }
serde_utils = { path = "../../consensus/serde_utils" }
eth2_serde_utils = "0.1.0"
zeroize = { version = "1.1.1", features = ["zeroize_derive"] }
eth2_keystore = { path = "../../crypto/eth2_keystore" }
libsecp256k1 = "0.6.0"
@ -22,8 +22,8 @@ ring = "0.16.19"
bytes = "1.0.1"
account_utils = { path = "../../common/account_utils" }
sensitive_url = { path = "../../common/sensitive_url" }
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
futures-util = "0.3.8"
futures = "0.3.8"

View File

@ -36,7 +36,7 @@ pub fn parse_pubkey(secret: &str) -> Result<PublicKey, Error> {
&secret[SECRET_PREFIX.len()..]
};
serde_utils::hex::decode(secret)
eth2_serde_utils::hex::decode(secret)
.map_err(|e| Error::InvalidSecret(format!("invalid hex: {:?}", e)))
.and_then(|bytes| {
if bytes.len() != PK_LEN {
@ -101,7 +101,7 @@ impl ValidatorClientHttpClient {
let message =
Message::parse_slice(digest(&SHA256, &body).as_ref()).expect("sha256 is 32 bytes");
serde_utils::hex::decode(&sig)
eth2_serde_utils::hex::decode(&sig)
.ok()
.and_then(|bytes| {
let sig = Signature::parse_der(&bytes).ok()?;

View File

@ -21,14 +21,14 @@ pub struct ValidatorRequest {
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub graffiti: Option<GraffitiString>,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub deposit_gwei: u64,
}
#[derive(Clone, PartialEq, Serialize, Deserialize)]
pub struct CreateValidatorsMnemonicRequest {
pub mnemonic: ZeroizeString,
#[serde(with = "serde_utils::quoted_u32")]
#[serde(with = "eth2_serde_utils::quoted_u32")]
pub key_derivation_path_offset: u32,
pub validators: Vec<ValidatorRequest>,
}
@ -42,7 +42,7 @@ pub struct CreatedValidator {
#[serde(skip_serializing_if = "Option::is_none")]
pub graffiti: Option<GraffitiString>,
pub eth1_deposit_tx_data: String,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub deposit_gwei: u64,
}

View File

@ -77,10 +77,10 @@ impl std::fmt::Display for EndpointVersion {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GenesisData {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub genesis_time: u64,
pub genesis_validators_root: Hash256,
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
pub genesis_fork_version: [u8; 4],
}
@ -270,9 +270,9 @@ impl fmt::Display for ValidatorId {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ValidatorData {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub index: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub balance: u64,
pub status: ValidatorStatus,
pub validator: Validator,
@ -280,9 +280,9 @@ pub struct ValidatorData {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ValidatorBalanceData {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub index: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub balance: u64,
}
@ -437,16 +437,16 @@ pub struct ValidatorsQuery {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CommitteeData {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub index: u64,
pub slot: Slot,
#[serde(with = "serde_utils::quoted_u64_vec")]
#[serde(with = "eth2_serde_utils::quoted_u64_vec")]
pub validators: Vec<u64>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SyncCommitteeByValidatorIndices {
#[serde(with = "serde_utils::quoted_u64_vec")]
#[serde(with = "eth2_serde_utils::quoted_u64_vec")]
pub validators: Vec<u64>,
pub validator_aggregates: Vec<SyncSubcommittee>,
}
@ -454,7 +454,7 @@ pub struct SyncCommitteeByValidatorIndices {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SyncSubcommittee {
#[serde(with = "serde_utils::quoted_u64_vec")]
#[serde(with = "eth2_serde_utils::quoted_u64_vec")]
pub indices: Vec<u64>,
}
@ -479,7 +479,7 @@ pub struct BlockHeaderData {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DepositContractData {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub chain_id: u64,
pub address: Address,
}
@ -501,7 +501,7 @@ pub struct IdentityData {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MetaData {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub seq_number: u64,
pub attnets: String,
pub syncnets: String,
@ -546,20 +546,20 @@ pub struct ValidatorBalancesQuery {
#[derive(Clone, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ValidatorIndexData(#[serde(with = "serde_utils::quoted_u64_vec")] pub Vec<u64>);
pub struct ValidatorIndexData(#[serde(with = "eth2_serde_utils::quoted_u64_vec")] pub Vec<u64>);
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AttesterData {
pub pubkey: PublicKeyBytes,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_index: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub committees_at_slot: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub committee_index: CommitteeIndex,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub committee_length: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_committee_index: u64,
pub slot: Slot,
}
@ -567,7 +567,7 @@ pub struct AttesterData {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProposerData {
pub pubkey: PublicKeyBytes,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_index: u64,
pub slot: Slot,
}
@ -592,11 +592,11 @@ pub struct ValidatorAggregateAttestationQuery {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BeaconCommitteeSubscription {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_index: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub committee_index: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub committees_at_slot: u64,
pub slot: Slot,
pub is_aggregator: bool,
@ -714,13 +714,13 @@ impl fmt::Display for PeerDirection {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PeerCount {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub connected: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub connecting: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub disconnected: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub disconnecting: u64,
}
@ -752,7 +752,7 @@ pub struct SseHead {
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
pub struct SseChainReorg {
pub slot: Slot,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub depth: u64,
pub old_head_block: Hash256,
pub old_head_state: Hash256,
@ -910,13 +910,13 @@ impl FromStr for Accept {
#[derive(Debug, Serialize, Deserialize)]
pub struct LivenessRequestData {
pub epoch: Epoch,
#[serde(with = "serde_utils::quoted_u64_vec")]
#[serde(with = "eth2_serde_utils::quoted_u64_vec")]
pub indices: Vec<u64>,
}
#[derive(PartialEq, Debug, Serialize, Deserialize)]
pub struct LivenessResponseData {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub index: u64,
pub epoch: Epoch,
pub is_live: bool,

View File

@ -9,7 +9,7 @@ edition = "2018"
[dependencies]
lazy_static = "1.4.0"
num-bigint = "0.3.0"
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
hex = "0.4.2"
serde_yaml = "0.8.13"
serde = "1.0.116"

View File

@ -17,6 +17,6 @@ tempfile = "3.1.0"
serde = "1.0.116"
serde_yaml = "0.8.13"
types = { path = "../../consensus/types"}
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
eth2_config = { path = "../eth2_config"}
enr = { version = "0.5.1", features = ["ed25519", "k256"] }

View File

@ -17,7 +17,7 @@ types = { path = "../../consensus/types" }
rand = "0.7.3"
deposit_contract = { path = "../deposit_contract" }
rayon = "1.4.1"
tree_hash = "0.1.1"
tree_hash = "0.3.0"
slog = { version = "2.5.2", features = ["max_level_trace", "release_max_level_trace"] }
hex = "0.4.2"
derivative = "2.1.1"

View File

@ -6,11 +6,11 @@ edition = "2018"
[dependencies]
ethereum-types = "0.11.0"
eth2_ssz_types = { path = "../ssz_types" }
eth2_hashing = "0.1.0"
eth2_ssz_derive = "0.1.0"
eth2_ssz = "0.1.2"
tree_hash = "0.1.1"
eth2_ssz_types = "0.2.0"
eth2_hashing = "0.2.0"
eth2_ssz_derive = "0.2.1"
eth2_ssz = "0.3.0"
tree_hash = "0.3.0"
smallvec = "1.6.1"
[dev-dependencies]

View File

@ -9,13 +9,13 @@ edition = "2018"
[dependencies]
types = { path = "../types" }
proto_array = { path = "../proto_array" }
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
[dev-dependencies]
state_processing = { path = "../../consensus/state_processing" }
beacon_chain = { path = "../../beacon_node/beacon_chain" }
store = { path = "../../beacon_node/store" }
tree_hash = "0.1.1"
tree_hash = "0.3.0"
slot_clock = { path = "../../common/slot_clock" }
hex = "0.4.2"

View File

@ -6,7 +6,7 @@ edition = "2018"
[dependencies]
ethereum-types = "0.11.0"
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
lazy_static = "1.4.0"
safe_arith = { path = "../safe_arith" }

View File

@ -10,8 +10,8 @@ path = "src/bin.rs"
[dependencies]
types = { path = "../types" }
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
serde = "1.0.116"
serde_derive = "1.0.116"
serde_yaml = "0.8.13"

View File

@ -1,8 +1,10 @@
[package]
name = "serde_utils"
name = "eth2_serde_utils"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com", "Michael Sproul <michael@sigmaprime.io>"]
edition = "2018"
description = "Serialization and deserialization utilities useful for JSON representations of Ethereum 2.0 types."
license = "Apache-2.0"
[dependencies]
serde = { version = "1.0.116", features = ["derive"] }

View File

@ -1,6 +1,6 @@
[package]
name = "eth2_ssz"
version = "0.1.2"
version = "0.3.0"
authors = ["Paul Hauner <paul@sigmaprime.io>"]
edition = "2018"
description = "SimpleSerialize (SSZ) as used in Ethereum 2.0"
@ -10,7 +10,7 @@ license = "Apache-2.0"
name = "ssz"
[dev-dependencies]
eth2_ssz_derive = "0.1.0"
eth2_ssz_derive = "0.2.1"
[dependencies]
ethereum-types = "0.11.0"

View File

@ -1,6 +1,6 @@
[package]
name = "eth2_ssz_derive"
version = "0.1.0"
version = "0.2.1"
authors = ["Paul Hauner <paul@sigmaprime.io>"]
edition = "2018"
description = "Procedural derive macros to accompany the eth2_ssz crate."

View File

@ -3,19 +3,21 @@ name = "eth2_ssz_types"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
description = "Provides types with unique properties required for SSZ serialization and Merklization."
license = "Apache-2.0"
[lib]
name = "ssz_types"
[dependencies]
tree_hash = "0.1.1"
tree_hash = "0.3.0"
serde = "1.0.116"
serde_derive = "1.0.116"
serde_utils = { path = "../serde_utils" }
eth2_ssz = "0.1.2"
eth2_serde_utils = "0.1.0"
eth2_ssz = "0.3.0"
typenum = "1.12.0"
arbitrary = { version = "0.4.6", features = ["derive"], optional = true }
[dev-dependencies]
serde_json = "1.0.58"
tree_hash_derive = "0.2.0"
tree_hash_derive = "0.3.1"

View File

@ -1,9 +1,9 @@
use crate::tree_hash::bitfield_bytes_tree_hash_root;
use crate::Error;
use core::marker::PhantomData;
use eth2_serde_utils::hex::{encode as hex_encode, PrefixedHexVisitor};
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_utils::hex::{encode as hex_encode, PrefixedHexVisitor};
use ssz::{Decode, Encode};
use tree_hash::Hash256;
use typenum::Unsigned;

View File

@ -6,9 +6,9 @@
use crate::serde_utils::quoted_u64_var_list::deserialize_max;
use crate::FixedVector;
use eth2_serde_utils::quoted_u64_vec::QuotedIntWrapper;
use serde::ser::SerializeSeq;
use serde::{Deserializer, Serializer};
use serde_utils::quoted_u64_vec::QuotedIntWrapper;
use std::marker::PhantomData;
use typenum::Unsigned;

View File

@ -5,9 +5,9 @@
//! Quotes can be optional during decoding. If the length of the `Vec` is greater than `N`, deserialization fails.
use crate::VariableList;
use eth2_serde_utils::quoted_u64_vec::QuotedIntWrapper;
use serde::ser::SerializeSeq;
use serde::{Deserializer, Serializer};
use serde_utils::quoted_u64_vec::QuotedIntWrapper;
use std::marker::PhantomData;
use typenum::Unsigned;

View File

@ -16,16 +16,16 @@ beacon_chain = { path = "../../beacon_node/beacon_chain" }
bls = { path = "../../crypto/bls" }
integer-sqrt = "0.1.5"
itertools = "0.10.0"
eth2_ssz = "0.1.2"
eth2_ssz_types = { path = "../ssz_types" }
eth2_ssz = "0.3.0"
eth2_ssz_types = "0.2.0"
merkle_proof = { path = "../merkle_proof" }
log = "0.4.11"
safe_arith = { path = "../safe_arith" }
tree_hash = "0.1.1"
tree_hash_derive = "0.2.0"
tree_hash = "0.3.0"
tree_hash_derive = "0.3.1"
types = { path = "../types", default-features = false }
rayon = "1.4.1"
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
int_to_bytes = { path = "../int_to_bytes" }
smallvec = "1.6.1"
arbitrary = { version = "0.4.6", features = ["derive"], optional = true }

View File

@ -12,7 +12,7 @@ harness = false
criterion = "0.3.3"
[dependencies]
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
ethereum-types = "0.11.0"
[features]

View File

@ -1,6 +1,6 @@
[package]
name = "tree_hash"
version = "0.1.1"
version = "0.3.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
license = "Apache-2.0"
@ -8,14 +8,14 @@ description = "Efficient Merkle-hashing as used in Ethereum 2.0"
[dev-dependencies]
rand = "0.7.3"
tree_hash_derive = "0.2.0"
tree_hash_derive = "0.3.1"
types = { path = "../types" }
lazy_static = "1.4.0"
beacon_chain = { path = "../../beacon_node/beacon_chain" }
[dependencies]
ethereum-types = "0.11.0"
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
smallvec = "1.6.1"
[features]

View File

@ -1,6 +1,6 @@
[package]
name = "tree_hash_derive"
version = "0.2.0"
version = "0.3.1"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
description = "Procedural derive macros to accompany the tree_hash crate."

View File

@ -14,7 +14,7 @@ compare_fields = { path = "../../common/compare_fields" }
compare_fields_derive = { path = "../../common/compare_fields_derive" }
eth2_interop_keypairs = { path = "../../common/eth2_interop_keypairs" }
ethereum-types = "0.11.0"
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
hex = "0.4.2"
int_to_bytes = { path = "../int_to_bytes" }
log = "0.4.11"
@ -25,13 +25,13 @@ safe_arith = { path = "../safe_arith" }
serde = {version = "1.0.116" , features = ["rc"] }
serde_derive = "1.0.116"
slog = "2.5.2"
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
eth2_ssz_types = { path = "../ssz_types" }
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
eth2_ssz_types = "0.2.0"
swap_or_not_shuffle = { path = "../swap_or_not_shuffle" }
test_random_derive = { path = "../../common/test_random_derive" }
tree_hash = "0.1.1"
tree_hash_derive = "0.2.0"
tree_hash = "0.3.0"
tree_hash_derive = "0.3.1"
rand_xorshift = "0.2.0"
cached_tree_hash = { path = "../cached_tree_hash" }
serde_yaml = "0.8.13"
@ -39,7 +39,7 @@ tempfile = "3.1.0"
derivative = "2.1.1"
rusqlite = { version = "0.25.3", features = ["bundled"], optional = true }
arbitrary = { version = "0.4.6", features = ["derive"], optional = true }
serde_utils = { path = "../serde_utils" }
eth2_serde_utils = "0.1.0"
regex = "1.3.9"
lazy_static = "1.4.0"
parking_lot = "0.11.1"

View File

@ -16,7 +16,7 @@ use tree_hash_derive::TreeHash;
#[serde(bound = "T: EthSpec")]
pub struct AggregateAndProof<T: EthSpec> {
/// The index of the validator that created the attestation.
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub aggregator_index: u64,
/// The aggregate attestation.
pub aggregate: Attestation<T>,

View File

@ -27,7 +27,7 @@ use tree_hash_derive::TreeHash;
)]
pub struct AttestationData {
pub slot: Slot,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub index: u64,
// LMD GHOST vote

View File

@ -13,6 +13,6 @@ pub struct AttestationDuty {
/// The total number of attesters in the committee.
pub committee_len: usize,
/// The committee count at `attestation_slot`.
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub committees_at_slot: u64,
}

View File

@ -40,7 +40,7 @@ pub struct BeaconBlock<T: EthSpec> {
#[superstruct(getter(copy))]
pub slot: Slot,
#[superstruct(getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub proposer_index: u64,
#[superstruct(getter(copy))]
pub parent_root: Hash256,

View File

@ -16,7 +16,7 @@ use tree_hash_derive::TreeHash;
)]
pub struct BeaconBlockHeader {
pub slot: Slot,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub proposer_index: u64,
pub parent_root: Hash256,
pub state_root: Hash256,

View File

@ -198,7 +198,7 @@ where
{
// Versioning
#[superstruct(getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub genesis_time: u64,
#[superstruct(getter(copy))]
pub genesis_validators_root: Hash256,
@ -219,7 +219,7 @@ where
pub eth1_data: Eth1Data,
pub eth1_data_votes: VariableList<Eth1Data, T::SlotsPerEth1VotingPeriod>,
#[superstruct(getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub eth1_deposit_index: u64,
// Registry

View File

@ -1,7 +1,7 @@
use crate::*;
use eth2_serde_utils::quoted_u64::MaybeQuoted;
use int_to_bytes::int_to_bytes4;
use serde_derive::{Deserialize, Serialize};
use serde_utils::quoted_u64::MaybeQuoted;
use std::fs::File;
use std::path::Path;
use tree_hash::TreeHash;
@ -533,44 +533,44 @@ pub struct Config {
#[serde(default)]
pub preset_base: String,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
min_genesis_active_validator_count: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
min_genesis_time: u64,
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
genesis_fork_version: [u8; 4],
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
genesis_delay: u64,
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
altair_fork_version: [u8; 4],
altair_fork_epoch: Option<MaybeQuoted<Epoch>>,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
seconds_per_slot: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
seconds_per_eth1_block: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
min_validator_withdrawability_delay: Epoch,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
shard_committee_period: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
eth1_follow_distance: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
inactivity_score_bias: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
inactivity_score_recovery_rate: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
ejection_balance: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
min_per_epoch_churn_limit: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
churn_limit_quotient: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
deposit_chain_id: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
deposit_network_id: u64,
deposit_contract_address: Address,
}

View File

@ -14,7 +14,7 @@ use tree_hash_derive::TreeHash;
#[serde(bound = "T: EthSpec")]
pub struct ContributionAndProof<T: EthSpec> {
/// The index of the validator that created the sync contribution.
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub aggregator_index: u64,
/// The aggregate contribution.
pub contribution: SyncCommitteeContribution<T>,

View File

@ -15,7 +15,7 @@ use tree_hash_derive::TreeHash;
pub struct DepositData {
pub pubkey: PublicKeyBytes,
pub withdrawal_credentials: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub amount: u64,
pub signature: SignatureBytes,
}

View File

@ -15,7 +15,7 @@ use tree_hash_derive::TreeHash;
pub struct DepositMessage {
pub pubkey: PublicKeyBytes,
pub withdrawal_credentials: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub amount: u64,
}

View File

@ -15,9 +15,9 @@ use tree_hash_derive::TreeHash;
Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
pub struct EnrForkId {
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
pub fork_digest: [u8; 4],
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
pub next_fork_version: [u8; 4],
pub next_fork_epoch: Epoch,
}

View File

@ -26,7 +26,7 @@ use tree_hash_derive::TreeHash;
)]
pub struct Eth1Data {
pub deposit_root: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub deposit_count: u64,
pub block_hash: Hash256,
}

View File

@ -24,9 +24,9 @@ use tree_hash_derive::TreeHash;
TestRandom,
)]
pub struct Fork {
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
pub previous_version: [u8; 4],
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
pub current_version: [u8; 4],
pub epoch: Epoch,
}

View File

@ -14,7 +14,7 @@ use tree_hash_derive::TreeHash;
Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom,
)]
pub struct ForkData {
#[serde(with = "serde_utils::bytes_4_hex")]
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
pub current_version: [u8; 4],
pub genesis_validators_root: Hash256,
}

View File

@ -9,6 +9,6 @@ use serde_derive::Serialize;
pub struct FreeAttestation {
pub data: AttestationData,
pub signature: Signature,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_index: u64,
}

View File

@ -27,7 +27,7 @@ impl Graffiti {
impl fmt::Display for Graffiti {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", serde_utils::hex::encode(&self.0))
write!(f, "{}", eth2_serde_utils::hex::encode(&self.0))
}
}
@ -96,7 +96,7 @@ pub mod serde_graffiti {
where
S: Serializer,
{
serializer.serialize_str(&serde_utils::hex::encode(bytes))
serializer.serialize_str(&eth2_serde_utils::hex::encode(bytes))
}
pub fn deserialize<'de, D>(deserializer: D) -> Result<[u8; GRAFFITI_BYTES_LEN], D::Error>
@ -105,7 +105,7 @@ pub mod serde_graffiti {
{
let s: String = Deserialize::deserialize(deserializer)?;
let bytes = serde_utils::hex::decode(&s).map_err(D::Error::custom)?;
let bytes = eth2_serde_utils::hex::decode(&s).map_err(D::Error::custom)?;
if bytes.len() != GRAFFITI_BYTES_LEN {
return Err(D::Error::custom(format!(

View File

@ -63,9 +63,9 @@ impl<T: EthSpec> Hash for IndexedAttestation<T> {
mod quoted_variable_list_u64 {
use super::*;
use crate::Unsigned;
use eth2_serde_utils::quoted_u64_vec::{QuotedIntVecVisitor, QuotedIntWrapper};
use serde::ser::SerializeSeq;
use serde::{Deserializer, Serializer};
use serde_utils::quoted_u64_vec::{QuotedIntVecVisitor, QuotedIntWrapper};
pub fn serialize<S, T>(value: &VariableList<u64, T>, serializer: S) -> Result<S::Ok, S::Error>
where

View File

@ -13,9 +13,9 @@ use tree_hash_derive::TreeHash;
pub struct PendingAttestation<T: EthSpec> {
pub aggregation_bits: BitList<T::MaxValidatorsPerCommittee>,
pub data: AttestationData,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub inclusion_delay: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub proposer_index: u64,
}

View File

@ -12,71 +12,71 @@ use serde_derive::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub struct BasePreset {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_committees_per_slot: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub target_committee_size: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_validators_per_committee: u64,
#[serde(with = "serde_utils::quoted_u8")]
#[serde(with = "eth2_serde_utils::quoted_u8")]
pub shuffle_round_count: u8,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub hysteresis_quotient: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub hysteresis_downward_multiplier: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub hysteresis_upward_multiplier: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub safe_slots_to_update_justified: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub min_deposit_amount: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_effective_balance: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub effective_balance_increment: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub min_attestation_inclusion_delay: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub slots_per_epoch: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub min_seed_lookahead: Epoch,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_seed_lookahead: Epoch,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub epochs_per_eth1_voting_period: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub slots_per_historical_root: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub min_epochs_to_inactivity_penalty: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub epochs_per_historical_vector: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub epochs_per_slashings_vector: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub historical_roots_limit: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_registry_limit: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub base_reward_factor: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub whistleblower_reward_quotient: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub proposer_reward_quotient: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub inactivity_penalty_quotient: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub min_slashing_penalty_quotient: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub proportional_slashing_multiplier: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_proposer_slashings: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_attester_slashings: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_attestations: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_deposits: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub max_voluntary_exits: u64,
}
@ -123,17 +123,17 @@ impl BasePreset {
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub struct AltairPreset {
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub inactivity_penalty_quotient_altair: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub min_slashing_penalty_quotient_altair: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub proportional_slashing_multiplier_altair: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub sync_committee_size: u64,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub epochs_per_sync_committee_period: Epoch,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub min_sync_committee_participants: u64,
}

View File

@ -27,12 +27,12 @@ use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub, SubAssi
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Slot(#[serde(with = "serde_utils::quoted_u64")] u64);
pub struct Slot(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Epoch(#[serde(with = "serde_utils::quoted_u64")] u64);
pub struct Epoch(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
impl_common!(Slot);
impl_common!(Epoch);

View File

@ -20,7 +20,7 @@ lazy_static! {
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SubnetId(#[serde(with = "serde_utils::quoted_u64")] u64);
pub struct SubnetId(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
pub fn subnet_id_to_string(i: u64) -> &'static str {
if i < MAX_SUBNET_ID as u64 {

View File

@ -21,7 +21,7 @@ pub enum Error {
pub struct SyncCommitteeContribution<T: EthSpec> {
pub slot: Slot,
pub beacon_block_root: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub subcommittee_index: u64,
pub aggregation_bits: BitVector<T::SyncSubcommitteeSize>,
pub signature: AggregateSignature,

View File

@ -13,7 +13,7 @@ use tree_hash_derive::TreeHash;
pub struct SyncCommitteeMessage {
pub slot: Slot,
pub beacon_block_root: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_index: u64,
// Signature by the validator over `beacon_block_root`.
pub signature: Signature,

View File

@ -7,9 +7,9 @@ use std::collections::HashSet;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SyncDuty {
pub pubkey: PublicKeyBytes,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_index: u64,
#[serde(with = "serde_utils::quoted_u64_vec")]
#[serde(with = "eth2_serde_utils::quoted_u64_vec")]
pub validator_sync_committee_indices: Vec<u64>,
}

View File

@ -22,7 +22,7 @@ lazy_static! {
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SyncSubnetId(#[serde(with = "serde_utils::quoted_u64")] u64);
pub struct SyncSubnetId(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
pub fn sync_subnet_id_to_string(i: u64) -> &'static str {
if i < SYNC_COMMITTEE_SUBNET_COUNT {

View File

@ -14,7 +14,7 @@ use tree_hash_derive::TreeHash;
pub struct Validator {
pub pubkey: PublicKeyBytes,
pub withdrawal_credentials: Hash256,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub effective_balance: u64,
pub slashed: bool,
pub activation_eligibility_epoch: Epoch,

View File

@ -16,7 +16,7 @@ use tree_hash_derive::TreeHash;
pub struct VoluntaryExit {
/// Earliest epoch when voluntary exit can be processed.
pub epoch: Epoch,
#[serde(with = "serde_utils::quoted_u64")]
#[serde(with = "eth2_serde_utils::quoted_u64")]
pub validator_index: u64,
}

View File

@ -5,15 +5,15 @@ authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
[dependencies]
eth2_ssz = "0.1.2"
tree_hash = "0.1.1"
eth2_ssz = "0.3.0"
tree_hash = "0.3.0"
milagro_bls = { git = "https://github.com/sigp/milagro_bls", tag = "v1.4.2", optional = true }
rand = "0.7.3"
serde = "1.0.116"
serde_derive = "1.0.116"
serde_utils = { path = "../../consensus/serde_utils" }
eth2_serde_utils = "0.1.0"
hex = "0.4.2"
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
ethereum-types = "0.11.0"
arbitrary = { version = "0.4.6", features = ["derive"], optional = true }
zeroize = { version = "1.1.1", features = ["zeroize_derive"] }

View File

@ -4,9 +4,9 @@ use crate::{
generic_signature::{GenericSignature, TSignature},
Error, Hash256, INFINITY_SIGNATURE, SIGNATURE_BYTES_LEN,
};
use eth2_serde_utils::hex::encode as hex_encode;
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_utils::hex::encode as hex_encode;
use ssz::{Decode, Encode};
use std::fmt;
use std::marker::PhantomData;

View File

@ -1,8 +1,8 @@
use crate::generic_public_key_bytes::GenericPublicKeyBytes;
use crate::Error;
use eth2_serde_utils::hex::encode as hex_encode;
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_utils::hex::encode as hex_encode;
use ssz::{Decode, Encode};
use std::fmt;
use std::hash::{Hash, Hasher};

View File

@ -2,9 +2,9 @@ use crate::{
generic_public_key::{GenericPublicKey, TPublicKey},
Error, PUBLIC_KEY_BYTES_LEN,
};
use eth2_serde_utils::hex::encode as hex_encode;
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_utils::hex::encode as hex_encode;
use ssz::{Decode, Encode};
use std::convert::TryInto;
use std::fmt;

View File

@ -2,9 +2,9 @@ use crate::{
generic_public_key::{GenericPublicKey, TPublicKey},
Error, Hash256,
};
use eth2_serde_utils::hex::encode as hex_encode;
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_utils::hex::encode as hex_encode;
use ssz::{Decode, Encode};
use std::fmt;
use std::marker::PhantomData;

View File

@ -3,9 +3,9 @@ use crate::{
generic_signature::{GenericSignature, TSignature},
Error, INFINITY_SIGNATURE, SIGNATURE_BYTES_LEN,
};
use eth2_serde_utils::hex::encode as hex_encode;
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_utils::hex::encode as hex_encode;
use ssz::{Decode, Encode};
use std::convert::TryInto;
use std::fmt;

View File

@ -1,6 +1,6 @@
[package]
name = "eth2_hashing"
version = "0.1.1"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
license = "Apache-2.0"

View File

@ -18,7 +18,7 @@ serde = "1.0.116"
serde_repr = "0.1.6"
hex = "0.4.2"
bls = { path = "../bls" }
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
serde_json = "1.0.58"
eth2_key_derivation = { path = "../eth2_key_derivation" }
unicode-normalization = "0.1.16"

View File

@ -18,7 +18,7 @@ serde_yaml = "0.8.13"
simple_logger = "1.10.0"
types = { path = "../consensus/types" }
state_processing = { path = "../consensus/state_processing" }
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
regex = "1.3.9"
futures = "0.3.7"
environment = { path = "../lighthouse/environment" }
@ -26,7 +26,7 @@ eth2_network_config = { path = "../common/eth2_network_config" }
dirs = "3.0.1"
genesis = { path = "../beacon_node/genesis" }
deposit_contract = { path = "../common/deposit_contract" }
tree_hash = "0.1.1"
tree_hash = "0.3.0"
tokio = { version = "1.10.0", features = ["full"] }
clap_utils = { path = "../common/clap_utils" }
eth2_libp2p = { path = "../beacon_node/eth2_libp2p" }

View File

@ -24,7 +24,7 @@ slog = { version = "2.5.2", features = ["max_level_trace"] }
sloggers = "1.0.1"
types = { "path" = "../consensus/types" }
bls = { path = "../crypto/bls" }
eth2_hashing = "0.1.0"
eth2_hashing = "0.2.0"
clap = "2.33.3"
env_logger = "0.9.0"
logging = { path = "../common/logging" }

109
scripts/ci/publish.sh Executable file
View File

@ -0,0 +1,109 @@
#!/usr/bin/env bash
# Based on: https://github.com/tokio-rs/tokio/blob/master/bin/publish
set -e
USAGE="Publish a new release of a lighthouse crate
USAGE:
$(basename "$0") [OPTIONS] [CRATE_PATH] [CRATE] [TAG]
OPTIONS:
-v, --verbose Use verbose Cargo output
-d, --dry-run Perform a dry run (do not publish the release)
-h, --help Show this help text and exit
--allow-dirty Allow dirty working directories to be packaged"
DRY_RUN=""
DIRTY=""
VERBOSE=""
verify() {
echo "Verifying if $CRATE v$VERSION can be released"
# `cargo pkgid` has different formats based on whether the `[lib]` name and `[package]` name
# are the same, necessitating the following logic.
#
# Try to match on `#`
ACTUAL=$(cargo pkgid | sed -n 's/.*#\([0-9]\)/\1/p' )
if [ -z "$ACTUAL" ]; then
# Match on the final `:`
ACTUAL=$(cargo pkgid | sed -n 's/.*:\(.*\)/\1/p')
fi
if [ "$ACTUAL" != "$VERSION" ]; then
echo "expected to release version $VERSION, but Cargo.toml contained $ACTUAL"
exit 1
fi
}
release() {
echo "Releasing $CRATE v$VERSION"
cargo package $VERBOSE $DIRTY
cargo publish $VERBOSE $DRY_RUN $DIRTY
}
while [[ $# -gt 0 ]]
do
case "$1" in
-h|--help)
echo "$USAGE"
exit 0
;;
-v|--verbose)
VERBOSE="--verbose"
set +x
shift
;;
--allow-dirty)
DIRTY="--allow-dirty"
shift
;;
-d|--dry-run)
DRY_RUN="--dry-run"
shift
;;
-*)
echo "unknown flag \"$1\""
echo "$USAGE"
exit 1
;;
*) # crate, crate path, or version
if [ -z "$CRATE_PATH" ]; then
CRATE_PATH="$1"
elif [ -z "$CRATE" ]; then
CRATE="$1"
elif [ -z "$TAG" ]; then
TAG="$1"
VERSION=$(sed -e 's#.*-v\([0-9]\)#\1#' <<< "$TAG")
else
echo "unknown positional argument \"$1\""
echo "$USAGE"
exit 1
fi
shift
;;
esac
done
# set -- "${POSITIONAL[@]}"
if [ -z "$VERSION" ]; then
echo "no version specified!"
HELP=1
fi
if [ -z "$CRATE" ]; then
echo "no crate specified!"
HELP=1
fi
if [ -n "$HELP" ]; then
echo "$USAGE"
exit 1
fi
if [ -d "$CRATE_PATH" ]; then
(cd "$CRATE_PATH" && verify && release )
else
echo "no such dir \"$CRATE_PATH\""
exit 1
fi

View File

@ -7,8 +7,8 @@ edition = "2018"
[dependencies]
bincode = "1.3.1"
byteorder = "1.3.4"
eth2_ssz = { path = "../consensus/ssz" }
eth2_ssz_derive = { path = "../consensus/ssz_derive" }
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
flate2 = { version = "1.0.14", features = ["zlib"], default-features = false }
lazy_static = "1.4.0"
lighthouse_metrics = { path = "../common/lighthouse_metrics" }
@ -22,8 +22,8 @@ serde = "1.0"
serde_derive = "1.0"
slog = "2.5.2"
sloggers = "*"
tree_hash = { path = "../consensus/tree_hash" }
tree_hash_derive = { path = "../consensus/tree_hash_derive" }
tree_hash = "0.3.0"
tree_hash_derive = "0.3.1"
types = { path = "../consensus/types" }
[dev-dependencies]

View File

@ -22,10 +22,10 @@ serde = "1.0.116"
serde_derive = "1.0.116"
serde_repr = "0.1.6"
serde_yaml = "0.8.13"
eth2_ssz = "0.1.2"
eth2_ssz_derive = "0.1.0"
tree_hash = "0.1.1"
tree_hash_derive = "0.2.0"
eth2_ssz = "0.3.0"
eth2_ssz_derive = "0.2.1"
tree_hash = "0.3.0"
tree_hash_derive = "0.3.1"
cached_tree_hash = { path = "../../consensus/cached_tree_hash" }
state_processing = { path = "../../consensus/state_processing" }
swap_or_not_shuffle = { path = "../../consensus/swap_or_not_shuffle" }

View File

@ -9,6 +9,6 @@ edition = "2018"
[dependencies]
state_processing = { path = "../../consensus/state_processing" }
types = { path = "../../consensus/types" }
eth2_ssz = "0.1.2"
eth2_ssz = "0.3.0"
beacon_chain = { path = "../../beacon_node/beacon_chain" }
lazy_static = "1.4.0"

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)