Skip to content

Commit 49b06d1

Browse files
tersecTomi-3-0
authored andcommitted
fix /eth/v1/beacon/rewards/block/{block_id} sync_aggregate value (status-im#6829)
* fix /eth/v1/beacon/rewards/block/{block_id} sync_aggregate value * adjust tests * copyright year linting
1 parent 702a3bf commit 49b06d1

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

beacon_chain/spec/state_transition_block.nim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ proc process_sync_aggregate*(
850850

851851
# Apply participant and proposer rewards
852852
let indices = get_sync_committee_cache(state, cache).current_sync_committee
853+
var total_proposer_reward: Gwei
853854

854855
for i in 0 ..< min(
855856
state.current_sync_committee.pubkeys.len,
@@ -858,10 +859,11 @@ proc process_sync_aggregate*(
858859
if sync_aggregate.sync_committee_bits[i]:
859860
increase_balance(state, participant_index, participant_reward)
860861
increase_balance(state, proposer_index, proposer_reward)
862+
increase_balance(total_proposer_reward, proposer_reward)
861863
else:
862864
decrease_balance(state, participant_index, participant_reward)
863865

864-
ok(proposer_reward)
866+
ok(total_proposer_reward)
865867

866868
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#process_execution_payload
867869
proc process_execution_payload*(

tests/consensus_spec/altair/test_fixture_operations.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# beacon_chain
2-
# Copyright (c) 2018-2024 Status Research & Development GmbH
2+
# Copyright (c) 2018-2025 Status Research & Development GmbH
33
# Licensed and distributed under either of
44
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@@ -149,9 +149,9 @@ suite baseDescription & "Sync Aggregate " & preset():
149149
preState: var altair.BeaconState, syncAggregate: SyncAggregate):
150150
Result[void, cstring] =
151151
var cache: StateCache
152-
doAssert (? process_sync_aggregate(
152+
discard ? process_sync_aggregate(
153153
preState, syncAggregate, get_total_active_balance(preState, cache),
154-
{}, cache)) > 0.Gwei
154+
{}, cache)
155155
ok()
156156

157157
for path in walkTests(OpSyncAggregateDir):

tests/consensus_spec/bellatrix/test_fixture_operations.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# beacon_chain
2-
# Copyright (c) 2018-2024 Status Research & Development GmbH
2+
# Copyright (c) 2018-2025 Status Research & Development GmbH
33
# Licensed and distributed under either of
44
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@@ -174,9 +174,9 @@ suite baseDescription & "Sync Aggregate " & preset():
174174
preState: var bellatrix.BeaconState, syncAggregate: SyncAggregate):
175175
Result[void, cstring] =
176176
var cache: StateCache
177-
doAssert (? process_sync_aggregate(
177+
discard ? process_sync_aggregate(
178178
preState, syncAggregate, get_total_active_balance(preState, cache),
179-
{}, cache)) > 0.Gwei
179+
{}, cache)
180180
ok()
181181

182182
for path in walkTests(OpSyncAggregateDir):

tests/consensus_spec/capella/test_fixture_operations.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# beacon_chain
2-
# Copyright (c) 2022-2024 Status Research & Development GmbH
2+
# Copyright (c) 2022-2025 Status Research & Development GmbH
33
# Licensed and distributed under either of
44
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@@ -191,9 +191,9 @@ suite baseDescription & "Sync Aggregate " & preset():
191191
preState: var capella.BeaconState, syncAggregate: SyncAggregate):
192192
Result[void, cstring] =
193193
var cache: StateCache
194-
doAssert (? process_sync_aggregate(
194+
discard ? process_sync_aggregate(
195195
preState, syncAggregate, get_total_active_balance(preState, cache),
196-
{}, cache)) > 0.Gwei
196+
{}, cache)
197197
ok()
198198

199199
for path in walkTests(OpSyncAggregateDir):

tests/consensus_spec/deneb/test_fixture_operations.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# beacon_chain
2-
# Copyright (c) 2022-2024 Status Research & Development GmbH
2+
# Copyright (c) 2022-2025 Status Research & Development GmbH
33
# Licensed and distributed under either of
44
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@@ -193,9 +193,9 @@ suite baseDescription & "Sync Aggregate " & preset():
193193
preState: var deneb.BeaconState, syncAggregate: SyncAggregate):
194194
Result[void, cstring] =
195195
var cache: StateCache
196-
doAssert (? process_sync_aggregate(
196+
discard ? process_sync_aggregate(
197197
preState, syncAggregate, get_total_active_balance(preState, cache),
198-
{}, cache)) > 0.Gwei
198+
{}, cache)
199199
ok()
200200

201201
for path in walkTests(OpSyncAggregateDir):

tests/consensus_spec/electra/test_fixture_operations.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# beacon_chain
2-
# Copyright (c) 2024 Status Research & Development GmbH
2+
# Copyright (c) 2024-2025 Status Research & Development GmbH
33
# Licensed and distributed under either of
44
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@@ -245,9 +245,9 @@ suite baseDescription & "Sync Aggregate " & preset():
245245
preState: var electra.BeaconState, syncAggregate: SyncAggregate):
246246
Result[void, cstring] =
247247
var cache: StateCache
248-
doAssert (? process_sync_aggregate(
248+
discard ? process_sync_aggregate(
249249
preState, syncAggregate, get_total_active_balance(preState, cache),
250-
{}, cache)) > 0.Gwei
250+
{}, cache)
251251
ok()
252252

253253
for path in walkTests(OpSyncAggregateDir):

0 commit comments

Comments
 (0)