@@ -28,31 +28,31 @@ var six = big.NewInt(6)
2828
2929// Implementation for tree generator ruleset v8
3030type treeGeneratorImpl_v8 struct {
31- networkState * state.NetworkState
32- rewardsFile * RewardsFile_v3
33- elSnapshotHeader * types.Header
34- log * log.ColorLogger
35- logPrefix string
36- rp * rocketpool.RocketPool
37- cfg * config. RocketPoolConfig
38- bc beacon.Client
39- opts * bind.CallOpts
40- nodeDetails []* NodeSmoothingDetails
41- smoothingPoolBalance * big.Int
42- intervalDutiesInfo * IntervalDutiesInfo
43- slotsPerEpoch uint64
44- validatorIndexMap map [string ]* MinipoolInfo
45- elStartTime time.Time
46- elEndTime time.Time
47- validNetworkCache map [uint64 ]bool
48- epsilon * big.Int
49- intervalSeconds * big.Int
50- beaconConfig beacon.Eth2Config
51- validatorStatusMap map [rptypes.ValidatorPubkey ]beacon.ValidatorStatus
52- totalAttestationScore * big.Int
53- successfulAttestations uint64
54- genesisTime time.Time
55- invalidNetworkNodes map [common.Address ]uint64
31+ networkState * state.NetworkState
32+ rewardsFile * RewardsFile_v3
33+ elSnapshotHeader * types.Header
34+ log * log.ColorLogger
35+ logPrefix string
36+ rp * rocketpool.RocketPool
37+ previousRewardsPoolAddresses []common. Address
38+ bc beacon.Client
39+ opts * bind.CallOpts
40+ nodeDetails []* NodeSmoothingDetails
41+ smoothingPoolBalance * big.Int
42+ intervalDutiesInfo * IntervalDutiesInfo
43+ slotsPerEpoch uint64
44+ validatorIndexMap map [string ]* MinipoolInfo
45+ elStartTime time.Time
46+ elEndTime time.Time
47+ validNetworkCache map [uint64 ]bool
48+ epsilon * big.Int
49+ intervalSeconds * big.Int
50+ beaconConfig beacon.Eth2Config
51+ validatorStatusMap map [rptypes.ValidatorPubkey ]beacon.ValidatorStatus
52+ totalAttestationScore * big.Int
53+ successfulAttestations uint64
54+ genesisTime time.Time
55+ invalidNetworkNodes map [common.Address ]uint64
5656}
5757
5858// Create a new tree generator
@@ -104,20 +104,20 @@ func (r *treeGeneratorImpl_v8) getRulesetVersion() uint64 {
104104 return r .rewardsFile .RulesetVersion
105105}
106106
107- func (r * treeGeneratorImpl_v8 ) generateTree (rp * rocketpool.RocketPool , cfg * config. RocketPoolConfig , bc beacon.Client ) (* GenerateTreeResult , error ) {
107+ func (r * treeGeneratorImpl_v8 ) generateTree (rp * rocketpool.RocketPool , networkName string , previousRewardsPoolAddresses []common. Address , bc beacon.Client ) (* GenerateTreeResult , error ) {
108108
109109 r .log .Printlnf ("%s Generating tree using Ruleset v%d." , r .logPrefix , r .rewardsFile .RulesetVersion )
110110
111111 // Provision some struct params
112112 r .rp = rp
113- r .cfg = cfg
113+ r .previousRewardsPoolAddresses = previousRewardsPoolAddresses
114114 r .bc = bc
115115 r .validNetworkCache = map [uint64 ]bool {
116116 0 : true ,
117117 }
118118
119119 // Set the network name
120- r .rewardsFile .Network = fmt . Sprint ( cfg . Smartnode . Network . Value )
120+ r .rewardsFile .Network = networkName
121121 r .rewardsFile .MinipoolPerformanceFile .Network = r .rewardsFile .Network
122122 r .rewardsFile .MinipoolPerformanceFile .RewardsFileVersion = r .rewardsFile .RewardsFileVersion
123123 r .rewardsFile .MinipoolPerformanceFile .RulesetVersion = r .rewardsFile .RulesetVersion
@@ -181,18 +181,17 @@ func (r *treeGeneratorImpl_v8) generateTree(rp *rocketpool.RocketPool, cfg *conf
181181
182182// Quickly calculates an approximate of the staker's share of the smoothing pool balance without processing Beacon performance
183183// Used for approximate returns in the rETH ratio update
184- func (r * treeGeneratorImpl_v8 ) approximateStakerShareOfSmoothingPool (rp * rocketpool.RocketPool , cfg * config. RocketPoolConfig , bc beacon.Client ) (* big.Int , error ) {
184+ func (r * treeGeneratorImpl_v8 ) approximateStakerShareOfSmoothingPool (rp * rocketpool.RocketPool , networkName string , bc beacon.Client ) (* big.Int , error ) {
185185 r .log .Printlnf ("%s Approximating tree using Ruleset v%d." , r .logPrefix , r .rewardsFile .RulesetVersion )
186186
187187 r .rp = rp
188- r .cfg = cfg
189188 r .bc = bc
190189 r .validNetworkCache = map [uint64 ]bool {
191190 0 : true ,
192191 }
193192
194193 // Set the network name
195- r .rewardsFile .Network = fmt . Sprint ( cfg . Smartnode . Network . Value )
194+ r .rewardsFile .Network = networkName
196195 r .rewardsFile .MinipoolPerformanceFile .Network = r .rewardsFile .Network
197196 r .rewardsFile .MinipoolPerformanceFile .RewardsFileVersion = r .rewardsFile .RewardsFileVersion
198197 r .rewardsFile .MinipoolPerformanceFile .RulesetVersion = r .rewardsFile .RulesetVersion
@@ -536,7 +535,7 @@ func (r *treeGeneratorImpl_v8) calculateEthRewards(checkBeaconPerformance bool)
536535
537536 // Get the start time of this interval based on the event from the previous one
538537 //previousIntervalEvent, err := GetRewardSnapshotEvent(r.rp, r.cfg, r.rewardsFile.Index-1, r.opts) // This is immutable so querying at the head is fine and mitigates issues around calls for pruned EL state
539- previousIntervalEvent , err := GetRewardSnapshotEvent (r .rp , r .cfg , r .rewardsFile .Index - 1 , nil )
538+ previousIntervalEvent , err := GetRewardSnapshotEvent (r .rp , r .previousRewardsPoolAddresses , r .rewardsFile .Index - 1 , nil )
540539 if err != nil {
541540 return err
542541 }
@@ -1207,6 +1206,6 @@ func (r *treeGeneratorImpl_v8) getMinipoolBondAndNodeFee(details *rpstate.Native
12071206 return currentBond , currentFee
12081207}
12091208
1210- func (r * treeGeneratorImpl_v8 ) saveFiles (treeResult * GenerateTreeResult , nodeTrusted bool ) (cid.Cid , map [string ]cid.Cid , error ) {
1211- return saveJSONArtifacts (r . cfg . Smartnode , treeResult , nodeTrusted )
1209+ func (r * treeGeneratorImpl_v8 ) saveFiles (smartnode * config. SmartnodeConfig , treeResult * GenerateTreeResult , nodeTrusted bool ) (cid.Cid , map [string ]cid.Cid , error ) {
1210+ return saveJSONArtifacts (smartnode , treeResult , nodeTrusted )
12121211}
0 commit comments