Skip to content

feat: Return code for FPI#521

Merged
igamigo merged 11 commits intonextfrom
igamigo-acc-code-fpi
Oct 23, 2024
Merged

feat: Return code for FPI#521
igamigo merged 11 commits intonextfrom
igamigo-acc-code-fpi

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.


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)

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.

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).

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 and others added 4 commits October 23, 2024 09:54
@igamigo igamigo merged commit b0a1721 into next Oct 23, 2024
@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