Skip to content

Conversation

@lightclient
Copy link
Member

Recently in #31630 we removed support for overriding the network id in preset networks. While this feature is niche, it is useful for shadow forks. This PR proposes we add the functionality back, but in a simpler way.

Instead of checking whether the flag is set in each branch of the network switch statement, simply apply the network flag after the switch statement is complete. This retains the following behavior:

  1. Auto network id based on chain id still works, because IsSet only returns true if the flag is actually set. Not if it just has a default set.
  2. The preset networks will set their network id directly and only if the network id flag is set is it overridden. This, combined with the override genesis flag is what allows the shadow forks.
  3. Setting the network id to the same network id that the preset would have set causes no issues and simply emits the WARN that the flag is being set explicitly. I don't think people explicitly set the network id flag often.
WARN [10-22|09:36:15.052] Setting network id with flag             id=10

Copy link
Member

@barnabasbusa barnabasbusa left a comment

Choose a reason for hiding this comment

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

LGTM

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