leonardocustodio / polkadart

Polkadart provides developers the ability to query a node and interact with the Polkadot based chains using Dart.
https://polkadart.dev
Apache License 2.0
39 stars 16 forks source link

Fixes MinInflation type not found on polkadart_cli #491

Closed leonardocustodio closed 3 weeks ago

leonardocustodio commented 3 weeks ago

PR Type

enhancement, configuration changes


Description


PRDescriptionHeader.CHANGES_WALKTHROUGH

Relevant files
Enhancement
v14_parser.dart
Add new codecs to the V14Parser registry                                 

packages/substrate_metadata/lib/parsers/v14_parser.dart
  • Added new codecs to the _resultingRegistry.
  • Included codecs for MinInflation, MaxInflation, Falloff, IdealStake,
    and UseAuctionSlots.
  • +6/-0     
    Configuration changes
    pubspec.yaml
    Update package version and repository information               

    packages/substrate_metadata/pubspec.yaml
  • Updated package version from 1.2.2 to 1.2.3.
  • Changed homepage and repository URLs.
  • +3/-3     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    github-actions[bot] commented 3 weeks ago

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Clarity
    The comment on line 35 suggests a TODO that might be overlooked. Ensure that the reference to the external PR is either resolved or updated to reflect the current state of the code.
    github-actions[bot] commented 3 weeks ago

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Ensure specialized codec instances are used for new codec types to handle specific encoding/decoding behaviors ___ **Ensure that the ProxyCodec instance is suitable for the new codec types added
    ('MinInflation', 'MaxInflation', 'Falloff', 'IdealStake', 'UseAuctionSlots'). If
    these types require specific encoding/decoding behaviors, consider implementing or
    using specialized codec instances for each.** [packages/substrate_metadata/lib/parsers/v14_parser.dart [32-40]](https://github.com/leonardocustodio/polkadart/pull/491/files#diff-55e21072d43e7d28703f4ae0fdf6b71eab55611036168bd13fb558d060d9eb77R32-R40) ```diff { final proxyCodec = ProxyCodec(); + final minInflationCodec = MinInflationCodec(); + final maxInflationCodec = MaxInflationCodec(); + final falloffCodec = FalloffCodec(); + final idealStakeCodec = IdealStakeCodec(); + final useAuctionSlotsCodec = UseAuctionSlotsCodec(); _resultingRegistry.addCodec('Call', proxyCodec); _resultingRegistry.addCodec('RuntimeCall', proxyCodec); - _resultingRegistry.addCodec('MinInflation', proxyCodec); - _resultingRegistry.addCodec('MaxInflation', proxyCodec); - _resultingRegistry.addCodec('Falloff', proxyCodec); - _resultingRegistry.addCodec('IdealStake', proxyCodec); - _resultingRegistry.addCodec('UseAuctionSlots', proxyCodec); + _resultingRegistry.addCodec('MinInflation', minInflationCodec); + _resultingRegistry.addCodec('MaxInflation', maxInflationCodec); + _resultingRegistry.addCodec('Falloff', falloffCodec); + _resultingRegistry.addCodec('IdealStake', idealStakeCodec); + _resultingRegistry.addCodec('UseAuctionSlots', useAuctionSlotsCodec); } ```
    Suggestion importance[1-10]: 7 Why: The suggestion addresses a potential issue where the same `ProxyCodec` instance is used for multiple codec types, which may not be suitable if these types require specific encoding/decoding behaviors. Implementing specialized codec instances for each type could enhance the functionality and correctness of the code.
    7
    leonardocustodio commented 3 weeks ago

    This PR fixes #490 while #487 is not finished and merged.

    codecov[bot] commented 3 weeks ago

    Codecov Report

    All modified and coverable lines are covered by tests :white_check_mark:

    Project coverage is 48.48%. Comparing base (ce390f2) to head (da86640). Report is 1 commits behind head on main.

    Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/graphs/tree.svg?width=650&height=150&src=pr&token=HG3K4LW5UN&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio)](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) ```diff @@ Coverage Diff @@ ## main #491 +/- ## =========================================== - Coverage 96.87% 48.48% -48.39% =========================================== Files 5 181 +176 Lines 160 9588 +9428 =========================================== + Hits 155 4649 +4494 - Misses 5 4939 +4934 ``` | [Flag](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | Coverage Δ | | |---|---|---| | [polkadart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `15.89% <ø> (?)` | | | [polkadart_cli](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `12.04% <ø> (?)` | | | [polkadart_keyring](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `65.24% <ø> (?)` | | | [polkadart_scale_codec](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `54.93% <ø> (?)` | | | [secp256k1_ecdsa](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `89.60% <ø> (?)` | | | [sr25519](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `85.91% <ø> (?)` | | | [ss58](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `96.87% <ø> (ø)` | | | [substrate_bip39](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `56.37% <ø> (?)` | | | [substrate_metadata](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | `87.72% <100.00%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio) | Coverage Δ | | |---|---|---| | [...ges/substrate\_metadata/lib/parsers/v14\_parser.dart](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491?src=pr&el=tree&filepath=packages%2Fsubstrate_metadata%2Flib%2Fparsers%2Fv14_parser.dart&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio#diff-cGFja2FnZXMvc3Vic3RyYXRlX21ldGFkYXRhL2xpYi9wYXJzZXJzL3YxNF9wYXJzZXIuZGFydA==) | `98.68% <100.00%> (ø)` | | ... and [175 files with indirect coverage changes](https://app.codecov.io/gh/leonardocustodio/polkadart/pull/491/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Leonardo+Custodio)