@@ -14,7 +14,6 @@ import (
1414 "github.com/eapache/channels"
1515
1616 "github.com/oasisprotocol/oasis-core/go/common/logging"
17- "github.com/oasisprotocol/oasis-core/go/common/node"
1817 "github.com/oasisprotocol/oasis-core/go/common/pubsub"
1918 "github.com/oasisprotocol/oasis-core/go/common/workerpool"
2019 "github.com/oasisprotocol/oasis-core/go/config"
@@ -26,11 +25,9 @@ import (
2625 storageApi "github.com/oasisprotocol/oasis-core/go/storage/api"
2726 dbApi "github.com/oasisprotocol/oasis-core/go/storage/mkvs/db/api"
2827 "github.com/oasisprotocol/oasis-core/go/worker/common/committee"
29- "github.com/oasisprotocol/oasis-core/go/worker/registration"
3028 "github.com/oasisprotocol/oasis-core/go/worker/storage/api"
3129 "github.com/oasisprotocol/oasis-core/go/worker/storage/p2p/checkpointsync"
3230 "github.com/oasisprotocol/oasis-core/go/worker/storage/p2p/diffsync"
33- storagePub "github.com/oasisprotocol/oasis-core/go/worker/storage/p2p/pub"
3431 "github.com/oasisprotocol/oasis-core/go/worker/storage/p2p/synclegacy"
3532)
3633
@@ -45,14 +42,6 @@ const (
4542
4643 checkpointSyncRetryDelay = 10 * time .Second
4744
48- // The maximum number of rounds the worker can be behind the chain before it's sensible for
49- // it to register as available.
50- maximumRoundDelayForAvailability = uint64 (10 )
51-
52- // The minimum number of rounds the worker can be behind the chain before it's sensible for
53- // it to stop advertising availability.
54- minimumRoundDelayForUnavailability = uint64 (15 )
55-
5645 // maxInFlightRounds is the maximum number of rounds that should be fetched before waiting
5746 // for them to be applied.
5847 maxInFlightRounds = 100
@@ -114,17 +103,10 @@ type finalizeResult struct {
114103// In addition this worker is responsible for:
115104// 1. Initializing the runtime state, possibly using checkpoints (if configured).
116105// 2. Pruning the state as specified by the configuration.
117- // 3. Optionally creating runtime state checkpoints (used by other nodes) for the state sync.
118- // 4. Creating (and optionally advertising) statesync p2p protocol clients and servers.
119- // 5. Registering node availability when it has synced sufficiently close to
120- // the latest known block header.
106+ // 3. Creating (and optionally advertising) statesync p2p protocol clients and servers.
121107type Worker struct {
122108 commonNode * committee.Node
123109
124- roleProvider registration.RoleProvider
125- rpcRoleProvider registration.RoleProvider
126- roleAvailable bool
127-
128110 logger * logging.Logger
129111
130112 localStorage storageApi.LocalBackend
@@ -156,8 +138,6 @@ type Worker struct {
156138// New creates a new state sync worker.
157139func New (
158140 commonNode * committee.Node ,
159- roleProvider registration.RoleProvider ,
160- rpcRoleProvider registration.RoleProvider ,
161141 localStorage storageApi.LocalBackend ,
162142 blockCh * channels.InfiniteChannel ,
163143 checkpointSyncCfg * CheckpointSyncConfig ,
@@ -167,9 +147,6 @@ func New(
167147 w := & Worker {
168148 commonNode : commonNode ,
169149
170- roleProvider : roleProvider ,
171- rpcRoleProvider : rpcRoleProvider ,
172-
173150 logger : logging .GetLogger ("worker/storage/statesync" ).With ("runtime_id" , commonNode .Runtime .ID ()),
174151
175152 localStorage : localStorage ,
@@ -202,9 +179,6 @@ func New(
202179 if config .GlobalConfig .Storage .Checkpointer .Enabled {
203180 commonNode .P2P .RegisterProtocolServer (checkpointsync .NewServer (commonNode .ChainContext , commonNode .Runtime .ID (), localStorage ))
204181 }
205- if rpcRoleProvider != nil {
206- commonNode .P2P .RegisterProtocolServer (storagePub .NewServer (commonNode .ChainContext , commonNode .Runtime .ID (), localStorage ))
207- }
208182
209183 // Create p2p protocol clients.
210184 w .legacyStorageSync = synclegacy .NewClient (commonNode .P2P , commonNode .ChainContext , commonNode .Runtime .ID ())
@@ -493,31 +467,6 @@ func (w *Worker) flushSyncedState(summary *blockSummary) (uint64, error) {
493467 return w .syncedState .Round , nil
494468}
495469
496- // This is only called from the main worker goroutine, so no locking should be necessary.
497- func (w * Worker ) nudgeAvailability (lastSynced , latest uint64 ) {
498- if lastSynced == w .undefinedRound || latest == w .undefinedRound {
499- return
500- }
501- if latest - lastSynced < maximumRoundDelayForAvailability && ! w .roleAvailable {
502- w .roleProvider .SetAvailable (func (_ * node.Node ) error {
503- return nil
504- })
505- if w .rpcRoleProvider != nil {
506- w .rpcRoleProvider .SetAvailable (func (_ * node.Node ) error {
507- return nil
508- })
509- }
510- w .roleAvailable = true
511- }
512- if latest - lastSynced > minimumRoundDelayForUnavailability && w .roleAvailable {
513- w .roleProvider .SetUnavailable ()
514- if w .rpcRoleProvider != nil {
515- w .rpcRoleProvider .SetUnavailable ()
516- }
517- w .roleAvailable = false
518- }
519- }
520-
521470// Serve runs the state sync worker.
522471func (w * Worker ) Serve (ctx context.Context ) error { // nolint: gocyclo
523472 defer close (w .diffCh )
@@ -950,7 +899,6 @@ mainLoop:
950899
951900 // Check if we're far enough to reasonably register as available.
952901 latestBlockRound = blk .Header .Round
953- w .nudgeAvailability (lastFinalizedRound , latestBlockRound )
954902
955903 if _ , ok := summaryCache [lastFullyAppliedRound ]; ! ok && lastFullyAppliedRound == w .undefinedRound {
956904 dummy := blockSummary {
@@ -1043,9 +991,6 @@ mainLoop:
1043991 }
1044992 storageWorkerLastFinalizedRound .With (w .getMetricLabels ()).Set (float64 (finalized .summary .Round ))
1045993
1046- // Check if we're far enough to reasonably register as available.
1047- w .nudgeAvailability (lastFinalizedRound , latestBlockRound )
1048-
1049994 case <- ctx .Done ():
1050995 err = ctx .Err ()
1051996 break mainLoop
0 commit comments