mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 19:02:42 +00:00
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:
@@ -1002,8 +1002,9 @@ mod tests {
|
||||
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
|
||||
BeaconBlockBellatrix::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;
|
||||
|
||||
@@ -1021,8 +1022,9 @@ mod tests {
|
||||
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
|
||||
BeaconBlockBellatrix::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;
|
||||
|
||||
@@ -1080,7 +1082,7 @@ mod tests {
|
||||
data_column_ids: RuntimeVariableList::new(
|
||||
vec![DataColumnsByRootIdentifier {
|
||||
block_root: Hash256::zero(),
|
||||
columns: VariableList::from(vec![0, 1, 2]),
|
||||
columns: VariableList::try_from(vec![0, 1, 2]).unwrap(),
|
||||
}],
|
||||
spec.max_request_blocks(fork_name),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user