Skip to content

Commit f6b04ff

Browse files
committed
Remove "parent" terminology
1 parent 6e7ad7a commit f6b04ff

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

beacon_node/beacon_chain/src/envelope_verification.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ pub enum EnvelopeError {
5555
committed_bid: u64,
5656
envelope: u64,
5757
},
58-
// The slot doesn't match the parent block
58+
// The envelope slot doesn't match the block
5959
SlotMismatch {
60-
parent_block: Slot,
60+
block: Slot,
6161
envelope: Slot,
6262
},
6363
// The validator index is unknown
@@ -127,13 +127,13 @@ fn load_snapshot<T: BeaconChainTypes>(
127127
envelope: &SignedExecutionPayloadEnvelope<T::EthSpec>,
128128
chain: &BeaconChain<T>,
129129
) -> Result<EnvelopeProcessingSnapshot<T::EthSpec>, EnvelopeError> {
130-
// Reject any block if its parent is not known to fork choice.
130+
// Reject any block if its block is not known to fork choice.
131131
//
132132
// A block that is not in fork choice is either:
133133
//
134134
// - Not yet imported: we should reject this block because we should only import a child
135-
// after its parent has been fully imported.
136-
// - Pre-finalized: if the parent block is _prior_ to finalization, we should ignore it
135+
// envelope after its parent has been fully imported.
136+
// - Pre-finalized: if the block is _prior_ to finalization, we should ignore the envelope
137137
// because it will revert finalization. Note that the finalized block is stored in fork
138138
// choice, so we will not reject any child of the finalized block (this is relevant during
139139
// genesis).
@@ -176,8 +176,8 @@ fn load_snapshot<T: BeaconChainTypes>(
176176
#[educe(Debug(bound = "T: BeaconChainTypes"))]
177177
pub struct GossipVerifiedEnvelope<T: BeaconChainTypes> {
178178
pub signed_envelope: Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>,
179-
pub parent_block: Arc<SignedBeaconBlock<T::EthSpec>>,
180-
pub parent: Option<Box<EnvelopeProcessingSnapshot<T::EthSpec>>>,
179+
pub block: Arc<SignedBeaconBlock<T::EthSpec>>,
180+
pub snapshot: Option<Box<EnvelopeProcessingSnapshot<T::EthSpec>>>,
181181
}
182182

183183
impl<T: BeaconChainTypes> GossipVerifiedEnvelope<T> {
@@ -197,7 +197,7 @@ impl<T: BeaconChainTypes> GossipVerifiedEnvelope<T> {
197197
//
198198
// Presently these two cases are conflated.
199199
let fork_choice_read_lock = chain.canonical_head.fork_choice_read_lock();
200-
let Some(parent_proto_block) = fork_choice_read_lock.get_block(&beacon_block_root) else {
200+
let Some(proto_block) = fork_choice_read_lock.get_block(&beacon_block_root) else {
201201
return Err(EnvelopeError::BlockRootUnknown {
202202
block_root: beacon_block_root,
203203
});
@@ -210,13 +210,13 @@ impl<T: BeaconChainTypes> GossipVerifiedEnvelope<T> {
210210
// TODO(EIP-7732): this could be obtained from the ProtoBlock instead of the DB
211211
// but this means the ProtoBlock needs to include something like the ExecutionBid
212212
// will need to answer this question later.
213-
let parent_block = chain
213+
let block = chain
214214
.get_full_block(&beacon_block_root)?
215215
.ok_or_else(|| {
216216
EnvelopeError::from(BeaconChainError::MissingBeaconBlock(beacon_block_root))
217217
})
218218
.map(Arc::new)?;
219-
let execution_bid = &parent_block
219+
let execution_bid = &block
220220
.message()
221221
.body()
222222
.signed_execution_payload_bid()?
@@ -229,9 +229,9 @@ impl<T: BeaconChainTypes> GossipVerifiedEnvelope<T> {
229229
// should these kinds of checks be included for envelopes as well?
230230

231231
// check that the slot of the envelope matches the slot of the parent block
232-
if envelope.slot != parent_block.slot() {
232+
if envelope.slot != block.slot() {
233233
return Err(EnvelopeError::SlotMismatch {
234-
parent_block: parent_block.slot(),
234+
block: block.slot(),
235235
envelope: envelope.slot,
236236
});
237237
}
@@ -258,8 +258,8 @@ impl<T: BeaconChainTypes> GossipVerifiedEnvelope<T> {
258258
let block_slot = envelope.slot;
259259
let block_epoch = block_slot.epoch(T::EthSpec::slots_per_epoch());
260260
let proposer_shuffling_decision_block =
261-
parent_proto_block.proposer_shuffling_root_for_child_block(block_epoch, &chain.spec);
262-
let mut opt_parent = None;
261+
proto_block.proposer_shuffling_root_for_child_block(block_epoch, &chain.spec);
262+
let mut opt_snapshot = None;
263263
let envelope_ref = signed_envelope.as_ref();
264264
let proposer = chain.with_proposer_cache::<_, EnvelopeError>(
265265
proposer_shuffling_decision_block,
@@ -274,14 +274,14 @@ impl<T: BeaconChainTypes> GossipVerifiedEnvelope<T> {
274274
// The proposer index was *not* cached and we must load the parent in order to
275275
// determine the proposer index.
276276
let snapshot = load_snapshot(envelope_ref, chain)?;
277-
opt_parent = Some(Box::new(snapshot.clone()));
277+
opt_snapshot = Some(Box::new(snapshot.clone()));
278278
Ok((snapshot.state_root, snapshot.pre_state))
279279
},
280280
)?;
281281
let fork = proposer.fork;
282282

283283
// True builder index accounting for self-building.
284-
let proposer_index = parent_block.message().proposer_index();
284+
let proposer_index = block.message().proposer_index();
285285
let builder_index = envelope.builder_index(proposer_index);
286286

287287
let signature_is_valid = {
@@ -303,8 +303,8 @@ impl<T: BeaconChainTypes> GossipVerifiedEnvelope<T> {
303303

304304
Ok(Self {
305305
signed_envelope,
306-
parent_block,
307-
parent: opt_parent,
306+
block,
307+
snapshot: opt_snapshot,
308308
})
309309
}
310310

@@ -341,7 +341,7 @@ impl<T: BeaconChainTypes> IntoExecutionPendingEnvelope<T> for GossipVerifiedEnve
341341
let payload_notifier =
342342
PayloadNotifier::from_envelope(chain.clone(), envelope, notify_execution_layer)?;
343343
let block_root = envelope.beacon_block_root;
344-
let slot = self.parent_block.slot();
344+
let slot = self.block.slot();
345345

346346
let payload_verification_future = async move {
347347
let chain = payload_notifier.chain.clone();
@@ -372,17 +372,17 @@ impl<T: BeaconChainTypes> IntoExecutionPendingEnvelope<T> for GossipVerifiedEnve
372372
)
373373
.ok_or(BeaconChainError::RuntimeShutdown)?;
374374

375-
let parent = if let Some(snapshot) = self.parent {
375+
let snapshot = if let Some(snapshot) = self.snapshot {
376376
*snapshot
377377
} else {
378378
load_snapshot(signed_envelope.as_ref(), chain)?
379379
};
380-
let mut state = parent.pre_state;
380+
let mut state = snapshot.pre_state;
381381

382382
// All the state modifications are done in envelope_processing
383383
envelope_processing(
384384
&mut state,
385-
Some(parent.state_root),
385+
Some(snapshot.state_root),
386386
&signed_envelope,
387387
// verify signature already done for GossipVerifiedEnvelope
388388
VerifySignatures::False,
@@ -396,7 +396,7 @@ impl<T: BeaconChainTypes> IntoExecutionPendingEnvelope<T> for GossipVerifiedEnve
396396
},
397397
import_data: EnvelopeImportData {
398398
block_root,
399-
parent_block: self.parent_block,
399+
block: self.block,
400400
post_state: Box::new(state),
401401
},
402402
payload_verification_handle,

beacon_node/beacon_chain/src/envelope_verification_types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ use types::{
77
#[derive(PartialEq)]
88
pub struct EnvelopeImportData<E: EthSpec> {
99
pub block_root: Hash256,
10-
pub parent_block: Arc<SignedBeaconBlock<E>>,
10+
pub block: Arc<SignedBeaconBlock<E>>,
1111
pub post_state: Box<BeaconState<E>>,
1212
}
1313

1414
#[derive(Debug)]
1515
#[allow(dead_code)]
1616
pub struct AvailableEnvelope<E: EthSpec> {
17+
// TODO(EIP-7732): rename to execution_block_hash
1718
block_hash: ExecutionBlockHash,
1819
envelope: Arc<SignedExecutionPayloadEnvelope<E>>,
1920
columns: DataColumnSidecarList<E>,

0 commit comments

Comments
 (0)