Skip to content

Commit 215b8bc

Browse files
author
Alexander Hentschel
committed
renamed trace FollowerExtendCertified to trace.FollowerExtendProtocolState
1 parent b5f6c2c commit 215b8bc

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

engine/common/follower/compliance_core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func (c *ComplianceCore) processCertifiedBlocks(ctx context.Context, blocks Cert
264264

265265
// Step 2 & 3: extend protocol state with connected certified blocks and forward them to consensus follower
266266
for _, certifiedBlock := range connectedBlocks {
267-
s, _ := c.tracer.StartBlockSpan(ctx, certifiedBlock.ID(), trace.FollowerExtendCertified)
267+
s, _ := c.tracer.StartBlockSpan(ctx, certifiedBlock.ID(), trace.FollowerExtendProtocolState)
268268
err = c.state.ExtendCertified(ctx, certifiedBlock.Block, certifiedBlock.QC)
269269
s.End()
270270
if err != nil {

module/trace/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const (
5656
FollowerProcessFinalizedBlock SpanName = "follower.processFinalizedBlock"
5757
FollowerProcessCertifiedBlocks SpanName = "follower.processCertifiedBlocks"
5858
FollowerExtendPendingTree SpanName = "follower.extendPendingTree"
59-
FollowerExtendCertified SpanName = "follower.extendCertified"
59+
FollowerExtendProtocolState SpanName = "follower.extendProtocolState"
6060

6161
// Collection Node
6262
//

state/protocol/badger/mutator.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,19 @@ func NewFullConsensusState(
109109
//
110110
// candidate.View == certifyingQC.View && candidate.ID() == certifyingQC.BlockID
111111
//
112-
// NOTE: this function expects that `certifyingQC` has been validated.
112+
// Caution:
113+
// - This function expects that `certifyingQC` has been validated.
114+
// - The parent block must already be stored.
115+
//
113116
// No errors are expected during normal operations.
114117
func (m *FollowerState) ExtendCertified(ctx context.Context, candidate *flow.Block, certifyingQC *flow.QuorumCertificate) error {
115118
span, ctx := m.tracer.StartSpanFromContext(ctx, trace.ProtoStateMutatorHeaderExtend)
116119
defer span.End()
117120

118-
blockID := candidate.ID()
119121
// check if candidate block has been already processed
120-
processed, err := m.checkBlockAlreadyProcessed(blockID)
121-
if err != nil || processed {
122+
blockID := candidate.ID()
123+
isDuplicate, err := m.checkBlockAlreadyProcessed(blockID)
124+
if err != nil || isDuplicate {
122125
return err
123126
}
124127

@@ -163,8 +166,8 @@ func (m *ParticipantState) Extend(ctx context.Context, candidate *flow.Block) er
163166
defer span.End()
164167

165168
// check if candidate block has been already processed
166-
processed, err := m.checkBlockAlreadyProcessed(candidate.ID())
167-
if err != nil || processed {
169+
isDuplicate, err := m.checkBlockAlreadyProcessed(candidate.ID())
170+
if err != nil || isDuplicate {
168171
return err
169172
}
170173

@@ -256,7 +259,7 @@ func (m *FollowerState) headerExtend(candidate *flow.Block) error {
256259
return nil
257260
}
258261

259-
// checkBlockAlreadyProcessed checks if block with given blockID has been added to the protocol state.
262+
// checkBlockAlreadyProcessed checks if block has been added to the protocol state.
260263
// Returns:
261264
// * (true, nil) - block has been already processed.
262265
// * (false, nil) - block has not been processed.
@@ -273,7 +276,7 @@ func (m *FollowerState) checkBlockAlreadyProcessed(blockID flow.Identifier) (boo
273276
return true, nil
274277
}
275278

276-
// checkOutdatedExtension checks whether candidate block is
279+
// checkOutdatedExtension checks whether given block is
277280
// valid in the context of the entire state. For this, the block needs to
278281
// directly connect, through its ancestors, to the last finalized block.
279282
// Expected errors during normal operations:

state/protocol/badger/mutator_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,8 +1941,8 @@ func TestExtendBlockProcessable(t *testing.T) {
19411941
})
19421942
}
19431943

1944-
// TestFollowerHeaderExtendBlockNotConnected tests adding orphan block to the finalized state
1945-
// add 2 blocks, where:
1944+
// TestFollowerHeaderExtendBlockNotConnected tests adding an orphaned block to the follower state.
1945+
// Specifically, we add 2 blocks, where:
19461946
// first block is added and then finalized;
19471947
// second block is a sibling to the finalized block
19481948
// The Follower should accept this block since tracking of orphan blocks is implemented by another component.
@@ -1971,8 +1971,8 @@ func TestFollowerHeaderExtendBlockNotConnected(t *testing.T) {
19711971
})
19721972
}
19731973

1974-
// TestParticipantHeaderExtendBlockNotConnected tests adding orphan block to the finalized state
1975-
// add 2 blocks, where:
1974+
// TestParticipantHeaderExtendBlockNotConnected tests adding an orphaned block to the consensus participant state.
1975+
// Specifically, we add 2 blocks, where:
19761976
// first block is added and then finalized;
19771977
// second block is a sibling to the finalized block
19781978
// The Participant should reject this block as an outdated chain extension

0 commit comments

Comments
 (0)