Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Jul 27, 2023
1 parent 26bbbe4 commit 5fa7e0f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/blocks/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {toHexString} from "@chainsafe/ssz";
import {CachedBeaconStateAllForks, computeEpochAtSlot, DataAvailableStatus} from "@lodestar/state-transition";
import {MaybeValidExecutionStatus} from "@lodestar/fork-choice";
import {allForks, deneb, Slot, RootHex} from "@lodestar/types";
import {ForkSeq, MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS} from "@lodestar/params";
import {ChainForkConfig} from "@lodestar/config";
import {toHexString} from "@chainsafe/ssz";
import {pruneSetToMax} from "@lodestar/utils";

export enum BlockInputType {
Expand Down
13 changes: 8 additions & 5 deletions packages/beacon-node/src/sync/range/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,15 @@ export class SyncChain {

if (!res.err) {
batch.downloadingSuccess(res.result);
const blobs = res.result.reduce(
(acc, blockInput) => acc + (blockInput.type === BlockInputType.postDeneb ? blockInput.blobs.length : 0),
0
);
let hasPostDenebBlocks = false;
const blobs = res.result.reduce((acc, blockInput) => {
hasPostDenebBlocks ||= blockInput.type === BlockInputType.postDeneb;
return hasPostDenebBlocks
? acc + (blockInput.type === BlockInputType.postDeneb ? blockInput.blobs.length : 0)
: 0;
}, 0);
const downloadInfo = {blocks: res.result.length};
if (blobs > 0) {
if (hasPostDenebBlocks) {
Object.assign(downloadInfo, {blobs});
}
this.logger.debug("Downloaded batch", {id: this.logId, ...batch.getMetadata(), ...downloadInfo});
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/test/spec/presets/finality.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
BeaconStateAllForks,
DataAvailableStatus,
ExecutionPayloadStatus,
stateTransition,
DataAvailableStatus,
} from "@lodestar/state-transition";
import {altair, bellatrix, ssz} from "@lodestar/types";
import {ForkName} from "@lodestar/params";
Expand Down

0 comments on commit 5fa7e0f

Please sign in to comment.