Skip to content

Commit 5a7c541

Browse files
committed
chore: use treeview getAll in inactivity_scores
Signed-off-by: Chen Kai <281165273grape@gmail.com>
1 parent 9f754ff commit 5a7c541

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/state_transition/epoch/process_inactivity_updates.zig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@ pub fn processInactivityUpdates(
3030
const FLAG_PREV_TARGET_ATTESTER_UNSLASHED = attester_status_utils.FLAG_PREV_TARGET_ATTESTER_UNSLASHED;
3131
const FLAG_ELIGIBLE_ATTESTER = attester_status_utils.FLAG_ELIGIBLE_ATTESTER;
3232

33-
// TODO for TreeView, we may want to convert to value and back
3433
var inactivity_scores = try state.inactivityScores();
34+
try inactivity_scores.commit();
35+
const allocator = state.baseView().allocator;
36+
const inactivity_scores_values = try inactivity_scores.getAll(allocator);
37+
defer allocator.free(inactivity_scores_values);
38+
std.debug.assert(flags.len <= inactivity_scores_values.len);
3539
for (0..flags.len) |i| {
3640
const flag = flags[i];
3741
if (hasMarkers(flag, FLAG_ELIGIBLE_ATTESTER)) {
38-
var inactivity_score = try inactivity_scores.get(i);
42+
var inactivity_score = inactivity_scores_values[i];
3943

4044
const prev_inactivity_score = inactivity_score;
4145
if (hasMarkers(flag, FLAG_PREV_TARGET_ATTESTER_UNSLASHED)) {

0 commit comments

Comments
 (0)