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: add retroactive support for core API to 0.45.x #14583

Merged
merged 15 commits into from
Feb 9, 2023

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented Jan 11, 2023

Description

This demonstrates how 0.45.x (or really any older SDK version) could be adapted to support modules written with the core API. This can allow us to write new modules which don't depend on any mainline SDK release (just core) but can be used with any SDK version.

The core API is currently incomplete and doesn't have support for things like registering services, begin/end blockers, events, etc. Those things should also be pretty straightforward to add and hopefully this proof of concept shows how this can work for multi-SDK version compatibility of standalone modules.

There are two parts to this adaptor:

  • core_module.go has a function UseCoreAPIModule to wrap a core API module as one that v0.45.x understands as an AppModule
  • core_serices.go which allows implementing the services core API modules will consume without depending directly on sdk.Context.

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@tac0turtle
Copy link
Member

@aaronc does someone need to take over this?

@aaronc
Copy link
Member Author

aaronc commented Jan 16, 2023

@aaronc does someone need to take over this?

That would be ideal

@alexanderbez
Copy link
Contributor

Can you describe what else needs to be done?

@aaronc
Copy link
Member Author

aaronc commented Jan 16, 2023

Can you describe what else needs to be done?

Testing it with mock modules

@facundomedica
Copy link
Member

I'm picking this one up 👍

@facundomedica facundomedica self-assigned this Jan 25, 2023
@facundomedica
Copy link
Member

@aaronc this is pretty much done, but it lacks the EndBlock and BeginBlock methods. Is that something we should backport too right?

@aaronc
Copy link
Member Author

aaronc commented Jan 31, 2023

Yes for sure

@facundomedica facundomedica marked this pull request as ready for review January 31, 2023 21:05
@facundomedica facundomedica requested review from a team and facundomedica and removed request for a team January 31, 2023 21:06
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Is there a plan to complete the backporting for the full core API service? I.e. begin blockers. Also, is there an example of how a module would use this adapter? e.g. x/bank

@aaronc
Copy link
Member Author

aaronc commented Feb 1, 2023

Is there a plan to complete the backporting for the full core API service? I.e. begin blockers. Also, is there an example of how a module would use this adapter? e.g. x/bank

Yes, although maybe things like event listeners and inter-module client don't get backported. We'd want to use a module that only uses core API as an example. Maybe x/circuit will?

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

lets add a changelog entry.

@aaronc
Copy link
Member Author

aaronc commented Feb 8, 2023

We should make it clear in documentation somehow that there will be limits on how much of core API can retroactively be supported. ADR 033 and event listeners obviously no. Also, if we do things with Msg's to remove the bech32 sdk.AccAddress dependency and support protoreflect, there will need to be other backports to 0.45 to support that... or it will just be an unsupported part of core API.

@tac0turtle
Copy link
Member

We should make it clear in documentation somehow that there will be limits on how much of core API can retroactively be supported. ADR 033 and event listeners obviously no. Also, if we do things with Msg's to remove the bech32 sdk.AccAddress dependency and support protoreflect, there will need to be other backports to 0.45 to support that... or it will just be an unsupported part of core API.

I think it will be unsupported. There isn't a large need to backport these items, but it's useful. Once we have better docs and people know what's possible then if we get requests to backport them we can evaluate on a per case basis

@facundomedica facundomedica merged commit f27d491 into release/v0.45.x Feb 9, 2023
@facundomedica facundomedica deleted the aaronc/v0.45.x-core-api-support branch February 9, 2023 14:54
julienrbrt pushed a commit that referenced this pull request Feb 22, 2023
Co-authored-by: Facundo Medica <facundomedica@gmail.com>
@faddat faddat mentioned this pull request Mar 23, 2023
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants