Skip to content

Commit 1160cd9

Browse files
committed
fix: simtest
1 parent 9a97299 commit 1160cd9

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

pkgs/node/src/chain.zig

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,7 @@ pub const BeamChain = struct {
924924
.signature = proposer_signature,
925925
};
926926

927-
// store signature if we are aggregator and there are multiple registered validators
928-
const store_signature = if (self.is_aggregator_enabled and self.registered_validator_ids.len > 1) true else false;
929-
self.forkChoice.onGossipAttestation(signed_proposer_attestation, store_signature) catch |e| {
927+
self.forkChoice.onGossipAttestation(signed_proposer_attestation, true) catch |e| {
930928
self.module_logger.err("error processing proposer attestation={f} error={any}", .{ signed_proposer_attestation, e });
931929
};
932930

@@ -1421,8 +1419,7 @@ pub const BeamChain = struct {
14211419
&signedAttestation.message.signature,
14221420
);
14231421

1424-
const store_signature = if (self.is_aggregator_enabled and self.registered_validator_ids.len > 1) true else false;
1425-
return self.forkChoice.onGossipAttestation(signedAttestation.message, store_signature);
1422+
return self.forkChoice.onGossipAttestation(signedAttestation.message, true);
14261423
}
14271424

14281425
pub fn onGossipAggregatedAttestation(self: *Self, signedAggregation: types.SignedAggregatedAttestation) !void {

pkgs/node/src/forkchoice.zig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -923,11 +923,9 @@ pub const ForkChoice = struct {
923923
// TODO naive strategy to include all attestations that are consistent with the latest justified
924924
// replace by the other mini 3sf simple strategy to loop and see if justification happens and
925925
// till no further attestations can be added
926-
var attestation_map = self.attestations.iterator();
927-
while (attestation_map.next()) |entry| {
928-
const validator_id = entry.key_ptr.*;
929-
const latest_known = entry.value_ptr.latestKnown orelse ProtoAttestation{};
930-
const attestation_data = latest_known.attestation_data;
926+
for (0..self.config.genesis.numValidators()) |validator_id| {
927+
const attestation_data = ((self.attestations.get(validator_id) orelse AttestationTracker{})
928+
.latestKnown orelse ProtoAttestation{}).attestation_data;
931929

932930
if (attestation_data) |att_data| {
933931
if (std.mem.eql(u8, &latest_justified.root, &att_data.source.root)) {

0 commit comments

Comments
 (0)