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

chore(xc_admin): fix xc_admin dependencies #1739

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

cprussin
Copy link
Collaborator

@cprussin cprussin commented Jun 27, 2024

This PR fixes some issues with the various xc_admin packages' dependencies. Specifically:

  • Deduplicate the version of @certusone/wormhole-sdk
  • Add a missing express dependency for proposer_server
  • Add a missing bn.js dependency for xc_admin_common
  • Don't allow @solana/web3.js to move to the v1.93.0 -- this version upgrades rpc-websockets to v9, which includes a significant change to the way that package is built which does not appear to be working with our codebase -- I'll have to investigate later
  • Fix issue where @injectivelabs/sdk-ts wasn't getting deployed by pnpm deploy, causing the servers to fail to start

The last issue turned out to be super tricky and subtle. Essentially what's happening here is:

  1. @certusone/wormhole-sdk specifies @injectivelabs/sdk-ts as an optional dependency
  2. The optional dependency tells pnpm that the dependency is not essential and can be skipped if dependencies can't be resolved
  3. @injectivelabs/sdk-ts has transitive peer dependencies (namely, on React and a few other packages we use in the monorepo, but not packages we use in the xc_admin services)
  4. Pnpm's peer resolution causes the dependency on @injectivelabs/sdk-ts to be tagged against the peers that are in the monorepo
  5. However, those peers aren't part of the xc_admin packages (other than xc_admin_frontend) and so aren't included in the pnpm deploy of those packages
  6. Because those peers aren't included in the deploy, and because the @injectivelabs/sdk-ts package is tagged against those peers, and because it's marked as an optional dependency, pnpm concludes that it does not need to be deployed and omits it.
  7. However, wormhole-sdk is incorrect in listing it as optional, it's actually mandatory, and the @certusone/wormhole-sdk package throws on import if it's not present.

Possibly it could be argued that this is a bug in how pnpm deploy works with optional dependencies, and it's definitely a bug in @certusone/wormhole-sdk's package manifest. However, adding an explicit dependency on @injectivelabs/sdk-ts to each xc_admin server package (and removing it from xc_admin_common) is enough to force pnpm to unify the transitive dependency and force it to be included in the deploy.

It's also worth noting that @certusone/wormhole-sdk is being deprecated and replaced with @wormhole-foundation/sdk. We'll need to move over eventually and doing so will likely help resolve similar packaging issues, due to the new sdk being more modular, simpler, and having far fewer and better maintained dependencies.

@cprussin cprussin requested a review from guibescos June 27, 2024 06:22
Copy link

vercel bot commented Jun 27, 2024

@cprussin is attempting to deploy a commit to the pyth-web Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jun 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2024 2:42pm
xc-admin-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2024 2:42pm

@cprussin cprussin merged commit 07b747a into pyth-network:main Jun 27, 2024
6 checks passed
@cprussin cprussin deleted the fix-xc_admin-dependencies branch June 27, 2024 15:03
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