Skip to content

Commit a73bafe

Browse files
committed
PR feedback
1 parent faa87d3 commit a73bafe

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

beacon_node/http_api/src/lib.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,12 +2397,10 @@ pub fn serve<T: BeaconChainTypes>(
23972397
.and(warp::path::end())
23982398
.and(not_while_syncing_filter.clone())
23992399
.and(chain_filter.clone())
2400-
.and(warp::addr::remote())
24012400
.and(log_filter.clone())
24022401
.and(warp::body::json())
24032402
.and_then(
24042403
|chain: Arc<BeaconChain<T>>,
2405-
client_addr: Option<SocketAddr>,
24062404
log: Logger,
24072405
preparation_data: Vec<ProposerPreparationData>| {
24082406
blocking_json_task(move || {
@@ -2419,9 +2417,6 @@ pub fn serve<T: BeaconChainTypes>(
24192417
log,
24202418
"Received proposer preparation data";
24212419
"count" => preparation_data.len(),
2422-
"client" => client_addr
2423-
.map(|a| a.to_string())
2424-
.unwrap_or_else(|| "unknown".to_string()),
24252420
);
24262421

24272422
execution_layer
@@ -2450,12 +2445,10 @@ pub fn serve<T: BeaconChainTypes>(
24502445
.and(warp::path("register_validator"))
24512446
.and(warp::path::end())
24522447
.and(chain_filter.clone())
2453-
.and(warp::addr::remote())
24542448
.and(log_filter.clone())
24552449
.and(warp::body::json())
24562450
.and_then(
24572451
|chain: Arc<BeaconChain<T>>,
2458-
client_addr: Option<SocketAddr>,
24592452
log: Logger,
24602453
register_val_data: Vec<SignedValidatorRegistrationData>| {
24612454
blocking_json_task(move || {
@@ -2472,9 +2465,6 @@ pub fn serve<T: BeaconChainTypes>(
24722465
log,
24732466
"Received register validator request";
24742467
"count" => register_val_data.len(),
2475-
"client" => client_addr
2476-
.map(|a| a.to_string())
2477-
.unwrap_or_else(|| "unknown".to_string()),
24782468
);
24792469

24802470
let preparation_data = register_val_data
@@ -2491,11 +2481,11 @@ pub fn serve<T: BeaconChainTypes>(
24912481
})
24922482
.collect::<Vec<_>>();
24932483

2494-
debug!(
2495-
log,
2496-
"Resolved validator request pubkeys";
2497-
"count" => preparation_data.len()
2498-
);
2484+
debug!(
2485+
log,
2486+
"Resolved validator request pubkeys";
2487+
"count" => preparation_data.len()
2488+
);
24992489

25002490
// Update the prepare beacon proposer cache based on this request.
25012491
execution_layer
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/// This value is an application index of 0 with the bitmask applied (so it's equivalent to the bit mask).
2+
/// Little endian hex: 0x00000001, Binary: 1000000000000000000000000
3+
pub const APPLICATION_DOMAIN_BUILDER: u32 = 16777216;
4+
15
#[derive(Debug, PartialEq, Clone, Copy)]
26
pub enum ApplicationDomain {
37
Builder,
@@ -6,9 +10,7 @@ pub enum ApplicationDomain {
610
impl ApplicationDomain {
711
pub fn get_domain_constant(&self) -> u32 {
812
match self {
9-
// This value is an application index of 0 with the bitmask applied (so it's equivalent to the bit mask).
10-
// Little endian hex: 0x00000001, Binary: 1000000000000000000000000
11-
ApplicationDomain::Builder => 16777216,
13+
ApplicationDomain::Builder => APPLICATION_DOMAIN_BUILDER,
1214
}
1315
}
1416
}

consensus/types/src/chain_spec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::application_domain::ApplicationDomain;
1+
use crate::application_domain::{ApplicationDomain, APPLICATION_DOMAIN_BUILDER};
22
use crate::*;
33
use eth2_serde_utils::quoted_u64::MaybeQuoted;
44
use int_to_bytes::int_to_bytes4;
@@ -588,7 +588,7 @@ impl ChainSpec {
588588
/*
589589
* Application specific
590590
*/
591-
domain_application_mask: 16777216, // Little endian hex: 0x00000001, Binary: 1000000000000000000000000
591+
domain_application_mask: APPLICATION_DOMAIN_BUILDER,
592592
}
593593
}
594594

@@ -791,7 +791,7 @@ impl ChainSpec {
791791
/*
792792
* Application specific
793793
*/
794-
domain_application_mask: 16777216, // Little endian hex: 0x00000001, Binary: 1000000000000000000000000
794+
domain_application_mask: APPLICATION_DOMAIN_BUILDER,
795795
}
796796
}
797797
}

validator_client/src/preparation_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ impl<T: SlotClock + 'static, E: EthSpec> PreparationService<T, E> {
483483

484484
match self
485485
.beacon_nodes
486-
.first_success(RequireSynced::No, |beacon_node| async move {
486+
.first_success(RequireSynced::Yes, |beacon_node| async move {
487487
beacon_node
488488
.post_validator_register_validator(signed_ref)
489489
.await

validator_client/src/signing_method.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub enum Error {
3030
ShuttingDown,
3131
TokioJoin(String),
3232
MergeForkNotSupported,
33+
GenesisForkVersionRequired,
3334
}
3435

3536
/// Enumerates all messages that can be signed by a validator.
@@ -207,6 +208,14 @@ impl SigningMethod {
207208
// Determine the Web3Signer message type.
208209
let message_type = object.message_type();
209210

211+
if matches!(
212+
object,
213+
Web3SignerObject::Deposit { .. } | Web3SignerObject::ValidatorRegistration(_)
214+
) && fork_info.is_some()
215+
{
216+
return Err(Error::GenesisForkVersionRequired);
217+
}
218+
210219
let request = SigningRequest {
211220
message_type,
212221
fork_info,

0 commit comments

Comments
 (0)