Skip to content
Merged
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ debug = true

[patch.crates-io]
# FIXME(eip-7688): EIP-7688 development patches
ssz_types = { git = "https://github.com/sigp/ssz_types", rev = "9203d56ad2d7bc5f12133d043e085843f81edcd6" }
milhouse = { git = "https://github.com/sigp/milhouse", rev = "c70f128976ac0d60ea65a978dabd117a921c36ee" }
ethereum_ssz = { git = "https://github.com/sigp/ethereum_ssz", rev = "2059c21ba52cd3a7e39a8ad537012b761812a393" }
ethereum_ssz_derive = { git = "https://github.com/sigp/ethereum_ssz", rev = "2059c21ba52cd3a7e39a8ad537012b761812a393" }
tree_hash = { git = "https://github.com/sigp/tree_hash", rev = "03d9fa474586c125f306dd7a00cf46284575a01f" }
tree_hash_derive = { git = "https://github.com/sigp/tree_hash", rev = "03d9fa474586c125f306dd7a00cf46284575a01f" }
ssz_types = { git = "https://github.com/sigp/ssz_types", rev = "8955d22edc7633f26fe3b5ac933facb5121d717a" }
milhouse = { git = "https://github.com/sigp/milhouse", rev = "d67aabd2a7c405b3c16f4aaff159b137dc5b5e38" }
ethereum_ssz = { git = "https://github.com/sigp/ethereum_ssz", rev = "974f78f421fbf70cba4e8f84e0fa28c23ad54f34" }
ethereum_ssz_derive = { git = "https://github.com/sigp/ethereum_ssz", rev = "974f78f421fbf70cba4e8f84e0fa28c23ad54f34" }
tree_hash = { git = "https://github.com/sigp/tree_hash", rev = "e5ea1875edddf12438506c3751cbb313f9c52d08" }
tree_hash_derive = { git = "https://github.com/sigp/tree_hash", rev = "e5ea1875edddf12438506c3751cbb313f9c52d08" }
# Temporary patch until the axum migration is complete
warp = { git = "https://github.com/macladson/warp", rev = "6f5f21beab6a240e59470caaab56afd46d46b709" }

Expand Down
87 changes: 53 additions & 34 deletions beacon_node/beacon_chain/src/block_production/gloas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use execution_layer::{
BlockProposalContentsGloas, BuilderParams, PayloadAttributes, PayloadParameters,
};
use operation_pool::CompactAttestationRef;
use ssz::{Encode, ProgressiveBitList};
use ssz::{Encode, ProgressiveBitList, TryFromIter};
use ssz_types::ProgressiveVariableList;
use state_processing::common::{get_attesting_indices_from_state, get_indexed_payload_attestation};
use state_processing::envelope_processing::verify_execution_payload_envelope;
Expand Down Expand Up @@ -582,20 +582,23 @@ impl<T: BeaconChainTypes> BeaconChain<T> {

let attester_slashings = attester_slashings
.into_iter()
.map(|a| match a {
// Convert pre-Gloas slashings into the Gloas type. The SSZ bytes are the same,
// only the hash tree root differs.
AttesterSlashing::Base(a) => AttesterSlashingGloas {
attestation_1: IndexedAttestation::Base(a.attestation_1).to_gloas(),
attestation_2: IndexedAttestation::Base(a.attestation_2).to_gloas(),
},
AttesterSlashing::Electra(a) => AttesterSlashingGloas {
attestation_1: IndexedAttestation::Electra(a.attestation_1).to_gloas(),
attestation_2: IndexedAttestation::Electra(a.attestation_2).to_gloas(),
},
AttesterSlashing::Gloas(a) => a,
.map(|a| {
Ok(match a {
// Convert pre-Gloas slashings into the Gloas type. The SSZ bytes are the same,
// only the hash tree root differs.
AttesterSlashing::Base(a) => AttesterSlashingGloas {
attestation_1: IndexedAttestation::Base(a.attestation_1).to_gloas()?,
attestation_2: IndexedAttestation::Base(a.attestation_2).to_gloas()?,
},
AttesterSlashing::Electra(a) => AttesterSlashingGloas {
attestation_1: IndexedAttestation::Electra(a.attestation_1).to_gloas()?,
attestation_2: IndexedAttestation::Electra(a.attestation_2).to_gloas()?,
},
AttesterSlashing::Gloas(a) => a,
})
})
.collect::<Vec<_>>();
.collect::<Result<Vec<_>, ssz_types::Error>>()
.map_err(BlockProductionError::SszTypesError)?;

let attestations = attestations
.into_iter()
Expand Down Expand Up @@ -728,18 +731,27 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
eth1_data,
graffiti,
// The operation list lengths are bounded by the op pool packing limits above.
proposer_slashings: ProgressiveVariableList::from_iter(proposer_slashings),
attester_slashings: ProgressiveVariableList::from_iter(attester_slashings),
attestations: ProgressiveVariableList::from_iter(attestations),
deposits: ProgressiveVariableList::from_iter(deposits),
voluntary_exits: ProgressiveVariableList::from_iter(voluntary_exits),
proposer_slashings: ProgressiveVariableList::try_from_iter(proposer_slashings)
.map_err(BlockProductionError::SszTypesError)?,
attester_slashings: ProgressiveVariableList::try_from_iter(attester_slashings)
.map_err(BlockProductionError::SszTypesError)?,
attestations: ProgressiveVariableList::try_from_iter(attestations)
.map_err(BlockProductionError::SszTypesError)?,
deposits: ProgressiveVariableList::try_from_iter(deposits)
.map_err(BlockProductionError::SszTypesError)?,
voluntary_exits: ProgressiveVariableList::try_from_iter(voluntary_exits)
.map_err(BlockProductionError::SszTypesError)?,
sync_aggregate,
bls_to_execution_changes: ProgressiveVariableList::from_iter(
bls_to_execution_changes: ProgressiveVariableList::try_from_iter(
bls_to_execution_changes,
),
)
.map_err(BlockProductionError::SszTypesError)?,
parent_execution_requests,
signed_execution_payload_bid,
payload_attestations: ProgressiveVariableList::from_iter(payload_attestations),
payload_attestations: ProgressiveVariableList::try_from_iter(
payload_attestations,
)
.map_err(BlockProductionError::SszTypesError)?,
_phantom: PhantomData::<FullPayload<T::EthSpec>>,
},
}),
Expand All @@ -753,18 +765,27 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
eth1_data,
graffiti,
// The operation list lengths are bounded by the op pool packing limits above.
proposer_slashings: ProgressiveVariableList::from_iter(proposer_slashings),
attester_slashings: ProgressiveVariableList::from_iter(attester_slashings),
attestations: ProgressiveVariableList::from_iter(attestations),
deposits: ProgressiveVariableList::from_iter(deposits),
voluntary_exits: ProgressiveVariableList::from_iter(voluntary_exits),
proposer_slashings: ProgressiveVariableList::try_from_iter(proposer_slashings)
.map_err(BlockProductionError::SszTypesError)?,
attester_slashings: ProgressiveVariableList::try_from_iter(attester_slashings)
.map_err(BlockProductionError::SszTypesError)?,
attestations: ProgressiveVariableList::try_from_iter(attestations)
.map_err(BlockProductionError::SszTypesError)?,
deposits: ProgressiveVariableList::try_from_iter(deposits)
.map_err(BlockProductionError::SszTypesError)?,
voluntary_exits: ProgressiveVariableList::try_from_iter(voluntary_exits)
.map_err(BlockProductionError::SszTypesError)?,
sync_aggregate,
bls_to_execution_changes: ProgressiveVariableList::from_iter(
bls_to_execution_changes: ProgressiveVariableList::try_from_iter(
bls_to_execution_changes,
),
)
.map_err(BlockProductionError::SszTypesError)?,
parent_execution_requests,
signed_execution_payload_bid,
payload_attestations: ProgressiveVariableList::from_iter(payload_attestations),
payload_attestations: ProgressiveVariableList::try_from_iter(
payload_attestations,
)
.map_err(BlockProductionError::SszTypesError)?,
_phantom: PhantomData::<FullPayload<T::EthSpec>>,
},
}),
Expand Down Expand Up @@ -989,7 +1010,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
execution_payment: EXECUTION_PAYMENT_TRUSTLESS_BUILD,
blob_kzg_commitments,
execution_requests_root: execution_requests.tree_hash_root(),
_phantom: PhantomData,
};

// Store payload data for envelope construction after block is created
Expand Down Expand Up @@ -1453,11 +1473,10 @@ mod tests {
) -> ExecutionRequestsGloas<TestSpec> {
ExecutionRequestsGloas {
deposits: ProgressiveVariableList::empty(),
withdrawals: ProgressiveVariableList::new(withdrawals),
consolidations: ProgressiveVariableList::new(consolidations),
withdrawals: ProgressiveVariableList::new(withdrawals).unwrap(),
consolidations: ProgressiveVariableList::new(consolidations).unwrap(),
builder_deposits: ProgressiveVariableList::empty(),
builder_exits: ProgressiveVariableList::empty(),
_phantom: PhantomData,
}
}

Expand Down
11 changes: 7 additions & 4 deletions beacon_node/beacon_chain/src/data_column_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2384,10 +2384,13 @@ mod test {
for i in 0..present_cells {
bitmap.set(i, true).unwrap();
}
let column: ProgressiveVariableList<_> =
(0..present_cells).map(|_| Cell::<E>::default()).collect();
let kzg_proofs: ProgressiveVariableList<_> =
(0..present_cells).map(|_| KzgProof::empty()).collect();
let column: ProgressiveVariableList<_, _> = ProgressiveVariableList::new(
(0..present_cells).map(|_| Cell::<E>::default()).collect(),
)
.unwrap();
let kzg_proofs: ProgressiveVariableList<_, _> =
ProgressiveVariableList::new((0..present_cells).map(|_| KzgProof::empty()).collect())
.unwrap();
PartialDataColumnGloas {
block_root,
slot,
Expand Down
8 changes: 6 additions & 2 deletions beacon_node/beacon_chain/src/fetch_blobs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,12 @@ async fn build_partial_columns_from_v4_response<T: BeaconChainTypes>(
})
}
PartialHeaderOrBid::Bid(_) => {
let column = ProgressiveVariableList::new(cells);
let kzg_proofs = ProgressiveVariableList::new(proofs);
let column = ProgressiveVariableList::new(cells).map_err(|e| {
FetchEngineBlobError::InternalError(format!("invalid cells list: {e:?}"))
})?;
let kzg_proofs = ProgressiveVariableList::new(proofs).map_err(|e| {
FetchEngineBlobError::InternalError(format!("invalid proofs list: {e:?}"))
})?;

PartialDataColumn::Gloas(PartialDataColumnGloas {
block_root,
Expand Down
5 changes: 3 additions & 2 deletions beacon_node/beacon_chain/src/inclusion_list_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ mod tests {
}

fn tx(byte: u8) -> ProgressiveVariableList<u8> {
ProgressiveVariableList::new(vec![byte])
ProgressiveVariableList::new(vec![byte]).unwrap()
}

fn signed_il(
Expand All @@ -316,7 +316,8 @@ mod tests {
dependent_root,
transactions: ProgressiveVariableList::new(
tx_bytes.iter().map(|b| tx(*b)).collect(),
),
)
.unwrap(),
},
signature: Signature::empty(),
}
Expand Down
12 changes: 8 additions & 4 deletions beacon_node/beacon_chain/src/kzg_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,10 @@ pub(crate) fn build_data_column_sidecars_gloas<E: EthSpec>(
|(index, (col, proofs))| -> Result<Arc<DataColumnSidecar<E>>, String> {
Ok(Arc::new(DataColumnSidecar::Gloas(DataColumnSidecarGloas {
index: index as u64,
column: ProgressiveVariableList::from_iter(col),
kzg_proofs: ProgressiveVariableList::from_iter(proofs),
column: ProgressiveVariableList::new(col)
.map_err(|e| format!("MaxBlobCommitmentsPerBlock exceeded: {e:?}"))?,
kzg_proofs: ProgressiveVariableList::new(proofs)
.map_err(|e| format!("MaxBlobCommitmentsPerBlock exceeded: {e:?}"))?,
beacon_block_root,
slot,
})))
Expand Down Expand Up @@ -696,8 +698,10 @@ pub(crate) fn build_partial_data_columns_gloas<E: EthSpec>(
index: index as u64,
sidecar: types::data::PartialDataColumnSidecarGloas {
cells_present_bitmap: bitmap.clone(),
column: ProgressiveVariableList::new(col),
kzg_proofs: ProgressiveVariableList::new(proofs),
column: ProgressiveVariableList::new(col)
.map_err(|e| format!("MaxBlobCommitmentsPerBlock exceeded: {e:?}"))?,
kzg_proofs: ProgressiveVariableList::new(proofs)
.map_err(|e| format!("MaxBlobCommitmentsPerBlock exceeded: {e:?}"))?,
},
}
.into())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ impl TestContext {
builder_exit: BuilderExitRequest,
) {
let mut envelope = ExecutionPayloadEnvelope::<E>::empty();
envelope.execution_requests.builder_exits.push(builder_exit);
envelope
.execution_requests
.builder_exits
.push(builder_exit)
.unwrap();
self.store
.put_payload_envelope(
&block_root,
Expand Down Expand Up @@ -1041,7 +1045,7 @@ fn invalid_blob_kzg_commitments() {
parent_block_root: ctx.genesis_block_root,
parent_block_hash: ctx.execution_parent_hash(),
prev_randao: ctx.expected_prev_randao(),
blob_kzg_commitments: ProgressiveVariableList::new(commitments),
blob_kzg_commitments: ProgressiveVariableList::new(commitments).unwrap(),
..ExecutionPayloadBid::default()
},
signature: Signature::empty(),
Expand Down
Loading
Loading