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

[Substrate.io Migration] Runtime APIs #25

Merged
merged 8 commits into from
Oct 8, 2024
Merged

Conversation

CrackTheCode016
Copy link
Collaborator

NOTE: This page may be unneeded, but is also good to include just to give light to how this works. It's possible that after some expansion that it will be something useful.

The "Runtime APIs" page was migrated from Substrate.io: https://docs.substrate.io/reference/runtime-apis/

@CrackTheCode016 CrackTheCode016 added B0 - Needs Review Pull request is ready for review and removed In Progress labels Sep 12, 2024
@nhussein11 nhussein11 self-requested a review September 27, 2024 11:12
@nhussein11
Copy link
Collaborator

heyy just jumping here to help on this :)

@dawnkelly09
Copy link
Collaborator

@nhussein11 I tried to beef up this page a bit with more details about the API methods, etc. I still need to spell check and things but, can you please take a look and make sure I'm technically making sense with definitions, types, etc. I dug through the code a good bit but I'm not very familiar with Rust so a second set of eyes would be really appreciated! Thank you!

@nhussein11
Copy link
Collaborator

@dawnkelly09 thank you! I reviewed this page, and there is only one aspect that I'd like to point out:

The parameter __runtime_api_at_param__ is missing in AuraAPI and AccountNonceApi; however, I think removing that param from all the methods listed would make sense. I looked for the implementation of that param in the polkadot-sdk, and it's never used when calling those functions.

As far as I know, __runtime_api_at_param__ represents the state of the runtime at a specific block, but the compiler ignores it in all instances by using _ since these methods are functional without needing to differentiate between specific block states. IMHO, this is something super specific that only a few devs would need to know.

TL;DR:
I'd suggest removing the __runtime_api_at_param__ from each method, or explaining it at the end of the page as a side note :)

@CrackTheCode016
Copy link
Collaborator Author

The dropdowns look much better than the table, thank you!

A little note on this type of documentation: I would be a little careful about documenting some of these API methods specifically in the future, as they could be hard to maintain, more could be added, changed ,etc.

In this case I think it is fine, and looks good, but again the Rust docs cover this stuff in detail anyways and is auto-generated from the codebase itself.

The parameter runtime_api_at_param is missing in AuraAPI and AccountNonceApi; however, I think removing that param from all the methods listed would make sense. I looked for the implementation of that param in the polkadot-sdk, and it's never used when calling those functions.

@nhussein11 is correct here, we should look to removing this, as it is part of the macro-madness of the polkadot sdk and not too relevant in this context 😁 we could just include the return type, or simply reference Rust docs instread.

@dawnkelly09 dawnkelly09 requested review from eshaben and removed request for eshaben October 1, 2024 19:04
@dawnkelly09 dawnkelly09 requested a review from eshaben October 1, 2024 19:14
@dawnkelly09
Copy link
Collaborator

@eshaben updated this per technical feedback. Please take a look for a formatting approval.

Copy link
Collaborator

@eshaben eshaben left a comment

Choose a reason for hiding this comment

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

I'm not sure about providing the parameters and returns for these functions, some of these are a bit half baked. I think for the sake of time in honing in on the types and reviewing all of this, maybe we should just point back to the Polkadot SDK docs instead

@dawnkelly09 dawnkelly09 requested a review from a team as a code owner October 7, 2024 17:36
@dawnkelly09
Copy link
Collaborator

I switched this up to just give a description of what each API does and let the user know they can select the API name to go to the Rust docs.

@dawnkelly09 dawnkelly09 removed their request for review October 7, 2024 17:37
@dawnkelly09 dawnkelly09 requested a review from eshaben October 7, 2024 17:37
Copy link
Collaborator

@nhussein11 nhussein11 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@eshaben eshaben left a comment

Choose a reason for hiding this comment

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

LGTM! ✨

@dawnkelly09 dawnkelly09 merged commit ed977fc into master Oct 8, 2024
@dawnkelly09 dawnkelly09 deleted the bd-runtime-api branch October 8, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B0 - Needs Review Pull request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants