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

Add flag to skip slippage computations #407

Merged
merged 9 commits into from
Oct 29, 2024

Conversation

harisang
Copy link
Contributor

@harisang harisang commented Oct 9, 2024

This PR adds a flag to completely skip slippage calculations, if they are not needed.

@harisang harisang requested a review from fhenneke October 9, 2024 12:27
@fhenneke
Copy link
Collaborator

fhenneke commented Oct 9, 2024

I only glanced over the changes and they look reasonable.

Is the changed code part of any test? Or is there a simple way to manually test this change?

@harisang
Copy link
Contributor Author

harisang commented Oct 9, 2024

I only glanced over the changes and they look reasonable.

Is the changed code part of any test? Or is there a simple way to manually test this change?

Not yet. I pushed a change in order to make existing tests pass. I will add some test so that we can confirm the flag works as expected.

Comment on lines +403 to +410
reward_target_reduced_df_columns = [
x for x in list(reward_target_df.columns) if x != "solver_name"
]
reward_target_reduced_df = reward_target_df[reward_target_reduced_df_columns]
service_fee_reduced_df_columns = [
x for x in list(service_fee_df.columns) if x != "solver_name"
]
service_fee_reduced_df = service_fee_df[service_fee_reduced_df_columns]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose that we are not really interested in the fully general approach. Then this would work:

Suggested change
reward_target_reduced_df_columns = [
x for x in list(reward_target_df.columns) if x != "solver_name"
]
reward_target_reduced_df = reward_target_df[reward_target_reduced_df_columns]
service_fee_reduced_df_columns = [
x for x in list(service_fee_df.columns) if x != "solver_name"
]
service_fee_reduced_df = service_fee_df[service_fee_reduced_df_columns]
reward_target_reduced_df = reward_target_df.drop("solver_name", axis=1)
service_fee_reduced_df = service_fee_df.drop("solver_name", axis=1)

If we actually want that generality, this and other data transformations should probably happen somewhere else. E.g. right after fetching the data.

@harisang
Copy link
Contributor Author

harisang commented Oct 9, 2024

I only glanced over the changes and they look reasonable.

Is the changed code part of any test? Or is there a simple way to manually test this change?

Following up on this, I am not sure how easy it would be to add clean tests for this, so don't know how soon i will address this. This is also meant for local testing so I would say this is not urgent so let's leave this PR open until i address the testing part

@fhenneke
Copy link
Collaborator

Not merging this might complicate other things like deploying on arbitrum.
If you are confident that without the flag, results are not changed, we should proceed with merging.

@harisang
Copy link
Contributor Author

Not merging this might complicate other things like deploying on arbitrum. If you are confident that without the flag, results are not changed, we should proceed with merging.

There are some issues when i did some local testing today and will try to figure out what is going on. I saw this alert
AssertionError: Slippage validation Failed with columns: {'slippage_usd', 'tx_hash', 'block_time', 'solver', 'slippage_wei'}

@fhenneke
Copy link
Collaborator

This error is probably due to the fact that the dummy slippage data frame does not have the required columns. Thus the check in validate_df_columns fails.

The dataframe slippage_df needs to have at least the columns SLIPPAGE_COLUMNS, i.e. {"solver", "solver_name", "eth_slippage_wei"}. The current code seems to miss solver_name and eth_slippage_wei in the case you checked.

@harisang harisang merged commit a196e0c into main Oct 29, 2024
5 checks passed
@harisang harisang deleted the add_flag_to_skip_slippage_computations branch October 29, 2024 17:16
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 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