Skip to content

Commit f428d17

Browse files
committed
Merge branch 'unstable' into peerdas-network-rpc-handler
# Conflicts: # beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs # beacon_node/lighthouse_network/src/rpc/methods.rs # beacon_node/lighthouse_network/src/rpc/protocol.rs # beacon_node/network/src/network_beacon_processor/rpc_methods.rs # consensus/types/src/chain_spec.rs
2 parents 76c5660 + 3a996fb commit f428d17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2467
-541
lines changed

Cargo.lock

Lines changed: 98 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ bytes = "1"
107107
clap = { version = "4.5.4", features = ["derive", "cargo", "wrap_help"] }
108108
# Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable
109109
# feature ourselves when desired.
110-
c-kzg = { version = "1", default-features = false }
110+
c-kzg = { version = "1", default-features = false }
111111
compare_fields_derive = { path = "common/compare_fields_derive" }
112112
criterion = "0.5"
113113
delay_map = "0.3"
114114
derivative = "2"
115115
dirs = "3"
116116
either = "1.9"
117+
rust_eth_kzg = "0.3.4"
117118
discv5 = { version = "0.4.1", features = ["libp2p"] }
118119
env_logger = "0.9"
119120
error-chain = "0.12"
@@ -239,6 +240,9 @@ validator_client = { path = "validator_client" }
239240
validator_dir = { path = "common/validator_dir" }
240241
warp_utils = { path = "common/warp_utils" }
241242

243+
[patch.crates-io]
244+
quick-protobuf = { git = "https://github.com/sigp/quick-protobuf.git", rev = "681f413312404ab6e51f0b46f39b0075c6f4ebfd" }
245+
242246
[profile.maxperf]
243247
inherits = "release"
244248
lto = "fat"

account_manager/src/validator/import.rs

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,13 @@ pub fn cli_run(matches: &ArgMatches, validator_dir: PathBuf) -> Result<(), Strin
178178
let password_opt = loop {
179179
if let Some(password) = previous_password.clone() {
180180
eprintln!("Reuse previous password.");
181-
break Some(password);
181+
if check_password_on_keystore(&keystore, &password)? {
182+
break Some(password);
183+
} else {
184+
eprintln!("Reused password incorrect. Retry!");
185+
previous_password = None;
186+
continue;
187+
}
182188
}
183189
eprintln!();
184190
eprintln!("{}", PASSWORD_PROMPT);
@@ -201,20 +207,12 @@ pub fn cli_run(matches: &ArgMatches, validator_dir: PathBuf) -> Result<(), Strin
201207
}
202208
};
203209

204-
match keystore.decrypt_keypair(password.as_ref()) {
205-
Ok(_) => {
206-
eprintln!("Password is correct.");
207-
eprintln!();
208-
sleep(Duration::from_secs(1)); // Provides nicer UX.
209-
if reuse_password {
210-
previous_password = Some(password.clone());
211-
}
212-
break Some(password);
213-
}
214-
Err(eth2_keystore::Error::InvalidPassword) => {
215-
eprintln!("Invalid password");
210+
// Check if the password unlocks the keystore
211+
if check_password_on_keystore(&keystore, &password)? {
212+
if reuse_password {
213+
previous_password = Some(password.clone());
216214
}
217-
Err(e) => return Err(format!("Error whilst decrypting keypair: {:?}", e)),
215+
break Some(password);
218216
}
219217
};
220218

@@ -317,3 +315,27 @@ pub fn cli_run(matches: &ArgMatches, validator_dir: PathBuf) -> Result<(), Strin
317315

318316
Ok(())
319317
}
318+
319+
/// Checks if the given password unlocks the keystore.
320+
///
321+
/// Returns `Ok(true)` if password unlocks the keystore successfully.
322+
/// Returns `Ok(false` if password is incorrect.
323+
/// Otherwise, returns the keystore error.
324+
fn check_password_on_keystore(
325+
keystore: &Keystore,
326+
password: &ZeroizeString,
327+
) -> Result<bool, String> {
328+
match keystore.decrypt_keypair(password.as_ref()) {
329+
Ok(_) => {
330+
eprintln!("Password is correct.");
331+
eprintln!();
332+
sleep(Duration::from_secs(1)); // Provides nicer UX.
333+
Ok(true)
334+
}
335+
Err(eth2_keystore::Error::InvalidPassword) => {
336+
eprintln!("Invalid password");
337+
Ok(false)
338+
}
339+
Err(e) => Err(format!("Error whilst decrypting keypair: {:?}", e)),
340+
}
341+
}

beacon_node/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "beacon_node"
3-
version = "5.2.1"
3+
version = "5.3.0"
44
authors = [
55
"Paul Hauner <[email protected]>",
66
"Age Manning <[email protected]",

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,14 +1353,27 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
13531353
) -> Result<(), Error> {
13541354
self.light_client_server_cache.recompute_and_cache_updates(
13551355
self.store.clone(),
1356-
&parent_root,
13571356
slot,
1357+
&parent_root,
13581358
&sync_aggregate,
13591359
&self.log,
13601360
&self.spec,
13611361
)
13621362
}
13631363

1364+
pub fn get_light_client_updates(
1365+
&self,
1366+
sync_committee_period: u64,
1367+
count: u64,
1368+
) -> Result<Vec<LightClientUpdate<T::EthSpec>>, Error> {
1369+
self.light_client_server_cache.get_light_client_updates(
1370+
&self.store,
1371+
sync_committee_period,
1372+
count,
1373+
&self.spec,
1374+
)
1375+
}
1376+
13641377
/// Returns the current heads of the `BeaconChain`. For the canonical head, see `Self::head`.
13651378
///
13661379
/// Returns `(block_root, block_slot)`.

beacon_node/beacon_chain/src/builder.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub struct BeaconChainBuilder<T: BeaconChainTypes> {
104104
kzg: Option<Arc<Kzg>>,
105105
task_executor: Option<TaskExecutor>,
106106
validator_monitor_config: Option<ValidatorMonitorConfig>,
107+
import_all_data_columns: bool,
107108
}
108109

109110
impl<TSlotClock, TEth1Backend, E, THotStore, TColdStore>
@@ -145,6 +146,7 @@ where
145146
kzg: None,
146147
task_executor: None,
147148
validator_monitor_config: None,
149+
import_all_data_columns: false,
148150
}
149151
}
150152

@@ -615,6 +617,12 @@ where
615617
self
616618
}
617619

620+
/// Sets whether to require and import all data columns when importing block.
621+
pub fn import_all_data_columns(mut self, import_all_data_columns: bool) -> Self {
622+
self.import_all_data_columns = import_all_data_columns;
623+
self
624+
}
625+
618626
/// Sets the `BeaconChain` event handler backend.
619627
///
620628
/// For example, provide `ServerSentEventHandler` as a `handler`.
@@ -965,8 +973,15 @@ where
965973
validator_monitor: RwLock::new(validator_monitor),
966974
genesis_backfill_slot,
967975
data_availability_checker: Arc::new(
968-
DataAvailabilityChecker::new(slot_clock, self.kzg.clone(), store, &log, self.spec)
969-
.map_err(|e| format!("Error initializing DataAvailabiltyChecker: {:?}", e))?,
976+
DataAvailabilityChecker::new(
977+
slot_clock,
978+
self.kzg.clone(),
979+
store,
980+
self.import_all_data_columns,
981+
&log,
982+
self.spec,
983+
)
984+
.map_err(|e| format!("Error initializing DataAvailabilityChecker: {:?}", e))?,
970985
),
971986
kzg: self.kzg.clone(),
972987
};

beacon_node/beacon_chain/src/canonical_head.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use fork_choice::{
4848
};
4949
use itertools::process_results;
5050
use parking_lot::{Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard};
51-
use slog::{crit, debug, error, warn, Logger};
51+
use slog::{crit, debug, error, info, warn, Logger};
5252
use slot_clock::SlotClock;
5353
use state_processing::AllCaches;
5454
use std::sync::Arc;
@@ -1212,7 +1212,7 @@ fn detect_reorg<E: EthSpec>(
12121212
&metrics::FORK_CHOICE_REORG_DISTANCE,
12131213
reorg_distance.as_u64() as i64,
12141214
);
1215-
warn!(
1215+
info!(
12161216
log,
12171217
"Beacon chain re-org";
12181218
"previous_head" => ?old_block_root,

0 commit comments

Comments
 (0)