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

Driver settle queue tests #3133

Merged
merged 62 commits into from
Dec 23, 2024
Merged

Driver settle queue tests #3133

merged 62 commits into from
Dec 23, 2024

Conversation

squadgazzz
Copy link
Contributor

@squadgazzz squadgazzz commented Nov 22, 2024

Description

An attempt to properly test #3129. The idea is to send multiple /settle requests to the same driver to check that some will be discarded due to the settlement queue limit.

Changes

  • anvil with disabled auto-mining is used to accumulate /settle requests in the queue.
  • Introduced a new TooManyPendingSettlements API error to properly identify the cause. I couldn't find a better way to ensure the logic is correct. Also, it might be helpful for all the parties to understand why a specific solution/settlement was discarded.
  • default_settle_queue_size is reduced to 2, since 1 ongoing settlement(dequeued) + 2 more in the queue make it 3 pending in total, which is high enough IMO.
  • Removed lifetime params from the Settle struct, which stores the /settle endpoint response data in order to fix a compilation issue. More details: Driver settle queue tests #3133 (comment)

How to test

This is the test.

@squadgazzz squadgazzz changed the base branch from main to settle-queue-to-driver November 22, 2024 15:12
@squadgazzz squadgazzz force-pushed the driver-settle-queue-tests branch from 287ccc1 to 5b27c13 Compare November 22, 2024 15:13
@squadgazzz squadgazzz marked this pull request as ready for review November 22, 2024 18:11
@squadgazzz squadgazzz requested a review from a team as a code owner November 22, 2024 18:11
@squadgazzz squadgazzz force-pushed the driver-settle-queue-tests branch from a5ab68a to 7bcd92f Compare November 22, 2024 18:14
Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Using the ethrpc configurations seems weird to make this test work.
Did you consider using anvil's helper methods instead?
You could first disable auto mining and manually clear the mempool to make sure that transactions actually do not get mined so that the submission futures don't return.

crates/driver/src/tests/cases/settle.rs Outdated Show resolved Hide resolved
crates/driver/src/tests/cases/settle.rs Show resolved Hide resolved
@squadgazzz squadgazzz force-pushed the driver-settle-queue-tests branch 2 times, most recently from de75f95 to 2efbcfe Compare November 28, 2024 10:26
Copy link
Contributor

@sunce86 sunce86 left a comment

Choose a reason for hiding this comment

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

LG.

I think it's good to have these tests to make sure no regression bugs are introduced in the future.
However, since this is a bit risky change, I would prefer to have a live testing on staging:

  1. Enable only one solver - baseline
  2. Organize testing session (maybe backend team only) and spam staging with multiple orders.

# Conflicts:
#	crates/driver/src/domain/competition/mod.rs
# Conflicts:
#	crates/driver/src/domain/competition/mod.rs
# Conflicts:
#	crates/driver/src/tests/cases/buy_eth.rs
#	crates/driver/src/tests/cases/merge_settlements.rs
#	crates/driver/src/tests/cases/parallel_auctions.rs
#	crates/driver/src/tests/cases/settle.rs
#	crates/driver/src/tests/setup/mod.rs
# Conflicts:
#	crates/driver/src/domain/competition/mod.rs
#	crates/driver/src/infra/api/mod.rs
#	crates/driver/src/infra/api/routes/solve/mod.rs
#	crates/driver/src/infra/config/file/load.rs
#	crates/driver/src/infra/config/file/mod.rs
#	crates/driver/src/infra/solver/mod.rs
Base automatically changed from settle-queue-to-driver to main December 23, 2024 13:17
# Conflicts:
#	crates/driver/src/domain/competition/mod.rs
#	crates/driver/src/infra/api/error.rs
#	crates/driver/src/infra/observe/mod.rs
@squadgazzz squadgazzz enabled auto-merge (squash) December 23, 2024 13:22
@squadgazzz squadgazzz merged commit a893c3b into main Dec 23, 2024
11 checks passed
@squadgazzz squadgazzz deleted the driver-settle-queue-tests branch December 23, 2024 13:27
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants