Skip to content

Commit

Permalink
fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Dec 13, 2024
1 parent e54d8d7 commit 25dcd82
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion assertions/poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func (m *Manager) PostAssertionBasedOnParent(
// contracts check for overflow assertion => assertion.afterState.globalState.u64Vals[0] < assertion.beforeStateData.configData.nextInboxPosition)
// then should check if we need to wait for the minimum number of blocks between assertions and a minimum time since parent assertion creation.
// Overflow ones are not subject to this check onchain.
if newState.GlobalState.Batch >= batchCount {
isOverflowAssertion := newState.MachineStatus != protocol.MachineStatusErrored && newState.GlobalState.PosInBatch < batchCount
if !isOverflowAssertion {
if err = m.waitToPostIfNeeded(ctx, parentCreationInfo); err != nil {
return none, err
}
Expand Down
4 changes: 0 additions & 4 deletions assertions/poster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,13 @@ func TestPostAssertion(t *testing.T) {
stateManager, err := statemanager.NewForSimpleMachine(t, stateManagerOpts...)
require.NoError(t, err)

// Set MinimumGapToBlockCreationTime as 1 second to verify that a new assertion is only posted after 1 sec has passed
// from parent assertion creation. This will make the test run for ~19 seconds as the parent assertion time is
// ~18 seconds in the future
assertionManager, err := assertions.NewManager(
aliceChain,
stateManager,
"alice",
types.DefensiveMode,
assertions.WithPollingInterval(time.Millisecond*200),
assertions.WithAverageBlockCreationTime(time.Second),
assertions.WithMinimumGapToParentAssertion(time.Second),
)
require.NoError(t, err)

Expand Down

0 comments on commit 25dcd82

Please sign in to comment.