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

Upgrade to web3py, fixes on ETHAccount/PAYG, EVM configs #154

Merged
merged 11 commits into from
Aug 26, 2024

Conversation

philogicae
Copy link
Member

@philogicae philogicae commented Aug 23, 2024

  • Add web3py depdendencies
  • Methods for balances (eth & aleph) and transactions
  • Superfluid connector rework
  • New config for EVM chains (allowing easy addition of new chains in the future)

@philogicae philogicae self-assigned this Aug 25, 2024
@philogicae philogicae marked this pull request as ready for review August 26, 2024 15:36
Copy link

Summary and Highlights

This PR introduces significant changes to the Python SDK library for the Aleph.im network, including updates to dependencies, new features, and modifications to existing logic. The main changes include:

  1. Dependency Updates:

    • Updated aleph-message to 0.4.9.
    • Added a new dependency superfluid@git+https://github.com/1yam/superfluid.py.git@1yam-add-base.
    • Added web3==6.3.0 as a dependency.
  2. Code Refactoring:

    • The ETHAccount class has been refactored to improve readability and maintainability.
    • Added asynchronous methods for transaction signing and sending.
  3. New Features:

    • Introduced asynchronous methods for creating, deleting, and updating flows in the Superfluid class.
    • Added support for multiple chains and updated the configuration to include chain-specific settings.
  4. Bug Fixes and Improvements:

    • Fixed potential issues with transaction signing and broadcasting.
    • Added checks to ensure sufficient funds before initiating transactions.

Detailed Changes

pyproject.toml

  • Updated aleph-message to 0.4.9.
  • Replaced superfluid~=0.2.1 with superfluid@git+https://github.com/1yam/superfluid.py.git@1yam-add-base.
  • Added web3==6.3.0 as a dependency.

src/aleph/sdk/chains/ethereum.py

  • Added asynchronous methods for transaction signing and sending.
  • Introduced connect_chain method to initialize the Web3 provider and superfluid connector.
  • Added checks to ensure sufficient funds before initiating transactions.

src/aleph/sdk/conf.py

  • Updated the configuration to include chain-specific settings, such as RPC URLs and chain IDs.
  • Added TOKEN_DECIMALS and TX_TIMEOUT settings.

src/aleph/sdk/connectors/superfluid.py

  • Introduced asynchronous methods for creating, deleting, and updating flows.
  • Added checks to ensure sufficient funds before initiating flows.

src/aleph/sdk/evm_utils.py

  • Added utility functions to convert between human-readable token amounts and Wei values.
  • Added utility functions to get chain-specific information, such as RPC URLs and token addresses.

src/aleph/sdk/types.py

  • Added ChainInfo model to store chain-specific information.

tests/unit/test_superfluid.py

  • Updated unit tests to cover the new asynchronous methods in the Superfluid class.
  • Added checks to ensure sufficient funds before initiating transactions.

Potential Impact and Review Complexity

The changes in this PR introduce new dependencies and refactor the existing codebase, which could potentially affect the stability and performance of the application. The review complexity is moderate due to the number of changes and the potential for introducing bugs.

Review Points:

  1. Verify that the new dependencies are compatible with the existing codebase.
  2. Check that the asynchronous methods for transaction signing and sending are correctly implemented.
  3. Ensure that the checks for sufficient funds are correctly placed to prevent transaction failures.
  4. Review the new chain-specific settings to ensure they are correctly configured.

This categorization is based on the changes introduced in the PR and the potential impact on the codebase. The review complexity is considered moderate due to the number of changes and the potential for introducing bugs.

@github-actions github-actions bot added the RED This PR is complex and may require more time to review. label Aug 26, 2024
@nesitor nesitor merged commit 2d4ded1 into main Aug 26, 2024
14 of 15 checks passed
@nesitor nesitor deleted the feature-web3-payg-base branch August 26, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RED This PR is complex and may require more time to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants