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

feat: Return code for FPI #521

Merged
merged 11 commits into from
Oct 23, 2024
Merged

feat: Return code for FPI #521

merged 11 commits into from
Oct 23, 2024

Conversation

igamigo
Copy link
Collaborator

@igamigo igamigo commented Oct 22, 2024

Closes #520

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you! Looks good! I left a few comments inline. The main one is about returning account code only if include_headers is set to true.

proto/requests.proto Show resolved Hide resolved
crates/store/src/server/api.rs Outdated Show resolved Hide resolved
proto/responses.proto Outdated Show resolved Hide resolved
@@ -691,7 +693,7 @@ impl State {
let inner_state = self.inner.read().await;

let state_headers = if !include_headers {
BTreeMap::<AccountId, AccountStateHeader>::default()
BTreeMap::<u64, AccountStateHeader>::new()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this change necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It wasn't, I thought I was rolling it back correctly but I wasn't (AccountId here is a newtype for u64)

proto/requests.proto Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left a couple more comments inline. Once they are addressed, we should be good to merge.

crates/store/src/server/api.rs Outdated Show resolved Hide resolved
Comment on lines +138 to +142
// Account code commitments corresponding to the last-known `AccountCode` for requested
// accounts. Responses will include only the ones that are not known to the caller.
repeated digest.Digest code_commitments = 2;
// Optional flag to include header in the response. `false` by default.
optional bool include_headers = 2;
optional bool include_headers = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would move include_headers above code_commitments.

Also, we should update comments to make it clear that account code only is included if include_headers is true, and also that it is not associated with a specific account ID (i.e., we check code roots against all accounts).

@@ -485,13 +485,25 @@ impl api_server::Api for StoreApi {
request: Request<GetAccountProofsRequest>,
) -> Result<Response<GetAccountProofsResponse>, Status> {
let request = request.into_inner();
if request.account_ids.len() >= request.code_commitments.len() {
return Err(Status::invalid_argument(
"Amount of code commitments should not be larger than amount of requested accounts.",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would use "number" instead of "amount" here.

@igamigo igamigo merged commit b0a1721 into next Oct 23, 2024
8 checks passed
@igamigo igamigo deleted the igamigo-acc-code-fpi branch October 23, 2024 13:45
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.

3 participants