feat(gre): desambiguate chainIds using secondary network name#714
Merged
feat(gre): desambiguate chainIds using secondary network name#714
Conversation
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
Codecov ReportBase: 90.57% // Head: 90.57% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## dev #714 +/- ##
=======================================
Coverage 90.57% 90.57%
=======================================
Files 35 35
Lines 1762 1762
Branches 296 296
=======================================
Hits 1596 1596
Misses 166 166
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
abarmat
approved these changes
Sep 22, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
GRE uses
chainIdto get details about networks defined inhardhat.config.ts. It's possible that there are multiple networks using the samechainIdso previously we used hardhat's main network name to disambiguate (i.e:hardhat,mainnet,localhost).This works as long as the chain id being disambiguated is the main one (specified by the
--networkflag), however it won't work if the secondary network is the one affected.For example, for this
hardhat.config.ts:Running a hardhat command using
--network localnitrol1will work as it will uselocalnitrol1network name to disambiguate, selectinglocalnitrol1as the L1 andlocalnitrol2as the L2.However running a hardhat command using
--network localnitrol2won't work as it doesn't know which L1 network to choose. It will selectlocalnitrol2as the L2 but the L1 will be uninitialized.Changes
This PR changes the GRE network selection so that it obtains the secondary network name from the main network name, and uses that to help disambiguating the networks.
So in the example above it will get the L1 network name
localnitrol2 --> localnitrol1, and will then uselocalnitrol1to find the correct L1 network.Signed-off-by: Tomás Migone tomas@edgeandnode.com