-
Notifications
You must be signed in to change notification settings - Fork 921
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
Audit Rewards server responses #5918
Conversation
@husobee If you take a look at the |
6dd2aa9
to
9fc2685
Compare
6c6e6d4
to
f38ab00
Compare
7931228
to
42ea64f
Compare
42ea64f
to
3a9b59d
Compare
3a9b59d
to
b7f4754
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.
-
All header guards need to be changed in
response
folder
BRAVELEDGER_COMMON_RESPONSE_API_H_
-> BRAVELEDGER_RESPONSE_RESPONSE_API_H_` -
Functions in
response
folder should not haveResponse
at the end of the functions as it's already inbraveledger_response_util
namespace -
Some functions in
response
folder haveParse
prefix, but they are not parsing anything, just readingHTTP_CODE
. I would suggest that we rename them to something likeCheck
prefix.
vendor/bat-native-ledger/src/bat/ledger/internal/attestation/attestation_iosx.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_promotion.cc
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_common.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_common.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_uphold.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_uphold.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_uphold.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_uphold.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_wallet.cc
Outdated
Show resolved
Hide resolved
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.
The response format documentation and parsing consolidations in this PR are great, and make it much easier to see our API client assumptions. Obviously keeping code comments in sync will be a challenge over time, but I think it's probably worth it in this case.
I'm less confident that moving all of this code out of its feature/responsibility area into a "response" folder is helpful, though. As it is, the code for accessing any particular HTTP service is already split out into a few different places:
static_values.h
- The request folder
- The general "subject" area folder that uses it
And having a "response" folder just means one more place to split things out into. Having a structure like this makes it harder to see the whole picture, harder to learn, and makes it more difficult to do gradual refactors. One option might be to create a new "endpoints" folder (or similar) that groups together each endpoint as an entity and provides a fetch function for each one.
In my opinion, for now I think we should keep these response files together in the folder where they are used. What do you think?
vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/publisher/publisher_server_list.h
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_common.h
Outdated
Show resolved
Hide resolved
|
||
namespace braveledger_response_util { | ||
|
||
ledger::ServerPublisherInfoPtr ParsePublisherInfoResponse( |
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.
I would prefer not merge any refactors of the publist code at this time (as there might be uplift requirements).
8531c14
to
55b9974
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.
The troubles that I've had this week have convinced me that we should not be refactoring publisher list v4 files until the feature has stabilized in 1.12.
8640528
to
67b0608
Compare
67b0608
to
8640528
Compare
8640528
to
70dd047
Compare
ledger::ResultCallback callback) { | ||
base::Value parsed_response(base::Value::Type::DICTIONARY); | ||
ParseSignedCredsResponse(response, &parsed_response); | ||
const ledger::Result result = |
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.
we receive RETRY_SHORT
, but it's ignored
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.
This code receives RETRY_SHORT
as a suggestion from a previous code review, but I guess I'm not sure why we wanted to make that logic change in the first place. None of this particular code has ever handled RETRY_SHORT
before, from what I can see. It seems like ParseSignedCreds
should return RETRY
to remain consistent with how things were before.
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.
Spoke offline, I'll add a RETRY_SHORT
handler to GetSignedCredsFromResponse
.
vendor/bat-native-ledger/src/bat/ledger/internal/credentials/credentials_promotion.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_promotion.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_sku.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_uphold.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/response/response_wallet.cc
Outdated
Show resolved
Hide resolved
0b80527
to
538ca7c
Compare
538ca7c
to
58246f6
Compare
Resolves brave/brave-browser#9666
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
No specific plan here, we just need to run through a general test of Rewards functionality with a focus on server communications.
Reviewer Checklist:
After-merge Checklist:
changes has landed on.