Skip to content

test(mempool): enhanced TestReactorNoBroadcastToSender#4127

Merged
cason merged 15 commits intomainfrom
cason/mempool-test-senders
Sep 26, 2024
Merged

test(mempool): enhanced TestReactorNoBroadcastToSender#4127
cason merged 15 commits intomainfrom
cason/mempool-test-senders

Conversation

@cason
Copy link

@cason cason commented Sep 19, 2024

The test should be able now to catch the error introduced by #3657.


To see how it would break, please checkout the branch cason/test-nobroadcastsender, then:

$ cd mempool
$ go test -v -run TestReactorNoBroadcastToSender

And wait it to fail, after 2 minutes. You are going to see the busy-loop around, logs entries starting with Skipping tx, forever for the same transaction.

Important: the test unit only works in the traditional mempool design, without lanes. We should consider adding a variant of it that should also pass when lanes are considered.


PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

@cason cason requested a review from a team as a code owner September 19, 2024 15:05
@cason cason requested a review from a team September 19, 2024 15:05
Copy link
Collaborator

@melekes melekes left a comment

Choose a reason for hiding this comment

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

👍

@hvanz
Copy link
Collaborator

hvanz commented Sep 26, 2024

Now that the mempool has lanes, the generated transactions will be assigned to different lanes, therefore they will arrive to the second node in a different order than FIFO. So one way to fix the test is to change the last line to only check that txs have arrived to the second reactor's mempool (with checkTxsInMempool) instead of checking that they have arrived and they have arrived in order (checkTxsInOrder).

If you still want to check that they have arrived in order, don't use lanes in this test. That will require more changes in the auxiliary functions because you will need to create the apps without lanes, with app := kvstore.NewInMemoryApplicationWithoutLanes() instead of app := kvstore.NewInMemoryApplication().

Copy link
Collaborator

@hvanz hvanz left a comment

Choose a reason for hiding this comment

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

Thanks for improving the test! As mentioned elsewhere, it would be better to test also the case with more than one lane, but the test in this PR is already better than the original one.

@cason cason added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit 9e25845 Sep 26, 2024
@cason cason deleted the cason/mempool-test-senders branch September 26, 2024 11:12
mergify bot pushed a commit that referenced this pull request Sep 26, 2024
The test should be able now to catch the error introduced by
#3657.

----

To see how it would break, please checkout the branch
`cason/test-nobroadcastsender`, then:

```
$ cd mempool
$ go test -v -run TestReactorNoBroadcastToSender
```

And wait it to fail, after 2 minutes. You are going to see the busy-loop
around, logs entries starting with `Skipping tx`, forever for the same
transaction.

Important: the test unit only works in the traditional mempool design,
without lanes. We should consider adding a variant of it that should
also pass when lanes are considered.

---

#### PR checklist

- [x] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 9e25845)

# Conflicts:
#	mempool/reactor.go
#	mempool/reactor_test.go
mergify bot added a commit that referenced this pull request Sep 27, 2024
) (#4182)

The test should be able now to catch the error introduced by
#3657.

FOR REVIEWERS: the
91ab7a7
commit was reverted in this backport, since mempool lanes is not
implemented in `v1.x`.

#### PR checklist

- [x] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
<hr>This is an automatic backport of pull request #4127 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Daniel <daniel.cason@informal.systems>
hvanz pushed a commit to InjectiveLabs/cometbft that referenced this pull request Mar 12, 2025
The test should be able now to catch the error introduced by
cometbft#3657.

----

To see how it would break, please checkout the branch
`cason/test-nobroadcastsender`, then:

```
$ cd mempool
$ go test -v -run TestReactorNoBroadcastToSender
```

And wait it to fail, after 2 minutes. You are going to see the busy-loop
around, logs entries starting with `Skipping tx`, forever for the same
transaction.

Important: the test unit only works in the traditional mempool design,
without lanes. We should consider adding a variant of it that should
also pass when lanes are considered.

---

- [x] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
maxim-inj pushed a commit to InjectiveLabs/cometbft that referenced this pull request Mar 15, 2025
The test should be able now to catch the error introduced by
cometbft#3657.

----

To see how it would break, please checkout the branch
`cason/test-nobroadcastsender`, then:

```
$ cd mempool
$ go test -v -run TestReactorNoBroadcastToSender
```

And wait it to fail, after 2 minutes. You are going to see the busy-loop
around, logs entries starting with `Skipping tx`, forever for the same
transaction.

Important: the test unit only works in the traditional mempool design,
without lanes. We should consider adding a variant of it that should
also pass when lanes are considered.

---

- [x] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mempool testing related to unit testing in general

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants