@@ -4,16 +4,22 @@ import { RelayMessage } from "../../../../ftso-core/src/fsp-utils/RelayMessage";
44import { ISignaturePayload } from "../../../../ftso-core/src/fsp-utils/SignaturePayload" ;
55import { GenericSubmissionData , ParsedFinalizationData } from "../../../../ftso-core/src/IndexerClient" ;
66import { VoterWeights } from "../../../../ftso-core/src/RewardEpoch" ;
7- import { Address , Feed , MedianCalculationResult , MessageHash , RandomCalculationResult } from "../../../../ftso-core/src/voting-types" ;
7+ import {
8+ Address ,
9+ Feed ,
10+ MedianCalculationResult ,
11+ MessageHash ,
12+ RandomCalculationResult ,
13+ } from "../../../../ftso-core/src/voting-types" ;
814import { IRevealData } from "../../../../ftso-core/src/data/RevealData" ;
915import { bigIntReplacer , bigIntReviver } from "../../../../ftso-core/src/utils/big-number-serialization" ;
1016import { REWARD_CALCULATION_DATA_FILE , TEMP_REWARD_EPOCH_FOLDER_PREFIX } from "./constants" ;
1117import { RewardEpochInfo } from "./reward-epoch-info" ;
12- import { CALCULATIONS_FOLDER } from "../../constants" ;
18+ import { CALCULATIONS_FOLDER } from "../../constants" ;
1319import {
1420 DataForRewardCalculation ,
1521 FastUpdatesDataForVotingRound ,
16- SFDCDataForVotingRound
22+ SFDCDataForVotingRound ,
1723} from "../../data-calculation-interfaces" ;
1824
1925export interface RevealRecords {
@@ -68,7 +74,7 @@ export function prepareDataForCalculations(rewardEpochId: number, data: DataForR
6874 voterMedianVotingWeights,
6975 randomGenerationBenchingWindow : data . dataForCalculations . randomGenerationBenchingWindow ,
7076 benchingWindowRevealOffenders : [ ...data . dataForCalculations . benchingWindowRevealOffenders ] ,
71- feedOrder : data . dataForCalculations . feedOrder
77+ feedOrder : data . dataForCalculations . feedOrder ,
7278 } ;
7379 return result ;
7480}
@@ -97,7 +103,10 @@ export interface SDataForRewardCalculation {
97103 fdcData ?: SFDCDataForVotingRound ;
98104 // usually added after results of the next voting round are known
99105 nextVotingRoundRandomResult ?: string ;
106+ // eligible finalizers for FTSO Scaling
100107 eligibleFinalizers : string [ ] ;
108+ // eligible finalizers for FDC
109+ eligibleFinalizersFdc : string [ ] ;
101110 // not serialized, reconstructed on augmentation
102111 signaturesMap ?: Map < MessageHash , GenericSubmissionData < ISignaturePayload > [ ] > ;
103112}
@@ -120,6 +129,7 @@ export function serializeDataForRewardCalculation(
120129 medianResults : MedianCalculationResult [ ] ,
121130 randomResult : RandomCalculationResult ,
122131 eligibleFinalizationRewardVotersInGracePeriod : string [ ] ,
132+ eligibleFinalizationRewardVotersInGracePeriodFdc : string [ ] ,
123133 tempRewardEpochFolder = false ,
124134 calculationFolder = CALCULATIONS_FOLDER ( )
125135) : void {
@@ -142,7 +152,6 @@ export function serializeDataForRewardCalculation(
142152 hashSignatures . push ( hashRecord ) ;
143153 }
144154
145-
146155 let fdcData : SFDCDataForVotingRound | undefined ;
147156
148157 if ( rewardCalculationData . fdcData ) {
@@ -165,7 +174,7 @@ export function serializeDataForRewardCalculation(
165174 consensusBitVote : rewardCalculationData . fdcData . consensusBitVote ,
166175 consensusBitVoteIndices : rewardCalculationData . fdcData . consensusBitVoteIndices ,
167176 fdcOffenders : rewardCalculationData . fdcData . fdcOffenders ,
168- }
177+ } ;
169178 }
170179
171180 for ( const finalization of rewardCalculationData . finalizations ) {
@@ -183,8 +192,9 @@ export function serializeDataForRewardCalculation(
183192 medianCalculationResults : medianResults ,
184193 randomResult : simplifyRandomCalculationResult ( randomResult ) ,
185194 eligibleFinalizers : eligibleFinalizationRewardVotersInGracePeriod ,
195+ eligibleFinalizersFdc : eligibleFinalizationRewardVotersInGracePeriodFdc ,
186196 fastUpdatesData : rewardCalculationData . fastUpdatesData ,
187- fdcData
197+ fdcData,
188198 } ;
189199 writeFileSync ( rewardCalculationsDataPath , JSON . stringify ( data , bigIntReplacer ) ) ;
190200}
@@ -294,17 +304,14 @@ export function augmentDataForRewardCalculation(
294304/**
295305 * After deserialization, the data is augmented with additional maps and sets for easier access.
296306 */
297- export function augmentFdcDataForRewardCalculation (
298- data : SFDCDataForVotingRound ,
299- ) : void {
307+ export function augmentFdcDataForRewardCalculation ( data : SFDCDataForVotingRound ) : void {
300308 const signaturesMap = new Map < string , GenericSubmissionData < ISignaturePayload > [ ] > ( ) ;
301309 for ( const hashSignature of data . signatures ) {
302310 signaturesMap . set ( hashSignature . hash , hashSignature . signatures ) ;
303311 }
304312 data . signaturesMap = signaturesMap ;
305313}
306314
307-
308315export function deserializeDataForRewardCalculation (
309316 rewardEpochId : number ,
310317 votingRoundId : number ,
0 commit comments