Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Sep 27, 2024
1 parent 04d37fd commit 620ca10
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 29 deletions.
29 changes: 4 additions & 25 deletions beacon_node/execution_layer/src/engine_api/json_structures.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use super::*;
use alloy_rlp::RlpEncodable;
use bytes::{BufMut, Bytes, BytesMut};
use bytes::Bytes;
use serde::{Deserialize, Serialize};
use ssz::{Decode, Encode};
use ssz::Decode;
use strum::EnumString;
use superstruct::superstruct;
use types::beacon_block_body::KzgCommitments;
use types::blob_sidecar::BlobsList;
use types::{DepositRequest, FixedVector, PublicKeyBytes, Signature, Unsigned, WithdrawalRequest};
use types::{DepositRequest, FixedVector, Unsigned, WithdrawalRequest};

#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -191,15 +191,6 @@ enum RequestPrefix {
}

impl RequestPrefix {
// TODO(pawan): get the final values from the spec
pub fn to_prefix(&self) -> u8 {
match self {
Self::Deposit => 0,
Self::Withdrawal => 1,
Self::Consolidation => 2,
}
}

pub fn from_prefix(prefix: u8) -> Option<Self> {
match prefix {
0 => Some(Self::Deposit),
Expand All @@ -210,13 +201,6 @@ impl RequestPrefix {
}
}

fn prefix_and_bytes<T: Encode>(request: &T, prefix: u8, max_size: usize) -> Bytes {
let mut bytes: Vec<u8> = Vec::with_capacity(max_size);
bytes.push(prefix);
bytes.append(&mut request.as_ssz_bytes());
Bytes::from(bytes)
}

impl<E: EthSpec> From<ExecutionPayloadElectra<E>> for JsonExecutionPayloadV4<E> {
fn from(payload: ExecutionPayloadElectra<E>) -> Self {
JsonExecutionPayloadV4 {
Expand Down Expand Up @@ -828,12 +812,7 @@ impl<E: EthSpec> From<ExecutionPayloadBodyV1<E>> for JsonExecutionPayloadBodyV1<
Self {
transactions: value.transactions,
withdrawals: value.withdrawals.map(|withdrawals| {
VariableList::from(
withdrawals
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
VariableList::from(withdrawals.into_iter().map(Into::into).collect::<Vec<_>>())
}),
}
}
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/execution_layer/src/test_utils/handle_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ pub async fn handle_rpc<E: EthSpec>(
Some(
ctx.execution_block_generator
.write()
.new_payload(request.try_into().unwrap()),
.new_payload(request.into()),
)
} else {
None
Expand Down
6 changes: 4 additions & 2 deletions beacon_node/execution_layer/src/test_utils/mock_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ pub fn serve<E: EthSpec>(

let mut message = match payload_response_type {
crate::GetPayloadResponseType::Full(payload_response) => {
let (payload, _block_value, maybe_blobs_bundle, maybe_requests): (
#[allow(clippy::type_complexity)]
let (payload, _block_value, maybe_blobs_bundle, _maybe_requests): (
ExecutionPayload<E>,
Uint256,
Option<BlobsBundle<E>>,
Expand Down Expand Up @@ -592,7 +593,8 @@ pub fn serve<E: EthSpec>(
}
}
crate::GetPayloadResponseType::Blinded(payload_response) => {
let (payload, _block_value, maybe_blobs_bundle, maybe_requests): (
#[allow(clippy::type_complexity)]
let (payload, _block_value, maybe_blobs_bundle, _maybe_requests): (
ExecutionPayload<E>,
Uint256,
Option<BlobsBundle<E>>,
Expand Down
4 changes: 3 additions & 1 deletion consensus/types/src/execution_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ pub struct ExecutionRequests<E: EthSpec> {

#[cfg(test)]
mod tests {
use crate::MainnetEthSpec;

use super::*;

ssz_and_tree_hash_tests!(ExecutionRequests);
ssz_and_tree_hash_tests!(ExecutionRequests<MainnetEthSpec>);
}

0 comments on commit 620ca10

Please sign in to comment.