Skip to content

Commit 94a55cb

Browse files
committed
update comments
1 parent 51255c2 commit 94a55cb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

state/protocol/protocol_state/epochs/statemachine_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ func (s *EpochStateMachineSuite) TestBuild_NoChanges() {
109109
dbUpdates, err := s.stateMachine.Build()
110110
require.NoError(s.T(), err)
111111

112-
// Provide the blockID and execute the resulting `dbUpdates`. Thereby, the expected mock methods should be called,
113-
// which is asserted by the testify framework. The lock context proof is passed to verify that the BatchIndex
114-
// operation receives the proper lock context as required by the storage layer.
112+
// Storage operations are deferred, because block ID is not known when the block is newly constructed. Only at the
113+
// end after the block is fully constructed, its ID can be computed. We emulate this step here to verify that the
114+
// deferred `dbOps` have been correctly constructed. Thereby, the expected mock methods should be called,
115+
// which is asserted by the testify framework.
115116
blockID := s.candidate.ID()
116117
return dbUpdates.Execute(lctx, blockID, rw)
117118
})
@@ -563,9 +564,10 @@ func (s *EpochStateMachineSuite) TestEvolveStateTransitionToNextEpoch_WithInvali
563564
rw := storagemock.NewReaderBatchWriter(s.T())
564565
rw.On("Writer").Return(w).Once() // called by epochStateDB.BatchStore
565566

566-
// Provide the blockID and execute the resulting `dbUpdates`. Thereby, the expected mock methods should be called,
567-
// which is asserted by the testify framework. The lock context proof is passed to verify that the BatchIndex
568-
// operation receives the proper lock context as required by the storage layer.
567+
// Storage operations are deferred, because block ID is not known when the block is newly constructed. Only at the
568+
// end after the block is fully constructed, its ID can be computed. We emulate this step here to verify that the
569+
// deferred `dbOps` have been correctly constructed. Thereby, the expected mock methods should be called,
570+
// which is asserted by the testify framework.
569571
blockID := s.candidate.ID()
570572
return dbOps.Execute(lctx, blockID, rw)
571573
})

0 commit comments

Comments
 (0)