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

runtime: Add OASIS_UNSAFE_USE_LOCALNET_CHAINID env flag #27

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

matevz
Copy link
Member

@matevz matevz commented Jan 13, 2023

Introduction of another localnet chain ID 0xa514 if OASIS_UNSAFE_USE_LOCALNET_CHAIN env variable is set targeted at dApp devs for testing on the local stack. Since the chain ID is hardcoded into runtime binary, this PR also adds the localnet release beside the existing one to CI.

Related: oasisprotocol/oasis-web3-gateway#348

binaries: emerald-paratime
clean: no
setup: |
export OASIS_UNSAFE_USE_LOCALNET_CHAINID=1
Copy link

Choose a reason for hiding this comment

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

From the variable name I would expect the following usage OASIS_UNSAFE_USE_LOCALNET_CHAINID=0xa514. But then this could also be reused for building official Testnet and Mainnet variants...

Copy link
Member Author

@matevz matevz Jan 13, 2023

Choose a reason for hiding this comment

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

There are bunch of issues around this:

  1. CHAIN_ID is constant and can only be set at compile time.
  2. And now since it needs to be hardcoded at compile time, up to date rust has issues with parsing env variables to integers.
  3. We could probably use konst (see the last comment), but it smells wrong.

So I dropped the idea of custom chain IDs read from env and just introduced a simple flag.

@matevz matevz force-pushed the matevz/feature/localnet_chainid branch from 90d9005 to fb8d090 Compare January 30, 2023 15:13
@matevz matevz merged commit 8cd9220 into main Feb 2, 2023
@matevz matevz deleted the matevz/feature/localnet_chainid branch February 2, 2023 15:21
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.

4 participants