Altair consensus changes and refactors (#2279)

## Proposed Changes

Implement the consensus changes necessary for the upcoming Altair hard fork.

## Additional Info

This is quite a heavy refactor, with pivotal types like the `BeaconState` and `BeaconBlock` changing from structs to enums. This ripples through the whole codebase with field accesses changing to methods, e.g. `state.slot` => `state.slot()`.


Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
Michael Sproul
2021-07-09 06:15:32 +00:00
parent 89361573d4
commit b4689e20c6
271 changed files with 9652 additions and 8444 deletions

92
Cargo.lock generated
View File

@@ -568,7 +568,7 @@ dependencies = [
"genesis",
"int_to_bytes",
"integer-sqrt",
"itertools 0.9.0",
"itertools 0.10.1",
"lazy_static",
"lighthouse_metrics",
"log",
@@ -1031,7 +1031,7 @@ dependencies = [
"ansi_term 0.11.0",
"atty",
"bitflags",
"strsim",
"strsim 0.8.0",
"textwrap",
"unicode-width",
"vec_map",
@@ -1426,6 +1426,41 @@ dependencies = [
"zeroize",
]
[[package]]
name = "darling"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim 0.10.0",
"syn",
]
[[package]]
name = "darling_macro"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a"
dependencies = [
"darling_core",
"quote",
"syn",
]
[[package]]
name = "darwin-libproc"
version = "0.1.2"
@@ -1684,15 +1719,20 @@ dependencies = [
"bls",
"cached_tree_hash",
"compare_fields",
"compare_fields_derive",
"derivative",
"eth2_ssz",
"eth2_ssz_derive",
"ethereum-types 0.9.2",
"fs2",
"hex",
"parking_lot",
"rayon",
"serde",
"serde_derive",
"serde_repr",
"serde_yaml",
"snap",
"state_processing",
"swap_or_not_shuffle",
"tree_hash",
@@ -2185,7 +2225,7 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
name = "fallback"
version = "0.1.0"
dependencies = [
"itertools 0.9.0",
"itertools 0.10.1",
]
[[package]]
@@ -2954,6 +2994,12 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.2.3"
@@ -4068,7 +4114,7 @@ dependencies = [
"hex",
"if-addrs",
"igd",
"itertools 0.9.0",
"itertools 0.10.1",
"lazy_static",
"lighthouse_metrics",
"logging",
@@ -4321,6 +4367,7 @@ dependencies = [
name = "operation_pool"
version = "0.2.0"
dependencies = [
"beacon_chain",
"eth2_ssz",
"eth2_ssz_derive",
"int_to_bytes",
@@ -6061,15 +6108,15 @@ name = "state_processing"
version = "0.2.0"
dependencies = [
"arbitrary",
"beacon_chain",
"bls",
"criterion",
"env_logger 0.8.4",
"eth2_hashing",
"eth2_ssz",
"eth2_ssz_types",
"int_to_bytes",
"integer-sqrt",
"itertools 0.9.0",
"itertools 0.10.1",
"lazy_static",
"log",
"merkle_proof",
@@ -6078,6 +6125,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_yaml",
"smallvec",
"tree_hash",
"tree_hash_derive",
"types",
@@ -6087,7 +6135,9 @@ dependencies = [
name = "state_transition_vectors"
version = "0.1.0"
dependencies = [
"beacon_chain",
"eth2_ssz",
"lazy_static",
"state_processing",
"types",
]
@@ -6151,18 +6201,17 @@ checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
name = "store"
version = "0.2.0"
dependencies = [
"criterion",
"beacon_chain",
"db-key",
"directory",
"eth2_ssz",
"eth2_ssz_derive",
"itertools 0.9.0",
"itertools 0.10.1",
"lazy_static",
"leveldb",
"lighthouse_metrics",
"lru",
"parking_lot",
"rayon",
"serde",
"serde_derive",
"slog",
@@ -6201,6 +6250,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "strum"
version = "0.20.0"
@@ -6234,6 +6289,19 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2"
[[package]]
name = "superstruct"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bf7f6700d7c135cf4e4900c2cfba9a12ecad1fdc45594aad48f6b344b2589a0"
dependencies = [
"darling",
"itertools 0.10.1",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "swap_or_not_shuffle"
version = "0.2.0"
@@ -6757,7 +6825,7 @@ dependencies = [
name = "tree_hash"
version = "0.1.1"
dependencies = [
"criterion",
"beacon_chain",
"eth2_hashing",
"ethereum-types 0.9.2",
"lazy_static",
@@ -6820,6 +6888,7 @@ name = "types"
version = "0.2.0"
dependencies = [
"arbitrary",
"beacon_chain",
"bls",
"cached_tree_hash",
"compare_fields",
@@ -6834,9 +6903,11 @@ dependencies = [
"ethereum-types 0.9.2",
"hex",
"int_to_bytes",
"itertools 0.10.1",
"lazy_static",
"log",
"merkle_proof",
"parking_lot",
"rand 0.7.3",
"rand_xorshift",
"rayon",
@@ -6849,6 +6920,7 @@ dependencies = [
"serde_utils",
"serde_yaml",
"slog",
"superstruct",
"swap_or_not_shuffle",
"tempfile",
"test_random_derive",