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

[PLA-1704] Add WhitelistedPallets codec #146

Merged
merged 2 commits into from
Mar 29, 2024
Merged

[PLA-1704] Add WhitelistedPallets codec #146

merged 2 commits into from
Mar 29, 2024

Conversation

leonardocustodio
Copy link
Member

@leonardocustodio leonardocustodio commented Mar 29, 2024

Type

enhancement


Description

  • Added "WhitelistedPallets" to the TankStorage codec to support new storage and dispatch rule types.

Changes walkthrough

Relevant files
Enhancement
TankStorage.json
Add WhitelistedPallets to TankStorage Codec                           

src/Services/Processor/Substrate/Codec/Types/TankStorage.json

  • Added "WhitelistedPallets" to the list of Storage types.
  • Included "WhitelistedPallets" with type "Vec" in DispatchRuleStorage
    enum.
  • +4/-2     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @leonardocustodio leonardocustodio self-assigned this Mar 29, 2024
    @github-actions github-actions bot added the enhancement New feature or request label Mar 29, 2024
    Copy link

    PR Description updated to latest commit (db0bb8b)

    Copy link

    PR Review

    ⏱️ Estimated effort to review [1-5]

    1, because the changes are straightforward and involve adding a new field to an existing JSON structure. The complexity and size of the PR are minimal, making it easy to review.

    🧪 Relevant tests

    No

    🔍 Possible issues

    No

    🔒 Security concerns

    No

    Code feedback:

    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

    The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

    • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    
    [pr_reviewer]
    some_config1=...
    some_config2=...
    

    See the review usage page for a comprehensive guide on using this tool.

    Copy link

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Add a description for the new "WhitelistedPallets" field for clarity.

    Consider adding a description for the new "WhitelistedPallets" field to maintain
    consistency and clarity in the JSON structure. Descriptions help developers understand the
    purpose and usage of each field, especially in complex configurations.

    src/Services/Processor/Substrate/Codec/Types/TankStorage.json [58]

    -"WhitelistedPallets": "Vec<Bytes>"
    +"WhitelistedPallets": {
    +  "description": "A list of pallets that are whitelisted for...",
    +  "type": "Vec<Bytes>"
    +}
     
    Consider using a more descriptive data type for "WhitelistedPallets".

    Verify the data type for "WhitelistedPallets" is appropriate. If "WhitelistedPallets" are
    expected to be a list of specific pallet names or identifiers, consider using a more
    descriptive type than "Vec", such as a list of strings, to improve readability and reduce
    potential errors in data handling.

    src/Services/Processor/Substrate/Codec/Types/TankStorage.json [58]

    -"WhitelistedPallets": "Vec<Bytes>"
    +"WhitelistedPallets": "Vec<String>"
     
    Best practice
    Ensure schema validation rules are updated for new fields.

    Ensure that the addition of "PermittedExtrinsics" and "WhitelistedPallets" aligns with the
    overall schema validation rules. If these fields are mandatory, update the schema
    validation to reflect this. Otherwise, consider making them optional to avoid breaking
    existing configurations.

    src/Services/Processor/Substrate/Codec/Types/TankStorage.json [57-58]

    -"PermittedExtrinsics": "PermittedExtrinsicsRuleStorage",
    -"WhitelistedPallets": "Vec<Bytes>"
    +"PermittedExtrinsics": {
    +  "type": "PermittedExtrinsicsRuleStorage",
    +  "required": true
    +},
    +"WhitelistedPallets": {
    +  "type": "Vec<Bytes>",
    +  "required": true
    +}
     
    Add examples or default values for new fields to aid understanding.

    For the newly added "PermittedExtrinsics" and "WhitelistedPallets" fields, consider adding
    examples or default values if applicable. This can help developers understand the expected
    format and values for these fields, especially when integrating or testing new
    configurations.

    src/Services/Processor/Substrate/Codec/Types/TankStorage.json [57-58]

    -"PermittedExtrinsics": "PermittedExtrinsicsRuleStorage",
    -"WhitelistedPallets": "Vec<Bytes>"
    +"PermittedExtrinsics": {
    +  "type": "PermittedExtrinsicsRuleStorage",
    +  "example": "ExampleValue"
    +},
    +"WhitelistedPallets": {
    +  "type": "Vec<Bytes>",
    +  "example": ["ExamplePallet1", "ExamplePallet2"]
    +}
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

    • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    
    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    

    See the improve usage page for a comprehensive guide on using this tool.

    @leonardocustodio leonardocustodio merged commit ccadd3d into master Mar 29, 2024
    5 checks passed
    @leonardocustodio leonardocustodio deleted the PLA-1704 branch March 29, 2024 21:22
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Development

    Successfully merging this pull request may close these issues.

    2 participants