Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions common/eth2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const HTTP_SYNC_DUTIES_TIMEOUT_QUOTIENT: u32 = 4;
const HTTP_SYNC_AGGREGATOR_TIMEOUT_QUOTIENT: u32 = 24; // For DVT involving middleware only
// TODO(EIP-7732): Determine what this quotient should be
const HTTP_PTC_DUTIES_TIMEOUT_QUOTIENT: u32 = 4;
const HTTP_INCLUSION_LIST_DUTIES_TIMEOUT_QUOTIENT: u32 = 4;
const HTTP_GET_BEACON_BLOCK_SSZ_TIMEOUT_QUOTIENT: u32 = 4;
const HTTP_GET_DEBUG_BEACON_STATE_QUOTIENT: u32 = 4;
const HTTP_GET_DEPOSIT_SNAPSHOT_QUOTIENT: u32 = 4;
Expand All @@ -104,6 +105,7 @@ pub struct Timeouts {
pub sync_duties: Duration,
pub sync_aggregators: Duration,
pub ptc_duties: Duration,
pub inclusion_list_duties: Duration,
pub get_beacon_blocks_ssz: Duration,
pub get_debug_beacon_states: Duration,
pub get_deposit_snapshot: Duration,
Expand All @@ -126,6 +128,7 @@ impl Timeouts {
sync_duties: timeout,
sync_aggregators: timeout,
ptc_duties: timeout,
inclusion_list_duties: timeout,
get_beacon_blocks_ssz: timeout,
get_debug_beacon_states: timeout,
get_deposit_snapshot: timeout,
Expand All @@ -150,6 +153,7 @@ impl Timeouts {
sync_duties: base_timeout / HTTP_SYNC_DUTIES_TIMEOUT_QUOTIENT,
sync_aggregators: base_timeout / HTTP_SYNC_AGGREGATOR_TIMEOUT_QUOTIENT,
ptc_duties: base_timeout / HTTP_PTC_DUTIES_TIMEOUT_QUOTIENT,
inclusion_list_duties: base_timeout / HTTP_INCLUSION_LIST_DUTIES_TIMEOUT_QUOTIENT,
get_beacon_blocks_ssz: base_timeout / HTTP_GET_BEACON_BLOCK_SSZ_TIMEOUT_QUOTIENT,
get_debug_beacon_states: base_timeout / HTTP_GET_DEBUG_BEACON_STATE_QUOTIENT,
get_deposit_snapshot: base_timeout / HTTP_GET_DEPOSIT_SNAPSHOT_QUOTIENT,
Expand Down Expand Up @@ -4133,6 +4137,29 @@ impl BeaconNodeHttpClient {
)
.await
}

/// `POST validator/duties/inclusion_list/{epoch}`
pub async fn post_validator_duties_inclusion_list(
&self,
epoch: Epoch,
indices: &[u64],
) -> Result<DutiesResponse<Vec<InclusionListDuty>>, Error> {
let mut path = self.eth_path(V1)?;

path.path_segments_mut()
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
.push("validator")
.push("duties")
.push("inclusion_list")
.push(&epoch.to_string());

self.post_with_timeout_and_response(
path,
&ValidatorIndexDataRef(indices),
self.timeouts.inclusion_list_duties,
)
.await
}
}

#[cfg(test)]
Expand Down
8 changes: 8 additions & 0 deletions common/eth2/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,14 @@ pub struct PtcDuty {
pub slot: Slot,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InclusionListDuty {
pub pubkey: PublicKeyBytes,
#[serde(with = "serde_utils::quoted_u64")]
pub validator_index: u64,
pub slot: Slot,
}

#[derive(Clone, Deserialize)]
pub struct ValidatorBlocksQuery {
pub randao_reveal: SignatureBytes,
Expand Down
10 changes: 10 additions & 0 deletions validator_client/http_metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ pub fn gather_prometheus_metrics<E: EthSpec>(
&[NEXT_EPOCH],
duties_service.ptc_count(next_epoch) as i64,
);
set_int_gauge(
&IL_COUNT,
&[CURRENT_EPOCH],
duties_service.il_duties_count(current_epoch) as i64,
);
set_int_gauge(
&IL_COUNT,
&[NEXT_EPOCH],
duties_service.il_duties_count(next_epoch) as i64,
);
}
}

Expand Down
12 changes: 12 additions & 0 deletions validator_client/validator_metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ pub const UPDATE_PTC_FETCH: &str = "update_ptc_fetch";
pub const UPDATE_PTC_STORE: &str = "update_ptc_store";
pub const ATTESTER_DUTIES_HTTP_POST: &str = "attester_duties_http_post";
pub const PTC_DUTIES_HTTP_POST: &str = "ptc_duties_http_post";
pub const UPDATE_IL_DUTIES_CURRENT_EPOCH: &str = "update_il_duties_current_epoch";
pub const UPDATE_IL_DUTIES_NEXT_EPOCH: &str = "update_il_duties_next_epoch";
pub const UPDATE_IL_DUTIES_FETCH: &str = "update_il_duties_fetch";
pub const UPDATE_IL_DUTIES_STORE: &str = "update_il_duties_store";
pub const IL_DUTIES_HTTP_POST: &str = "il_duties_http_post";
pub const PROPOSER_DUTIES_HTTP_GET: &str = "proposer_duties_http_get";
pub const VALIDATOR_DUTIES_SYNC_HTTP_POST: &str = "validator_duties_sync_http_post";
pub const VALIDATOR_ID_HTTP_GET: &str = "validator_id_http_get";
Expand Down Expand Up @@ -174,6 +179,13 @@ pub static PTC_COUNT: LazyLock<Result<IntGaugeVec>> = LazyLock::new(|| {
&["task"],
)
});
pub static IL_COUNT: LazyLock<Result<IntGaugeVec>> = LazyLock::new(|| {
try_create_int_gauge_vec(
"vc_beacon_il_count",
"Number of IL (Inclusion List Committee) validators on this host",
&["task"],
)
});
pub static PROPOSAL_CHANGED: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
try_create_int_counter(
"vc_beacon_block_proposal_changed",
Expand Down
Loading