Bump ssz_types to v0.12.2 (#8032)

https://github.com/sigp/lighthouse/issues/8012


  Replace all instances of `VariableList::from` and `FixedVector::from` to their `try_from` variants.

While I tried to use proper error handling in most cases, there were certain situations where adding an `expect` for situations where `try_from` can trivially never fail avoided adding a lot of extra complexity.


Co-Authored-By: Mac L <mjladson@pm.me>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Mac L
2025-10-28 08:01:09 +04:00
committed by GitHub
parent 5840004c36
commit f5809aff87
39 changed files with 758 additions and 465 deletions

View File

@@ -26,8 +26,8 @@ type E = MinimalEthSpec;
/// Bellatrix block with length < max_rpc_size.
fn bellatrix_block_small(spec: &ChainSpec) -> BeaconBlock<E> {
let mut block = BeaconBlockBellatrix::<E>::empty(spec);
let tx = VariableList::from(vec![0; 1024]);
let txs = VariableList::from(std::iter::repeat_n(tx, 5000).collect::<Vec<_>>());
let tx = VariableList::try_from(vec![0; 1024]).unwrap();
let txs = VariableList::try_from(std::iter::repeat_n(tx, 5000).collect::<Vec<_>>()).unwrap();
block.body.execution_payload.execution_payload.transactions = txs;
@@ -41,8 +41,8 @@ fn bellatrix_block_small(spec: &ChainSpec) -> BeaconBlock<E> {
/// Hence, we generate a bellatrix block just greater than `MAX_RPC_SIZE` to test rejection on the rpc layer.
fn bellatrix_block_large(spec: &ChainSpec) -> BeaconBlock<E> {
let mut block = BeaconBlockBellatrix::<E>::empty(spec);
let tx = VariableList::from(vec![0; 1024]);
let txs = VariableList::from(std::iter::repeat_n(tx, 100000).collect::<Vec<_>>());
let tx = VariableList::try_from(vec![0; 1024]).unwrap();
let txs = VariableList::try_from(std::iter::repeat_n(tx, 100000).collect::<Vec<_>>()).unwrap();
block.body.execution_payload.execution_payload.transactions = txs;
@@ -1018,14 +1018,17 @@ fn test_tcp_columns_by_root_chunked_rpc() {
},
signature: Signature::empty(),
},
column: vec![vec![0; E::bytes_per_blob()].into()].into(),
kzg_commitments: vec![KzgCommitment::empty_for_testing()].into(),
kzg_proofs: vec![KzgProof::empty()].into(),
column: vec![vec![0; E::bytes_per_cell()].try_into().unwrap()]
.try_into()
.unwrap(),
kzg_commitments: vec![KzgCommitment::empty_for_testing()].try_into().unwrap(),
kzg_proofs: vec![KzgProof::empty()].try_into().unwrap(),
kzg_commitments_inclusion_proof: vec![
Hash256::zero();
E::kzg_commitments_inclusion_proof_depth()
]
.into(),
.try_into()
.unwrap(),
});
let rpc_response = Response::DataColumnsByRoot(Some(data_column.clone()));
@@ -1160,14 +1163,17 @@ fn test_tcp_columns_by_range_chunked_rpc() {
},
signature: Signature::empty(),
},
column: vec![vec![0; E::bytes_per_blob()].into()].into(),
kzg_commitments: vec![KzgCommitment::empty_for_testing()].into(),
kzg_proofs: vec![KzgProof::empty()].into(),
column: vec![vec![0; E::bytes_per_cell()].try_into().unwrap()]
.try_into()
.unwrap(),
kzg_commitments: vec![KzgCommitment::empty_for_testing()].try_into().unwrap(),
kzg_proofs: vec![KzgProof::empty()].try_into().unwrap(),
kzg_commitments_inclusion_proof: vec![
Hash256::zero();
E::kzg_commitments_inclusion_proof_depth()
]
.into(),
.try_into()
.unwrap(),
});
let rpc_response = Response::DataColumnsByRange(Some(data_column.clone()));