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] - Altair consensus changes and refactors #2279

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
2c52794
Start Altair refactor
michaelsproul Mar 23, 2021
bb397c5
Add AltairConfig
michaelsproul Mar 23, 2021
937a19a
Towards SSZ tests passing
michaelsproul Mar 24, 2021
b199b25
Generate as_base/as_altair with superstruct
michaelsproul Mar 25, 2021
a4d3e70
Most SSZ static tests passing
michaelsproul Mar 25, 2021
ca6bbf9
justification_and_finalization changes
realbigsean Mar 25, 2021
a5c8990
refactor to match eth2 spec, and fix epoch processing EF tests
realbigsean Mar 25, 2021
6585c9d
Merge branch 'consensus-spec-tests' of https://github.com/realbigsean…
realbigsean Mar 25, 2021
20181b7
Make SignedBeaconBlock a superstruct
michaelsproul Mar 26, 2021
3283abc
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Mar 26, 2021
1449230
Fix ef_tests for SBB change
michaelsproul Mar 26, 2021
5090cf4
refactors
realbigsean Mar 26, 2021
a0fa7af
Merge branch 'altair' of https://github.com/sigp/lighthouse into alta…
realbigsean Mar 26, 2021
4895348
refactor justification and finalization, begin altair rewards and pen…
realbigsean Mar 27, 2021
9ab858a
get rewards and penalties working for altair
realbigsean Mar 28, 2021
060e3d4
fix some imports
realbigsean Mar 28, 2021
d5cf7a8
Implement basic sync committee functions
michaelsproul Mar 31, 2021
e470fd4
Merge remote-tracking branch 'sean/altair-process-epoch' into altair
michaelsproul Mar 31, 2021
746e99b
Implement process_sync_committee
michaelsproul Mar 31, 2021
3b00f83
Update EF operation tests incl sync agg
michaelsproul Apr 1, 2021
b9f32e0
small refactors
realbigsean Apr 6, 2021
3a364d9
Update attestation/deposit processing
michaelsproul Apr 6, 2021
f68738e
Implement `upgrade_to_altair`, genesis init test
michaelsproul Apr 6, 2021
1815024
Merge branch 'altair' of https://github.com/sigp/lighthouse into more…
realbigsean Apr 6, 2021
84c0441
fix slashings and implement sync committee processing
realbigsean Apr 6, 2021
5c63dcd
refactor common epoch processing methods
realbigsean Apr 6, 2021
97106d4
delete unused imports
realbigsean Apr 6, 2021
4cffdcb
Fix typo in sync_committee_updates
michaelsproul Apr 7, 2021
9ac6850
Update to v1.1.0-alpha.3
michaelsproul Apr 7, 2021
8ffeb33
Fix remaining EF tests/handlers!
michaelsproul Apr 7, 2021
d5f19dc
Fix beacon chain tests non-altair (#2305)
realbigsean Apr 13, 2021
254bd66
Use RefMut
michaelsproul Apr 13, 2021
e873ad9
Reset Cargo.lock to "stable" style
michaelsproul Apr 13, 2021
458828f
Tidy block tree hash
michaelsproul Apr 13, 2021
ace7c45
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Apr 13, 2021
a256b06
Temporarily hardcode base fork in op pool
michaelsproul Apr 13, 2021
0cdd19c
Update block proposal & op pool
michaelsproul Apr 14, 2021
1a4145d
Fix bounds check on compute_sync_committee_indices
michaelsproul Apr 14, 2021
d6f2acc
Tidy phase0 op pool
michaelsproul Apr 14, 2021
bfc70cf
Remove global fork schedule (#2314)
michaelsproul Apr 19, 2021
663a9ef
Use superstruct partial getters
michaelsproul Apr 19, 2021
27f41c6
Lots of test refactors (#2315)
realbigsean Apr 20, 2021
610e92b
More test cleanups and fixes
michaelsproul Apr 20, 2021
e490f3c
Use `upgrade_to_altair` in state transition
michaelsproul Apr 20, 2021
af9e2d8
More test fixes
michaelsproul Apr 20, 2021
98e26d5
Add fork upgrade test, fix EF spec test
michaelsproul Apr 21, 2021
92d3c33
Update lcli and local testnet scripts
michaelsproul Apr 22, 2021
f8b31f6
More test updates, release-tests might pass now...
michaelsproul Apr 23, 2021
e92e61b
Nuke old store benchmark
michaelsproul Apr 23, 2021
14a15ca
Fix arbitrary instances
michaelsproul Apr 23, 2021
0ded5cb
Participation bits fixes, clippy fixes
michaelsproul Apr 23, 2021
9882bbb
Disable indexing in types & state processing
michaelsproul Apr 27, 2021
5176655
Delete tree hash and state proc benchmarks
michaelsproul Apr 27, 2021
e4b2570
Disable aggressive lints in tests
michaelsproul Apr 27, 2021
eea1708
Appease udeps
michaelsproul Apr 27, 2021
fa3f6f7
Fix the RPC tests without hacks
michaelsproul Apr 27, 2021
a1d9182
Fix double update in github cargo fmt
michaelsproul Apr 27, 2021
d0f63e0
Use published superstruct
michaelsproul Apr 27, 2021
d1d3cba
Try splitting beacon_chain tests out of CI
michaelsproul Apr 28, 2021
d32cc3d
Fix cargo-fmt --all
michaelsproul Apr 28, 2021
95ca4ed
Abstract over fork in beacon_chain tests
michaelsproul Apr 29, 2021
0cf1834
Fix clippy
michaelsproul Apr 29, 2021
a549472
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Apr 29, 2021
c89de3b
Maintain backwards compatibility with std config
michaelsproul Apr 30, 2021
f7b82ae
Provide clarity about BeaconState leaf count (#2339)
paulhauner May 10, 2021
1a9c899
Remove sync committee indices cache
michaelsproul May 11, 2021
6d01530
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul May 13, 2021
967d680
Add tests for decoding state/block with bad slot (#2341)
paulhauner May 14, 2021
70a2fc0
Use graffiti len more consistently (#2348)
paulhauner May 19, 2021
28aa869
Replace a test deleted during Altair update (#2351)
paulhauner May 19, 2021
6c16333
Apply comment fixes from Paul
michaelsproul May 19, 2021
8377565
Avoid slicing in PartialBeaconState (#2361)
paulhauner May 21, 2021
6f6eebf
[Altair] Make anonymous var-length SSZ decoding explicit (#2362)
paulhauner May 21, 2021
76d31cd
[Altair] Rewards tests (#2349)
michaelsproul May 24, 2021
5cb0211
[Altair] Remove duplicate vars, panic on `u64::pow` overflow (#2350)
paulhauner May 24, 2021
06c46f4
[Altair] Applying Base block to Altair chain (#2353)
paulhauner May 24, 2021
97d1807
[Altair] Add check for missed EF tests (#2346)
paulhauner May 24, 2021
dba9dca
Merge branch 'unstable' of github.com:sigp/lighthouse into altair-mer…
paulhauner May 24, 2021
e324310
Merge pull request #2365 from paulhauner/altair-merge-unstable
michaelsproul May 25, 2021
443793b
Restore lost CI YAML
michaelsproul May 25, 2021
6415962
Address review comments
michaelsproul May 25, 2021
49b79b8
Update comment
michaelsproul May 25, 2021
338a2d1
Return an error if total bal is 0 (#2366)
paulhauner May 25, 2021
dc2227a
Minor changes to justification code (#2367)
paulhauner May 25, 2021
7d18521
[Altair] Optimization for `get_unslashed_participating_indices` (#2369)
paulhauner May 26, 2021
2a7c2b3
Update consensus code to v1.1.0-alpha.6
michaelsproul May 28, 2021
cb9a7a2
Ripple spec updates
michaelsproul May 31, 2021
ee8dea8
Implement preset <> config distinction
michaelsproul Jun 2, 2021
897fb7c
Return ConfigAndPreset from VC API
michaelsproul Jun 3, 2021
f08e96f
Don't panic if there aren't any aggregators
michaelsproul Jun 3, 2021
9940cc8
Check state root in transition tests
michaelsproul Jun 3, 2021
c0b20fb
Fix clippy
michaelsproul Jun 3, 2021
f532a92
Fix Pyrmont & Prater configs. Delete Toledo.
michaelsproul Jun 3, 2021
5a556b3
Add compatibility shim for /config/spec
michaelsproul Jun 3, 2021
0a2d57f
Minor cleanups
michaelsproul Jun 8, 2021
bc68a2d
Merge pull request #2373 from michaelsproul/altair-latest-spec
michaelsproul Jun 8, 2021
99bffdb
Update to spec v1.1.0-alpha.7
michaelsproul Jun 11, 2021
17a0431
Update mainnet preset YAML
michaelsproul Jun 15, 2021
c962b88
Merge pull request #2405 from sigp/altair-alpha.7
michaelsproul Jun 16, 2021
8a13d6f
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Jun 17, 2021
ffba057
Fix beacon_chain test
michaelsproul Jun 17, 2021
0a4c4f5
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Jun 23, 2021
c878ff5
Updates related to merge with `unstable`
realbigsean Jun 17, 2021
95e3069
Couple more `unstable` merge fixes
realbigsean Jun 17, 2021
e377395
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Jul 6, 2021
5d36a6c
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Jul 6, 2021
a40826b
Merge remote-tracking branch 'origin/unstable' into altair
michaelsproul Jul 9, 2021
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
14 changes: 12 additions & 2 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get latest version of stable Rust
run: rustup update stable
- name: Get latest version of stable Rust
run: rustup update stable
- name: Check formatting with cargo fmt
Expand Down Expand Up @@ -58,6 +56,18 @@ jobs:
run: choco install -y make
- name: Run tests in release
run: make test-release
beacon-chain-tests:
name: beacon-chain-tests
runs-on: ubuntu-latest
needs: cargo-fmt
steps:
- uses: actions/checkout@v1
- name: Get latest version of stable Rust
run: rustup update stable
- name: Run beacon_chain tests for base hard fork
run: make test-beacon-chain-base
- name: Run beacon_chain tests for Altair hard fork
run: make test-beacon-chain-altair
debug-tests-ubuntu:
name: debug-tests-ubuntu
runs-on: ubuntu-latest
Expand Down
92 changes: 82 additions & 10 deletions Cargo.lock

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

17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: tests

EF_TESTS = "testing/ef_tests"
BEACON_CHAIN_CRATE = "beacon_node/beacon_chain"
STATE_TRANSITION_VECTORS = "testing/state_transition_vectors"
GIT_TAG := $(shell git describe --tags --candidates 1)
BIN_DIR = "bin"
Expand Down Expand Up @@ -79,30 +80,38 @@ build-release-tarballs:
# Runs the full workspace tests in **release**, without downloading any additional
# test vectors.
test-release:
cargo test --all --release --exclude ef_tests
cargo test --workspace --release --exclude ef_tests --exclude beacon_chain

# Runs the full workspace tests in **debug**, without downloading any additional test
# vectors.
test-debug:
cargo test --all --exclude ef_tests
cargo test --workspace --exclude ef_tests --exclude beacon_chain

# Runs cargo-fmt (linter).
cargo-fmt:
cargo fmt --all -- --check

# Typechecks benchmark code
check-benches:
cargo check --all --benches
cargo check --workspace --benches

# Typechecks consensus code *without* allowing deprecated legacy arithmetic
check-consensus:
cargo check --manifest-path=consensus/state_processing/Cargo.toml --no-default-features

# Runs only the ef-test vectors.
run-ef-tests:
rm -rf $(EF_TESTS)/.accessed_file_log.txt
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"
./$(EF_TESTS)/check_all_files_accessed.py $(EF_TESTS)/.accessed_file_log.txt $(EF_TESTS)/eth2.0-spec-tests

# Run the tests in the `beacon_chain` crate.
test-beacon-chain: test-beacon-chain-base test-beacon-chain-altair

test-beacon-chain-%:
env FORK_NAME=$* cargo test --release --features fork_from_env --manifest-path=$(BEACON_CHAIN_CRATE)/Cargo.toml

# Runs only the tests/state_transition_vectors tests.
run-state-transition-tests:
Expand All @@ -121,7 +130,7 @@ test-full: cargo-fmt test-release test-debug test-ef
# Lints the code for bad style and potentially unsafe arithmetic using Clippy.
# Clippy lints are opt-in per-crate for now. By default, everything is allowed except for performance and correctness lints.
lint:
cargo clippy --all --tests -- \
cargo clippy --workspace --tests -- \
-D warnings \
-A clippy::from-over-into \
-A clippy::upper-case-acronyms \
Expand Down
2 changes: 1 addition & 1 deletion account_manager/src/validator/exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async fn publish_voluntary_exit<E: EthSpec>(
.beacon_state::<E>()
.as_ref()
.expect("network should have valid genesis state")
.genesis_validators_root;
.genesis_validators_root();

// Verify that the beacon node and validator being exited are on the same network.
if genesis_data.genesis_validators_root != testnet_genesis_root {
Expand Down
2 changes: 1 addition & 1 deletion account_manager/src/validator/slashing_protection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub fn cli_run<T: EthSpec>(

let genesis_validators_root = testnet_config
.beacon_state::<T>()
.map(|state: BeaconState<T>| state.genesis_validators_root)
.map(|state: BeaconState<T>| state.genesis_validators_root())
.map_err(|e| {
format!(
"Unable to get genesis state, has genesis occurred? Detail: {:?}",
Expand Down
5 changes: 3 additions & 2 deletions beacon_node/beacon_chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +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.
test_logger = [] # Print log output to stderr when running tests instead of dropping it
fork_from_env = [] # Initialise the harness chain spec from the FORK_NAME env variable

[dev-dependencies]
int_to_bytes = { path = "../../consensus/int_to_bytes" }
maplit = "1.0.2"
environment = { path = "../../lighthouse/environment" }

Expand Down Expand Up @@ -45,6 +45,7 @@ eth1 = { path = "../eth1" }
futures = "0.3.7"
genesis = { path = "../genesis" }
integer-sqrt = "0.1.5"
int_to_bytes = { path = "../../consensus/int_to_bytes" }
rand = "0.7.3"
rand_core = "0.6.2"
proto_array = { path = "../../consensus/proto_array" }
Expand All @@ -56,7 +57,7 @@ safe_arith = { path = "../../consensus/safe_arith" }
fork_choice = { path = "../../consensus/fork_choice" }
task_executor = { path = "../../common/task_executor" }
derivative = "2.1.1"
itertools = "0.9.0"
itertools = "0.10.0"
regex = "1.3.9"
exit-future = "0.2.0"
slasher = { path = "../../slasher" }
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/src/attestation_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ pub fn verify_attestation_signature<T: BeaconChainTypes>(
.canonical_head
.try_read_for(HEAD_LOCK_TIMEOUT)
.ok_or(BeaconChainError::CanonicalHeadLockTimeout)
.map(|head| head.beacon_state.fork)?;
.map(|head| head.beacon_state.fork())?;

let signature_set = indexed_attestation_signature_set_from_pubkeys(
|validator_index| pubkey_cache.get(validator_index).map(Cow::Borrowed),
Expand Down Expand Up @@ -1001,7 +1001,7 @@ pub fn verify_signed_aggregate_signatures<T: BeaconChainTypes>(
.canonical_head
.try_read_for(HEAD_LOCK_TIMEOUT)
.ok_or(BeaconChainError::CanonicalHeadLockTimeout)
.map(|head| head.beacon_state.fork)?;
.map(|head| head.beacon_state.fork())?;

let signature_sets = vec![
signed_aggregate_selection_proof_signature_set(
Expand Down
Loading