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

refactor: generic extension crate to de-duplicate code between runtimes #163

Merged

Conversation

chungquantin
Copy link
Collaborator

@chungquantin chungquantin commented Aug 7, 2024

Description

Removing the extension from the devnet and testnet runtimes. Make sure that adding features in the future for one runtime does not impact the other runtimes.

CHANGELOG

  • Separate the extension from runtimes to standalone crate pop-runtime-extension in runtime/extension
  • Preview the integration of pop-runtime-extension crate to pop-runtime-testnet: (no merge) refactor: migrate testnet chain extension #167
  • Encoding / decoding dispatch error test module is currently defined inside pop-runtime-devnet. This can be improved in the another PR to make something like TestSuiteBuilder that can be reused in multiple runtimes.

How feature can be added in the future?

Create a struct Extension and implement the ReadState trait and CallFilter trait for the Extension to handle the queries from the contract environment.

@chungquantin chungquantin linked an issue Aug 7, 2024 that may be closed by this pull request
@chungquantin chungquantin marked this pull request as ready for review August 7, 2024 14:17
@chungquantin chungquantin changed the title refactor: duplicate chain extensions refactor: generic extension crate to avoid duplicate code between runtimes Aug 11, 2024
@chungquantin chungquantin changed the title refactor: generic extension crate to avoid duplicate code between runtimes refactor: generic extension crate to de-duplicate code between runtimes Aug 11, 2024
Copy link
Collaborator

@evilrobot-01 evilrobot-01 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, just missing doc comments as a finishing touch.

Strange that there is no code coverage report added to this PR, nor the base branch. I'll see if I can get that resolved.

extension/src/constants.rs Outdated Show resolved Hide resolved
extension/src/lib.rs Show resolved Hide resolved
extension/src/lib.rs Show resolved Hide resolved
extension/src/lib.rs Show resolved Hide resolved
extension/src/lib.rs Outdated Show resolved Hide resolved
extension/src/lib.rs Outdated Show resolved Hide resolved
extension/Cargo.toml Show resolved Hide resolved
Copy link
Collaborator

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

Two last suggestions to simplify the language on the comments and then good to go!

extension/src/lib.rs Outdated Show resolved Hide resolved
extension/src/lib.rs Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 41.72662% with 162 lines in your changes missing coverage. Please review.

Please upload report for BASE (daan/api@1acbd21). Learn more about missing BASE report.

Files Patch % Lines
extension/src/lib.rs 8.00% 138 Missing ⚠️
extension/src/tests.rs 88.03% 0 Missing and 14 partials ⚠️
runtime/devnet/src/config/api.rs 0.00% 10 Missing ⚠️
@@             Coverage Diff             @@
##             daan/api     #163   +/-   ##
===========================================
  Coverage            ?   31.43%           
===========================================
  Files               ?       34           
  Lines               ?     2885           
  Branches            ?     2885           
===========================================
  Hits                ?      907           
  Misses              ?     1955           
  Partials            ?       23           
Files Coverage Δ
extension/src/v0.rs 100.00% <100.00%> (ø)
runtime/devnet/src/config/contracts.rs 60.00% <ø> (ø)
runtime/devnet/src/lib.rs 17.31% <ø> (ø)
runtime/devnet/src/config/api.rs 0.00% <0.00%> (ø)
extension/src/tests.rs 88.03% <88.03%> (ø)
extension/src/lib.rs 8.00% <8.00%> (ø)

Copy link
Collaborator

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for your patience!

@chungquantin chungquantin merged commit 99d0f6d into daan/api Aug 13, 2024
8 checks passed
@chungquantin chungquantin deleted the chungquantin/refactor-duplicate_chain_extensions branch August 13, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor: remove duplicate chain extensions across runtimes
5 participants