From 6bee86707cad8537bdf41410b19ed6f69422d984 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Mon, 6 Nov 2023 10:24:09 +0100 Subject: [PATCH] go/worker/common/committee: Remove unused node hooks --- go/worker/client/committee/node.go | 11 ----------- go/worker/common/committee/node.go | 13 ------------- go/worker/common/committee/p2p.go | 6 ------ go/worker/compute/executor/committee/hooks.go | 12 ------------ go/worker/storage/committee/node.go | 10 ---------- 5 files changed, 52 deletions(-) diff --git a/go/worker/client/committee/node.go b/go/worker/client/committee/node.go index 145fbb842f8..49a4b45b6fa 100644 --- a/go/worker/client/committee/node.go +++ b/go/worker/client/committee/node.go @@ -77,17 +77,6 @@ func (n *Node) Initialized() <-chan struct{} { return n.initCh } -// HandlePeerTx is guarded by CrossNode. -func (n *Node) HandlePeerTx(context.Context, []byte) error { - // Nothing to do here. - return nil -} - -// HandleEpochTransitionLocked is guarded by CrossNode. -func (n *Node) HandleEpochTransitionLocked(*committee.EpochSnapshot) { - // Nothing to do here. -} - // HandleNewBlockEarlyLocked is guarded by CrossNode. func (n *Node) HandleNewBlockEarlyLocked(*runtime.BlockInfo) { // Nothing to do here. diff --git a/go/worker/common/committee/node.go b/go/worker/common/committee/node.go index fb92b98219a..f33d88e2362 100644 --- a/go/worker/common/committee/node.go +++ b/go/worker/common/committee/node.go @@ -127,11 +127,6 @@ var ( // NodeHooks defines a worker's duties at common events. // These are called from the runtime's common node's worker. type NodeHooks interface { - // HandlePeerTx handles a transaction received from a (non-local) peer. - HandlePeerTx(ctx context.Context, tx []byte) error - - // Guarded by CrossNode. - HandleEpochTransitionLocked(*EpochSnapshot) // Guarded by CrossNode. HandleNewBlockEarlyLocked(*runtime.BlockInfo) // Guarded by CrossNode. @@ -365,9 +360,6 @@ func (n *Node) handleEpochTransitionLocked(height int64) { } epochNumber.With(n.getMetricLabels()).Set(float64(epoch.epochNumber)) - for _, hooks := range n.hooks { - hooks.HandleEpochTransitionLocked(epoch) - } } // Guarded by n.CrossNode. @@ -377,11 +369,6 @@ func (n *Node) handleSuspendLocked(int64) { // Suspend group. n.Group.Suspend() - epoch := n.Group.GetEpochSnapshot() - for _, hooks := range n.hooks { - hooks.HandleEpochTransitionLocked(epoch) - } - // If the runtime has been suspended, we need to switch to checking the latest registry // descriptor instead of the active one as otherwise we may miss deployment updates and never // register, keeping the runtime suspended. diff --git a/go/worker/common/committee/p2p.go b/go/worker/common/committee/p2p.go index da015a16635..a9b37e0a298 100644 --- a/go/worker/common/committee/p2p.go +++ b/go/worker/common/committee/p2p.go @@ -52,12 +52,6 @@ func (h *txMsgHandler) HandleMessage(ctx context.Context, _ signature.PublicKey, } } - // Dispatch to any transaction handlers. - for _, hooks := range h.n.hooks { - if err := hooks.HandlePeerTx(ctx, tx); err != nil { - return err - } - } return nil } diff --git a/go/worker/compute/executor/committee/hooks.go b/go/worker/compute/executor/committee/hooks.go index 601115a3cda..13532c02983 100644 --- a/go/worker/compute/executor/committee/hooks.go +++ b/go/worker/compute/executor/committee/hooks.go @@ -9,18 +9,6 @@ import ( // Ensure Node implements NodeHooks. var _ committee.NodeHooks = (*Node)(nil) -// HandlePeerTx implements NodeHooks. -func (n *Node) HandlePeerTx(context.Context, []byte) error { - // Nothing to do here. - return nil -} - -// HandleEpochTransitionLocked implements NodeHooks. -// Guarded by n.commonNode.CrossNode. -func (n *Node) HandleEpochTransitionLocked(*committee.EpochSnapshot) { - // Nothing to do here. -} - // HandleNewBlockEarlyLocked implements NodeHooks. // Guarded by n.commonNode.CrossNode. func (n *Node) HandleNewBlockEarlyLocked(*runtime.BlockInfo) { diff --git a/go/worker/storage/committee/node.go b/go/worker/storage/committee/node.go index 4734431463e..974fc4de34e 100644 --- a/go/worker/storage/committee/node.go +++ b/go/worker/storage/committee/node.go @@ -337,16 +337,6 @@ func (n *Node) GetLocalStorage() storageApi.LocalBackend { // NodeHooks implementation. -func (n *Node) HandlePeerTx(context.Context, []byte) error { - // Nothing to do here. - return nil -} - -// HandleEpochTransitionLocked is guarded by CrossNode. -func (n *Node) HandleEpochTransitionLocked(*committee.EpochSnapshot) { - // Nothing to do here. -} - // HandleNewBlockEarlyLocked is guarded by CrossNode. func (n *Node) HandleNewBlockEarlyLocked(*runtime.BlockInfo) { // Nothing to do here.