-
Notifications
You must be signed in to change notification settings - Fork 1
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
Asset registry not correct for testnet-phobos-2 #73
Comments
With an assist from @hdevalence, I've confirmed that the |
Adds an easy way to run the container image locally, to aid in debugging. Refs #73.
After much debugging, and poring over the NextJS docs, it's now clear to me that the application does not actually accept runtime configuration via env var for chain id. The code looks up dex-explorer/src/constants/configConstants.ts Lines 6 to 11 in eff9854
penumbra-1 , but if you set NEXT_PUBLIC_CHAIN_ID=penumbra-testnet-phobos-2 at runtime, the app will still query for penumbra-1 . That's because the NEXT_PUBLIC_* env vars are baked in at build time based on the value of the environment variable, and cannot be updated at runtime. Notably the nextjs docs do describe this behavior:
We currently build a container image, So, how to do that? From my limited understanding of the nextjs docs, it appears we should be using |
Previously the `NEXT_PUBLIC_CHAIN_ID` env var was only read at build time, and was ignored at runtime. That's not the behavior we want: we want a default value that can be overridden at runtime to refer to any network, so that the same built container image can be used in multiple contexts. This change permits that, by using a variable name, rather than a string literal, to look up the `NEXT_PUBLIC_CHAIN_ID` env var. Also refactors the endpoint-loading logic, which isn't strictly necessary, but I found it cleaner to only have hits for `grep -rF process.env` in a single location in the source code. Sprinkles in a few `justfile` additions to make testing locally a bit more straightforward, since it was useful to me while debugging. Refs #73.
As a temporary measure, uses the `pnpm run dev` environment inside the container image. This is an anti-pattern. We *should* be using the "standalone" output of nextjs and running that directly via `node`, but doing so does not permit runtime configuration of the chain-id, used for loading assets, which is must-have for the built image. Sprinkles in a few `justfile` additions to make testing locally a bit more straightforward, as we'll surely be exercising these config paths again in the near future. Refs #73.
No, that approach didn't work: when I tested, the server-side code reports the runtime value, but the client-side code reports the build-time value. That's not good enough for our use case.
That's the approach I went with in #76, as a temporary solution to have a working staging environment again. @JasonMHasperhoven, I'd very much appreciate you taking a look at the config logic, and resolving as you see fit, so that we can use |
There are some optimization that we would miss if we don't pre-build nextjs. I think the move is to have multiple images that point to different environments, so then we run the test image in our staging env and the prod image in the prod env. |
I'd prefer to keep the built artifact, i.e. the container, environment-agnostic, using runtime environment variables to configure the same app code to interact with different networks. We already have the ability to inject e.g. a postgres database URL at runtime, and the same should be true of asset registry info. Discussed this out of band with @JasonMHasperhoven, who agreed that |
Another idea: what if running the server involved running the next build in the current environment, and then serving that? This way you could have one container, and then dynamically configure the build process, but then also not require changes to the code. |
Resolved via #80. |
Now that we've resolved #73, we're unblocked from restoring rolling deployments on merge to main, to the testnet instance [0]. This new workflow blocks on completion of the build-container logic, then bounces the pre-existing deployment to pull the most recently built container. [0] https://dex-explorer.testnet.plinfra.net
Now that we've resolved #73, we're unblocked from restoring rolling deployments on merge to main, to the testnet instance [0]. This new workflow blocks on completion of the build-container logic, then bounces the pre-existing deployment to pull the most recently built container. Refs #72. [0] https://dex-explorer.testnet.plinfra.net
Now that we've resolved #73, we're unblocked from restoring rolling deployments on merge to main, to the testnet instance [0]. This new workflow blocks on completion of the build-container logic, then bounces the pre-existing deployment to pull the most recently built container. Refs #72. [0] https://dex-explorer.testnet.plinfra.net
There's a new testnet chain
penumbra-testnet-phobos-2
, running here: https://testnet.plinfra.net There's also a dex-explorer instance running against that chain https://dex-explorer.testnet.plinfra.net (#72). Despite recent updates to the prax registry in prax-wallet/registry#91 & prax-wallet/registry#93, as well as corresponding changes in this repo to consume #57, thetest_usd
asset still isn't loading correctly:The asset on the lefthand side is
test_usd
, or at least that's how it was specified on when swapped viapcli
. But the app fails to understand the asset, which indicates that we likely have the wrong string set in the prax registry still: https://github.com/prax-wallet/registry/blob/7cfdd0000c4f4c458e147b85ba6c7f3f87066c11/input/chains/penumbra-testnet-phobos-2.json#L144 Let's debug that and fix it.The text was updated successfully, but these errors were encountered: