Skip to content
This repository was archived by the owner on Nov 11, 2025. It is now read-only.

Conversation

@leonardocustodio
Copy link
Contributor

@leonardocustodio leonardocustodio commented Jan 27, 2025

PR Type

Enhancement, Dependencies


Description

  • Added support for new Canary version v1050.

  • Updated metadata and constants for Canary relay chain.

  • Bumped project version to 2.3.0 and updated dependencies.

  • Exported new v1050 file for Canary metadata.


Changes walkthrough 📝

Relevant files
Enhancement
enjin.dart
Update Canary metadata to include `v1050`                               

lib/consts/enjin/enjin.dart

  • Updated canaryLatest to return v1050.
  • Added case for v1050 in canarySpec.
  • +3/-1     
    general.dart
    Update latest spec version for Canary relay chain               

    lib/handler/general.dart

  • Updated getLatestSpecVersion to return 1050 for canary-relaychain.
  • +1/-1     
    canary.dart
    Export new Canary metadata file `v1050`                                   

    lib/consts/enjin/canary/canary.dart

    • Exported new v1050.dart file for Canary metadata.
    +1/-0     
    Dependencies
    pubspec.yaml
    Update project version and dependencies                                   

    pubspec.yaml

  • Bumped project version to 2.3.0.
  • Updated dependencies: shelf, polkadart, substrate_metadata,
    polkadart_scale_codec, logging, and lints.
  • +7/-8     
    Additional files
    v1050.dart +2/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link

    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

    Possible Missing Test Coverage

    Ensure that the addition of v1050 in canaryLatest and canarySpec functions is covered by tests to validate the new metadata integration.

      return c.v1050;
    }
    
    String productionLatest() {
      return p.v1032;
    }
    
    String metadata(network, specVersion) {
      if (network == 'canary-relaychain') {
        return canarySpec(specVersion);
      }
    
      return productionSpec(specVersion);
    }
    
    String canarySpec(specVersion) {
      switch (specVersion) {
        case 100:
          return c.v100;
        case 101:
          return c.v101;
        case 102:
          return c.v102;
        case 103:
          return c.v103;
        case 104:
          return c.v104;
        case 105:
          return c.v105;
        case 106:
          return c.v106;
        case 107:
          return c.v107;
        case 110:
          return c.v110;
        case 120:
          return c.v120;
        case 1021:
          return c.v1021;
        case 1022:
          return c.v1022;
        case 1023:
          return c.v1023;
        case 1024:
          return c.v1024;
        case 1025:
          return c.v1025;
        case 1026:
          return c.v1026;
        case 1030:
          return c.v1030;
        case 1031:
          return c.v1031;
        case 1032:
          return c.v1032;
        case 1033:
          return c.v1033;
        case 1050:
          return c.v1050;
    Potential Logic Validation

    Confirm that the logic for returning 1050 as the latest spec version for canary-relaychain is correct and does not conflict with other network conditions.

    return 1050;

    @github-actions
    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Handle unsupported network values

    Validate that the getLatestSpecVersion function handles all possible network values
    to prevent unexpected behavior or errors.

    lib/handler/general.dart [16-17]

     if (network == 'canary-relaychain') {
       return 1050;
    +} else {
    +  throw ArgumentError('Unsupported network: $network');
     }
    Suggestion importance[1-10]: 8

    Why: The suggestion improves the robustness of the getLatestSpecVersion function by ensuring unsupported network values are handled explicitly, which could prevent runtime errors and unexpected behavior. This is a meaningful enhancement to the code.

    8
    General
    Avoid hardcoding version in canaryLatest

    Ensure that the canaryLatest function returns the correct and most up-to-date
    version, as hardcoding c.v1050 could lead to maintenance issues when newer versions
    are added.

    lib/consts/enjin/enjin.dart [5]

    -return c.v1050;
    +return c.v1050; // Consider dynamically determining the latest version to avoid future maintenance issues.
    Suggestion importance[1-10]: 7

    Why: The suggestion highlights a valid concern about maintainability, as hardcoding the version in canaryLatest could lead to issues when newer versions are introduced. However, the improved code does not resolve the issue but only adds a comment, making it less impactful.

    7

    @leonardocustodio leonardocustodio merged commit 5d330fe into master Jan 28, 2025
    1 check passed
    @leonardocustodio leonardocustodio deleted the feature/PLA-2151/new-relay-metadata branch January 28, 2025 00:45
    Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

    Development

    Successfully merging this pull request may close these issues.

    2 participants