Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config Change] Removes HardReorg config from InboxReader #2542

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

diegoximenes
Copy link
Contributor

Resolves NIT-1349

HardReorg config from InboxReader seems unused so this PR removes it.

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Jul 31, 2024
@diegoximenes diegoximenes marked this pull request as ready for review July 31, 2024 20:35
gligneul
gligneul previously approved these changes Aug 1, 2024
@diegoximenes diegoximenes changed the title Removes HardReorg config from InboxReader [Config Change] Removes HardReorg config from InboxReader Aug 2, 2024
ganeshvanahalli
ganeshvanahalli previously approved these changes Aug 5, 2024
Require(t, err)

// Reorg out the user delayed message
err = tracker.ReorgDelayedTo(1, true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of just removing this test, we should instead have this test insert an alternative delayed message at position 1 which would cause the same reorg. Instead of getting the delayed count below, we could then get the delayed message to ensure it changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adjusted the test to trigger a reorg by adding an alternative delayed message through AddDelayedMessages as you mentioned, but the strategy that I implemented is a little bit different than the one you described.

@diegoximenes diegoximenes marked this pull request as draft October 4, 2024 18:01
},
},
}
err = tracker.AddDelayedMessages([]*DelayedInboxMessage{userDelayedModified})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it weird that, if instead I add an alternative delayed message related to delayedRequestId2, then userMsgBatch, and emptyBatch, will not be deleted.

So maybe I am missing something.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is unexpected. Could you push up a failing test case with delayedRequestId2? I can take a look from there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a commit that adds TestSequencerReorgFromLastDelayedMsg

@diegoximenes diegoximenes marked this pull request as ready for review October 4, 2024 19:25
@PlasmaPower
Copy link
Collaborator

I think there is an issue in the inbox tracker that your test exposed. I pushed up a commit to this branch to fix it. Let me know what you think

@@ -462,6 +462,7 @@ func (t *InboxTracker) AddDelayedMessages(messages []*DelayedInboxMessage) error
}
}

firstPos := pos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm right, that will force a reorg of any batch added in any of the messages[] received.
But there is a possibility that some of the messages were already known and have not changed.
A few lines above we have:

if haveLastAcc == messages[len(messages)-1].AfterInboxAcc() {
			// We already have these delayed messages
			return nil
		}

I think that we want to test it for each message and use for firstPos the first one which it isn't true.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad, I read the loop above it and thought it did this but it only happens for snap sync apparently. I'll probably just modify the loop to always happen. Thanks for catching that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed this and updated the test to catch this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants