fix /eth/v1/beacon/rewards/block/{block_id} sync_aggregate value (#6829)

* fix /eth/v1/beacon/rewards/block/{block_id} sync_aggregate value

* adjust tests

* copyright year linting
This commit is contained in:
tersec 2025-01-09 05:03:23 +00:00 committed by GitHub
parent 8a494e9c34
commit 4cca50873e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 16 deletions

View File

@ -850,6 +850,7 @@ proc process_sync_aggregate*(
# Apply participant and proposer rewards
let indices = get_sync_committee_cache(state, cache).current_sync_committee
var total_proposer_reward: Gwei
for i in 0 ..< min(
state.current_sync_committee.pubkeys.len,
@ -858,10 +859,11 @@ proc process_sync_aggregate*(
if sync_aggregate.sync_committee_bits[i]:
increase_balance(state, participant_index, participant_reward)
increase_balance(state, proposer_index, proposer_reward)
increase_balance(total_proposer_reward, proposer_reward)
else:
decrease_balance(state, participant_index, participant_reward)
ok(proposer_reward)
ok(total_proposer_reward)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/beacon-chain.md#process_execution_payload
proc process_execution_payload*(

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * 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():
preState: var altair.BeaconState, syncAggregate: SyncAggregate):
Result[void, cstring] =
var cache: StateCache
doAssert (? process_sync_aggregate(
discard ? process_sync_aggregate(
preState, syncAggregate, get_total_active_balance(preState, cache),
{}, cache)) > 0.Gwei
{}, cache)
ok()
for path in walkTests(OpSyncAggregateDir):

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * 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():
preState: var bellatrix.BeaconState, syncAggregate: SyncAggregate):
Result[void, cstring] =
var cache: StateCache
doAssert (? process_sync_aggregate(
discard ? process_sync_aggregate(
preState, syncAggregate, get_total_active_balance(preState, cache),
{}, cache)) > 0.Gwei
{}, cache)
ok()
for path in walkTests(OpSyncAggregateDir):

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2022-2024 Status Research & Development GmbH
# Copyright (c) 2022-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * 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():
preState: var capella.BeaconState, syncAggregate: SyncAggregate):
Result[void, cstring] =
var cache: StateCache
doAssert (? process_sync_aggregate(
discard ? process_sync_aggregate(
preState, syncAggregate, get_total_active_balance(preState, cache),
{}, cache)) > 0.Gwei
{}, cache)
ok()
for path in walkTests(OpSyncAggregateDir):

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2022-2024 Status Research & Development GmbH
# Copyright (c) 2022-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * 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():
preState: var deneb.BeaconState, syncAggregate: SyncAggregate):
Result[void, cstring] =
var cache: StateCache
doAssert (? process_sync_aggregate(
discard ? process_sync_aggregate(
preState, syncAggregate, get_total_active_balance(preState, cache),
{}, cache)) > 0.Gwei
{}, cache)
ok()
for path in walkTests(OpSyncAggregateDir):

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2024 Status Research & Development GmbH
# Copyright (c) 2024-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * 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():
preState: var electra.BeaconState, syncAggregate: SyncAggregate):
Result[void, cstring] =
var cache: StateCache
doAssert (? process_sync_aggregate(
discard ? process_sync_aggregate(
preState, syncAggregate, get_total_active_balance(preState, cache),
{}, cache)) > 0.Gwei
{}, cache)
ok()
for path in walkTests(OpSyncAggregateDir):