Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
30b7b94
feat: init BeaconEngine
twoeths Jun 18, 2026
a07d28e
refactor: move Seen Caches + Shuffling Cache to engine
twoeths Jun 18, 2026
c24604a
feat: move regen into BeaconEngine
twoeths Jun 18, 2026
a107e87
feat: implement IForkchoiceRead
twoeths Jun 18, 2026
91c22ec
feat: move gossip validation fns to BeaconEngine
twoeths Jun 18, 2026
b2aeb95
fix: gossip validation fn should not throw error
twoeths Jun 19, 2026
f3580dc
feat: move verifyBlockStateTransition() and importBlock() to BeaconEn…
twoeths Jun 19, 2026
2a5e82e
feat: implement and consume BeaconEngine.produceBlockBase()
twoeths Jun 23, 2026
207b272
feat: BeaconEngine.computeNewStateRoot()
twoeths Jun 25, 2026
85cf31e
feat: implement duties apis in BeaconEngine
twoeths Jun 26, 2026
452cc42
feat: implement BeaconEngine.prepareForNextSlot()
twoeths Jun 29, 2026
cc46c04
fix: api to pass bytes to BeaconEngine
twoeths Jun 29, 2026
b89e517
feat: archive blocks + states by BeaconEngine
twoeths Jul 2, 2026
40169aa
feat: move ExecutionPayload db to BeaconEngine
twoeths Jul 3, 2026
b5e4eea
feat: separate IBeaconChainDb vs IBeaconEngineDb
twoeths Jul 3, 2026
f161878
feat: remove BeaconEngine caches from BeaconChain
twoeths Jul 7, 2026
d9b63e3
fix: avoid calling forkchoice in BeaconChain.importBlock()
twoeths Jul 7, 2026
2ae61ae
feat: move importExecutionPayload to BeconEngine
twoeths Jul 7, 2026
17e3af9
fix: remove BeaconChain.get_head() methods
twoeths Jul 7, 2026
5efce01
fix: more BeaconEngine forkchoice methods
twoeths Jul 7, 2026
f3c5eb0
fix: gossip validation functions as methods
twoeths Jul 7, 2026
fec127f
feat: move gossip handlers to BeaconEngine
twoeths Jul 8, 2026
e1af424
fix: move forkchoice to BeaconEngine
twoeths Jul 9, 2026
14f38ed
feat: move regen and getState*() api to BeaconEngine
twoeths Jul 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 94 additions & 66 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/beacon-node/src/api/impl/beacon/blocks/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {routes} from "@lodestar/api";
import {ChainForkConfig} from "@lodestar/config";
import {IForkChoice} from "@lodestar/fork-choice";
import {blockToHeader} from "@lodestar/state-transition";
import {RootHex, SignedBeaconBlock, Slot} from "@lodestar/types";
import {IBeaconEngine} from "../../../../chain/beaconEngine/index.js";
import {IBeaconChain} from "../../../../chain/interface.js";
import {GENESIS_SLOT} from "../../../../constants/index.js";
import {rootHexRegex} from "../../../../execution/engine/utils.js";
Expand All @@ -23,22 +23,22 @@ export function toBeaconHeaderResponse(
};
}

export function resolveBlockId(forkChoice: IForkChoice, blockId: routes.beacon.BlockId): RootHex | Slot {
export function resolveBlockId(beaconEngine: IBeaconEngine, blockId: routes.beacon.BlockId): RootHex | Slot {
blockId = String(blockId).toLowerCase();
if (blockId === "head") {
return forkChoice.getHead().blockRoot;
return beaconEngine.getHead().blockRoot;
}

if (blockId === "genesis") {
return GENESIS_SLOT;
}

if (blockId === "finalized") {
return forkChoice.getFinalizedBlock().blockRoot;
return beaconEngine.getFinalizedBlock().blockRoot;
}

if (blockId === "justified") {
return forkChoice.getJustifiedBlock().blockRoot;
return beaconEngine.getJustifiedBlock().blockRoot;
}

if (blockId.startsWith("0x")) {
Expand All @@ -60,7 +60,7 @@ export async function getBlockResponse(
chain: IBeaconChain,
blockId: routes.beacon.BlockId
): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean}> {
const rootOrSlot = resolveBlockId(chain.forkChoice, blockId);
const rootOrSlot = resolveBlockId(chain.beaconEngine, blockId);

const res =
typeof rootOrSlot === "string"
Expand Down
277 changes: 119 additions & 158 deletions packages/beacon-node/src/api/impl/beacon/pool/index.ts

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions packages/beacon-node/src/api/impl/beacon/rewards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@ export function getBeaconRewardsApi({
return {
async getBlockRewards({blockId}) {
const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
const data = await chain.getBlockRewards(block.message);
const data = await chain.beaconEngine.getBlockRewards(block.message);
return {data, meta: {executionOptimistic, finalized}};
},
async getAttestationsRewards({epoch, validatorIds}) {
assertUniqueItems(validatorIds, "Duplicate validator IDs provided");

const {rewards, executionOptimistic, finalized} = await chain.getAttestationsRewards(epoch, validatorIds);
const {rewards, executionOptimistic, finalized} = await chain.beaconEngine.getAttestationsRewards(
epoch,
validatorIds
);
return {data: rewards, meta: {executionOptimistic, finalized}};
},
async getSyncCommitteeRewards({blockId, validatorIds}) {
assertUniqueItems(validatorIds, "Duplicate validator IDs provided");

const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
const data = await chain.getSyncCommitteeRewards(block.message, validatorIds);
const data = await chain.beaconEngine.getSyncCommitteeRewards(block.message, validatorIds);
return {data, meta: {executionOptimistic, finalized}};
},
};
Expand Down
Loading