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

add contract setup script #144

Merged
merged 1 commit into from
Jul 22, 2024
Merged

add contract setup script #144

merged 1 commit into from
Jul 22, 2024

Conversation

RnkSngh
Copy link
Collaborator

@RnkSngh RnkSngh commented Jul 22, 2024

PR to allow for deploying & sending txs within a single script. This will help clean up the complexity in our contract deployment CI, by allowing us to have a single script for deploying & upgrading contracts

Summary by CodeRabbit

  • New Features

    • Renamed command for updating smart contracts to "update-vibc-core-smart-contracts" for clarity.
    • Introduced a new script for managing contract updates, enhancing blockchain management.
    • Added functionality for simultaneous updating and deploying smart contracts on specified blockchains.
  • Bug Fixes

    • Improved transaction handling by streamlining the transaction processing loop.
  • Enhancements

    • Added schemas for contract updates and improved validation processes.
    • Enhanced functionality for connecting multiple wallet accounts to Ethereum providers.
  • Chores

    • Updated build configuration to include the new contract update script.

Copy link

coderabbitai bot commented Jul 22, 2024

Walkthrough

The recent changes enhance smart contract management by transitioning from "upgrade" to "update," refining deployment and transaction handling processes. New schemas for contract updates are introduced, streamlining script functionalities and improving organization. This update broadens the capabilities for managing contract versions while enhancing user experience with clearer code structure and better-defined processes.

Changes

Files Change Summary
package.json Renamed command and script paths from "upgrade" to "update" in the bin section to clarify contract management terminology.
specs/update.spec.yaml, specs/upgrade.spec.yaml Added specifications for contract deployment and new configuration for "UCH Upgrade," enhancing contract management.
src/deploy.ts Introduced deployContract function for streamlined deployment; modified deployToChain to utilize the new function.
src/evm/account.ts Introduced connectProviderAccounts to connect multiple accounts to an Ethereum provider efficiently.
src/evm/schemas/contract.ts, src/evm/schemas/contractUpdate.ts Changed ContractItemSchema to an exported constant; added UpdateContractConfigSchema for managing contract updates.
src/evm/schemas/tx.ts Made TxItemSchema an exported constant for improved modularity.
src/scripts/update-contracts-script.ts New script added for managing contract updates via command line.
src/tx.ts Added sendTx function for handling transactions, modifying the existing sendTxToChain function for better flow.
src/updateContract.ts Introduced updateContractForChain for simultaneous updating and deployment of smart contracts.
src/utils/constants.ts Added new constant UPDATE_SPECS_PATH for configuration management.
tsup.config.ts Updated build configuration to include the new update script instead of the old upgrade script.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script
    participant ContractRegistry
    participant Logger

    User->>Script: Execute contract update command
    Script->>ContractRegistry: Fetch existing contracts
    Script->>Logger: Log the update process
    Script->>ContractRegistry: Update contracts
    Logger-->>User: Display update status
Loading

🐰 "A script so bright, with updates anew,
Contracts dance in a blockchain view.
From upgrade to update, we hop with glee,
Managing our contracts, so simply and free!
With every transaction, a leap and a bound,
In this digital garden, joyfully found!" 🌼


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 Configuration 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

@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: 26

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aa7caa4 and fcb8f1d.

Files selected for processing (13)
  • package.json (1 hunks)
  • specs/update.spec.yaml (1 hunks)
  • specs/upgrade.spec.yaml (1 hunks)
  • src/deploy.ts (6 hunks)
  • src/evm/account.ts (1 hunks)
  • src/evm/schemas/contract.ts (2 hunks)
  • src/evm/schemas/contractUpdate.ts (1 hunks)
  • src/evm/schemas/tx.ts (1 hunks)
  • src/scripts/update-contracts-script.ts (1 hunks)
  • src/tx.ts (3 hunks)
  • src/updateContract.ts (1 hunks)
  • src/utils/constants.ts (1 hunks)
  • tsup.config.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
Additional context used
yamllint
specs/upgrade.spec.yaml

[error] 28-28: trailing spaces

(trailing-spaces)


[error] 30-30: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 35-35: no new line character at the end of file

(new-line-at-end-of-file)

specs/update.spec.yaml

[error] 1-1: trailing spaces

(trailing-spaces)


[error] 11-11: trailing spaces

(trailing-spaces)


[error] 14-14: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 33-33: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 115-115: trailing spaces

(trailing-spaces)


[error] 116-116: trailing spaces

(trailing-spaces)


[error] 117-117: trailing spaces

(trailing-spaces)


[error] 118-118: trailing spaces

(trailing-spaces)


[error] 119-119: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 121-121: trailing spaces

(trailing-spaces)


[error] 122-122: trailing spaces

(trailing-spaces)


[error] 125-125: trailing spaces

(trailing-spaces)


[error] 126-126: trailing spaces

(trailing-spaces)


[error] 127-127: trailing spaces

(trailing-spaces)


[error] 128-128: trailing spaces

(trailing-spaces)


[error] 129-129: trailing spaces

(trailing-spaces)


[error] 130-130: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 134-134: trailing spaces

(trailing-spaces)


[error] 136-136: trailing spaces

(trailing-spaces)


[error] 138-138: trailing spaces

(trailing-spaces)


[error] 140-140: trailing spaces

(trailing-spaces)


[error] 145-145: trailing spaces

(trailing-spaces)


[error] 147-147: trailing spaces

(trailing-spaces)


[error] 149-149: trailing spaces

(trailing-spaces)


[error] 155-155: trailing spaces

(trailing-spaces)


[error] 157-157: trailing spaces

(trailing-spaces)


[error] 159-159: trailing spaces

(trailing-spaces)


[error] 161-161: no new line character at the end of file

(new-line-at-end-of-file)

Biome
src/tx.ts

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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (18)
tsup.config.ts (1)

17-17: Update script reference verified.

The reference to "src/scripts/update-contracts-script.ts" replaces "src/scripts/upgrade-script.ts", aligning with the new script's purpose. Ensure the new script exists and functions as intended.

src/scripts/update-contracts-script.ts (4)

1-1: Ensure the script is executable.

The shebang line #!/usr/bin/env node makes the script executable in a Unix-like environment. Ensure the script has the correct permissions.


10-26: Ensure correct argument parsing and contract updating.

The main function parses CLI arguments, loads contract update specifications, and invokes updateContractForChain. Ensure the logic is correct and handles errors appropriately.


2-4: Verify import paths and functionality.

The imports from relative paths should be verified to ensure they exist and function as expected.

Verification successful

Import paths and functionality verified successfully.

The imported modules ContractRegistryLoader, parseObjFromFile, loadContractUpdateRegistry, and updateContractForChain exist and are defined correctly in the codebase.

  • ContractRegistryLoader: Defined in src/evm/schemas/contract.ts
  • parseObjFromFile: Defined in src/utils/io.ts
  • loadContractUpdateRegistry: Defined in src/evm/schemas/contractUpdate.ts
  • updateContractForChain: Defined in src/updateContract.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of imported modules.

# Test: Check if the imported modules exist. Expect: All modules should be found.
fd 'ContractRegistryLoader' src --exec echo "Found: {}"
fd 'parseObjFromFile' src --exec echo "Found: {}"
fd 'loadContractUpdateRegistry' src --exec echo "Found: {}"
fd 'updateContractForChain' src --exec echo "Found: {}"

Length of output: 221


Script:

#!/bin/bash
# Description: Verify the existence of imported modules using ripgrep.

# Test: Check if the imported modules exist. Expect: All modules should be found.
rg 'ContractRegistryLoader' -t js -A 3
rg 'parseObjFromFile' -t js -A 3
rg 'loadContractUpdateRegistry' -t js -A 3
rg 'updateContractForChain' -t js -A 3

Length of output: 749


Script:

#!/bin/bash
# Description: Verify the existence of imported modules using ripgrep and ast-grep.

# Test: Check if the imported modules exist. Expect: All modules should be found.
rg 'ContractRegistryLoader' -A 3
rg 'parseObjFromFile' -A 3
rg 'loadContractUpdateRegistry' -A 3
rg 'updateContractForChain' -A 3

# Using ast-grep to search for the definitions
ast-grep --lang typescript --pattern 'class ContractRegistryLoader { $$$ }'
ast-grep --lang typescript --pattern 'function parseObjFromFile($_) { $$$ }'
ast-grep --lang typescript --pattern 'function loadContractUpdateRegistry($_) { $$$ }'
ast-grep --lang typescript --pattern 'function updateContractForChain($_) { $$$ }'

Length of output: 13415


6-8: Verify utility imports.

The utility imports from relative paths should be verified to ensure they exist and function as expected.

Verification successful

Utility imports verified.

The imported utility modules have been verified and exist in the codebase:

  • getOutputLogger is defined in src/utils/cli.ts.
  • UPDATE_SPECS_PATH is defined in src/utils/constants.ts.
  • parseArgsFromCLI is defined in src/utils/io.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of imported utility modules.

# Test: Check if the utility modules exist. Expect: All modules should be found.
fd 'getOutputLogger' src --exec echo "Found: {}"
fd 'UPDATE_SPECS_PATH' src --exec echo "Found: {}"
fd 'parseArgsFromCLI' src --exec echo "Found: {}"

Length of output: 149


Script:

#!/bin/bash
# Description: Verify the existence of imported utility modules using ast-grep.

# Test: Check if the utility function getOutputLogger exists. Expect: The function should be found.
ast-grep --lang typescript --pattern 'function getOutputLogger($_) { $$$ }'

# Test: Check if the constant UPDATE_SPECS_PATH exists. Expect: The constant should be found.
ast-grep --lang typescript --pattern 'const UPDATE_SPECS_PATH = $_'

# Test: Check if the function parseArgsFromCLI exists. Expect: The function should be found.
ast-grep --lang typescript --pattern 'function parseArgsFromCLI($_) { $$$ }'

Length of output: 459


Script:

#!/bin/bash
# Description: Verify the existence of imported utility modules using rg.

# Test: Check if the utility function getOutputLogger exists. Expect: The function should be found.
rg 'function getOutputLogger' -A 5

# Test: Check if the function parseArgsFromCLI exists. Expect: The function should be found.
rg 'function parseArgsFromCLI' -A 5

Length of output: 828

src/evm/schemas/tx.ts (3)

5-6: Export TxItemSchema for reusability.

The export of TxItemSchema enhances modularity and reusability across the application.


22-22: Enforce strict validation with .strict().

Adding .strict() to the schema ensures only specified fields are allowed, improving data integrity.


24-24: Export TxItem for type safety.

The export of TxItem promotes type safety and consistency when working with transaction items.

src/evm/schemas/contractUpdate.ts (2)

1-13: LGTM!

The UpdateContractConfigSchema correctly combines TxItemSchema and ContractItemSchema using z.union. The UpdateContractRegistry class extends Registry with the appropriate type.


14-29: LGTM!

The function loadContractUpdateRegistry correctly parses the config file and handles errors using safeParse. It returns an UpdateContractRegistry instance with the parsed data.

src/utils/constants.ts (1)

49-52: LGTM!

The new constant UPDATE_SPECS_PATH is correctly defined and follows the existing pattern for constants.

src/evm/schemas/contract.ts (3)

6-6: LGTM! Exporting ContractItemSchema improves reusability.

The change enhances the schema's accessibility across different modules.


15-16: LGTM! Stricter validation for libraries improves data integrity.

The schema now ensures that each library has a non-empty name and address.


25-26: LGTM! Stricter validation for initialization data improves data integrity.

The schema now ensures that the signature and args fields are non-empty strings.

src/updateContract.ts (1)

15-25: LGTM! The updateContractForChain function is comprehensive and well-structured.

The function handles contract updates, including deployment and transaction sending, with logging and error handling.

src/tx.ts (1)

15-23: LGTM! The sendTx function encapsulates transaction logic effectively.

The function handles ABI retrieval, transaction sending, and error management.

src/evm/account.ts (1)

105-117: LGTM! But verify the function usage in the codebase.

The function connectProviderAccounts correctly connects all accounts in the AccountRegistry to the specified Ethereum provider. The logic and syntax appear correct.

However, ensure that all function calls to connectProviderAccounts are correctly implemented across the codebase.

Verification successful

The function usage is correctly implemented.

The function connectProviderAccounts is used appropriately across the codebase in the following files:

  • src/tx.ts
  • src/updateContract.ts
  • src/deploy.ts

The function is called with the correct parameters, ensuring that all accounts in the AccountRegistry are connected to the specified Ethereum provider.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `connectProviderAccounts` are correctly implemented.

# Test: Search for the function usage. Expect: Correct implementation.
rg --type typescript -A 5 $'connectProviderAccounts'

Length of output: 86


Script:

#!/bin/bash
# Description: Verify all function calls to `connectProviderAccounts` are correctly implemented.

# Test: Search for the function usage. Expect: Correct implementation.
rg --type ts -A 5 $'connectProviderAccounts'

Length of output: 2310

src/deploy.ts (1)

Line range hint 156-206:
LGTM!

The function deployToChain is well-structured and includes necessary error handling.

src/evm/schemas/contract.ts Show resolved Hide resolved
src/updateContract.ts Show resolved Hide resolved
src/updateContract.ts Show resolved Hide resolved
src/updateContract.ts Show resolved Hide resolved
src/updateContract.ts Show resolved Hide resolved
src/tx.ts Show resolved Hide resolved
src/tx.ts Show resolved Hide resolved
src/tx.ts Show resolved Hide resolved
@RnkSngh RnkSngh force-pushed the raunak/deploy-ux-fixes branch from fcb8f1d to b09dcbc Compare July 22, 2024 20:59
Copy link

@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: 4

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fcb8f1d and b09dcbc.

Files selected for processing (5)
  • package.json (1 hunks)
  • specs/update.spec.yaml (1 hunks)
  • specs/upgrade.spec.yaml (1 hunks)
  • src/deploy.ts (6 hunks)
  • src/evm/account.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
Files skipped from review as they are similar to previous changes (1)
  • src/evm/account.ts
Additional context used
yamllint
specs/upgrade.spec.yaml

[error] 28-28: trailing spaces

(trailing-spaces)


[error] 30-30: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 35-35: no new line character at the end of file

(new-line-at-end-of-file)

specs/update.spec.yaml

[error] 1-1: trailing spaces

(trailing-spaces)


[error] 11-11: trailing spaces

(trailing-spaces)


[error] 14-14: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 33-33: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 115-115: trailing spaces

(trailing-spaces)


[error] 116-116: trailing spaces

(trailing-spaces)


[error] 117-117: trailing spaces

(trailing-spaces)


[error] 118-118: trailing spaces

(trailing-spaces)


[error] 119-119: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 121-121: trailing spaces

(trailing-spaces)


[error] 122-122: trailing spaces

(trailing-spaces)


[error] 125-125: trailing spaces

(trailing-spaces)


[error] 126-126: trailing spaces

(trailing-spaces)


[error] 127-127: trailing spaces

(trailing-spaces)


[error] 128-128: trailing spaces

(trailing-spaces)


[error] 129-129: trailing spaces

(trailing-spaces)


[error] 130-130: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 134-134: trailing spaces

(trailing-spaces)


[error] 136-136: trailing spaces

(trailing-spaces)


[error] 138-138: trailing spaces

(trailing-spaces)


[error] 140-140: trailing spaces

(trailing-spaces)


[error] 145-145: trailing spaces

(trailing-spaces)


[error] 147-147: trailing spaces

(trailing-spaces)


[error] 149-149: trailing spaces

(trailing-spaces)


[error] 155-155: trailing spaces

(trailing-spaces)


[error] 157-157: trailing spaces

(trailing-spaces)


[error] 159-159: trailing spaces

(trailing-spaces)


[error] 161-161: no new line character at the end of file

(new-line-at-end-of-file)

Additional comments not posted (1)
src/deploy.ts (1)

Line range hint 156-204:
LGTM!

The function deployToChain is well-structured and effectively leverages the new deployContract function.

specs/update.spec.yaml Show resolved Hide resolved
src/deploy.ts Show resolved Hide resolved
@RnkSngh RnkSngh force-pushed the raunak/deploy-ux-fixes branch from b09dcbc to 40bb42a Compare July 22, 2024 21:55
Copy link

@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: 18

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b09dcbc and 40bb42a.

Files selected for processing (13)
  • package.json (1 hunks)
  • specs/update.spec.yaml (1 hunks)
  • specs/upgrade.spec.yaml (1 hunks)
  • src/deploy.ts (6 hunks)
  • src/evm/account.ts (1 hunks)
  • src/evm/schemas/contract.ts (2 hunks)
  • src/evm/schemas/contractUpdate.ts (1 hunks)
  • src/evm/schemas/tx.ts (1 hunks)
  • src/scripts/update-contracts-script.ts (1 hunks)
  • src/tx.ts (3 hunks)
  • src/updateContract.ts (1 hunks)
  • src/utils/constants.ts (1 hunks)
  • tsup.config.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • package.json
Files skipped from review as they are similar to previous changes (7)
  • src/evm/schemas/contract.ts
  • src/evm/schemas/contractUpdate.ts
  • src/evm/schemas/tx.ts
  • src/scripts/update-contracts-script.ts
  • src/updateContract.ts
  • src/utils/constants.ts
  • tsup.config.ts
Additional context used
yamllint
specs/upgrade.spec.yaml

[error] 28-28: trailing spaces

(trailing-spaces)


[error] 30-30: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 35-35: no new line character at the end of file

(new-line-at-end-of-file)

specs/update.spec.yaml

[error] 1-1: trailing spaces

(trailing-spaces)


[error] 11-11: trailing spaces

(trailing-spaces)


[error] 14-14: trailing spaces

(trailing-spaces)


[error] 29-29: trailing spaces

(trailing-spaces)


[error] 33-33: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 115-115: trailing spaces

(trailing-spaces)


[error] 116-116: trailing spaces

(trailing-spaces)


[error] 117-117: trailing spaces

(trailing-spaces)


[error] 118-118: trailing spaces

(trailing-spaces)


[error] 119-119: trailing spaces

(trailing-spaces)


[error] 120-120: trailing spaces

(trailing-spaces)


[error] 121-121: trailing spaces

(trailing-spaces)


[error] 122-122: trailing spaces

(trailing-spaces)


[error] 125-125: trailing spaces

(trailing-spaces)


[error] 126-126: trailing spaces

(trailing-spaces)


[error] 127-127: trailing spaces

(trailing-spaces)


[error] 128-128: trailing spaces

(trailing-spaces)


[error] 129-129: trailing spaces

(trailing-spaces)


[error] 130-130: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 134-134: trailing spaces

(trailing-spaces)


[error] 136-136: trailing spaces

(trailing-spaces)


[error] 138-138: trailing spaces

(trailing-spaces)


[error] 140-140: trailing spaces

(trailing-spaces)


[error] 145-145: trailing spaces

(trailing-spaces)


[error] 147-147: trailing spaces

(trailing-spaces)


[error] 149-149: trailing spaces

(trailing-spaces)


[error] 155-155: trailing spaces

(trailing-spaces)


[error] 157-157: trailing spaces

(trailing-spaces)


[error] 159-159: trailing spaces

(trailing-spaces)


[error] 161-161: no new line character at the end of file

(new-line-at-end-of-file)

Biome
src/tx.ts

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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (7)
src/tx.ts (5)

2-4: LGTM! Imports are necessary for new functionality.

The new imports for connectProviderAccounts, TxItem, and TxRegistry are necessary for the new functionality introduced in the file.


15-75: LGTM! The new function sendTx is well-structured and includes necessary error handling.

The function encapsulates the logic for sending transactions to existing contracts, including ABI retrieval, transaction sending, and error handling, which improves code robustness.

Tools
Biome

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

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


82-84: LGTM! The modification to use sendTx improves code readability.

The modification streamlines the transaction processing loop by delegating the logic to sendTx, leading to a cleaner separation of concerns.


97-97: Suggestion: Add error handling for account connection.

Consider adding error handling for the connectProviderAccounts function to manage potential connection issues.

-    accountRegistry = connectProviderAccounts(accountRegistry, chain.rpc);
+    try {
+      accountRegistry = connectProviderAccounts(accountRegistry, chain.rpc);
+    } catch (error) {
+      logger.error(`Failed to connect provider accounts: ${error.message}`);
+      throw error;
+    }

114-122: LGTM! The function now uses sendTx for transaction processing.

The change ensures that the new sendTx function is used for transaction processing, improving modularity and maintainability.

src/evm/account.ts (1)

105-117: LGTM! The new function connectProviderAccounts is well-structured.

The function connects all accounts in an AccountRegistry to an Ethereum provider using a provided RPC URL, facilitating blockchain interactions.

src/deploy.ts (1)

150-153: Improve error handling by providing more context.

Consider providing more context in the error message to help with debugging.

-    logger.error(
-      `[${chain.chainName}-${chain.deploymentEnvironment}] deploy ${contract.name} failed: ${err}`
-    );
+    logger.error({
+      message: `[${chain.chainName}-${chain.deploymentEnvironment}] deploy ${contract.name} failed`,
+      error: err,
+      contract,
+      chain,
+    });

Likely invalid or redundant comment.

specs/upgrade.spec.yaml Show resolved Hide resolved
src/tx.ts Show resolved Hide resolved
specs/update.spec.yaml Show resolved Hide resolved
specs/update.spec.yaml Show resolved Hide resolved
specs/update.spec.yaml Show resolved Hide resolved
specs/update.spec.yaml Show resolved Hide resolved
specs/update.spec.yaml Show resolved Hide resolved
specs/update.spec.yaml Show resolved Hide resolved
specs/update.spec.yaml Show resolved Hide resolved
src/deploy.ts Show resolved Hide resolved
@RnkSngh RnkSngh merged commit 27f9e3f into main Jul 22, 2024
3 checks passed
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.

2 participants