Skip to content

Commit a39e991

Browse files
Gloas(EIP-7732): Containers / Constants (#7923)
* #7850 This is the first round of the conga line! 🎉 Just spec constants and container changes so far. Co-Authored-By: shane-moore <skm1790@gmail.com> Co-Authored-By: Mark Mackey <mark@sigmaprime.io> Co-Authored-By: Shane K Moore <41407272+shane-moore@users.noreply.github.com> Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: ethDreamer <37123614+ethDreamer@users.noreply.github.com> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com> Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
1 parent 86c2b7c commit a39e991

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+930
-689
lines changed

Makefile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ TEST_FEATURES ?=
3030
# Cargo profile for regular builds.
3131
PROFILE ?= release
3232

33+
# List of all hard forks up to gloas. This list is used to set env variables for several tests so that
34+
# they run for different forks.
35+
# TODO(EIP-7732) Remove this once we extend network tests to support gloas and use RECENT_FORKS instead
36+
RECENT_FORKS_BEFORE_GLOAS=electra fulu
37+
3338
# List of all recent hard forks. This list is used to set env variables for http_api tests
3439
RECENT_FORKS=electra fulu gloas
3540

@@ -197,29 +202,31 @@ run-ef-tests:
197202
cargo nextest run --release -p ef_tests --features "ef_tests,$(EF_TEST_FEATURES),fake_crypto"
198203
./$(EF_TESTS)/check_all_files_accessed.py $(EF_TESTS)/.accessed_file_log.txt $(EF_TESTS)/consensus-spec-tests
199204

200-
# Run the tests in the `beacon_chain` crate for recent forks.
201-
test-beacon-chain: $(patsubst %,test-beacon-chain-%,$(RECENT_FORKS))
205+
# Run the tests in the `beacon_chain` crate for all known forks.
206+
# TODO(EIP-7732) Extend to support gloas by using RECENT_FORKS instead
207+
test-beacon-chain: $(patsubst %,test-beacon-chain-%,$(RECENT_FORKS_BEFORE_GLOAS))
202208

203209
test-beacon-chain-%:
204210
env FORK_NAME=$* cargo nextest run --release --features "fork_from_env,slasher/lmdb,$(TEST_FEATURES)" -p beacon_chain
205211

206212
# Run the tests in the `http_api` crate for recent forks.
207-
test-http-api: $(patsubst %,test-http-api-%,$(RECENT_FORKS))
213+
test-http-api: $(patsubst %,test-http-api-%,$(RECENT_FORKS_BEFORE_GLOAS))
208214

209215
test-http-api-%:
210216
env FORK_NAME=$* cargo nextest run --release --features "beacon_chain/fork_from_env" -p http_api
211217

212218

213219
# Run the tests in the `operation_pool` crate for all known forks.
214-
test-op-pool: $(patsubst %,test-op-pool-%,$(RECENT_FORKS))
220+
test-op-pool: $(patsubst %,test-op-pool-%,$(RECENT_FORKS_BEFORE_GLOAS))
215221

216222
test-op-pool-%:
217223
env FORK_NAME=$* cargo nextest run --release \
218224
--features "beacon_chain/fork_from_env,$(TEST_FEATURES)"\
219225
-p operation_pool
220226

221-
# Run the tests in the `network` crate for recent forks.
222-
test-network: $(patsubst %,test-network-%,$(RECENT_FORKS))
227+
# Run the tests in the `network` crate for all known forks.
228+
# TODO(EIP-7732) Extend to support gloas by using RECENT_FORKS instead
229+
test-network: $(patsubst %,test-network-%,$(RECENT_FORKS_BEFORE_GLOAS))
223230

224231
test-network-%:
225232
env FORK_NAME=$* cargo nextest run --release \

beacon_node/beacon_chain/src/beacon_block_streamer.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,16 +715,16 @@ mod tests {
715715
harness
716716
}
717717

718+
// TODO(EIP-7732) Extend this test for gloas
718719
#[tokio::test]
719-
async fn check_all_blocks_from_altair_to_gloas() {
720+
async fn check_all_blocks_from_altair_to_fulu() {
720721
let slots_per_epoch = MinimalEthSpec::slots_per_epoch() as usize;
721722
let num_epochs = 12;
722723
let bellatrix_fork_epoch = 2usize;
723724
let capella_fork_epoch = 4usize;
724725
let deneb_fork_epoch = 6usize;
725726
let electra_fork_epoch = 8usize;
726727
let fulu_fork_epoch = 10usize;
727-
let gloas_fork_epoch = 12usize;
728728
let num_blocks_produced = num_epochs * slots_per_epoch;
729729

730730
let mut spec = test_spec::<MinimalEthSpec>();
@@ -734,7 +734,6 @@ mod tests {
734734
spec.deneb_fork_epoch = Some(Epoch::new(deneb_fork_epoch as u64));
735735
spec.electra_fork_epoch = Some(Epoch::new(electra_fork_epoch as u64));
736736
spec.fulu_fork_epoch = Some(Epoch::new(fulu_fork_epoch as u64));
737-
spec.gloas_fork_epoch = Some(Epoch::new(gloas_fork_epoch as u64));
738737
let spec = Arc::new(spec);
739738

740739
let harness = get_harness(VALIDATOR_COUNT, spec.clone());

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5795,60 +5795,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
57955795
execution_payload_value,
57965796
)
57975797
}
5798-
BeaconState::Gloas(_) => {
5799-
let (
5800-
payload,
5801-
kzg_commitments,
5802-
maybe_blobs_and_proofs,
5803-
maybe_requests,
5804-
execution_payload_value,
5805-
) = block_contents
5806-
.ok_or(BlockProductionError::MissingExecutionPayload)?
5807-
.deconstruct();
5808-
5809-
(
5810-
BeaconBlock::Gloas(BeaconBlockGloas {
5811-
slot,
5812-
proposer_index,
5813-
parent_root,
5814-
state_root: Hash256::zero(),
5815-
body: BeaconBlockBodyGloas {
5816-
randao_reveal,
5817-
eth1_data,
5818-
graffiti,
5819-
proposer_slashings: proposer_slashings
5820-
.try_into()
5821-
.map_err(BlockProductionError::SszTypesError)?,
5822-
attester_slashings: attester_slashings_electra
5823-
.try_into()
5824-
.map_err(BlockProductionError::SszTypesError)?,
5825-
attestations: attestations_electra
5826-
.try_into()
5827-
.map_err(BlockProductionError::SszTypesError)?,
5828-
deposits: deposits
5829-
.try_into()
5830-
.map_err(BlockProductionError::SszTypesError)?,
5831-
voluntary_exits: voluntary_exits
5832-
.try_into()
5833-
.map_err(BlockProductionError::SszTypesError)?,
5834-
sync_aggregate: sync_aggregate
5835-
.ok_or(BlockProductionError::MissingSyncAggregate)?,
5836-
execution_payload: payload
5837-
.try_into()
5838-
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
5839-
bls_to_execution_changes: bls_to_execution_changes
5840-
.try_into()
5841-
.map_err(BlockProductionError::SszTypesError)?,
5842-
blob_kzg_commitments: kzg_commitments
5843-
.ok_or(BlockProductionError::InvalidPayloadFork)?,
5844-
execution_requests: maybe_requests
5845-
.ok_or(BlockProductionError::MissingExecutionRequests)?,
5846-
},
5847-
}),
5848-
maybe_blobs_and_proofs,
5849-
execution_payload_value,
5850-
)
5851-
}
5798+
BeaconState::Gloas(_) => return Err(BlockProductionError::GloasNotImplemented),
58525799
};
58535800

58545801
let block = SignedBeaconBlock::from_block(

beacon_node/beacon_chain/src/errors.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ pub enum BlockProductionError {
320320
FailedToBuildBlobSidecars(String),
321321
MissingExecutionRequests,
322322
SszTypesError(ssz_types::Error),
323+
// TODO(gloas): Remove this once Gloas is implemented
324+
GloasNotImplemented,
323325
}
324326

325327
easy_from_to!(BlockProcessingError, BlockProductionError);

beacon_node/beacon_chain/src/test_utils.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,9 +3300,7 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
33003300
SignedBeaconBlock::Fulu(SignedBeaconBlockFulu {
33013301
ref mut message, ..
33023302
}) => add_blob_transactions!(message, FullPayloadFulu<E>, num_blobs, rng, fork_name),
3303-
SignedBeaconBlock::Gloas(SignedBeaconBlockGloas {
3304-
ref mut message, ..
3305-
}) => add_blob_transactions!(message, FullPayloadGloas<E>, num_blobs, rng, fork_name),
3303+
// TODO(EIP-7732) Add `SignedBeaconBlock::Gloas` variant
33063304
_ => return (block, blob_sidecars),
33073305
};
33083306

beacon_node/beacon_chain/tests/store_tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ fn get_states_descendant_of_block(
159159
.collect()
160160
}
161161

162+
// TODO(EIP-7732) Extend to support gloas
162163
#[tokio::test]
163164
async fn light_client_bootstrap_test() {
164165
let spec = test_spec::<E>();
@@ -206,7 +207,6 @@ async fn light_client_bootstrap_test() {
206207
LightClientBootstrap::Deneb(lc_bootstrap) => lc_bootstrap.header.beacon.slot,
207208
LightClientBootstrap::Electra(lc_bootstrap) => lc_bootstrap.header.beacon.slot,
208209
LightClientBootstrap::Fulu(lc_bootstrap) => lc_bootstrap.header.beacon.slot,
209-
LightClientBootstrap::Gloas(lc_bootstrap) => lc_bootstrap.header.beacon.slot,
210210
};
211211

212212
assert_eq!(
@@ -1581,6 +1581,10 @@ async fn proposer_duties_from_head_fulu() {
15811581
}
15821582

15831583
/// Test that we can compute the proposer shuffling for the Gloas fork epoch itself using lookahead!
1584+
// TODO(EIP-7732): Extend to gloas
1585+
// `state.latest_execution_payload_header()` not available in Gloas
1586+
// called from `add_block_at_slot` -> `make_block` -> `produce_block_on_state` -> `produce_partial_beacon_block` -> `get_execution_payload` -> `Error`
1587+
#[ignore]
15841588
#[tokio::test]
15851589
async fn proposer_lookahead_gloas_fork_epoch() {
15861590
let gloas_fork_epoch = Epoch::new(4);

beacon_node/execution_layer/src/engine_api.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -541,34 +541,6 @@ impl<E: EthSpec> ExecutionPayloadBodyV1<E> {
541541
))
542542
}
543543
}
544-
ExecutionPayloadHeader::Gloas(header) => {
545-
if let Some(withdrawals) = self.withdrawals {
546-
Ok(ExecutionPayload::Gloas(ExecutionPayloadGloas {
547-
parent_hash: header.parent_hash,
548-
fee_recipient: header.fee_recipient,
549-
state_root: header.state_root,
550-
receipts_root: header.receipts_root,
551-
logs_bloom: header.logs_bloom,
552-
prev_randao: header.prev_randao,
553-
block_number: header.block_number,
554-
gas_limit: header.gas_limit,
555-
gas_used: header.gas_used,
556-
timestamp: header.timestamp,
557-
extra_data: header.extra_data,
558-
base_fee_per_gas: header.base_fee_per_gas,
559-
block_hash: header.block_hash,
560-
transactions: self.transactions,
561-
withdrawals,
562-
blob_gas_used: header.blob_gas_used,
563-
excess_blob_gas: header.excess_blob_gas,
564-
}))
565-
} else {
566-
Err(format!(
567-
"block {} is post capella but payload body doesn't have withdrawals",
568-
header.block_hash
569-
))
570-
}
571-
}
572544
}
573545
}
574546
}

beacon_node/execution_layer/src/engine_api/new_payload_request.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> {
172172
}
173173
}
174174

175+
//TODO(EIP7732): Consider implementing these as methods on the NewPayloadRequest struct
175176
impl<'a, E: EthSpec> TryFrom<BeaconBlockRef<'a, E>> for NewPayloadRequest<'a, E> {
176177
type Error = BeaconStateError;
177178

@@ -220,17 +221,7 @@ impl<'a, E: EthSpec> TryFrom<BeaconBlockRef<'a, E>> for NewPayloadRequest<'a, E>
220221
parent_beacon_block_root: block_ref.parent_root,
221222
execution_requests: &block_ref.body.execution_requests,
222223
})),
223-
BeaconBlockRef::Gloas(block_ref) => Ok(Self::Gloas(NewPayloadRequestGloas {
224-
execution_payload: &block_ref.body.execution_payload.execution_payload,
225-
versioned_hashes: block_ref
226-
.body
227-
.blob_kzg_commitments
228-
.iter()
229-
.map(kzg_commitment_to_versioned_hash)
230-
.collect(),
231-
parent_beacon_block_root: block_ref.parent_root,
232-
execution_requests: &block_ref.body.execution_requests,
233-
})),
224+
BeaconBlockRef::Gloas(_) => Err(Self::Error::IncorrectStateVariant),
234225
}
235226
}
236227
}
@@ -251,11 +242,15 @@ impl<'a, E: EthSpec> TryFrom<ExecutionPayloadRef<'a, E>> for NewPayloadRequest<'
251242
ExecutionPayloadRef::Deneb(_) => Err(Self::Error::IncorrectStateVariant),
252243
ExecutionPayloadRef::Electra(_) => Err(Self::Error::IncorrectStateVariant),
253244
ExecutionPayloadRef::Fulu(_) => Err(Self::Error::IncorrectStateVariant),
245+
//TODO(EIP7732): Probably time to just get rid of this
254246
ExecutionPayloadRef::Gloas(_) => Err(Self::Error::IncorrectStateVariant),
255247
}
256248
}
257249
}
258250

251+
// TODO(EIP-7732) build out the following when it's needed like in Mark's branch
252+
// impl<'a, E: EthSpec> TryFrom<ExecutionEnvelopeRef<'a, E>> for NewPayloadRequest<E> {
253+
259254
#[cfg(test)]
260255
mod test {
261256
use crate::versioned_hashes::Error as VersionedHashError;

beacon_node/execution_layer/src/lib.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ use types::{
5555
};
5656
use types::{
5757
BeaconStateError, BlindedPayload, ChainSpec, Epoch, ExecPayload, ExecutionPayloadBellatrix,
58-
ExecutionPayloadCapella, ExecutionPayloadElectra, ExecutionPayloadFulu, ExecutionPayloadGloas,
59-
FullPayload, ProposerPreparationData, Slot,
58+
ExecutionPayloadCapella, ExecutionPayloadElectra, ExecutionPayloadFulu, FullPayload,
59+
ProposerPreparationData, Slot,
6060
};
6161

6262
mod block_hash;
@@ -131,13 +131,6 @@ impl<E: EthSpec> TryFrom<BuilderBid<E>> for ProvenancedPayload<BlockProposalCont
131131
blobs_and_proofs: None,
132132
requests: Some(builder_bid.execution_requests),
133133
},
134-
BuilderBid::Gloas(builder_bid) => BlockProposalContents::PayloadAndBlobs {
135-
payload: ExecutionPayloadHeader::Gloas(builder_bid.header).into(),
136-
block_value: builder_bid.value,
137-
kzg_commitments: builder_bid.blob_kzg_commitments,
138-
blobs_and_proofs: None,
139-
requests: Some(builder_bid.execution_requests),
140-
},
141134
};
142135
Ok(ProvenancedPayload::Builder(
143136
BlockProposalContentsType::Blinded(block_proposal_contents),
@@ -1368,6 +1361,7 @@ impl<E: EthSpec> ExecutionLayer<E> {
13681361
}
13691362

13701363
/// Maps to the `engine_newPayload` JSON-RPC call.
1364+
/// TODO(EIP-7732) figure out how and why Mark relaxed new_payload_request param's typ to NewPayloadRequest<E>
13711365
pub async fn notify_new_payload(
13721366
&self,
13731367
new_payload_request: NewPayloadRequest<'_, E>,
@@ -1839,10 +1833,12 @@ impl<E: EthSpec> ExecutionLayer<E> {
18391833
ForkName::Deneb => ExecutionPayloadDeneb::default().into(),
18401834
ForkName::Electra => ExecutionPayloadElectra::default().into(),
18411835
ForkName::Fulu => ExecutionPayloadFulu::default().into(),
1842-
ForkName::Gloas => ExecutionPayloadGloas::default().into(),
18431836
ForkName::Base | ForkName::Altair => {
18441837
return Err(Error::InvalidForkForPayload);
18451838
}
1839+
ForkName::Gloas => {
1840+
return Err(Error::InvalidForkForPayload);
1841+
}
18461842
};
18471843
return Ok(Some(payload));
18481844
}

beacon_node/execution_layer/src/test_utils/execution_block_generator.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -909,12 +909,8 @@ pub fn generate_genesis_header<E: EthSpec>(
909909
*header.transactions_root_mut() = empty_transactions_root;
910910
Some(header)
911911
}
912-
ForkName::Gloas => {
913-
let mut header = ExecutionPayloadHeader::Gloas(<_>::default());
914-
*header.block_hash_mut() = genesis_block_hash.unwrap_or_default();
915-
*header.transactions_root_mut() = empty_transactions_root;
916-
Some(header)
917-
}
912+
// TODO(EIP-7732): need to look into this
913+
ForkName::Gloas => None,
918914
}
919915
}
920916

0 commit comments

Comments
 (0)