-
Notifications
You must be signed in to change notification settings - Fork 535
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
Unable to fund relayer when using rootchain originated native token #2002
Merged
Stefan-Ethernal
merged 20 commits into
develop
from
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
Nov 3, 2023
Merged
Unable to fund relayer when using rootchain originated native token #2002
Stefan-Ethernal
merged 20 commits into
develop
from
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
Nov 3, 2023
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
Stefan-Ethernal
changed the title
Evm 865 unable to fund relayer when using rootchain originated native token
Unable to fund relayer when using rootchain originated native token
Oct 20, 2023
Stefan-Ethernal
force-pushed
the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
from
October 23, 2023 06:21
7583ccc
to
003b62b
Compare
Stefan-Ethernal
added
bug fix
Functionality that fixes a bug
feature
New update to Polygon Edge
labels
Oct 25, 2023
goran-ethernal
force-pushed
the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
4 times, most recently
from
October 27, 2023 08:17
2d8db65
to
2ebc4d3
Compare
Stefan-Ethernal
force-pushed
the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
from
October 30, 2023 07:47
2ebc4d3
to
a88d2ff
Compare
goran-ethernal
force-pushed
the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
2 times, most recently
from
October 30, 2023 11:02
de844fd
to
0c6a692
Compare
Co-authored-by: Goran Rojovic <[email protected]>
goran-ethernal
force-pushed
the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
from
October 31, 2023 08:06
82fc683
to
210b4e2
Compare
Stefan-Ethernal
force-pushed
the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
from
October 31, 2023 08:16
ea7821a
to
c54e0b4
Compare
Stefan-Ethernal
force-pushed
the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
from
October 31, 2023 08:48
4a66df4
to
6bb3a69
Compare
begmaroman
approved these changes
Nov 3, 2023
rachit77
approved these changes
Nov 3, 2023
Stefan-Ethernal
deleted the
EVM-865-unable-to-fund-relayer-when-using-rootchain-originated-native-token
branch
November 3, 2023 15:30
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 introduces the
addGenesisBalance
function on theCustomSupernetManager
and integrates those changes in the Edge. It enables genesis accounts to lock root chain-originated Supernets native tokens on theRootERC20Predicate
and be premined with the exact same amount of native tokens in the genesis time on a Supernets. This is especially significant for relayer nodes, because they are executing bridge transactions. Without this change, it was not possible to execute any bridge transaction with non-zero gas price transactions, which is the case for the London hard fork being enabled.These commands were added:
bridge mint-erc20
command - mintsERC20
tokens to specified addresses. It has these flags:--addresses
- list of addresses for whichERC20
tokens should be minted (separated by a coma).--amounts
- list of amounts ofERC20
tokens that should be minted to given addresses (separated by a coma).--erc20-token
- address of theERC20
token that should be minted.--private-key
- private key of theERC20
token deployer, since only token deployer can mint tokens.--jsonrpc
- json RPC url to a node on chain on which mint transactions are sent.Please note that addresses and amounts flags need to be the same length.
rootchain premine
command - only used for non-mintable nativeERC20
tokens on bootstrap of a Supernet. It locks the specified amount of native tokens on theRootERC20Predicate
. Those tokens will than be premined in the genesis time on a Supernet, as described eariler. Each account that wants to have some non-mintable nativeERC20
token premined on a supernet, needs to call this command itself, meaning that each validator, each relayer node, and any other node that wants to have some nativeERC20
balance on Supernet from the genesis (in case of non-mintable token), needs to do this command.It has these flags:
--data-dir
- the directory for the Polygon Edge data if the local FS is used.--config
- the path to the SecretsManager config file, if omitted, the local FS secrets manager is used.--private-key
- hex-encoded private key of the account which executes command.--supernet-manager
- address of theCustomSupernetManager
contract on root.--erc20-token
- address of the native rootERC20
token.--root-erc20-predicate
- address of theRootERC20Predicate
contract on root.--amount
- amount of tokens to be premined.--jsonrpc
- json RPC url to a node on root chain on which premine transactions are sent.Please note that
--data-dir
,--config
and--private-key
flags are mutually exclusive. The account who is calling the premine command needs to have that amount of native rootERC20
tokens. You can use themint-erc20
command to mint him some before he premines.Changes in deployment of a Supernet if non-mintable
ERC20
native token is usedAfter the validators are whitelisted, registered and do the initial staking, premine to at least the relayer nodes have to be done as well. This should be the last step before the
supernet
command.Here we can simply call
mint-erc20
command to mint him some tokens first:$ polygon-edge bridge mint-erc20 \ --erc20-token {address_of_native_root_erc20_token} \ --private-key {hex_encoded_private_key_of_token_deployer} \ --addresses {address_of_relayer_node} \ --amounts {ammount_of_tokens_to_mint_to_relayer}
After this is done, relayer node needs to call the
premine
command:$ polygon-edge rootchain premine \ --erc20-token {address_of_native_root_erc20_token} \ --root-erc20-predicate {address_of_root_erc20_predicate_on_root} \ --supernet-manager {address_of_CustomSupernetManager_contract_on_root} \ --private-key {hex_encoded_private_key_of_relayer_node \ --amount {ammount_of_tokens_to_premine}
After that,
supernet
command is called, which finalizes the stake and premined tokens on root, and signals that Supernet nodes can be started.IMPORTANT: If non-mintable native
ERC20
token is used, a custom reward token must be provided togenesis
command through the-reward-token-code
flag. (user provides hex encoded byte code of the customERC20
reward token). This is done because since non-mintable nativeERC20
token originates on root, we can not just mint rewards on L2 in this case.Changes include
Checklist
Testing