Skip to content

Commit 573fb3c

Browse files
committed
go/worker: Remove unused variables
1 parent 6012b57 commit 573fb3c

8 files changed

Lines changed: 6 additions & 52 deletions

File tree

go/oasis-node/cmd/node/node.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,11 @@ func (n *Node) initRuntimeWorkers(genesisDoc *genesisAPI.Document) error {
219219
n.svcMgr.Register(n.RuntimeRegistry)
220220

221221
// Initialize the common worker.
222+
commonCfg := workerCommon.Config{
223+
TxPool: config.GlobalConfig.Runtime.TxPool,
224+
}
222225
n.CommonWorker, err = workerCommon.New(
223-
n,
224-
n.dataDir,
226+
commonCfg,
225227
n.chainContext,
226228
n.Identity,
227229
n.Consensus,

go/worker/common/committee/node.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/oasisprotocol/oasis-core/go/common/version"
1616
"github.com/oasisprotocol/oasis-core/go/config"
1717
consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
18-
control "github.com/oasisprotocol/oasis-core/go/control/api"
1918
keymanager "github.com/oasisprotocol/oasis-core/go/keymanager/api"
2019
cmmetrics "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common/metrics"
2120
p2pAPI "github.com/oasisprotocol/oasis-core/go/p2p/api"
@@ -56,8 +55,6 @@ type Node struct {
5655
Runtime runtimeRegistry.Runtime
5756
RuntimeRegistry runtimeRegistry.Registry
5857

59-
HostNode control.NodeController
60-
6158
Identity *identity.Identity
6259
KeyManager keymanager.Backend
6360
KeyManagerClient *KeyManagerClientWrapper
@@ -632,7 +629,6 @@ func (n *Node) handleDispatchInfo() {
632629

633630
func NewNode(
634631
chainContext string,
635-
hostNode control.NodeController,
636632
runtime runtimeRegistry.Runtime,
637633
provisioner host.Provisioner,
638634
rtRegistry runtimeRegistry.Registry,
@@ -660,7 +656,6 @@ func NewNode(
660656

661657
n := &Node{
662658
ChainContext: chainContext,
663-
HostNode: hostNode,
664659
Runtime: runtime,
665660
RuntimeRegistry: rtRegistry,
666661
Identity: identity,

go/worker/common/config.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
package common
22

33
import (
4-
"github.com/oasisprotocol/oasis-core/go/common/logging"
5-
"github.com/oasisprotocol/oasis-core/go/config"
64
tpConfig "github.com/oasisprotocol/oasis-core/go/runtime/txpool/config"
75
)
86

97
// Config contains common worker config.
108
type Config struct {
119
TxPool tpConfig.Config
12-
13-
logger *logging.Logger
14-
}
15-
16-
// NewConfig creates a new worker config.
17-
func NewConfig() (*Config, error) {
18-
cfg := Config{
19-
TxPool: config.GlobalConfig.Runtime.TxPool,
20-
logger: logging.GetLogger("worker/config"),
21-
}
22-
23-
return &cfg, nil
2410
}

go/worker/common/worker.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package common
22

33
import (
4-
"fmt"
5-
64
"github.com/oasisprotocol/oasis-core/go/common"
75
"github.com/oasisprotocol/oasis-core/go/common/identity"
86
"github.com/oasisprotocol/oasis-core/go/common/logging"
@@ -22,7 +20,6 @@ type Worker struct {
2220
cfg Config
2321

2422
HostNode control.NodeController
25-
DataDir string
2623
ChainContext string
2724
Identity *identity.Identity
2825
Consensus consensus.Service
@@ -131,11 +128,6 @@ func (w *Worker) Initialized() <-chan struct{} {
131128
return w.initCh
132129
}
133130

134-
// GetConfig returns the worker's configuration.
135-
func (w *Worker) GetConfig() Config {
136-
return w.cfg
137-
}
138-
139131
// GetRuntimes returns a map of configured runtimes.
140132
func (w *Worker) GetRuntimes() map[common.Namespace]*committee.Node {
141133
return w.runtimes
@@ -156,7 +148,6 @@ func (w *Worker) registerRuntime(runtime runtimeRegistry.Runtime) error {
156148

157149
node, err := committee.NewNode(
158150
w.ChainContext,
159-
w.HostNode,
160151
runtime,
161152
w.Provisioner,
162153
w.RuntimeRegistry,
@@ -181,8 +172,7 @@ func (w *Worker) registerRuntime(runtime runtimeRegistry.Runtime) error {
181172

182173
// New creates a new worker.
183174
func New(
184-
hostNode control.NodeController,
185-
dataDir string,
175+
cfg Config,
186176
chainContext string,
187177
identity *identity.Identity,
188178
consensus consensus.Service,
@@ -203,16 +193,9 @@ func New(
203193
enabled = true
204194
}
205195

206-
cfg, err := NewConfig()
207-
if err != nil {
208-
return nil, fmt.Errorf("worker/common: failed to initialize config: %w", err)
209-
}
210-
211196
w := &Worker{
212197
enabled: enabled,
213-
cfg: *cfg,
214-
HostNode: hostNode,
215-
DataDir: dataDir,
198+
cfg: cfg,
216199
ChainContext: chainContext,
217200
Identity: identity,
218201
Consensus: consensus,

go/worker/compute/executor/committee/node.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"github.com/oasisprotocol/oasis-core/go/runtime/transaction"
3030
"github.com/oasisprotocol/oasis-core/go/runtime/txpool"
3131
storage "github.com/oasisprotocol/oasis-core/go/storage/api"
32-
commonWorker "github.com/oasisprotocol/oasis-core/go/worker/common"
3332
"github.com/oasisprotocol/oasis-core/go/worker/common/committee"
3433
"github.com/oasisprotocol/oasis-core/go/worker/common/p2p/txsync"
3534
"github.com/oasisprotocol/oasis-core/go/worker/registration"
@@ -56,7 +55,6 @@ type Node struct {
5655
runtimeTrustSyncCancel context.CancelFunc
5756

5857
commonNode *committee.Node
59-
commonCfg commonWorker.Config
6058
roleProvider registration.RoleProvider
6159

6260
committeeTopic string
@@ -1511,7 +1509,6 @@ func (n *Node) roundWorker(ctx context.Context) {
15111509
// NewNode initializes a new executor node.
15121510
func NewNode(
15131511
commonNode *committee.Node,
1514-
commonCfg commonWorker.Config,
15151512
roleProvider registration.RoleProvider,
15161513
) (*Node, error) {
15171514
initMetrics()
@@ -1522,7 +1519,6 @@ func NewNode(
15221519

15231520
n := &Node{
15241521
commonNode: commonNode,
1525-
commonCfg: commonCfg,
15261522
roleProvider: roleProvider,
15271523
committeeTopic: committeeTopic,
15281524
proposals: newPendingProposals(),

go/worker/compute/executor/worker.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ func (w *Worker) registerRuntime(commonNode *committeeCommon.Node) error {
148148
// Create committee node for the given runtime.
149149
node, err := committee.NewNode(
150150
commonNode,
151-
w.commonWorker.GetConfig(),
152151
rp,
153152
)
154153
if err != nil {

go/worker/storage/committee/worker.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
storageApi "github.com/oasisprotocol/oasis-core/go/storage/api"
2828
"github.com/oasisprotocol/oasis-core/go/storage/mkvs/checkpoint"
2929
dbApi "github.com/oasisprotocol/oasis-core/go/storage/mkvs/db/api"
30-
workerCommon "github.com/oasisprotocol/oasis-core/go/worker/common"
3130
"github.com/oasisprotocol/oasis-core/go/worker/common/committee"
3231
"github.com/oasisprotocol/oasis-core/go/worker/registration"
3332
"github.com/oasisprotocol/oasis-core/go/worker/storage/api"
@@ -148,8 +147,6 @@ type Worker struct {
148147

149148
undefinedRound uint64
150149

151-
workerCommonCfg workerCommon.Config
152-
153150
checkpointer checkpoint.Checkpointer
154151
checkpointSyncCfg *CheckpointSyncConfig
155152
checkpointSyncForced bool
@@ -181,7 +178,6 @@ func New(
181178
commonNode *committee.Node,
182179
roleProvider registration.RoleProvider,
183180
rpcRoleProvider registration.RoleProvider,
184-
workerCommonCfg workerCommon.Config,
185181
localStorage storageApi.LocalBackend,
186182
checkpointSyncCfg *CheckpointSyncConfig,
187183
pruneCfg PruneConfig,
@@ -196,8 +192,6 @@ func New(
196192

197193
logger: logging.GetLogger("worker/storage/committee").With("runtime_id", commonNode.Runtime.ID()),
198194

199-
workerCommonCfg: workerCommonCfg,
200-
201195
localStorage: localStorage,
202196

203197
checkpointSyncCfg: checkpointSyncCfg,

go/worker/storage/worker.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func (w *Worker) registerRuntime(commonNode *committeeCommon.Node) error {
103103
commonNode,
104104
rp,
105105
rpRPC,
106-
w.commonWorker.GetConfig(),
107106
localStorage,
108107
&committee.CheckpointSyncConfig{
109108
Disabled: config.GlobalConfig.Storage.CheckpointSyncDisabled,

0 commit comments

Comments
 (0)