Skip to content

Change GetAccountProofs to a single GetAccountProof, cleanup#1211

Merged
drahnr merged 10 commits intonextfrom
bernhard-1185-acounts-part-1
Sep 12, 2025
Merged

Change GetAccountProofs to a single GetAccountProof, cleanup#1211
drahnr merged 10 commits intonextfrom
bernhard-1185-acounts-part-1

Conversation

@drahnr
Copy link
Contributor

@drahnr drahnr commented Sep 8, 2025

Part one of #1185

If desired, can also change to adding rather than replacing the single account GetAccountProof API

Copy link
Collaborator

@igamigo igamigo 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 overall, only one small comment for now (which you might have already been keeping in mind)

@drahnr drahnr force-pushed the bernhard-1185-acounts-part-1 branch from 451ab1f to 0848b56 Compare September 10, 2025 09:56
@drahnr drahnr marked this pull request as ready for review September 10, 2025 11:40
Comment on lines +312 to +328
let proto::rpc_store::AccountProofRequest {
account_request,
include_headers,
code_commitments,
code_commitment,
} = request.into_inner();

let include_headers = include_headers.unwrap_or_default();
let request_code_commitments: BTreeSet<Word> = try_convert(code_commitments)
.collect::<Result<_, _>>()
.map_err(|err| Status::invalid_argument(format!("Invalid code commitment: {err}")))?;

let account_requests: Vec<AccountProofRequest> =
try_convert(account_requests).collect::<Result<_, _>>().map_err(|err| {
Status::invalid_argument(format!("Invalid account proofs request: {err}"))
})?;

let (block_num, infos) = self
let request_code_commitment = Word::try_from(
&(code_commitment.ok_or(Status::invalid_argument(stringify!(code_commitment)))?),
)
.map_err(|err| Status::invalid_argument(format!("Invalid code commitment: {err}")))?;

let account_request =
account_request.ok_or(Status::invalid_argument(stringify!(account_request)))?;
let account_request = account_request.try_into().map_err(|err| {
Status::invalid_argument(format!("Invalid account proof request: {err}"))
})?;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we update the request message as I mentioned in the other comment, I think the logic here and downstream would get simpler. Basically, we'd just need to pass account Id and an optional "account request" (maybe makes sense to rename it to "account details request").

@drahnr drahnr changed the title Change GetAccountProofs -> GetAccountProof Change GetAccountProofs to a single GetAccountProof, cleanup Sep 11, 2025
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 some comments inline - but they are pretty small.

repeated StorageSlotMapProof storage_maps = 4;
message AccountProof {
// State header, available for public accounts only.
message AccountDetailsResponse {
Copy link
Contributor

Choose a reason for hiding this comment

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

Once we get rid of GetAccountDetails endpoint, we should rename AccountDetailsResponse into just AccountDetails.

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 think for clarity the *Response suffix does help, but it's also a bit weird if we'd use these message types in i.e. queries.

@drahnr drahnr merged commit 8d19c07 into next Sep 12, 2025
6 checks passed
@drahnr drahnr deleted the bernhard-1185-acounts-part-1 branch September 12, 2025 11:09
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.

4 participants