Skip to content

Commit f42d9bd

Browse files
committed
go/worker/common/committee: Simplify node hooks
1 parent 0ad15c1 commit f42d9bd

File tree

5 files changed

+10
-35
lines changed

5 files changed

+10
-35
lines changed

go/worker/client/committee/node.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ func (n *Node) Initialized() <-chan struct{} {
7979
return n.initCh
8080
}
8181

82-
// HandleNewBlockEarlyLocked is guarded by CrossNode.
83-
func (n *Node) HandleNewBlockEarlyLocked(*runtime.BlockInfo) {
84-
// Nothing to do here.
85-
}
86-
8782
// HandleNewBlockLocked is guarded by CrossNode.
8883
func (n *Node) HandleNewBlockLocked(*runtime.BlockInfo) {
8984
// Nothing to do here.

go/worker/common/committee/node.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ var (
128128
// NodeHooks defines a worker's duties at common events.
129129
// These are called from the runtime's common node's worker.
130130
type NodeHooks interface {
131-
// Guarded by CrossNode.
132-
HandleNewBlockEarlyLocked(*runtime.BlockInfo)
133131
// Guarded by CrossNode.
134132
HandleNewBlockLocked(*runtime.BlockInfo)
135133
// Guarded by CrossNode.
@@ -531,17 +529,6 @@ func (n *Node) handleNewBlock(blk *block.Block, height int64) {
531529
n.KeyManagerClient.SetKeyManagerID(n.CurrentDescriptor.KeyManager)
532530
}
533531

534-
bi := &runtime.BlockInfo{
535-
RuntimeBlock: n.CurrentBlock,
536-
ConsensusBlock: n.CurrentConsensusBlock,
537-
Epoch: n.CurrentEpoch,
538-
ActiveDescriptor: n.CurrentDescriptor,
539-
}
540-
541-
for _, hooks := range n.hooks {
542-
hooks.HandleNewBlockEarlyLocked(bi)
543-
}
544-
545532
// Perform actions based on block type.
546533
switch header.HeaderType {
547534
case block.Normal:
@@ -566,11 +553,18 @@ func (n *Node) handleNewBlock(blk *block.Block, height int64) {
566553
n.handleSuspendLocked(height)
567554
default:
568555
n.logger.Error("invalid block type",
569-
"block", bi.RuntimeBlock,
556+
"block", blk,
570557
)
571558
return
572559
}
573560

561+
bi := &runtime.BlockInfo{
562+
RuntimeBlock: n.CurrentBlock,
563+
ConsensusBlock: n.CurrentConsensusBlock,
564+
Epoch: n.CurrentEpoch,
565+
ActiveDescriptor: n.CurrentDescriptor,
566+
}
567+
574568
n.TxPool.ProcessBlock(bi)
575569

576570
// Fetch incoming messages.

go/worker/compute/executor/committee/hooks.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
package committee
22

33
import (
4-
"github.com/oasisprotocol/oasis-core/go/common/crash"
54
runtime "github.com/oasisprotocol/oasis-core/go/runtime/api"
65
"github.com/oasisprotocol/oasis-core/go/worker/common/committee"
76
)
87

98
// Ensure Node implements NodeHooks.
109
var _ committee.NodeHooks = (*Node)(nil)
1110

12-
// HandleNewBlockEarlyLocked implements NodeHooks.
11+
// HandleNewBlockLocked implements NodeHooks.
1312
// Guarded by n.commonNode.CrossNode.
14-
func (n *Node) HandleNewBlockEarlyLocked(*runtime.BlockInfo) {
15-
crash.Here(crashPointRoothashReceiveAfter)
16-
13+
func (n *Node) HandleNewBlockLocked(bi *runtime.BlockInfo) {
1714
// Update our availability.
1815
n.nudgeAvailabilityLocked(false)
19-
}
2016

21-
// HandleNewBlockLocked implements NodeHooks.
22-
// Guarded by n.commonNode.CrossNode.
23-
func (n *Node) HandleNewBlockLocked(bi *runtime.BlockInfo) {
2417
// Drop blocks if the worker falls behind.
2518
select {
2619
case <-n.blockInfoCh:

go/worker/compute/executor/committee/init.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const (
1111
crashPointBatchProposeBefore = "worker.executor.batch.propose.before"
1212
crashPointBatchProposeAfter = "worker.executor.batch.propose.after"
1313
crashPointDiscrepancyDetectedAfter = "worker.executor.batch.discrepancy_detected.after"
14-
crashPointRoothashReceiveAfter = "worker.executor.batch.roothash.receive.after"
1514
crashPointBatchPublishAfter = "worker.executor.batch.schedule.publish.after"
1615
)
1716

@@ -23,7 +22,6 @@ func init() {
2322
crashPointBatchProposeBefore,
2423
crashPointBatchProposeAfter,
2524
crashPointDiscrepancyDetectedAfter,
26-
crashPointRoothashReceiveAfter,
2725
crashPointBatchPublishAfter,
2826
)
2927
}

go/worker/storage/committee/worker.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,6 @@ func (w *Worker) GetLocalStorage() storageApi.LocalBackend {
330330

331331
// NodeHooks implementation.
332332

333-
// HandleNewBlockEarlyLocked is guarded by CrossNode.
334-
func (w *Worker) HandleNewBlockEarlyLocked(*runtime.BlockInfo) {
335-
// Nothing to do here.
336-
}
337-
338333
// HandleNewBlockLocked is guarded by CrossNode.
339334
func (w *Worker) HandleNewBlockLocked(bi *runtime.BlockInfo) {
340335
// Notify the state syncer that there is a new block.

0 commit comments

Comments
 (0)