Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Sep 19, 2024
1 parent 04fb9c1 commit 42e2cd0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
9 changes: 7 additions & 2 deletions packages/beacon-node/src/execution/engine/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
executionPayload: ExecutionPayload,
versionedHashes?: VersionedHashes,
parentBlockRoot?: Root,
executionRequests?: ExecutionRequests,
executionRequests?: ExecutionRequests
): Promise<ExecutePayloadResponse> {
const method =
ForkSeq[fork] >= ForkSeq.electra
Expand Down Expand Up @@ -229,7 +229,12 @@ export class ExecutionEngineHttp implements IExecutionEngine {
const serializedExecutionRequests = serializeExecutionRequests(executionRequests);
engineRequest = {
method: "engine_newPayloadV4",
params: [serializedExecutionPayload, serializedVersionedHashes, parentBeaconBlockRoot, serializedExecutionRequests],
params: [
serializedExecutionPayload,
serializedVersionedHashes,
parentBeaconBlockRoot,
serializedExecutionRequests,
],
methodOpts: notifyNewPayloadOpts,
};
} else {
Expand Down
20 changes: 7 additions & 13 deletions packages/beacon-node/src/execution/engine/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ export type WithdrawalRpc = {
};

export type ExecutionRequestsRpc = {
deposits: DepositRequestRpc[],
withdrawals: WithdrawalRequestRpc[],
consolidations: ConsolidationRequestRpc[],
}
deposits: DepositRequestRpc[];
withdrawals: WithdrawalRequestRpc[];
consolidations: ConsolidationRequestRpc[];
};

export type DepositRequestRpc = {
pubkey: DATA;
Expand Down Expand Up @@ -361,15 +361,13 @@ export function parseExecutionPayload(
// );
// }
// (executionPayload as electra.ExecutionPayload).depositRequests = depositRequests.map(deserializeDepositRequest);

// if (withdrawalRequests == null) {
// throw Error(
// `withdrawalRequests missing for ${fork} >= electra executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
// );
// }
// (executionPayload as electra.ExecutionPayload).withdrawalRequests =
// withdrawalRequests.map(deserializeWithdrawalRequest);

// if (consolidationRequests == null) {
// throw Error(
// `consolidationRequests missing for ${fork} >= electra executionPayload number=${executionPayload.blockNumber} hash=${data.blockHash}`
Expand Down Expand Up @@ -482,19 +480,15 @@ function deserializeWithdrawalRequest(withdrawalRequest: WithdrawalRequestRpc):
};
}

function serializeConsolidationRequest(
consolidationRequest: electra.ConsolidationRequest
): ConsolidationRequestRpc {
function serializeConsolidationRequest(consolidationRequest: electra.ConsolidationRequest): ConsolidationRequestRpc {
return {
sourceAddress: bytesToData(consolidationRequest.sourceAddress),
sourcePubkey: bytesToData(consolidationRequest.sourcePubkey),
targetPubkey: bytesToData(consolidationRequest.targetPubkey),
};
}

function deserializeConsolidationRequest(
consolidationRequest: ConsolidationRequestRpc
): electra.ConsolidationRequest {
function deserializeConsolidationRequest(consolidationRequest: ConsolidationRequestRpc): electra.ConsolidationRequest {
return {
sourceAddress: dataToBytes(consolidationRequest.sourceAddress, 20),
sourcePubkey: dataToBytes(consolidationRequest.sourcePubkey, 48),
Expand All @@ -507,7 +501,7 @@ export function serializeExecutionRequests(executionRequests: ExecutionRequests)
return {
deposits: deposits.map(serializeDepositRequest),
withdrawals: withdrawals.map(serializeWithdrawalRequest),
consolidations: consolidations.map(serializeConsolidationRequest),
consolidations: consolidations.map(serializeConsolidationRequest),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("UpgradeLightClientHeader", function () {
capella: ssz.capella.LightClientHeader.defaultValue(),
bellatrix: ssz.altair.LightClientHeader.defaultValue(),
deneb: ssz.deneb.LightClientHeader.defaultValue(),
electra: ssz.electra.LightClientHeader.defaultValue(),
electra: ssz.deneb.LightClientHeader.defaultValue(),
};

testSlots = {
Expand Down
1 change: 0 additions & 1 deletion packages/state-transition/src/util/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
bellatrix,
capella,
deneb,
electra,
isBlindedBeaconBlockBody,
ssz,
BeaconBlock,
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/electra/sszTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from "@chainsafe/ssz";
import {
HISTORICAL_ROOTS_LIMIT,
BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH,
EPOCHS_PER_SYNC_COMMITTEE_PERIOD,
SLOTS_PER_EPOCH,
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD,
Expand Down
10 changes: 9 additions & 1 deletion packages/types/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import {ForkAll, ForkBlobs, ForkExecution, ForkLightClient, ForkName, ForkPostElectra, ForkPreBlobs} from "@lodestar/params";
import {
ForkAll,
ForkBlobs,
ForkExecution,
ForkLightClient,
ForkName,
ForkPostElectra,
ForkPreBlobs,
} from "@lodestar/params";
import {ts as phase0} from "./phase0/index.js";
import {ts as altair} from "./altair/index.js";
import {ts as bellatrix} from "./bellatrix/index.js";
Expand Down

0 comments on commit 42e2cd0

Please sign in to comment.