forked from 0xPolygon/polygon-edge
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Change child predicates deployment #372
Merged
goran-ethernal
merged 20 commits into
feat/bridge
from
BLADE-232-Fix-child-predicates-deployment-on-blade
Sep 16, 2024
Merged
Change child predicates deployment #372
goran-ethernal
merged 20 commits into
feat/bridge
from
BLADE-232-Fix-child-predicates-deployment-on-blade
Sep 16, 2024
Conversation
This file contains 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
goran-ethernal
requested review from
dusannosovic-ethernal and
Stefan-Ethernal
September 10, 2024 11:54
goran-ethernal
force-pushed
the
BLADE-232-Fix-child-predicates-deployment-on-blade
branch
5 times, most recently
from
September 10, 2024 13:05
9f6073b
to
6aee0ee
Compare
goran-ethernal
force-pushed
the
BLADE-232-Fix-child-predicates-deployment-on-blade
branch
from
September 11, 2024 09:17
e686582
to
6c0e784
Compare
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.
LGTM
dusannosovic-ethernal
approved these changes
Sep 11, 2024
Stefan-Ethernal
force-pushed
the
BLADE-232-Fix-child-predicates-deployment-on-blade
branch
from
September 12, 2024 14:36
fa43539
to
d334f1c
Compare
Stefan-Ethernal
approved these changes
Sep 16, 2024
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.
LGTM, but have a couple of questions
goran-ethernal
deleted the
BLADE-232-Fix-child-predicates-deployment-on-blade
branch
September 16, 2024 07:13
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.
Description
This PR changes the way how child predicates are deployed.
Now all bridge contracts deployed on blade are removed from the
genesis
command. Instead, they are deployed in thebridge deploy
command.Bridge deploy logic
Since
bridge deploy
command is the one that deploys everything the bridge needs, it was a logical place to add deployment of bridge contracts on blade as well, separating thegenesis
from bridge completely.Since
blade
can have connection to multiple external chains, meaning, a singleblade
chain can have multiplebridges
in relation 1 to 1 (1 bridge to 1 chain), each bridge needs to have its bridge contract pairs on both chains (external and blade).This means that for example, if blade has 2 bridges, one to
Ethereum
, one toPolygon
, bridge contracts will be deployed on those two external chains, and as well their corresponding counterparts onblade
, so we have twoGateway
contracts onblade
one forEthereum
, one forPolygon
.Genesis command
Removed deployment of all bridge contracts from it.
Bridge Deploy command
Moved all the child predicates (internal bridge contracts) deployment to the command.
These are all the changes in the command:
bootstrap
which indicates ifbridge deploy
command is executed onblade
chain bootstrapping. By default is true.internal-json-rpc
which defines rpc url to the liveblade
chain if the command is not run on bootstrappingblade
.json-rpc
flag toexternal-json-rpc
flag, which defines the rpc url to the external chain.internal_contracts.go
andexternal_contracts.go
).blade
is being setup), the child predicates (internal bridge contracts) can not be deployed in the command, rather it will only calculate their addresses and pre-allocate them ingenesis
.blade
is already live), the child predicates must be deployed through the command (can not be pre-allocated ingenesis
, since we can not changegenesis
after the chain is live). The command will then deployed them and initialize them immediately. It will also update its bridge config as well to save the contracts addresses. This mode is used when some clients want to add new bridges fromblade
to some other chain and vice verse, while theblade
chain is still live. Since addresses of new contracts are saved in thegenesis.json
file in the corresponding bridge configuration, in this case, the nodes need to be restarted.Polybft
In the
GenesisPostHook
added logic to initialize child predicates (internal bridge contracts) for each configured bridge, but only if they are in the pre-allocation map that thebridge deploy
command updated. If they are not in the map, then we do not need to initialize them in theGenesisPostHook
, since the command already did that.System Addresses
Reorganized system (fixed) addresses, since their values were scattered from range to range. Also removed unnecessary ones.
Bridge Config
Now contains addresses of both external and internal (
blade
) bridge contracts.Changes include
Checklist
Testing