Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Oct 10, 2024
1 parent 6b3205d commit 46a3395
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions packages/beacon-node/src/execution/engine/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {capella, deneb, electra, Wei, bellatrix, Root, ExecutionPayload, ExecutionRequests, ssz} from "@lodestar/types";
import { capella, deneb, electra, Wei, bellatrix, Root, ExecutionPayload, ExecutionRequests, ssz } from "@lodestar/types";
import {
BYTES_PER_LOGS_BLOOM,
FIELD_ELEMENTS_PER_BLOB,
Expand All @@ -16,16 +16,16 @@ import {
QUANTITY,
quantityToBigint,
} from "../../eth1/provider/utils.js";
import {ExecutionPayloadStatus, BlobsBundle, PayloadAttributes, VersionedHashes} from "./interface.js";
import {WithdrawalV1} from "./payloadIdCache.js";
import { ExecutionPayloadStatus, BlobsBundle, PayloadAttributes, VersionedHashes } from "./interface.js";
import { WithdrawalV1 } from "./payloadIdCache.js";

/* eslint-disable @typescript-eslint/naming-convention */

export type EngineApiRpcParamTypes = {
/**
* 1. Object - Instance of ExecutionPayload
*/
engine_newPayloadV1: [ExecutionPayloadRpc];
engine_newPayloadV1: [ExecutionPayloadRpc]
engine_newPayloadV2: [ExecutionPayloadRpc];
engine_newPayloadV3: [ExecutionPayloadRpc, VersionedHashesRpc, DATA];
engine_newPayloadV4: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc];
Expand All @@ -35,15 +35,15 @@ export type EngineApiRpcParamTypes = {
* - status: String: VALID|INVALID - result of the payload validation with respect to the proof-of-stake consensus rules
*/
engine_forkchoiceUpdatedV1: [
forkChoiceData: {headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA},
forkChoiceData: { headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA },
payloadAttributes?: PayloadAttributesRpc,
];
engine_forkchoiceUpdatedV2: [
forkChoiceData: {headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA},
forkChoiceData: { headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA },
payloadAttributes?: PayloadAttributesRpc,
];
engine_forkchoiceUpdatedV3: [
forkChoiceData: {headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA},
forkChoiceData: { headBlockHash: DATA; safeBlockHash: DATA; finalizedBlockHash: DATA },
payloadAttributes?: PayloadAttributesRpc,
];
/**
Expand Down Expand Up @@ -225,13 +225,13 @@ export function serializeExecutionPayload(fork: ForkName, data: ExecutionPayload

// Capella adds withdrawals to the ExecutionPayload
if (ForkSeq[fork] >= ForkSeq.capella) {
const {withdrawals} = data as capella.ExecutionPayload;
const { withdrawals } = data as capella.ExecutionPayload;
payload.withdrawals = withdrawals.map(serializeWithdrawal);
}

// DENEB adds blobGasUsed & excessBlobGas to the ExecutionPayload
if (ForkSeq[fork] >= ForkSeq.deneb) {
const {blobGasUsed, excessBlobGas} = data as deneb.ExecutionPayload;
const { blobGasUsed, excessBlobGas } = data as deneb.ExecutionPayload;
payload.blobGasUsed = numToQuantity(blobGasUsed);
payload.excessBlobGas = numToQuantity(excessBlobGas);
}
Expand Down Expand Up @@ -298,7 +298,7 @@ export function parseExecutionPayload(
};

if (ForkSeq[fork] >= ForkSeq.capella) {
const {withdrawals} = data;
const { withdrawals } = data;
// Geth can also reply with null
if (withdrawals == null) {
throw Error(
Expand All @@ -310,7 +310,7 @@ export function parseExecutionPayload(

// DENEB adds excessBlobGas to the ExecutionPayload
if (ForkSeq[fork] >= ForkSeq.deneb) {
const {blobGasUsed, excessBlobGas} = data;
const { blobGasUsed, excessBlobGas } = data;

if (blobGasUsed == null) {
throw Error(
Expand All @@ -329,7 +329,7 @@ export function parseExecutionPayload(

// No changes in Electra

return {executionPayload, executionPayloadValue, blobsBundle, executionRequests, shouldOverrideBuilder};
return { executionPayload, executionPayloadValue, blobsBundle, executionRequests, shouldOverrideBuilder };
}

export function serializePayloadAttributes(data: PayloadAttributes): PayloadAttributesRpc {
Expand Down Expand Up @@ -424,7 +424,7 @@ function deserializeConsolidationRequests(serialized: ConsolidationRequestsRpc):
* https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.8/specs/electra/beacon-chain.md#new-get_execution_requests_list
*/
export function serializeExecutionRequests(executionRequests: ExecutionRequests): ExecutionRequestsRpc {
const {deposits, withdrawals, consolidations} = executionRequests;
const { deposits, withdrawals, consolidations } = executionRequests;

return [serializeDepositRequests(deposits), serializeWithdrawalRequests(withdrawals), serializeConsolidationRequests(consolidations)];
}
Expand All @@ -442,18 +442,18 @@ export function deserializeExecutionRequests(serialized: ExecutionRequestsRpc):
export function deserializeExecutionPayloadBody(data: ExecutionPayloadBodyRpc | null): ExecutionPayloadBody | null {
return data
? {
transactions: data.transactions.map((tran) => dataToBytes(tran, null)),
withdrawals: data.withdrawals ? data.withdrawals.map(deserializeWithdrawal) : null,
}
transactions: data.transactions.map((tran) => dataToBytes(tran, null)),
withdrawals: data.withdrawals ? data.withdrawals.map(deserializeWithdrawal) : null,
}
: null;
}

export function serializeExecutionPayloadBody(data: ExecutionPayloadBody | null): ExecutionPayloadBodyRpc | null {
return data
? {
transactions: data.transactions.map((tran) => bytesToData(tran)),
withdrawals: data.withdrawals ? data.withdrawals.map(serializeWithdrawal) : null,
}
transactions: data.transactions.map((tran) => bytesToData(tran)),
withdrawals: data.withdrawals ? data.withdrawals.map(serializeWithdrawal) : null,
}
: null;
}

Expand Down

0 comments on commit 46a3395

Please sign in to comment.