Skip to content

Commit c4ab7b3

Browse files
committed
Merge fix/beacon-foreign-vc-endpoints into tmp/bci-626-63-64-633-636-638-gloas-live
Brings 4cd3f24 (the branch merged onto 30d42ba) onto the current tmp. tmp already serves GET .../validators/{validator_id} from #653, so its handler and docs row are kept and the branch's copy is dropped.
2 parents e5e6ec3 + 4cd3f24 commit c4ab7b3

20 files changed

Lines changed: 1806 additions & 334 deletions

File tree

‎crates/common/types/src/beacon/containers/altair.rs‎

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,19 @@ pub type SyncSubcommitteeBits =
7070
/// needs one regardless of how many attestations or other operations it
7171
/// includes.
7272
#[derive(
73-
Debug, Clone, Default, PartialEq, Eq, serde::Serialize, SszEncode, SszDecode, HashTreeRoot,
73+
Debug,
74+
Clone,
75+
Default,
76+
PartialEq,
77+
Eq,
78+
serde::Serialize,
79+
serde::Deserialize,
80+
SszEncode,
81+
SszDecode,
82+
HashTreeRoot,
7483
)]
7584
pub struct SyncAggregate {
76-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
85+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
7786
pub sync_committee_bits: SyncCommitteeBits,
7887
/// The aggregate of every signature from a member set in
7988
/// `sync_committee_bits`, over the previous slot's block root.
@@ -85,7 +94,7 @@ pub struct SyncAggregate {
8594
/// participates.
8695
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, SszEncode, SszDecode, HashTreeRoot)]
8796
pub struct SyncCommittee {
88-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
97+
#[serde(with = "crate::beacon::serde_helpers::seq")]
8998
pub pubkeys: SyncCommitteePubkeys,
9099
/// The aggregate of every key in `pubkeys`, so `process_sync_aggregate` does
91100
/// not have to re-aggregate from scratch when the whole committee signs.
@@ -109,15 +118,15 @@ pub struct BeaconBlockBody {
109118
pub eth1_data: Eth1Data,
110119
/// Arbitrary proposer-chosen bytes, which consensus never reads.
111120
pub graffiti: Bytes32,
112-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
121+
#[serde(with = "crate::beacon::serde_helpers::seq")]
113122
pub proposer_slashings: SszList<ProposerSlashing, { preset::MAX_PROPOSER_SLASHINGS }>,
114-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
123+
#[serde(with = "crate::beacon::serde_helpers::seq")]
115124
pub attester_slashings: SszList<AttesterSlashing, { preset::MAX_ATTESTER_SLASHINGS }>,
116-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
125+
#[serde(with = "crate::beacon::serde_helpers::seq")]
117126
pub attestations: SszList<Attestation, { preset::MAX_ATTESTATIONS }>,
118-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
127+
#[serde(with = "crate::beacon::serde_helpers::seq")]
119128
pub deposits: SszList<Deposit, { preset::MAX_DEPOSITS }>,
120-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
129+
#[serde(with = "crate::beacon::serde_helpers::seq")]
121130
pub voluntary_exits: SszList<SignedVoluntaryExit, { preset::MAX_VOLUNTARY_EXITS }>,
122131
/// The aggregated sync committee signature over the previous slot's block
123132
/// root, plus which members contributed. This is what lets a light client
@@ -180,34 +189,34 @@ pub struct BeaconState {
180189
/// slot advances, since a block cannot commit to the root of the state
181190
/// containing it.
182191
pub latest_block_header: BeaconBlockHeader,
183-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
192+
#[serde(with = "crate::beacon::serde_helpers::seq")]
184193
pub block_roots: BlockRoots,
185-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
194+
#[serde(with = "crate::beacon::serde_helpers::seq")]
186195
pub state_roots: StateRoots,
187-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
196+
#[serde(with = "crate::beacon::serde_helpers::seq")]
188197
pub historical_roots: HistoricalRoots,
189198

190199
// -- Eth1 --
191200
pub eth1_data: Eth1Data,
192-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
201+
#[serde(with = "crate::beacon::serde_helpers::seq")]
193202
pub eth1_data_votes: Eth1DataVotes,
194203
/// How many deposits from the contract have been processed, which is where
195204
/// the next one will be read from.
196205
#[serde(with = "crate::beacon::serde_helpers::quoted_or_bare")]
197206
pub eth1_deposit_index: u64,
198207

199208
// -- Registry --
200-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
209+
#[serde(with = "crate::beacon::serde_helpers::seq")]
201210
pub validators: Validators,
202-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
211+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
203212
pub balances: Balances,
204213

205214
// -- Randomness --
206-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
215+
#[serde(with = "crate::beacon::serde_helpers::seq")]
207216
pub randao_mixes: RandaoMixes,
208217

209218
// -- Slashings --
210-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
219+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
211220
pub slashings: Slashings,
212221

213222
// -- Participation --
@@ -217,15 +226,15 @@ pub struct BeaconState {
217226
/// it is processed instead of deferring to the epoch boundary, so there is
218227
/// no longer a backlog of whole attestations to keep around, only a flag
219228
/// per validator per epoch.
220-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
229+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
221230
pub previous_epoch_participation: EpochParticipation,
222231
/// Flags for the current epoch, which become `previous_epoch_participation`
223232
/// at the next epoch boundary.
224-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
233+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
225234
pub current_epoch_participation: EpochParticipation,
226235

227236
// -- Finality --
228-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
237+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
229238
pub justification_bits: JustificationBits,
230239
pub previous_justified_checkpoint: Checkpoint,
231240
pub current_justified_checkpoint: Checkpoint,
@@ -237,7 +246,7 @@ pub struct BeaconState {
237246
/// non-finalizing epoch and falls otherwise, which is what lets the
238247
/// inactivity leak single out validators who are actually offline rather
239248
/// than penalizing everyone during a stall.
240-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
249+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
241250
pub inactivity_scores: InactivityScores,
242251

243252
// -- Sync committees --
@@ -289,7 +298,7 @@ pub struct SyncCommitteeContribution {
289298
pub beacon_block_root: Root,
290299
#[serde(with = "crate::beacon::serde_helpers::quoted_or_bare")]
291300
pub subcommittee_index: u64,
292-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
301+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
293302
pub aggregation_bits: SyncSubcommitteeBits,
294303
/// The aggregate signature of every member set in `aggregation_bits`, over
295304
/// `beacon_block_root`.

‎crates/common/types/src/beacon/containers/bellatrix.rs‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub struct ExecutionPayload {
9191
/// own `state_root`.
9292
pub state_root: Bytes32,
9393
pub receipts_root: Bytes32,
94-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
94+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
9595
pub logs_bloom: LogsBloom,
9696
/// The randomness the beacon chain exposes to the EVM for this block;
9797
/// `difficulty` in the yellow paper before the merge repurposed the
@@ -105,15 +105,15 @@ pub struct ExecutionPayload {
105105
pub gas_used: u64,
106106
#[serde(with = "crate::beacon::serde_helpers::quoted_or_bare")]
107107
pub timestamp: u64,
108-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
108+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
109109
pub extra_data: ExtraData,
110110
/// This block's EIP-1559 base fee, a `uint256` because the execution
111111
/// layer's fee market is not bounded to fit a `uint64`.
112112
pub base_fee_per_gas: Uint256,
113113
/// This payload's own hash, which the next payload's `parent_hash` must
114114
/// equal.
115115
pub block_hash: ExecutionBlockHash,
116-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex_seq::serialize")]
116+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex_seq")]
117117
pub transactions: Transactions,
118118
}
119119

@@ -127,7 +127,7 @@ pub struct ExecutionPayloadHeader {
127127
pub fee_recipient: ExecutionAddress,
128128
pub state_root: Bytes32,
129129
pub receipts_root: Bytes32,
130-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
130+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
131131
pub logs_bloom: LogsBloom,
132132
pub prev_randao: Bytes32,
133133
#[serde(with = "crate::beacon::serde_helpers::quoted_or_bare")]
@@ -138,7 +138,7 @@ pub struct ExecutionPayloadHeader {
138138
pub gas_used: u64,
139139
#[serde(with = "crate::beacon::serde_helpers::quoted_or_bare")]
140140
pub timestamp: u64,
141-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
141+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
142142
pub extra_data: ExtraData,
143143
pub base_fee_per_gas: Uint256,
144144
/// The hash of the execution block this header summarizes.
@@ -177,15 +177,15 @@ pub struct BeaconBlockBody {
177177
pub eth1_data: Eth1Data,
178178
/// Arbitrary proposer-chosen bytes, which consensus never reads.
179179
pub graffiti: Bytes32,
180-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
180+
#[serde(with = "crate::beacon::serde_helpers::seq")]
181181
pub proposer_slashings: SszList<ProposerSlashing, { preset::MAX_PROPOSER_SLASHINGS }>,
182-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
182+
#[serde(with = "crate::beacon::serde_helpers::seq")]
183183
pub attester_slashings: SszList<AttesterSlashing, { preset::MAX_ATTESTER_SLASHINGS }>,
184-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
184+
#[serde(with = "crate::beacon::serde_helpers::seq")]
185185
pub attestations: SszList<Attestation, { preset::MAX_ATTESTATIONS }>,
186-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
186+
#[serde(with = "crate::beacon::serde_helpers::seq")]
187187
pub deposits: SszList<Deposit, { preset::MAX_DEPOSITS }>,
188-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
188+
#[serde(with = "crate::beacon::serde_helpers::seq")]
189189
pub voluntary_exits: SszList<SignedVoluntaryExit, { preset::MAX_VOLUNTARY_EXITS }>,
190190
/// The aggregated sync committee signature over the previous slot's block
191191
/// root, plus which members contributed.
@@ -292,56 +292,56 @@ pub struct BeaconState {
292292
/// slot advances, since a block cannot commit to the root of the state
293293
/// containing it.
294294
pub latest_block_header: BeaconBlockHeader,
295-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
295+
#[serde(with = "crate::beacon::serde_helpers::seq")]
296296
pub block_roots: BlockRoots,
297-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
297+
#[serde(with = "crate::beacon::serde_helpers::seq")]
298298
pub state_roots: StateRoots,
299-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
299+
#[serde(with = "crate::beacon::serde_helpers::seq")]
300300
pub historical_roots: HistoricalRoots,
301301

302302
// -- Eth1 --
303303
pub eth1_data: Eth1Data,
304-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
304+
#[serde(with = "crate::beacon::serde_helpers::seq")]
305305
pub eth1_data_votes: Eth1DataVotes,
306306
/// How many deposits from the contract have been processed, which is where
307307
/// the next one will be read from.
308308
#[serde(with = "crate::beacon::serde_helpers::quoted_or_bare")]
309309
pub eth1_deposit_index: u64,
310310

311311
// -- Registry --
312-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
312+
#[serde(with = "crate::beacon::serde_helpers::seq")]
313313
pub validators: Validators,
314-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
314+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
315315
pub balances: Balances,
316316

317317
// -- Randomness --
318-
#[serde(serialize_with = "crate::beacon::serde_helpers::seq::serialize")]
318+
#[serde(with = "crate::beacon::serde_helpers::seq")]
319319
pub randao_mixes: RandaoMixes,
320320

321321
// -- Slashings --
322-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
322+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
323323
pub slashings: Slashings,
324324

325325
// -- Participation --
326326
/// Per-validator participation flags for the previous epoch, positionally
327327
/// parallel to `validators`.
328-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
328+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
329329
pub previous_epoch_participation: EpochParticipation,
330330
/// Flags for the current epoch, which become `previous_epoch_participation`
331331
/// at the next epoch boundary.
332-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
332+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
333333
pub current_epoch_participation: EpochParticipation,
334334

335335
// -- Finality --
336-
#[serde(serialize_with = "crate::beacon::serde_helpers::ssz_hex::serialize")]
336+
#[serde(with = "crate::beacon::serde_helpers::ssz_hex")]
337337
pub justification_bits: JustificationBits,
338338
pub previous_justified_checkpoint: Checkpoint,
339339
pub current_justified_checkpoint: Checkpoint,
340340
pub finalized_checkpoint: Checkpoint,
341341

342342
// -- Inactivity --
343343
/// Per-validator inactivity score, positionally parallel to `validators`.
344-
#[serde(serialize_with = "crate::beacon::serde_helpers::quoted_u64_seq::serialize")]
344+
#[serde(with = "crate::beacon::serde_helpers::quoted_u64_seq")]
345345
pub inactivity_scores: InactivityScores,
346346

347347
// -- Sync committees --

0 commit comments

Comments
 (0)