Skip to content
Merged
Show file tree
Hide file tree
Changes from 116 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
541d640
chore: use tree view data pointers
wemeetagain Jan 8, 2026
0cdc10d
wip
wemeetagain Jan 8, 2026
587963b
fix: fix duplicate conflict syncCommitteeCache
GrapeBaBa Jan 9, 2026
e24495a
fix: fix missing pmt module in the state transition
GrapeBaBa Jan 9, 2026
adf0ccb
fix: add missing pool arg
GrapeBaBa Jan 9, 2026
3a36ba6
fix: fix generate_state test using treeview
GrapeBaBa Jan 9, 2026
60047f3
fix: fix seed isPostElectra migration
GrapeBaBa Jan 9, 2026
ba879cb
fix: fix beacon state get const ptr
GrapeBaBa Jan 9, 2026
ee58135
fix: fix generate_state test using setValue and getAllInto
GrapeBaBa Jan 9, 2026
9ddcb52
fix: fix fork epoch in the generate state
GrapeBaBa Jan 9, 2026
6807f23
fix: fix error union mismatch
GrapeBaBa Jan 9, 2026
2c10c6c
feat: add getAllReadonlyValues for array/list tree view
GrapeBaBa Jan 9, 2026
781d24f
fix: fix epoch cache get validators
GrapeBaBa Jan 9, 2026
2348644
fix: fix epoch cache issue
GrapeBaBa Jan 9, 2026
8ba1771
fix: fix several using tree view error
GrapeBaBa Jan 9, 2026
128b266
fix: processSlashings
wemeetagain Jan 9, 2026
76fa3c3
fix: processRewardsAndPenalties
wemeetagain Jan 9, 2026
5e8fcc6
fix: processRegistryUpdates
wemeetagain Jan 9, 2026
96bb17b
fix: processRandaoMixesReset
wemeetagain Jan 9, 2026
da46fde
fix: partially fix processProposerLookahead
wemeetagain Jan 9, 2026
cd5b954
fix: more processProposerLookahead
wemeetagain Jan 9, 2026
a0d7dd5
Merge remote-tracking branch 'origin/main' into tree-view-state
wemeetagain Jan 10, 2026
68a1b85
feat: add ListTreeView.iteratorReadonly
wemeetagain Jan 12, 2026
b019231
fix: processPendingDeposits
wemeetagain Jan 12, 2026
60fc413
fix: add electra/fulu in beacon execution payload
GrapeBaBa Jan 12, 2026
e2fb0aa
fix: fix beacon state test
GrapeBaBa Jan 12, 2026
524d58f
fix: fix state transition block
GrapeBaBa Jan 12, 2026
c4208b6
fix: fix state transition block issue
GrapeBaBa Jan 12, 2026
936ec93
fix: processPendingConsolidations
wemeetagain Jan 12, 2026
d1ad229
fix: processParticipationFlagUpdates
wemeetagain Jan 12, 2026
28b79ee
fix: processJustificationAndFinalization
wemeetagain Jan 12, 2026
0ac1ca0
fix: processInactivityUpdates
wemeetagain Jan 12, 2026
d353978
fix: processHistoricalSummariesUpdate
wemeetagain Jan 12, 2026
ad28b61
fix: processHistoricalRootsUpdate
wemeetagain Jan 12, 2026
02f2279
fix: processEth1DataReset
wemeetagain Jan 12, 2026
dfe5085
fix: processEffectiveBalanceUpdates
wemeetagain Jan 12, 2026
12602f5
fix: processEpoch
wemeetagain Jan 12, 2026
b59448f
feat: update TreeView.hashTreeRoot signature (return root const pointer)
wemeetagain Jan 12, 2026
27cefab
fix: stateTransition
wemeetagain Jan 12, 2026
619b003
fix: stray hashTreeRoot fixes
wemeetagain Jan 12, 2026
ddf127d
chore: remove interior mutability
wemeetagain Jan 12, 2026
7031c15
fix: start on sanity spec tests
wemeetagain Jan 12, 2026
22bf3c3
fix: fix state_transition test
GrapeBaBa Jan 13, 2026
fbd1dcf
fix: fix era treeview test
GrapeBaBa Jan 13, 2026
ef5c22f
fix: fix spec test unalign issue related to ownership
GrapeBaBa Jan 13, 2026
68d4a5f
fix: fix children nodes and datas cache not consistent
GrapeBaBa Jan 13, 2026
885f275
fix: fix skipped slots spec test
GrapeBaBa Jan 13, 2026
74c3e83
fix: remove debug log
GrapeBaBa Jan 13, 2026
b0ce31a
fix: various fixes
wemeetagain Jan 13, 2026
58f0cf8
fix: fix the phase0 epoch spec test
GrapeBaBa Jan 14, 2026
af8719b
fix: fix operation spec test
GrapeBaBa Jan 14, 2026
2b9582f
fix: fix finality spec test
GrapeBaBa Jan 14, 2026
5cce078
fix: fix random spec test
GrapeBaBa Jan 14, 2026
fe28bc6
fix: fix the phase0 fork spec test
GrapeBaBa Jan 14, 2026
f357119
fix: using setrootnode instead of transfer ownership
GrapeBaBa Jan 14, 2026
6f2294d
fix: fix altiar spec test
GrapeBaBa Jan 14, 2026
bd62993
fix: more spec test fixes
wemeetagain Jan 14, 2026
aad9fea
fix: simplify tree view semantics
wemeetagain Jan 14, 2026
c9527ae
fix: add TreeView.getReadonly behavior
wemeetagain Jan 14, 2026
03acfe3
fix: fixup becomesNewEth1Data
wemeetagain Jan 14, 2026
1b344f9
fix: bench_process_block
wemeetagain Jan 14, 2026
3a87de4
Merge branch 'main' into tree-view-state
GrapeBaBa Jan 15, 2026
e3303b4
fix: fix tests
GrapeBaBa Jan 15, 2026
caea327
refactor: make bench process epoch works
GrapeBaBa Jan 15, 2026
dbcd8c2
fix: fix lint
GrapeBaBa Jan 15, 2026
f034c58
fix: remove stray constCasts
wemeetagain Jan 15, 2026
ee69250
chore: use DebugAllocator in benchmarks
wemeetagain Jan 15, 2026
e1b9275
fix: illegal instruction
wemeetagain Jan 15, 2026
7464392
chore: minor tweaks
wemeetagain Jan 15, 2026
818e484
chore: commit state if verify_state_root = false
wemeetagain Jan 15, 2026
d273827
fix: slot check in processSlots
wemeetagain Jan 15, 2026
8f27a4c
chore: rename processSlots
wemeetagain Jan 15, 2026
9fb83a5
chore: fix bls wrapper test
wemeetagain Jan 15, 2026
5b1a961
chore: apply suggestions from code review
wemeetagain Jan 16, 2026
f7ee63b
fix: build errors
wemeetagain Jan 16, 2026
8990d8c
feat: rotateSyncCommittees
wemeetagain Jan 16, 2026
467e5ca
chore: more pr review
wemeetagain Jan 16, 2026
ad8b6ce
feat: add ssz.Type.default_root
wemeetagain Jan 9, 2026
bfd0c6a
feat: add ST.tree.default and ListST.tree.zeros
wemeetagain Jan 16, 2026
4e4dc56
chore: use EpochParticipation.tree.zeros to rotate epoch participation
wemeetagain Jan 16, 2026
7acc7d0
feat: BeaconState.balancesSlice
wemeetagain Jan 16, 2026
88d4f51
chore: remove allocator from processConsolidationRequest
wemeetagain Jan 16, 2026
30d8cca
chore: clean up processRandao
wemeetagain Jan 16, 2026
e66590c
chore: clean up BeaconState.populateFields
wemeetagain Jan 16, 2026
ac05476
chore: remove stale comment
wemeetagain Jan 16, 2026
12d3082
fix: errdefer remove dangling undefined in BaseTreeView.getChildDataR…
wemeetagain Jan 16, 2026
d10e670
chore: more comments on ListView.iteratorReadonly
wemeetagain Jan 16, 2026
0c70743
chore: use TreeView.getValue(out) pattern
wemeetagain Jan 16, 2026
be91097
chore: fix build errors
wemeetagain Jan 16, 2026
1fff4f1
fix: fix spec test failed
GrapeBaBa Jan 18, 2026
3ee0cc3
wip
wemeetagain Jan 20, 2026
f389502
feat: add slashed cache and use it in process_attestation
GrapeBaBa Jan 20, 2026
f300170
feat: add slashed cache and use it in process_attestation
GrapeBaBa Jan 20, 2026
d2a39ff
feat: track slashed flags per CachedBeaconState
GrapeBaBa Jan 20, 2026
bb778f1
Merge remote-tracking branch 'origin/gr/slashed_cache' into gr/slashe…
GrapeBaBa 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
8c805a1
Merge branch 'comptime-fork' into gr/slashed_cache
GrapeBaBa Jan 28, 2026
2791109
refactor: optimize slash cache rebuild
GrapeBaBa Jan 29, 2026
911432f
merge: origin/main
GrapeBaBa Jan 30, 2026
a4c6257
fix: fix merge error
GrapeBaBa Jan 30, 2026
4e989ff
chore: refactor the cache build
GrapeBaBa Jan 30, 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
483 changes: 304 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