Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Support multiple BLS implementations #1335

Closed
wants to merge 79 commits into from
Closed
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
7b2b698
Start reviving bls-refactor branch
paulhauner Jun 25, 2020
7cd13a3
Merge branch 'master' into multi-bls
paulhauner Jul 6, 2020
12d0995
Make `bls` compile, start integration
paulhauner Jul 6, 2020
9e25d66
Fix eth2_keystore compile errors
paulhauner Jul 6, 2020
cc57bd4
Add progress on integration
paulhauner Jul 6, 2020
bddc83a
Fix `lighthouse` binary compile errors
paulhauner Jul 6, 2020
158c44a
Add progress on ef_tests
paulhauner Jul 6, 2020
614cd17
Add progress on fast_agg_verify
paulhauner Jul 6, 2020
ad52e96
Add aggregates to bls
paulhauner Jul 6, 2020
fa749d0
Add progress towards compilation
paulhauner Jul 6, 2020
a05ccc1
Allow for compile up to ef_tests
paulhauner Jul 7, 2020
2239f3c
Make ef tests pass
paulhauner Jul 7, 2020
8886ca3
Fix secret key byte len issue
paulhauner Jul 7, 2020
28ba558
Fix some failing ef_tests
paulhauner Jul 7, 2020
f0657e5
Update fake-crypto, features
paulhauner Jul 7, 2020
609b024
Integrate into tests
paulhauner Jul 7, 2020
d44d37e
Fix some failing tests
paulhauner Jul 7, 2020
2616ab4
Remove keypair serialization
paulhauner Jul 7, 2020
413d4c8
Remove commented-out code
paulhauner Jul 7, 2020
b47a0d7
Merge branch 'master' into multi-bls
paulhauner Jul 7, 2020
cab9b60
Merge branch 'master' into multi-bls
paulhauner Jul 7, 2020
241e648
Start integrating blst
paulhauner Jul 7, 2020
4d0a90e
Add partial eq, clone to blst
paulhauner Jul 8, 2020
7c72eba
Reduce code duplication
paulhauner Jul 8, 2020
a98229e
Check for empty lists
paulhauner Jul 8, 2020
304cee3
Add zero support to blst agg sig
paulhauner Jul 8, 2020
2805cd8
Fix blst agg sig zero
paulhauner Jul 8, 2020
af35587
Change profile version
paulhauner Jul 8, 2020
7a08ddf
Small cosmetic changes
paulhauner Jul 8, 2020
974986f
Switch to sigp blst repo
paulhauner Jul 8, 2020
f7e68a8
Use supranational by defualt
paulhauner Jul 8, 2020
1e8862b
Update cargo.lock
paulhauner Jul 8, 2020
5682ce7
Merge branch 'master' into multi-bls
paulhauner Jul 16, 2020
1dc4bf5
Update Cargo.lock
paulhauner Jul 16, 2020
8085a35
Update main docs
paulhauner Jul 16, 2020
7575623
Merge branch 'master' into multi-bls
paulhauner Jul 17, 2020
d298c8e
Swap from format! to to_hex_string
paulhauner Jul 17, 2020
5f662b9
Fix test compile error
paulhauner Jul 17, 2020
daaac86
Start tidying, adding comments
paulhauner Jul 17, 2020
ad92f1c
Add more comments
paulhauner Jul 17, 2020
55d50bc
Add comments, tidy
paulhauner Jul 17, 2020
1b57083
Fix double 0x serialization
paulhauner Jul 17, 2020
f749a18
Remove some unused functions
paulhauner Jul 17, 2020
ef209aa
Remove legacy key upgrading
paulhauner Jul 17, 2020
55e2a98
Fix random secret key gen for BLST
paulhauner Jul 17, 2020
9e765f2
Start adding Generic prefix
paulhauner Jul 17, 2020
4a56954
Finish adding Generic prefix
paulhauner Jul 17, 2020
e6409f9
Fix clippy errors
paulhauner Jul 17, 2020
cd465f8
Rename generic files, fix some missed structs
paulhauner Jul 17, 2020
4432051
Shift around impls mod
paulhauner Jul 17, 2020
fb28192
Export generic structs
paulhauner Jul 17, 2020
d33d84f
Refactor blst signature set verification
paulhauner Jul 17, 2020
b7daf5e
Update BLS library target
paulhauner Jul 17, 2020
abb81a4
Loose Eq constraints
paulhauner Jul 17, 2020
717cb51
Remove build.rs
paulhauner Jul 18, 2020
044f740
Fix supranational typo
paulhauner Jul 18, 2020
7387542
Fix cargo.toml git mistake
paulhauner Jul 18, 2020
c8717bd
Add special-case for infinity point
paulhauner Jul 18, 2020
872e5e3
Start adding tests
paulhauner Jul 18, 2020
2e08dd8
Add more testing
paulhauner Jul 19, 2020
8eb77e0
Add more comments, tests
paulhauner Jul 19, 2020
8105af8
Add some partial eq tests
paulhauner Jul 19, 2020
ad2b3f8
Fix zero/infinity mixup
paulhauner Jul 19, 2020
d44723d
Remove unnecessary casts
paulhauner Jul 19, 2020
d6df596
Change how blst and milagro get infinity keys
paulhauner Jul 19, 2020
6c7b5e1
Improve tests, add TODO to unsafe code
paulhauner Jul 19, 2020
d4ef68f
Fix ssz round trip issue with agg sig
paulhauner Jul 20, 2020
30094a6
Remove `GenericAggregatePublicKey`
paulhauner Jul 20, 2020
54fa3fd
Add signature set testing
paulhauner Jul 20, 2020
acd4184
Add test comments
paulhauner Jul 20, 2020
6324d21
Remove opt-level restriction
paulhauner Jul 20, 2020
8f06c0e
Add milagro to ef_tests
paulhauner Jul 20, 2020
43b9ac6
Merge branch 'master' into multi-bls
paulhauner Jul 20, 2020
0ae278a
Rename to AggregateSignature::infinity
paulhauner Jul 20, 2020
af9e63e
Fix bls features
paulhauner Jul 20, 2020
f69f2b4
Merge branch 'master' into multi-bls
paulhauner Jul 23, 2020
85ed2ae
Add "secure" to random keygen comments
paulhauner Jul 23, 2020
1e60f79
Rename SecretHash -> ZeroizeHash
paulhauner Jul 23, 2020
9d9b357
Address clippy lints
paulhauner Jul 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- uses: actions/checkout@v1
- name: Get latest version of stable Rust
run: rustup update stable
- name: Run eth2.0-spec-tests with and without fake_crypto
- name: Run eth2.0-spec-tests with blst, milagro and fake_crypto
run: make test-ef
dockerfile-ubuntu:
name: dockerfile-ubuntu
Expand Down
32 changes: 27 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ check-benches:
run-ef-tests:
cargo test --release --manifest-path=$(EF_TESTS)/Cargo.toml --features "ef_tests"
cargo test --release --manifest-path=$(EF_TESTS)/Cargo.toml --features "ef_tests,fake_crypto"
cargo test --release --manifest-path=$(EF_TESTS)/Cargo.toml --features "ef_tests,milagro"

# Runs only the tests/state_transition_vectors tests.
run-state-transition-tests:
Expand Down
2 changes: 1 addition & 1 deletion account_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ clap_utils = { path = "../common/clap_utils" }
eth2_wallet = { path = "../crypto/eth2_wallet" }
eth2_wallet_manager = { path = "../common/eth2_wallet_manager" }
rand = "0.7.2"
validator_dir = { path = "../common/validator_dir", features = ["unencrypted_keys"] }
validator_dir = { path = "../common/validator_dir" }
tokio = { version = "0.2.21", features = ["full"] }
eth2_keystore = { path = "../crypto/eth2_keystore" }
3 changes: 0 additions & 3 deletions account_manager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod common;
pub mod upgrade_legacy_keypairs;
pub mod validator;
pub mod wallet;

Expand All @@ -19,15 +18,13 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.about("Utilities for generating and managing Ethereum 2.0 accounts.")
.subcommand(wallet::cli_app())
.subcommand(validator::cli_app())
.subcommand(upgrade_legacy_keypairs::cli_app())
}

/// Run the account manager, returning an error if the operation did not succeed.
pub fn run<T: EthSpec>(matches: &ArgMatches<'_>, env: Environment<T>) -> Result<(), String> {
match matches.subcommand() {
(wallet::CMD, Some(matches)) => wallet::cli_run(matches)?,
(validator::CMD, Some(matches)) => validator::cli_run(matches, env)?,
(upgrade_legacy_keypairs::CMD, Some(matches)) => upgrade_legacy_keypairs::cli_run(matches)?,
(unknown, _) => {
return Err(format!(
"{} is not a valid {} command. See --help.",
Expand Down
149 changes: 0 additions & 149 deletions account_manager/src/upgrade_legacy_keypairs.rs

This file was deleted.

3 changes: 3 additions & 0 deletions beacon_node/beacon_chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ default = ["participation_metrics"]
write_ssz_files = [] # Writes debugging .ssz files to /tmp during block processing.
participation_metrics = [] # Exposes validator participation metrics to Prometheus.

[dev-dependencies]
int_to_bytes = { path = "../../consensus/int_to_bytes" }

[dependencies]
eth2_config = { path = "../../common/eth2_config" }
merkle_proof = { path = "../../consensus/merkle_proof" }
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/src/attestation_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ pub fn verify_signed_aggregate_signatures<T: BeaconChainTypes>(
.map_err(BeaconChainError::SignatureSetError)?,
];

Ok(verify_signature_sets(signature_sets))
Ok(verify_signature_sets(signature_sets.iter()))
}

/// Assists in readability.
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
root: target_root,
},
},
signature: AggregateSignature::empty_signature(),
signature: AggregateSignature::empty(),
})
}

Expand Down Expand Up @@ -1655,7 +1655,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
},
},
// The block is not signed here, that is the task of a validator client.
signature: Signature::empty_signature(),
signature: Signature::empty(),
};

per_block_processing(
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ fn genesis_block<T: EthSpec>(
message: BeaconBlock::empty(&spec),
// Empty signature, which should NEVER be read. This isn't to-spec, but makes the genesis
// block consistent with every other block.
signature: Signature::empty_signature(),
signature: Signature::empty(),
};
genesis_block.message.state_root = genesis_state
.update_tree_hash_cache()
Expand Down
3 changes: 1 addition & 2 deletions beacon_node/beacon_chain/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::observed_attesters::Error as ObservedAttestersError;
use crate::observed_block_producers::Error as ObservedBlockProducersError;
use operation_pool::OpPoolError;
use safe_arith::ArithError;
use ssz::DecodeError;
use ssz_types::Error as SszTypesError;
use state_processing::{
block_signature_verifier::Error as BlockSignatureVerifierError,
Expand Down Expand Up @@ -69,7 +68,7 @@ pub enum BeaconChainError {
AttestationCacheLockTimeout,
ValidatorPubkeyCacheLockTimeout,
IncorrectStateForAttestation(RelativeEpochError),
InvalidValidatorPubkeyBytes(DecodeError),
InvalidValidatorPubkeyBytes(bls::Error),
ValidatorPubkeyCacheIncomplete(usize),
SignatureSetError(SignatureSetError),
BlockSignatureVerifierError(state_processing::block_signature_verifier::Error),
Expand Down
6 changes: 4 additions & 2 deletions beacon_node/beacon_chain/src/snapshot_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mod test {
use super::*;
use types::{
test_utils::{generate_deterministic_keypair, TestingBeaconStateBuilder},
BeaconBlock, Epoch, MainnetEthSpec, Signature, SignedBeaconBlock, Slot,
BeaconBlock, Epoch, MainnetEthSpec, SignedBeaconBlock, Slot,
};

const CACHE_SIZE: usize = 4;
Expand All @@ -115,7 +115,9 @@ mod test {
beacon_state_root: Hash256::from_low_u64_be(i),
beacon_block: SignedBeaconBlock {
message: BeaconBlock::empty(&spec),
signature: Signature::new(&[42], &generate_deterministic_keypair(0).sk),
signature: generate_deterministic_keypair(0)
.sk
.sign(Hash256::from_low_u64_be(42)),
},
beacon_block_root: Hash256::from_low_u64_be(i),
}
Expand Down
Loading