Update ENR construction and mainnet bootnodes (#1968)
## Issue Addressed Boot nodes were being successfully created and publishing valid ENRs however the `eth2` field was not being saved to disk leading to a discrepancy between published ENR and disk ENR. If the `eth2` field is known, it is now constructed in the initial ENR and saved to disk. Previous mainnet bootnodes did not contain the `eth2` field and these have also been updated.
This commit is contained in:
parent
7b6a97e73c
commit
198c4a873d
@ -79,14 +79,8 @@ impl<T: EthSpec> TryFrom<&ArgMatches<'_>> for BootNodeConfig<T> {
|
|||||||
let private_key = load_private_key(&network_config, &logger);
|
let private_key = load_private_key(&network_config, &logger);
|
||||||
let local_key = CombinedKey::from_libp2p(&private_key)?;
|
let local_key = CombinedKey::from_libp2p(&private_key)?;
|
||||||
|
|
||||||
let mut local_enr = create_enr_builder_from_config(&network_config, false)
|
|
||||||
.build(&local_key)
|
|
||||||
.map_err(|e| format!("Failed to build ENR: {:?}", e))?;
|
|
||||||
|
|
||||||
use_or_load_enr(&local_key, &mut local_enr, &network_config, &logger)?;
|
|
||||||
|
|
||||||
// build the enr_fork_id and add it to the local_enr if it exists
|
// build the enr_fork_id and add it to the local_enr if it exists
|
||||||
if let Some(config) = eth2_testnet_config.as_ref() {
|
let enr_fork = if let Some(config) = eth2_testnet_config.as_ref() {
|
||||||
let spec = config
|
let spec = config
|
||||||
.yaml_config
|
.yaml_config
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -103,22 +97,37 @@ impl<T: EthSpec> TryFrom<&ArgMatches<'_>> for BootNodeConfig<T> {
|
|||||||
genesis_state.genesis_validators_root,
|
genesis_state.genesis_validators_root,
|
||||||
);
|
);
|
||||||
|
|
||||||
// add to the local_enr
|
Some(enr_fork.as_ssz_bytes())
|
||||||
if let Err(e) = local_enr.insert("eth2", &enr_fork.as_ssz_bytes(), &local_key) {
|
|
||||||
slog::warn!(logger, "Could not update eth2 field"; "error" => ?e);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
slog::warn!(
|
slog::warn!(
|
||||||
logger,
|
logger,
|
||||||
"No genesis state provided. No Eth2 field added to the ENR"
|
"No genesis state provided. No Eth2 field added to the ENR"
|
||||||
);
|
);
|
||||||
|
None
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
slog::warn!(
|
slog::warn!(
|
||||||
logger,
|
logger,
|
||||||
"No testnet config provided. Not setting an eth2 field"
|
"No testnet config provided. Not setting an eth2 field"
|
||||||
);
|
);
|
||||||
}
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
// Build the local ENR
|
||||||
|
|
||||||
|
let mut local_enr = {
|
||||||
|
let mut builder = create_enr_builder_from_config(&network_config, false);
|
||||||
|
|
||||||
|
// If we know of the ENR field, add it to the initial construction
|
||||||
|
if let Some(enr_fork_bytes) = enr_fork {
|
||||||
|
builder.add_value("eth2", &enr_fork_bytes);
|
||||||
|
}
|
||||||
|
builder
|
||||||
|
.build(&local_key)
|
||||||
|
.map_err(|e| format!("Failed to build ENR: {:?}", e))?
|
||||||
|
};
|
||||||
|
|
||||||
|
use_or_load_enr(&local_key, &mut local_enr, &network_config, &logger)?;
|
||||||
|
|
||||||
let auto_update = matches.is_present("enable-enr_auto_update");
|
let auto_update = matches.is_present("enable-enr_auto_update");
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Lighthouse Team (Sigma Prime)
|
# Lighthouse Team (Sigma Prime)
|
||||||
- enr:-IS4QLkKqDMy_ExrpOEWa59NiClemOnor-krjp4qoeZwIw2QduPC-q7Kz4u1IOWf3DDbdxqQIgC4fejavBOuUPy-HE4BgmlkgnY0gmlwhCLzAHqJc2VjcDI1NmsxoQLQSJfEAHZApkm5edTCZ_4qps_1k_ub2CxHFxi-gr2JMIN1ZHCCIyg
|
- enr:-Jq4QN6_FzIYyfJET9hiLcGUsg_EVOwCQ4bwsBwe0S4ElrfXUXufSYLtQAHU9_LuO9uice7EAaLbDlMK8QEhtyg8Oh4BhGV0aDKQtTA_KgAAAAD__________4JpZIJ2NIJpcIQDGh4giXNlY3AyNTZrMaECSHaY_36GdNjF8-CLfMSg-8lB0wce5VRZ96HkT9tSkVeDdWRwgiMo
|
||||||
- enr:-IS4QDAyibHCzYZmIYZCjXwU9BqpotWmv2BsFlIq1V31BwDDMJPFEbox1ijT5c2Ou3kvieOKejxuaCqIcjxBjJ_3j_cBgmlkgnY0gmlwhAMaHiCJc2VjcDI1NmsxoQJIdpj_foZ02MXz4It8xKD7yUHTBx7lVFn3oeRP21KRV4N1ZHCCIyg
|
- enr:-Jq4QMOjjkLYSN7GVAf_zBSS5c_MokSPMZZvmjLUYiuHrPLHInjeBtF1IfskuYlmhglGan2ECmPk89SRXr4FY1jVp5YBhGV0aDKQtTA_KgAAAAD__________4JpZIJ2NIJpcIQi8wB6iXNlY3AyNTZrMaEC0EiXxAB2QKZJuXnUwmf-KqbP9ZP7m9gsRxcYvoK9iTCDdWRwgiMo
|
||||||
# Teku team (Consensys)
|
# Teku team (Consensys)
|
||||||
- enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA
|
- enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA
|
||||||
# Prysm team (Prysmatic Labs)
|
# Prysm team (Prysmatic Labs)
|
||||||
|
Loading…
Reference in New Issue
Block a user