Skip to content

support Paseo #1401

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

Merged
merged 7 commits into from
Jul 1, 2024
Merged

support Paseo #1401

merged 7 commits into from
Jul 1, 2024

Conversation

Nick-1979
Copy link
Member

@Nick-1979 Nick-1979 commented Jun 29, 2024

add paseo and its asset hub

Governance is disabled for Paseo atm intentionally

closes #1398

Summary by CodeRabbit

  • New Features

    • Added support for the Paseo chain and asset hub in multiple configurations and constants.
  • Enhancements

    • Updated @polkagate/apps-config to version ^0.140.2.
    • Improved handling of chain names and additional chain-specific features.
  • Bug Fixes

    • Updated code to use bracket notation for state and API access to handle potential null values and improve robustness.
    • Adjusted validator filtering and sorting logic for better accuracy.
  • Refactor

    • Simplified console logs for better readability and maintenance.

add paseo and its asset hub
@Nick-1979 Nick-1979 requested a review from AMIRKHANEF June 29, 2024 15:19
Copy link
Contributor

coderabbitai bot commented Jun 29, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

This update primarily enhances versioning, refines handling and display of validator data, incorporates new constants, and heightens type safety across various modules. Notable improvements include the integration of new constants, such as the Paseo Asset Hub, refined state handling, and safer property access methods. These adjustments bolster overall stability and prepare for broader chain support.

Changes

File(s) Change Summary
package.json Updated @polkagate/apps-config version to ^0.140.2
.../index.tsx Updated state handling and constants import for POLKAGATE_POOL_IDS
.../ShowValidator.tsx Used optional chaining to safely access v.exposure.others.length
.../ValidatorsTable.tsx Enhanced type annotations, nullable value handling, and property accesses
.../usePeopleChain.ts Added PASEO_GENESIS_HASH and updated logic for Paseo chain name
.../useValidatorSuggestion.ts Adjusted validator filtering and sorting, ensuring safe property access
.../popup/staking/partial/ShowValidator.tsx Used optional chaining for v.exposure.others.length
.../constants.tsx Added new constants and updated several arrays to include PASEO_* constants
.../utils.ts Updated sanitizeChainName to cover an additional replacement
.../useTeleport.ts Changed property access for parachainId using bracket notation
replacements/interfaces.js Added declarations for Paseo and updated configurations for testnets and asset hubs

Poem

In a codebase, vast and wide,
New constants now do abide.
Optional chains to guard what's best,
From pools to chains, it's all addressed.
With brackets new, and safer ties,
We venture forth, towards vast skies.
Embrace the change, with joy and cheer,
For in the code, our path is clear.


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range and nitpick comments (1)
packages/extension-polkagate/src/hooks/useValidatorSuggestion.ts (1)

Line range hint 19-19: Fix the optional chaining.

Change to an optional chain to handle potential null values.

- const allValidatorsAccountIds = useMemo(() => allValidatorsInfo && allValidatorsInfo.current.concat(allValidatorsInfo.waiting)?.map((v) => v.accountId), [allValidatorsInfo]);
+ const allValidatorsAccountIds = useMemo(() => allValidatorsInfo?.current.concat(allValidatorsInfo.waiting)?.map((v) => v.accountId), [allValidatorsInfo]);
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e22cc96 and 04b1ac3.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (10)
  • package.json (1 hunks)
  • packages/extension-polkagate/src/fullscreen/stake/easyMode/index.tsx (5 hunks)
  • packages/extension-polkagate/src/fullscreen/stake/solo/partials/ShowValidator.tsx (1 hunks)
  • packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx (3 hunks)
  • packages/extension-polkagate/src/hooks/usePeopleChain.ts (3 hunks)
  • packages/extension-polkagate/src/hooks/useValidatorSuggestion.ts (4 hunks)
  • packages/extension-polkagate/src/popup/staking/partial/ShowValidator.tsx (1 hunks)
  • packages/extension-polkagate/src/util/constants.tsx (4 hunks)
  • packages/extension-polkagate/src/util/utils.ts (1 hunks)
  • replacements/interfaces.js (4 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
Additional context used
Biome
packages/extension-polkagate/src/hooks/useValidatorSuggestion.ts

[error] 19-19: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx

[error] 101-101: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

GitHub Check: build
packages/extension-polkagate/src/fullscreen/stake/easyMode/index.tsx

[failure] 72-72:
Argument of type 'Codec' is not assignable to parameter of type 'SetStateAction<Balance | undefined>'.


[failure] 76-76:
Argument of type 'Codec' is not assignable to parameter of type 'SetStateAction<Balance | undefined>'.

Additional comments not posted (31)
packages/extension-polkagate/src/hooks/usePeopleChain.ts (2)

10-10: Import looks good.

The import of PASEO_GENESIS_HASH from ../util/constants is appropriate and necessary for the subsequent logic.


36-37: Case addition looks good.

The case for Paseo in the getPeopleChainGenesisHash function to return PASEO_GENESIS_HASH is correctly integrated.

replacements/interfaces.js (4)

50-52: Genesis hash addition looks good.

The addition of paseo to the knownGenesis object with the specified genesis hash is correctly integrated.


53-55: Genesis hash addition looks good.

The addition of paseoAssetHub to the knownGenesis object with the specified genesis hash is correctly integrated.


67-74: Testnet addition looks good.

The addition of the Paseo Testnet to the testnets array is correctly integrated with the appropriate configuration.


104-110: Asset Hub addition looks good.

The addition of the Paseo Asset Hub to the assetHubs array is correctly integrated with the appropriate configuration.

packages/extension-polkagate/src/hooks/useValidatorSuggestion.ts (3)

25-25: Filtering logic update looks good.

The update to handle validatorPrefs.blocked as a boolean ensures type safety and correct filtering.


40-40: Sorting logic update looks good.

The update to include an optional chaining operator ensures that potential null values are handled correctly.


67-67: Filtering logic update looks good.

The update to include an optional chaining operator ensures that potential null values are handled correctly.

packages/extension-polkagate/src/popup/staking/partial/ShowValidator.tsx (1)

103-103: Use of Optional Chaining for Null Safety

The update to use optional chaining (v.exposure.others?.length) improves null safety and prevents potential runtime errors if v.exposure.others is undefined.

packages/extension-polkagate/src/fullscreen/stake/solo/partials/ShowValidator.tsx (1)

111-111: Use of Optional Chaining for Null Safety

The update to use optional chaining (v.exposure.others?.length) improves null safety and prevents potential runtime errors if v.exposure.others is undefined.

packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx (4)

10-10: Use of Optional Chaining for Null Safety

The update to use optional chaining (v.exposure.others?.length) improves null safety and prevents potential runtime errors if v.exposure.others is undefined.


13-13: Change Import Statement to Use Type Only Imports

Changing the import statement to use import type for DeriveAccountInfo helps to optimize the code by ensuring that only the type information is imported, which can result in better performance and reduced bundle size.


58-58: Use of Optional Chaining for Null Safety

The update to use optional chaining (v.exposure.others?.sort) improves null safety and prevents potential runtime errors if v.exposure.others is undefined.


62-63: Use of Optional Chaining for Null Safety

The update to use optional chaining (v.exposure.others?.length) improves null safety and prevents potential runtime errors if v.exposure.others is undefined.

packages/extension-polkagate/src/fullscreen/stake/easyMode/index.tsx (5)

20-20: Import POLKAGATE_POOL_IDS from constants

The constant POLKAGATE_POOL_IDS is now imported from ../../../util/constants, which improves maintainability by centralizing constant definitions.


34-34: Type assertion for chainName

The type assertion chainName as string ensures that chainName is treated as a string, which can help prevent type errors.


39-39: Bracket notation for dynamic property

Using bracket notation inputs?.extraInfo?.['amount'] ensures that the amount property is correctly accessed, especially if it is dynamic or contains special characters.


52-52: Bracket notation for dynamic property

Using bracket notation inputs?.extraInfo?.['amount'] ensures that the amount property is correctly accessed for calculating isBusy.


100-100: Simplified console log

The console log statement is simplified to console.log('waiting for pool:', pool);, reducing noise in the console output.

packages/extension-polkagate/src/util/constants.tsx (10)

10-15: New constant for pool IDs

The POLKAGATE_POOL_IDS constant is added to store pool IDs for Kusama, Polkadot, Westend, and Paseo. This centralizes the pool ID definitions and improves maintainability.


42-42: New constant for Paseo Asset Hub genesis hash

The PASEO_ASSET_HUB_GENESIS_HASH constant is added, which is necessary for identifying the Paseo Asset Hub.


49-49: Updated relay chains names

The RELAY_CHAINS_NAMES array is updated to include Paseo, ensuring that Paseo is recognized as a relay chain.


55-55: New constant for Paseo genesis hash

The PASEO_GENESIS_HASH constant is added, which is necessary for identifying the Paseo chain.


61-61: Updated relay chains genesis hashes

The RELAY_CHAINS_GENESISHASH array is updated to include PASEO_GENESIS_HASH, ensuring that Paseo's genesis hash is recognized.


68-68: Updated asset hubs

The ASSET_HUBS array is updated to include PASEO_ASSET_HUB_GENESIS_HASH, ensuring that Paseo Asset Hub is recognized.


76-76: Updated test nets

The TEST_NETS array is updated to include PASEO_GENESIS_HASH and PASEO_ASSET_HUB_GENESIS_HASH, ensuring that both Paseo and Paseo Asset Hub are recognized as test nets.


83-83: Updated proxy chains

The PROXY_CHAINS array is updated to include PASEO_GENESIS_HASH, ensuring that Paseo is recognized as a proxy chain.


108-108: Updated staking chains

The STAKING_CHAINS array is updated to include PASEO_GENESIS_HASH, ensuring that Paseo is recognized as a staking chain.


153-153: Updated chain proxy types

The CHAIN_PROXY_TYPES object is updated to include AssetHubs, ensuring that AssetHubs are recognized as a proxy type.

packages/extension-polkagate/src/util/utils.ts (1)

339-339: Updated sanitizeChainName function

The sanitizeChainName function is updated to include replacement for ' Testnet', ensuring that ' Testnet' is removed from chain names.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 04b1ac3 and e4fb1ce.

Files selected for processing (1)
  • packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx (3 hunks)
Additional context used
Biome
packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx

[error] 101-101: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

GitHub Check: build
packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx

[failure] 98-98:
'v' is possibly 'undefined'.


[failure] 99-99:
Argument of type 'ValidatorInfo | undefined' is not assignable to parameter of type 'ValidatorInfo'.


[failure] 101-101:
Argument of type 'ValidatorInfo | undefined' is not assignable to parameter of type 'ValidatorInfo'.


[failure] 102-102:
'v' is possibly 'undefined'.


[failure] 118-118:
Type 'ValidatorInfo | undefined' is not assignable to type 'ValidatorInfo'.


[failure] 120-120:
Argument of type 'ValidatorInfo | undefined' is not assignable to parameter of type 'ValidatorInfo'.

Additional comments not posted (1)
packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx (1)

62-63: Use Optional Chaining for Null Safety

The use of optional chaining for v.exposure.others ensures that the code handles potential null or undefined values gracefully. This is a good practice to avoid runtime errors.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e4fb1ce and 3e321a6.

Files selected for processing (2)
  • packages/extension-polkagate/src/fullscreen/stake/easyMode/index.tsx (6 hunks)
  • packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/extension-polkagate/src/fullscreen/stake/easyMode/index.tsx
Additional context used
Biome
packages/extension-polkagate/src/fullscreen/stake/solo/partials/ValidatorsTable.tsx

[error] 101-101: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

@AMIRKHANEF
Copy link
Member

Proxy type list issue found

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3e321a6 and 4aa1a5f.

Files selected for processing (1)
  • packages/extension-polkagate/src/util/constants.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/extension-polkagate/src/util/constants.tsx

@Nick-1979 Nick-1979 merged commit ba0074f into main Jul 1, 2024
3 checks passed
@Nick-1979 Nick-1979 deleted the addPaseo branch July 9, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support paseo chain
2 participants