Skip to content

Commit 10a1347

Browse files
authored
Testnet2 (#685)
* Apply clippy lints to beacon node * Remove unnecessary logging and correct formatting * Initial bones of load-balanced range-sync * Port bump meshsup tests * Further structure and network handling logic added * Basic structure, ignoring error handling * Correct max peers delay bug * Clean up and re-write message processor and sync manager * Restructure directory, correct type issues * Fix compiler issues * Completed first testing of new sync * Correct merge issues * Clean up warnings * Push attestation processed log down to dbg * Add state enc/dec benches * Correct math error, downgraded logs * Add example for flamegraph * Use `PublicKeyBytes` for `Validator` * Ripple PublicKeyBytes change through codebase * Add RPC error handling and improved syncing code * Add benches, optimizations to store BeaconState * Store BeaconState in StorageContainer too * Optimize StorageContainer with std::mem magic * Add libp2p stream error handling and dropping of invalid peers * Lower logs * Update lcli to parse spec at boot, remove pycli * Fix issues when starting with mainnet spec * Set default spec to mainnet * Fix lcli --spec param * Add discovery tweak * Ensure ETH1_FOLLOW_DISTANCE is in YamlConfig * Set testnet ETH1_FOLLOW_DISTANCE to 16 * Fix rest_api tests * Set testnet min validator count * Update with new testnet dir * Remove some dbg, println * Add timeout when notifier waits for libp2p lock * Add validator count CLI flag to lcli contract deploy * Extend genesis delay time * Correct libp2p service locking * Update testnet dir * Add basic block/state caching on beacon chain * Add decimals display to notifier sync speed * Try merge in change to reduce fork choice calls * Remove fork choice from process block * Minor log fix * Check successes > 0 * Adds checkpoint cache * Stop storing the tree hash cache in the db * Handles peer disconnects for sync * Fix failing beacon chain tests * Change eth2_testnet_config tests to Mainnet * Add logs downgrade discovery log * Remove dedunant beacon state write * Fix re-org warnings * Use caching get methods in fork choice * Fix mistake in prev commit * Use caching state getting in state_by_slot * Add state.cacheless_clone * Less fork choice (#679) * Try merge in change to reduce fork choice calls * Remove fork choice from process block * Minor log fix * Check successes > 0 * Fix failing beacon chain tests * Fix re-org warnings * Fix mistake in prev commit * Attempt to improve attestation processing times * Introduce HeadInfo struct * Used cache tree hash for block processing * Use cached tree hash for block production too * Range sync refactor - Introduces `ChainCollection` - Correct Disconnect node handling - Removes duplicate code * Add more logging for DB * Various bug fixes * Remove unnecessary logs * Maintain syncing state in the transition from finalied to head * Improved disconnect handling * Add `Speedo` struct * Fix bugs in speedo * Fix bug in speedo * Fix rounding bug in speedo * Move code around, reduce speedo observation count * Adds forwards block interator * Fix inf NaN * Add first draft of validator onboarding * Update docs * Add documentation link to main README * Continue docs development * Update book readme * Update docs * Allow vc to run without testnet subcommand * Small change to onboarding docs * Tidy CLI help messages * Update docs * Add check to val client see if beacon node is synced * Attempt to fix NaN bug * Fix compile bug * Add notifier service to validator client * Re-order onboarding steps * Update deposit contract address * Update testnet dir * Add note about public eth1 node * Fix installation link * Set default eth1 endpoint to sigp * Fix broken test * Try fix eth1 cache locking * Be more specific about eth1 endpoint * Increase gas limit for deposit * Fix default deposit amount * Fix re-org log
1 parent 3c6c06a commit 10a1347

File tree

5 files changed

+40
-21
lines changed

5 files changed

+40
-21
lines changed

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
15041504
let previous_slot = self.head_info().slot;
15051505
let new_slot = beacon_block.slot;
15061506

1507-
let is_reorg = self.head_info().block_root != beacon_block.parent_root;
1507+
// Note: this will declare a re-org if we skip `SLOTS_PER_HISTORICAL_ROOT` blocks
1508+
// between calls to fork choice without swapping between chains. This seems like an
1509+
// extreme-enough scenario that a warning is fine.
1510+
let is_reorg = self.head_info().block_root
1511+
!= beacon_state
1512+
.get_block_root(self.head_info().slot)
1513+
.map(|root| *root)
1514+
.unwrap_or_else(|_| Hash256::random());
15081515

15091516
// If we switched to a new chain (instead of building atop the present chain).
15101517
if is_reorg {

beacon_node/store/src/leveldb_store.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,18 @@ impl<E: EthSpec> Store<E> for LevelDB<E> {
6969
let column_key = Self::get_key_for_col(col, key);
7070

7171
metrics::inc_counter(&metrics::DISK_DB_READ_COUNT);
72+
let timer = metrics::start_timer(&metrics::DISK_DB_READ_TIMES);
7273

73-
let result = self
74-
.db
74+
self.db
7575
.get(self.read_options(), column_key)
76-
.map_err(Into::into);
77-
78-
if let Ok(Some(bytes)) = &result {
79-
metrics::inc_counter_by(&metrics::DISK_DB_READ_BYTES, bytes.len() as i64)
80-
}
81-
82-
result
76+
.map_err(Into::into)
77+
.map(|opt| {
78+
opt.map(|bytes| {
79+
metrics::inc_counter_by(&metrics::DISK_DB_READ_BYTES, bytes.len() as i64);
80+
metrics::stop_timer(timer);
81+
bytes
82+
})
83+
})
8384
}
8485

8586
/// Store some `value` in `column`, indexed with `key`.
@@ -88,10 +89,14 @@ impl<E: EthSpec> Store<E> for LevelDB<E> {
8889

8990
metrics::inc_counter(&metrics::DISK_DB_WRITE_COUNT);
9091
metrics::inc_counter_by(&metrics::DISK_DB_WRITE_BYTES, val.len() as i64);
92+
let timer = metrics::start_timer(&metrics::DISK_DB_WRITE_TIMES);
9193

9294
self.db
9395
.put(self.write_options(), column_key, val)
9496
.map_err(Into::into)
97+
.map(|()| {
98+
metrics::stop_timer(timer);
99+
})
95100
}
96101

97102
/// Return `true` if `key` exists in `column`.

beacon_node/store/src/metrics.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ lazy_static! {
2525
"store_disk_db_write_count_total",
2626
"Total number of writes to the on-disk DB"
2727
);
28+
pub static ref DISK_DB_READ_TIMES: Result<Histogram> = try_create_histogram(
29+
"store_disk_db_read_seconds",
30+
"Time taken to write bytes to store."
31+
);
32+
pub static ref DISK_DB_WRITE_TIMES: Result<Histogram> = try_create_histogram(
33+
"store_disk_db_write_seconds",
34+
"Time taken to write bytes to store."
35+
);
2836
pub static ref DISK_DB_EXISTS_COUNT: Result<IntCounter> = try_create_int_counter(
2937
"store_disk_db_exists_count_total",
3038
"Total number of checks if a key is in the on-disk DB"

book/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* [Introduction](./intro.md)
44
* [Become a Validator](./become-a-validator.md)
5-
* [Introduction](./intro.md)
5+
* [Installation](./installation.md)
66
* [Docker](./docker.md)
77
* [CLI](./cli.md)
88
* [Testnets](./testnets.md)

lcli/src/main.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ fn main() {
2525
"Performs various testing-related tasks, modelled after zcli. \
2626
by @protolambda.",
2727
)
28+
.arg(
29+
Arg::with_name("spec")
30+
.short("s")
31+
.value_name("STRING")
32+
.takes_value(true)
33+
.required(true)
34+
.possible_values(&["minimal", "mainnet"])
35+
.default_value("mainnet")
36+
)
2837
.subcommand(
2938
SubCommand::with_name("genesis_yaml")
3039
.about("Generates a genesis YAML file")
@@ -44,16 +53,6 @@ fn main() {
4453
.required(false)
4554
.help("Eth2 genesis time (seconds since UNIX epoch)."),
4655
)
47-
.arg(
48-
Arg::with_name("spec")
49-
.short("s")
50-
.value_name("STRING")
51-
.takes_value(true)
52-
.required(true)
53-
.possible_values(&["minimal", "mainnet"])
54-
.default_value("mainnet")
55-
.help("Eth2 genesis time (seconds since UNIX epoch)."),
56-
)
5756
.arg(
5857
Arg::with_name("output_file")
5958
.short("f")

0 commit comments

Comments
 (0)