Skip to content

Commit

Permalink
Fix max_payload_size function
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Nov 10, 2021
1 parent ed32dbf commit 260e9ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions consensus/types/src/execution_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ impl<T: EthSpec> ExecutionPayload<T> {
}
}

#[allow(clippy::integer_arithmetic)]
/// Returns the maximum size of an execution payload.
pub fn max_execution_payload_size() -> usize {
// Fixed part
Self::empty().as_ssz_bytes().len()
// length of List * size_of(uint8)
+ (T::max_extra_data_bytes() * 1)
+ (T::max_extra_data_bytes() * <u8 as Encode>::ssz_fixed_len())
// length of List * offset size * max size of transaction
+ (T::max_transactions_per_payload() *4 * T::max_bytes_per_transaction())
+ (T::max_transactions_per_payload() *ssz::BYTES_PER_LENGTH_OFFSET * T::max_bytes_per_transaction())
}
}

0 comments on commit 260e9ea

Please sign in to comment.