Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3ee0cc3
wip
wemeetagain Jan 20, 2026
4b2fd98
wip
wemeetagain Jan 20, 2026
1bd6cab
chore: remove unused imports
GrapeBaBa Jan 21, 2026
8c2b1dd
refactor: move beacon_state to fork types to prepare refactor
GrapeBaBa Jan 21, 2026
b80bba7
refactor: change some processXX to use comptime fork
GrapeBaBa Jan 21, 2026
1e37e44
refactor: continue change func using comptime fork
GrapeBaBa Jan 21, 2026
011ea81
chore: fork_types tweaks
wemeetagain Jan 21, 2026
064c413
chore: more processXX updates, top-level stateTransition update
wemeetagain Jan 21, 2026
a13ffb1
Merge main (int tests migration)
GrapeBaBa Jan 22, 2026
ab58507
refactor: continue use comptimee fork
GrapeBaBa Jan 22, 2026
1876bfe
refactor: continue to use comptime fork
GrapeBaBa Jan 22, 2026
600beaa
refactor: continue translate functions using comptime fork
GrapeBaBa Jan 22, 2026
a689e5f
chore: continue refactor
wemeetagain Jan 22, 2026
fbbb1a3
fix: fix state transition test
GrapeBaBa Jan 23, 2026
71b16d8
fix: fix spec test
GrapeBaBa Jan 23, 2026
a951492
fix: fix build compile error
GrapeBaBa Jan 23, 2026
8616e50
fix: fix bench
GrapeBaBa Jan 23, 2026
9f754ff
chore: use `ForkBeaconBlockBody` in stf util
GrapeBaBa Jan 25, 2026
b856f10
Merge branch 'main' into comptime-fork
wemeetagain Jan 26, 2026
54623fd
chore: bring CachedBeaconState back to top-level stfn
wemeetagain Jan 26, 2026
cae6099
fix: fix the spec and bench tests
GrapeBaBa Jan 27, 2026
947046a
fix: fix some error not called
GrapeBaBa Jan 28, 2026
d155063
chore: consistent order of block_type, fork
wemeetagain Jan 28, 2026
44c3af6
chore: remove Fork prefix from fork-specific types
wemeetagain Jan 28, 2026
e62ca1e
chore: add more tests
wemeetagain Jan 28, 2026
e04cf66
chore: standardize blockType and forkSeq anyblock methods
wemeetagain Jan 28, 2026
463178b
fix: remove wrong import
GrapeBaBa Jan 29, 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
478 changes: 299 additions & 179 deletions bench/state_transition/process_block.zig

Large diffs are not rendered by default.

865 changes: 501 additions & 364 deletions bench/state_transition/process_epoch.zig

Large diffs are not rendered by default.

29 changes: 9 additions & 20 deletions bench/state_transition/utils.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ const std = @import("std");
const Node = @import("persistent_merkle_tree").Node;
const types = @import("consensus_types");
const config = @import("config");
const state_transition = @import("state_transition");
const fork_types = @import("fork_types");

const ForkSeq = config.ForkSeq;
const BeaconState = state_transition.BeaconState;
const AnyBeaconState = fork_types.AnyBeaconState;
const AnySignedBeaconBlock = fork_types.AnySignedBeaconBlock;
const Slot = types.primitive.Slot.Type;

/// Read slot from raw BeaconState SSZ bytes (offset 40)
Expand All @@ -23,26 +24,14 @@ pub fn slotFromBlockBytes(block_bytes: []const u8) Slot {
}

/// Load and deserialize BeaconState from SSZ bytes for a specific fork
pub fn loadState(comptime fork: ForkSeq, allocator: std.mem.Allocator, pool: *Node.Pool, state_bytes: []const u8) !*BeaconState {
const BeaconStateST = @field(types, @tagName(fork)).BeaconState;
var state_data = try BeaconStateST.TreeView.init(
allocator,
pool,
try BeaconStateST.tree.deserializeFromBytes(pool, state_bytes),
);
errdefer state_data.deinit();

const beacon_state = try allocator.create(BeaconState);
beacon_state.* = @unionInit(BeaconState, @tagName(fork), state_data);
pub fn loadState(comptime fork: ForkSeq, allocator: std.mem.Allocator, pool: *Node.Pool, state_bytes: []const u8) !*AnyBeaconState {
const beacon_state = try allocator.create(AnyBeaconState);
errdefer allocator.destroy(beacon_state);
beacon_state.* = try AnyBeaconState.deserialize(allocator, pool, fork, state_bytes);
return beacon_state;
}

/// Load and deserialize SignedBeaconBlock from SSZ bytes for a specific fork
pub fn loadBlock(comptime fork: ForkSeq, allocator: std.mem.Allocator, block_bytes: []const u8) !state_transition.SignedBeaconBlock {
const SignedBeaconBlock = @field(types, @tagName(fork)).SignedBeaconBlock;
const block_data = try allocator.create(SignedBeaconBlock.Type);
errdefer allocator.destroy(block_data);
block_data.* = SignedBeaconBlock.default_value;
try SignedBeaconBlock.deserializeFromBytes(allocator, block_bytes, block_data);
return @unionInit(state_transition.SignedBeaconBlock, @tagName(fork), block_data);
pub fn loadBlock(comptime fork: ForkSeq, allocator: std.mem.Allocator, block_bytes: []const u8) !AnySignedBeaconBlock {
return try AnySignedBeaconBlock.deserialize(allocator, .full, fork, block_bytes);
}
32 changes: 32 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ pub fn build(b: *std.Build) void {
});
b.modules.put(b.dupe("hex"), module_hex) catch @panic("OOM");

const module_fork_types = b.createModule(.{
.root_source_file = b.path("src/fork_types/root.zig"),
.target = target,
.optimize = optimize,
});
b.modules.put(b.dupe("fork_types"), module_fork_types) catch @panic("OOM");

const module_persistent_merkle_tree = b.createModule(.{
.root_source_file = b.path("src/persistent_merkle_tree/root.zig"),
.target = target,
Expand Down Expand Up @@ -546,6 +553,20 @@ pub fn build(b: *std.Build) void {
tls_run_test_hex.dependOn(&run_test_hex.step);
tls_run_test.dependOn(&run_test_hex.step);

const test_fork_types = b.addTest(.{
.name = "fork_types",
.root_module = module_fork_types,
.filters = b.option([][]const u8, "fork_types.filters", "fork_types test filters") orelse &[_][]const u8{},
});
const install_test_fork_types = b.addInstallArtifact(test_fork_types, .{});
const tls_install_test_fork_types = b.step("build-test:fork_types", "Install the fork_types test");
tls_install_test_fork_types.dependOn(&install_test_fork_types.step);

const run_test_fork_types = b.addRunArtifact(test_fork_types);
const tls_run_test_fork_types = b.step("test:fork_types", "Run the fork_types test");
tls_run_test_fork_types.dependOn(&run_test_fork_types.step);
tls_run_test.dependOn(&run_test_fork_types.step);

const test_persistent_merkle_tree = b.addTest(.{
.name = "persistent_merkle_tree",
.root_module = module_persistent_merkle_tree,
Expand Down Expand Up @@ -895,6 +916,7 @@ pub fn build(b: *std.Build) void {

module_era.addImport("consensus_types", module_consensus_types);
module_era.addImport("config", module_config);
module_era.addImport("fork_types", module_fork_types);
module_era.addImport("preset", module_preset);
module_era.addImport("state_transition", module_state_transition);
module_era.addImport("snappy", dep_snappy.module("snappy"));
Expand All @@ -904,6 +926,12 @@ pub fn build(b: *std.Build) void {
module_hashing.addImport("hex", module_hex);
module_hashing.addImport("hashtree", dep_hashtree.module("hashtree"));

module_fork_types.addImport("consensus_types", module_consensus_types);
module_fork_types.addImport("config", module_config);
module_fork_types.addImport("persistent_merkle_tree", module_persistent_merkle_tree);
module_fork_types.addImport("preset", module_preset);
module_fork_types.addImport("ssz", module_ssz);

module_persistent_merkle_tree.addImport("build_options", options_module_build_options);
module_persistent_merkle_tree.addImport("hex", module_hex);
module_persistent_merkle_tree.addImport("hashing", module_hashing);
Expand All @@ -921,6 +949,7 @@ pub fn build(b: *std.Build) void {
module_state_transition.addImport("config", module_config);
module_state_transition.addImport("consensus_types", module_consensus_types);
module_state_transition.addImport("blst", dep_blst.module("blst"));
module_state_transition.addImport("fork_types", module_fork_types);
module_state_transition.addImport("preset", module_preset);
module_state_transition.addImport("constants", module_constants);
module_state_transition.addImport("hex", module_hex);
Expand Down Expand Up @@ -972,6 +1001,7 @@ pub fn build(b: *std.Build) void {
module_bench_hashing.addImport("zbench", dep_zbench.module("zbench"));

module_bench_process_block.addImport("state_transition", module_state_transition);
module_bench_process_block.addImport("fork_types", module_fork_types);
module_bench_process_block.addImport("consensus_types", module_consensus_types);
module_bench_process_block.addImport("config", module_config);
module_bench_process_block.addImport("zbench", dep_zbench.module("zbench"));
Expand All @@ -980,6 +1010,7 @@ pub fn build(b: *std.Build) void {
module_bench_process_block.addImport("era", module_era);

module_bench_process_epoch.addImport("state_transition", module_state_transition);
module_bench_process_epoch.addImport("fork_types", module_fork_types);
module_bench_process_epoch.addImport("consensus_types", module_consensus_types);
module_bench_process_epoch.addImport("config", module_config);
module_bench_process_epoch.addImport("zbench", dep_zbench.module("zbench"));
Expand All @@ -994,6 +1025,7 @@ pub fn build(b: *std.Build) void {
module_spec_tests.addImport("spec_test_options", options_module_spec_test_options);
module_spec_tests.addImport("consensus_types", module_consensus_types);
module_spec_tests.addImport("config", module_config);
module_spec_tests.addImport("fork_types", module_fork_types);
module_spec_tests.addImport("preset", module_preset);
module_spec_tests.addImport("snappy", dep_snappy.module("snappy"));
module_spec_tests.addImport("state_transition", module_state_transition);
Expand Down
13 changes: 6 additions & 7 deletions src/config/BeaconConfig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,17 @@ pub fn getMaxRequestBlobSidecars(self: *const BeaconConfig, fork: ForkSeq) u64 {
///
/// When the message epoch is before the state's active fork epoch, the domain is computed
/// using the previous fork sequence (per spec rules around fork boundaries).
pub fn getDomain(self: *const BeaconConfig, state_slot: Slot, domain_type: DomainType, message_slot: ?Slot) !*const [32]u8 {
const slot = if (message_slot) |s| s else state_slot;
const epoch = @divFloor(slot, preset.SLOTS_PER_EPOCH);
const state_fork_info = self.forkInfo(state_slot);
pub fn getDomain(self: *const BeaconConfig, state_epoch: Epoch, domain_type: DomainType, message_slot: ?Slot) !*const [32]u8 {
const epoch = if (message_slot) |s| @divFloor(s, preset.SLOTS_PER_EPOCH) else state_epoch;
const state_fork_info = self.forkInfoAtEpoch(state_epoch);
const fork_seq = if (epoch < state_fork_info.epoch) state_fork_info.prev_fork_seq else state_fork_info.fork_seq;

return self.domain_cache.get(fork_seq, domain_type);
}

pub fn getDomainForVoluntaryExit(self: *const BeaconConfig, state_slot: Slot, message_slot: ?Slot) !*const [32]u8 {
if (@divFloor(state_slot, preset.SLOTS_PER_EPOCH) < self.chain.DENEB_FORK_EPOCH) {
return self.getDomain(state_slot, DOMAIN_VOLUNTARY_EXIT, message_slot);
pub fn getDomainForVoluntaryExit(self: *const BeaconConfig, state_epoch: Epoch, message_slot: ?Slot) !*const [32]u8 {
if (state_epoch < self.chain.DENEB_FORK_EPOCH) {
return self.getDomain(state_epoch, DOMAIN_VOLUNTARY_EXIT, message_slot);
} else {
return self.domain_cache.get(.capella, DOMAIN_VOLUNTARY_EXIT);
}
Expand Down
3 changes: 0 additions & 3 deletions src/config/fork_seq.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const std = @import("std");
const types = @import("consensus_types");
const Epoch = types.primitive.Epoch.Type;
const Version = types.primitive.Version.Type;

/// Ordered consensus fork identifiers used throughout the client.
///
Expand Down
2 changes: 0 additions & 2 deletions src/config/networks/chiado.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const std = @import("std");
const Preset = @import("preset").Preset;
const ChainConfig = @import("../ChainConfig.zig");
const BeaconConfig = @import("../BeaconConfig.zig");
const b = @import("hex").hexToBytesComptime;
const gnosis = @import("./gnosis.zig");
Expand Down
2 changes: 0 additions & 2 deletions src/config/networks/hoodi.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const std = @import("std");
const preset = @import("preset").preset;
const ChainConfig = @import("../ChainConfig.zig");
const BeaconConfig = @import("../BeaconConfig.zig");
const b = @import("hex").hexToBytesComptime;
Expand Down
2 changes: 0 additions & 2 deletions src/config/networks/sepolia.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const std = @import("std");
const preset = @import("preset").preset;
const ChainConfig = @import("../ChainConfig.zig");
const BeaconConfig = @import("../BeaconConfig.zig");
const b = @import("hex").hexToBytesComptime;
Expand Down
5 changes: 5 additions & 0 deletions src/consensus_types/altair.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ pub const Fork = phase0.Fork;
pub const ForkData = phase0.ForkData;
pub const Checkpoint = phase0.Checkpoint;
pub const Validator = phase0.Validator;
pub const Validators = phase0.Validators;
pub const AttestationData = phase0.AttestationData;
pub const IndexedAttestation = phase0.IndexedAttestation;
pub const PendingAttestation = phase0.PendingAttestation;
pub const Eth1Data = phase0.Eth1Data;
pub const Eth1DataVotes = phase0.Eth1DataVotes;
pub const HistoricalBatch = phase0.HistoricalBatch;
pub const DepositMessage = phase0.DepositMessage;
pub const DepositData = phase0.DepositData;
Expand All @@ -32,6 +34,9 @@ pub const HistoricalBlockRoots = phase0.HistoricalBlockRoots;
pub const HistoricalStateRoots = phase0.HistoricalStateRoots;
pub const ProposerSlashings = phase0.ProposerSlashings;
pub const AttesterSlashings = phase0.AttesterSlashings;
pub const Slashings = phase0.Slashings;
pub const Balances = phase0.Balances;
pub const RandaoMixes = phase0.RandaoMixes;
pub const Attestations = phase0.Attestations;
pub const Deposits = phase0.Deposits;
pub const VoluntaryExits = phase0.VoluntaryExits;
Expand Down
7 changes: 5 additions & 2 deletions src/consensus_types/bellatrix.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const std = @import("std");
const ssz = @import("ssz");
const p = @import("primitive.zig");
const c = @import("constants");
const preset = @import("preset").preset;
const phase0 = @import("phase0.zig");
const altair = @import("altair.zig");
Expand All @@ -10,10 +8,12 @@ pub const Fork = phase0.Fork;
pub const ForkData = phase0.ForkData;
pub const Checkpoint = phase0.Checkpoint;
pub const Validator = phase0.Validator;
pub const Validators = phase0.Validators;
pub const AttestationData = phase0.AttestationData;
pub const IndexedAttestation = phase0.IndexedAttestation;
pub const PendingAttestation = phase0.PendingAttestation;
pub const Eth1Data = phase0.Eth1Data;
pub const Eth1DataVotes = phase0.Eth1DataVotes;
pub const HistoricalBatch = phase0.HistoricalBatch;
pub const DepositMessage = phase0.DepositMessage;
pub const DepositData = phase0.DepositData;
Expand All @@ -33,6 +33,9 @@ pub const HistoricalBlockRoots = phase0.HistoricalBlockRoots;
pub const HistoricalStateRoots = phase0.HistoricalStateRoots;
pub const ProposerSlashings = phase0.ProposerSlashings;
pub const AttesterSlashings = phase0.AttesterSlashings;
pub const Slashings = phase0.Slashings;
pub const Balances = phase0.Balances;
pub const RandaoMixes = phase0.RandaoMixes;
pub const Attestations = phase0.Attestations;
pub const Deposits = phase0.Deposits;
pub const VoluntaryExits = phase0.VoluntaryExits;
Expand Down
5 changes: 5 additions & 0 deletions src/consensus_types/capella.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ pub const Fork = phase0.Fork;
pub const ForkData = phase0.ForkData;
pub const Checkpoint = phase0.Checkpoint;
pub const Validator = phase0.Validator;
pub const Validators = phase0.Validators;
pub const AttestationData = phase0.AttestationData;
pub const IndexedAttestation = phase0.IndexedAttestation;
pub const PendingAttestation = phase0.PendingAttestation;
pub const Eth1Data = phase0.Eth1Data;
pub const Eth1DataVotes = phase0.Eth1DataVotes;
pub const HistoricalBatch = phase0.HistoricalBatch;
pub const DepositMessage = phase0.DepositMessage;
pub const DepositData = phase0.DepositData;
Expand All @@ -34,6 +36,9 @@ pub const HistoricalBlockRoots = phase0.HistoricalBlockRoots;
pub const HistoricalStateRoots = phase0.HistoricalStateRoots;
pub const ProposerSlashings = phase0.ProposerSlashings;
pub const AttesterSlashings = phase0.AttesterSlashings;
pub const Slashings = phase0.Slashings;
pub const Balances = phase0.Balances;
pub const RandaoMixes = phase0.RandaoMixes;
pub const Attestations = phase0.Attestations;
pub const Deposits = phase0.Deposits;
pub const VoluntaryExits = phase0.VoluntaryExits;
Expand Down
5 changes: 5 additions & 0 deletions src/consensus_types/deneb.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ pub const Fork = phase0.Fork;
pub const ForkData = phase0.ForkData;
pub const Checkpoint = phase0.Checkpoint;
pub const Validator = phase0.Validator;
pub const Validators = phase0.Validators;
pub const AttestationData = phase0.AttestationData;
pub const IndexedAttestation = phase0.IndexedAttestation;
pub const PendingAttestation = phase0.PendingAttestation;
pub const Eth1Data = phase0.Eth1Data;
pub const Eth1DataVotes = phase0.Eth1DataVotes;
pub const HistoricalBatch = phase0.HistoricalBatch;
pub const DepositMessage = phase0.DepositMessage;
pub const DepositData = phase0.DepositData;
Expand All @@ -35,6 +37,9 @@ pub const HistoricalBlockRoots = phase0.HistoricalBlockRoots;
pub const HistoricalStateRoots = phase0.HistoricalStateRoots;
pub const ProposerSlashings = phase0.ProposerSlashings;
pub const AttesterSlashings = phase0.AttesterSlashings;
pub const Slashings = phase0.Slashings;
pub const Balances = phase0.Balances;
pub const RandaoMixes = phase0.RandaoMixes;
pub const Attestations = phase0.Attestations;
pub const Deposits = phase0.Deposits;
pub const VoluntaryExits = phase0.VoluntaryExits;
Expand Down
5 changes: 5 additions & 0 deletions src/consensus_types/electra.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ pub const Fork = phase0.Fork;
pub const ForkData = phase0.ForkData;
pub const Checkpoint = phase0.Checkpoint;
pub const Validator = phase0.Validator;
pub const Validators = phase0.Validators;
pub const AttestationData = phase0.AttestationData;
pub const PendingAttestation = phase0.PendingAttestation;
pub const Eth1Data = phase0.Eth1Data;
pub const Eth1DataVotes = phase0.Eth1DataVotes;
pub const HistoricalBatch = phase0.HistoricalBatch;
pub const DepositMessage = phase0.DepositMessage;
pub const DepositData = phase0.DepositData;
Expand All @@ -31,6 +33,9 @@ pub const HistoricalBlockRoots = phase0.HistoricalBlockRoots;
pub const HistoricalStateRoots = phase0.HistoricalStateRoots;
pub const ProposerSlashings = phase0.ProposerSlashings;
pub const AttesterSlashings = ssz.VariableListType(AttesterSlashing, preset.MAX_ATTESTER_SLASHINGS_ELECTRA);
pub const Slashings = phase0.Slashings;
pub const Balances = phase0.Balances;
pub const RandaoMixes = phase0.RandaoMixes;
pub const Deposits = phase0.Deposits;
pub const VoluntaryExits = phase0.VoluntaryExits;

Expand Down
6 changes: 5 additions & 1 deletion src/consensus_types/fulu.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const std = @import("std");
const ssz = @import("ssz");
const p = @import("primitive.zig");
const c = @import("constants");
Expand All @@ -15,9 +14,11 @@ pub const Fork = phase0.Fork;
pub const ForkData = phase0.ForkData;
pub const Checkpoint = phase0.Checkpoint;
pub const Validator = phase0.Validator;
pub const Validators = phase0.Validators;
pub const AttestationData = phase0.AttestationData;
pub const PendingAttestation = phase0.PendingAttestation;
pub const Eth1Data = phase0.Eth1Data;
pub const Eth1DataVotes = phase0.Eth1DataVotes;
pub const HistoricalBatch = phase0.HistoricalBatch;
pub const DepositMessage = phase0.DepositMessage;
pub const DepositData = phase0.DepositData;
Expand All @@ -33,6 +34,9 @@ pub const HistoricalStateRoots = phase0.HistoricalStateRoots;
pub const ProposerSlashings = phase0.ProposerSlashings;
pub const Deposits = phase0.Deposits;
pub const VoluntaryExits = phase0.VoluntaryExits;
pub const Slashings = phase0.Slashings;
pub const Balances = phase0.Balances;
pub const RandaoMixes = phase0.RandaoMixes;

pub const SyncAggregate = altair.SyncAggregate;
pub const SyncCommittee = altair.SyncCommittee;
Expand Down
1 change: 0 additions & 1 deletion src/consensus_types/phase0.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const std = @import("std");
const ssz = @import("ssz");
const p = @import("primitive.zig");
const c = @import("constants");
Expand Down
10 changes: 5 additions & 5 deletions src/era/Reader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const std = @import("std");
const c = @import("config");
const preset = @import("preset").preset;
const Node = @import("persistent_merkle_tree").Node;
const state_transition = @import("state_transition");
const fork_types = @import("fork_types");
const snappy = @import("snappy").frame;
const e2s = @import("e2s.zig");
const era = @import("era.zig");
Expand Down Expand Up @@ -91,14 +91,14 @@ pub fn readSerializedState(self: Reader, allocator: std.mem.Allocator, era_numbe
return try snappy.uncompress(allocator, compressed) orelse error.InvalidE2SHeader;
}

pub fn readState(self: Reader, allocator: std.mem.Allocator, era_number: ?u64) !state_transition.BeaconState {
pub fn readState(self: Reader, allocator: std.mem.Allocator, era_number: ?u64) !fork_types.AnyBeaconState {
const serialized = try self.readSerializedState(allocator, era_number);
defer allocator.free(serialized);

const state_slot = era.readSlotFromBeaconStateBytes(serialized);
const state_fork = self.config.forkSeq(state_slot);

return try state_transition.BeaconState.deserialize(allocator, self.pool, state_fork, serialized);
return try fork_types.AnyBeaconState.deserialize(allocator, self.pool, state_fork, serialized);
}

pub fn readCompressedBlock(self: Reader, allocator: std.mem.Allocator, slot: u64) !?[]const u8 {
Expand Down Expand Up @@ -131,13 +131,13 @@ pub fn readSerializedBlock(self: Reader, allocator: std.mem.Allocator, slot: u64
return try snappy.uncompress(allocator, compressed) orelse error.InvalidE2SHeader;
}

pub fn readBlock(self: Reader, allocator: std.mem.Allocator, slot: u64) !?state_transition.SignedBeaconBlock {
pub fn readBlock(self: Reader, allocator: std.mem.Allocator, slot: u64) !?fork_types.AnySignedBeaconBlock {
const serialized = try self.readSerializedBlock(allocator, slot) orelse return null;
defer allocator.free(serialized);

const fork_seq = self.config.forkSeq(slot);

return try state_transition.SignedBeaconBlock.deserialize(allocator, fork_seq, serialized);
return try fork_types.AnySignedBeaconBlock.deserialize(allocator, .full, fork_seq, serialized);
}

/// Validate the era file.
Expand Down
Loading