-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix merge_registries
to account for same contract names across different chain ids
#149
Conversation
…ent chain ids - dictionary of entries keyed by chain id must be first established.
merge_registries
to account for same contract names across different chain ids
def _select_conflict_resolution( | ||
registry_1_entry, registry_1_filepath, registry_2_entry, registry_2_filepath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the "green path" we'd deploy a contract, then replace it in the old registry, right? This implies that the merge is one-way, so It may be useful to have an alternate strategy to "update" a base registry with a patch, instead of an interactive flow. This can be achieved with some optional parameters here in your function to always select resolution 1 or 2. You might even make this function private and then wrap it with differently parameterized calls. Not a blocker, just commentary (ps let's not reinvent git
😆 ).
def _perform_merge(...):
...
def interactive_merge(reg1, reg2):
...
def one_way_merge(patch, base, ...):
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's a good point. I guess for some conflict resolution it won't be a 2nd filepath, just an updated contract to add to the registry at the end of an updated deployment eg. we update the Coordinator contract for Lynx.
We could handle that in a follow-up change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #151 .
Will this be affected by the fact that we have a new domain?: |
It's not a real TACo domain ( |
… converting chain ids to strings.
No, lynx and dashboard are separate domains so they are not exposed to these merge utilities. |
It is possible to have the same contract name repeated across different chain ids. The initial set-up for the
merge_registries()
function placed all registry entries from a registry file into a dictionary keyed by name. However, some entries can get lost this way, because the dictionary is keyed by name and contract names can be repeated across different chains eg.ProxyAdmin
. Therefore some registry entries don't end up in the merged contract registry.This PR accounts for common names across the registry in different chains. The ridiculous test was to try to merge
lynx.json
andtapir.json
(a ridiculous example yes, but great for testing). The merged registry should have all entries for chain id5
fromlynx.json
, all entries from chain id11155111
fromtapir.json
(those 2 chains are non-conflicting), and then conflicts for80001
which you can test resolving appropriately.If the above test is run with the old code some registry entries (with dupe names across different chains) are not included for some chains.
ProxyAdmin
is the worst offender because it is an entry in all chains (5
,11155111
,80001
).Try it out, both with/without the change: