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

fix(connector-polkadot): use dynamic import calls for ESM dependencies #3417

Merged

Conversation

petermetz
Copy link
Contributor

  1. The polkadot libraries are all ESM-only so we have to import them
    in a specific way in order to avoid runtime crashes.
  2. This was not done in the original implementation of the polkadot
    connector and because of that all the tests were failing.
  3. Refactoring the code so that all polkadot related dependencies are
    imported dynamically fixes the issue.
  4. Also fixed the issue where the getRawTransaction HTTP REST handler
    was not await ing for the result of the connector's method which broke
    the run-transaction test case (now also fixed)

Fixes #3077

Signed-off-by: Peter Somogyvari peter.somogyvari@accenture.com

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

Copy link
Contributor

@jagpreetsinghsasan jagpreetsinghsasan left a comment

Choose a reason for hiding this comment

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

LGTM, (lint ,custom checks script and polkadot tests are failing though)

1. The polkadot libraries are all ESM-only so we have to import them
in a specific way in order to avoid runtime crashes.
2. This was not done in the original implementation of the polkadot
connector and because of that all the tests were failing.
3. Refactoring the code so that all polkadot related dependencies are
imported dynamically fixes the issue.
4. Also fixed the issue where the getRawTransaction HTTP REST handler
was not `await` ing for the result of the connector's method which broke
the run-transaction test case (now also fixed)

Fixes hyperledger-cacti#3077

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz force-pushed the fix-connector-polkadot-esm-imports branch from cf2727d to e00cd07 Compare July 17, 2024 17:46
@petermetz
Copy link
Contributor Author

LGTM, (lint ,custom checks script and polkadot tests are failing though)

@jagpreetsinghsasan Oops, sorry and thanks for noticing that! I fixed the issues now (fingers crossed)

@petermetz petermetz merged commit 76adf12 into hyperledger-cacti:main Jul 17, 2024
142 of 143 checks passed
@petermetz petermetz deleted the fix-connector-polkadot-esm-imports branch July 18, 2024 02:10
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.

test(connector-polkadot): fix broken tests (all) due to ESM imports
3 participants