-
Notifications
You must be signed in to change notification settings - Fork 97
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
Make the partner fee max cap configurable in autopilot #2559
Conversation
I'd suggest rebasing onto this branch to avoid a lot of conflicts. |
crates/e2e/tests/e2e/protocol_fee.rs
Outdated
@@ -320,7 +371,7 @@ fn is_approximately_equal(executed_value: U256, expected_value: U256) -> bool { | |||
|
|||
async fn execute_test( | |||
web3: Web3, | |||
fee_policy: FeePolicyKind, | |||
autopilot_config: Vec<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: don't really feel confident to pass strings here. Would rather see a protocol fees config struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I am changing to accept anything which implements ToString
. The reason of it is that we can keep the current FeePolicyKind
enum without needing to convert it to string, and at the same time it adds customization to what you want to pass.
The idea of doing it like that is to avoid creating a struct containing FeePolicyKind
and a new field which is going to be used just is one test, and at the same time it opens to possibility of adding more tests with different configurations without altering the execute_test()
signature.
Thanks for the heads up! I saw the conflicts and aren't many. I will wait until your PR is merged so I don't pass the conflicts to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me.
@@ -47,9 +51,11 @@ impl ProtocolFee { | |||
{ | |||
if let Some(partner_fee) = validated_app_data.protocol.partner_fee { | |||
let fee_policy = vec![Policy::Volume { | |||
factor: FeeFactor::partner_fee_capped_from( | |||
factor: FeeFactor::try_from_capped( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check. The fee policy extracted from the app data here will get stored in the DB when the order gets executed during an auction, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a really good question! @sunce86 correct me if I am wrong, but as far as I understood it, by placing the code there (domain/fee/mod.rs
), the action is cached
and then taken as the next auction
to process and find a solution in the single_run()
(run_loop.rs
) it is stored the order event
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG one comment
556dd23
to
fe2c19e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
We should make configurable in the autopilot the maximum partner fee amount.
Changes
How to test
Related Issues
Fixes #2554