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

Reduce alerts for cost coverage #99

Merged
merged 6 commits into from
Mar 28, 2024
Merged

Conversation

harisang
Copy link
Contributor

@harisang harisang commented Mar 21, 2024

This PR reduces alerts for cost coverage as they were too noisy, and only alerts if there is significant overcharging. There rest is just logged; the rationale being that with CIP-38, the protocol shouldn't in principle worry about cost coverage unless there is overcharging. This dune query can help with monitoring whenever needed.
https://dune.com/queries/3431685

Note that protocol fees can cause some false positives

@harisang harisang requested a review from fhenneke March 21, 2024 00:36
@harisang harisang changed the title Remove alerts for cost coverage Reduce alerts for cost coverage Mar 21, 2024
Copy link
Contributor

@fhenneke fhenneke left a comment

Choose a reason for hiding this comment

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

This PR is an update to the cost coverage test to the zero-signed fee world. It also updates alert thresholds.

I added minor comments. We can address them now or just merge this as is and add an issue to change it later.

I added a test to make sure the logic changes work. The test can be run locally using e.g. python -m tests.e2e.cost_coverage_test. It should print the error message and the test should pass.

@@ -37,20 +36,12 @@ def cost_coverage(self, competition_data: dict[str, Any], gas_cost: float) -> bo
orders = solution["orders"]
native_prices = competition_data["auction"]["prices"]
total_fee = 0.0
zero_signed_fee_market = False
Copy link
Contributor

Choose a reason for hiding this comment

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

This was removed since all orders are zero signed fees, right? Maybe the test can be renamed then to just cost coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good point. Let me try to clean it up

Comment on lines +57 to +66
if total_fee - gas_cost > 0.02:
self.alert(
f'"Fees - gasCost" is {total_fee - gas_cost} \
for {competition_data["transactionHash"]}.'
)
)
elif total_fee - gas_cost < -0.04:
self.logger.info(
f'"Fees - gasCost" is {total_fee - gas_cost} \
for {competition_data["transactionHash"]}.'
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This log message is quite different from what other tests emit. It also does not follow the log_output = ... and self.alert(log_output) convention.

@fhenneke
Copy link
Contributor

Closes #101.

@fhenneke fhenneke merged commit 76bf50a into main Mar 28, 2024
4 checks passed
@fhenneke fhenneke deleted the remove_cost_coverage_errors branch March 28, 2024 17:30
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 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.

2 participants