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

Sends auction_id as query parameter to http solvers. #133

Merged
merged 4 commits into from
Apr 7, 2022

Conversation

marcovc
Copy link
Contributor

@marcovc marcovc commented Apr 5, 2022

No description provided.

@marcovc marcovc requested a review from a team as a code owner April 5, 2022 15:39
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2022

Codecov Report

Merging #133 (4b4c3e5) into main (e73b207) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

❗ Current head 4b4c3e5 differs from pull request most recent head 14ff193. Consider uploading reports for the commit 14ff193 to get more accurate results

@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
- Coverage   65.11%   65.10%   -0.01%     
==========================================
  Files         182      182              
  Lines       38049    38047       -2     
==========================================
- Hits        24775    24772       -3     
- Misses      13274    13275       +1     

@@ -108,6 +106,10 @@ impl HttpSolverApi for DefaultHttpSolverApi {
use_internal_buffers.to_string().as_str(),
);
}
if let Some(auction_id) = maybe_auction_id {
url.query_pairs_mut()
.append_pair("auction_id", auction_id.to_string().as_str());
Copy link
Contributor

@nlordell nlordell Apr 5, 2022

Choose a reason for hiding this comment

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

Do the MIP and CowDexAg solver support this parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not MIP (which is being deprecated btw), not sure about cowdex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we merge this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also use the same fallback value for auction_id as the instance name so that the query parameter always gets added?

Copy link
Contributor

Choose a reason for hiding this comment

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

Cow does not yet. But after I get an approval in this PR, it should be good:
gnosis/cow-dex-solver#18

Comment on lines 81 to 86
let maybe_auction_id = model
.metadata
.as_ref()
.unwrap_or(&MetadataModel::default())
.auction_id;
let instance_name = self.generate_instance_name(maybe_auction_id.unwrap_or(0u64));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The value of maybe_auction_id can depend on the implementation of MetadataModel::default() which is probably not intended. As an alternative you could try this:

        let auction_id = match &model.metadata {
            Some(metadata) => metadata.auction_id.unwrap_or(0),
            None => 0,
        };

I believe this makes a little more obvious what's going on.
Alternatively if you actually want this value to be an Option<u64> this would also work:

        let maybe_auction_id = model.metadata.as_ref().and_then(|data| data.auction_id);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll go with the last one, thank you!

@@ -108,6 +106,10 @@ impl HttpSolverApi for DefaultHttpSolverApi {
use_internal_buffers.to_string().as_str(),
);
}
if let Some(auction_id) = maybe_auction_id {
url.query_pairs_mut()
.append_pair("auction_id", auction_id.to_string().as_str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also use the same fallback value for auction_id as the instance name so that the query parameter always gets added?

@marcovc
Copy link
Contributor Author

marcovc commented Apr 6, 2022

Should this also use the same fallback value for auction_id as the instance name so that the query parameter always gets added?

At least quasimodo is counting for the presence/absence of auction_id to decide which log info should be appended - if not present then it records an internal request counter. So I'd say to keep it like this if all agree.

@marcovc marcovc enabled auto-merge (squash) April 7, 2022 14:09
@marcovc marcovc merged commit a27b50b into main Apr 7, 2022
@marcovc marcovc deleted the send-auction-id-as-query-parameter branch April 7, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants