Skip to content
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

Correctly initialize use allow list and use block list parameters on the access list predicates #1750

Conversation

Stefan-Ethernal
Copy link
Collaborator

@Stefan-Ethernal Stefan-Ethernal commented Jul 25, 2023

Description

In case either bridge allow list admin or bridge block list admin is provided, predicate contracts are initialized with flags that indicate that both bridge transactions allow list and block list should be checked.

This was wrong because if someone configures Supernets to rely only on the bridge block list (by specifying the bridge block list admin address), SC will also check the allow list. Since the bridge allow list is empty it would result in the account not being able to execute bridge transactions, even though it is not block-listed.

Therefore, the fix includes using separate boolean parameters to initialize SCs whether allow list or block list should be used.

Existing data fix

If bridge transactions are not executed successfully (either deposit for child chain mintable tokens or withdraw for root chain mintable tokens), and access lists are in use, chances are the issue is related to this bug.
In order to fix it the following Foundry commands need to be run (https://book.getfoundry.sh/reference/cast/cast-send).

Use only block lists for bridge transactions

In case only bridge block lists should be used, an account that was specified as bridge block lists admin during deployment should send the following transactions, which would disable usage of allow lists on the predicate contracts:

$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001004 "function setAllowList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001006 "function setAllowList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001008 "function setAllowList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001009 "function setAllowList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x000000000000000000000000000000000000100a "function setAllowList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x000000000000000000000000000000000000100b "function setAllowList(bool)" false

Use only allow lists for bridge transactions

In case only bridge block lists should be used, an account that was specified as bridge block lists admin during deployment should send the following transactions, which would disable usage of block lists on the predicate contracts:

$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001004 "function setBlockList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001006 "function setBlockList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001008 "function setBlockList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x0000000000000000000000000000000000001009 "function setBlockList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x000000000000000000000000000000000000100a "function setBlockList(bool)" false
$ cast send --private-key <owner private key> --rpc-url <Supernets JSON RPC URL> --legacy --gas-limit 100000 0x000000000000000000000000000000000000100b "function setBlockList(bool)" false

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@Stefan-Ethernal Stefan-Ethernal force-pushed the EVM-748-properly-initialize-access-list-fields-on-predicate-contracts branch from 166516a to 6c5fdc1 Compare July 25, 2023 14:54
@Stefan-Ethernal Stefan-Ethernal self-assigned this Jul 26, 2023
@Stefan-Ethernal Stefan-Ethernal added the bug fix Functionality that fixes a bug label Jul 26, 2023
@Stefan-Ethernal Stefan-Ethernal requested a review from a team July 26, 2023 08:14
@Stefan-Ethernal Stefan-Ethernal marked this pull request as ready for review July 26, 2023 08:14
@Stefan-Ethernal Stefan-Ethernal changed the title Split use allow list and use block list parameters Correctly initialize use allow list and use block list parameters on the access list predicates Jul 26, 2023
Copy link
Contributor

@vcastellm vcastellm left a comment

Choose a reason for hiding this comment

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

LGTM

@Stefan-Ethernal Stefan-Ethernal merged commit b430680 into develop Jul 27, 2023
7 checks passed
@Stefan-Ethernal Stefan-Ethernal deleted the EVM-748-properly-initialize-access-list-fields-on-predicate-contracts branch July 27, 2023 07:50
@github-actions github-actions bot locked and limited conversation to collaborators Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Functionality that fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants