File tree Expand file tree Collapse file tree 5 files changed +26
-1
lines changed
beacon-node/src/chain/archiveStore/historicalState Expand file tree Collapse file tree 5 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 11import {
22 BeaconStateTransitionMetrics ,
33 EpochTransitionStep ,
4+ ProposerRewardType ,
45 StateCloneSource ,
56 StateHashTreeRootSource ,
67} from "@lodestar/state-transition" ;
@@ -127,6 +128,11 @@ export function createHistoricalStateTransitionMetrics(
127128 name : "lodestar_historical_state_stfn_attestations_per_block_total" ,
128129 help : "Count of attestations per block" ,
129130 } ) ,
131+ proposerRewards : metricsRegister . gauge < { type : ProposerRewardType } > ( {
132+ name : "lodestar_historical_state_stfn_proposer_rewards_total" ,
133+ help : "Proposer reward by type per block" ,
134+ labelNames : [ "type" ] ,
135+ } ) ,
130136 } ;
131137}
132138
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {processOperations} from "./processOperations.js";
1212import { processRandao } from "./processRandao.js" ;
1313import { processSyncAggregate } from "./processSyncCommittee.js" ;
1414import { processWithdrawals } from "./processWithdrawals.js" ;
15- import { ProcessBlockOpts } from "./types.js" ;
15+ import { ProcessBlockOpts , ProposerRewardType } from "./types.js" ;
1616
1717// Spec tests
1818export {
@@ -73,4 +73,9 @@ export function processBlock(
7373 throw Error ( "dataAvailabilityStatus.PreData" ) ;
7474 }
7575 }
76+
77+ const rewards = state . proposerRewards ;
78+ metrics ?. proposerRewards . set ( { type : ProposerRewardType . attestation } , rewards . attestations ) ;
79+ metrics ?. proposerRewards . set ( { type : ProposerRewardType . syncAggregate } , rewards . syncAggregate ) ;
80+ metrics ?. proposerRewards . set ( { type : ProposerRewardType . slashing } , rewards . slashing ) ;
7681}
Original file line number Diff line number Diff line change 11export interface ProcessBlockOpts {
22 verifySignatures ?: boolean ;
33}
4+
5+ export enum ProposerRewardType {
6+ attestation = "attestation" ,
7+ syncAggregate = "sync_aggregate" ,
8+ slashing = "slashing" ,
9+ }
Original file line number Diff line number Diff line change @@ -71,3 +71,5 @@ export {becomesNewEth1Data} from "./block/processEth1Data.js";
7171export { getExpectedWithdrawals } from "./block/processWithdrawals.js" ;
7272
7373export { getAttestationParticipationStatus , processAttestationsAltair } from "./block/processAttestationsAltair.js" ;
74+
75+ export { ProposerRewardType } from "./block/types.js" ;
Original file line number Diff line number Diff line change 11import { MetricsRegister } from "@lodestar/utils" ;
2+ import { ProposerRewardType } from "./block/types.js" ;
23import { EpochTransitionStep } from "./epoch/index.js" ;
34import { StateCloneSource , StateHashTreeRootSource } from "./stateTransition.js" ;
45import { CachedBeaconStateAllForks } from "./types.js" ;
@@ -112,6 +113,11 @@ export function getMetrics(register: MetricsRegister) {
112113 name : "lodestar_stfn_attestations_per_block_total" ,
113114 help : "Total count of attestations per block" ,
114115 } ) ,
116+ proposerRewards : register . gauge < { type : ProposerRewardType } > ( {
117+ name : "lodestar_stfn_proposer_rewards_total" ,
118+ help : "Proposer reward by type per block" ,
119+ labelNames : [ "type" ] ,
120+ } ) ,
115121 } ;
116122}
117123
You can’t perform that action at this time.
0 commit comments