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

Runtime api documentation #2041

Closed
kostekIV opened this issue Oct 26, 2023 · 2 comments
Closed

Runtime api documentation #2041

kostekIV opened this issue Oct 26, 2023 · 2 comments

Comments

@kostekIV
Copy link
Contributor

I feel like the documentation that references runtime api and in particular documentation from sp-api and executor crate is missing some important informations.

List of Missing informations that I couldnt find in documentation but have to go through a lot of code to get and Im still not sure if I understand it well enough:

  • combinations of [old/new] runtime X [old/new] client, which apis are available & what code gets executed?
    • Envision situation when we have changed the logic of the existing runtime api. Which logic is executed in scenarios where we have new client but old runtime and which logic is executed when we have new runtime but old client?
  • Calling apis on old blocks with different runtime
    • which runtime is used?
    • can you use api that was not yet defined at that point in the old runtime?
  • What are best practices/recommendations to make apis backwards compatible?
    • logic changes
    • struct definitions changes in the runtime
    • api_version macro - I may not understand it well but is it mostly for situation when we want to have multiple versions of the same function in single runtime?

What, in regard to runtime api, will change after native free world? Should we prepare for any major refactoring?

@bkchr
Copy link
Member

bkchr commented Oct 30, 2023

  • Envision situation when we have changed the logic of the existing runtime api. Which logic is executed in scenarios where we have new client but old runtime and which logic is executed when we have new runtime but old client?

The implementation of the runtime api always depends on the on the runtime you are calling into. Not really related to the node version (assuming function name/signature) didn't changed.

  • which runtime is used?

The one that was active at the block you are calling into.

  • can you use api that was not yet defined at that point in the old runtime?

No.

  • api_version macro - I may not understand it well but is it mostly for situation when we want to have multiple versions of the same function in single runtime?

No. If you do changes that change the signature/name/add a new function you should bump the version. This version is basically an identifier that you can use in your node code to find out which api version the runtime is supporting to call the appropriate function etc.

serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 26, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 27, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
bkchr pushed a commit that referenced this issue Apr 10, 2024
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

No branches or pull requests

3 participants