-
Notifications
You must be signed in to change notification settings - Fork 228
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
Update security roles on v1 contracts #116
Conversation
May you prepare new gists based on the contracts you prepared in #109? |
I will prepare gist for the contracts. Should I also test upgrading them similar as we did on #109 ? |
yes. And it should be extended with tests that we can send back tokens that exceed the limit. |
Here are the gists:
Next step is to run the suggested tests |
Actually on v1.x contracts I don't think we have the ability to send back tokens that exceed the limit. From changes on #109, transactions that exceeded the limit are reverted. However, such kind of test can be applied to |
Oh! Sorry. It should be for another issue, for #110. So, for #116 you need to test the following:
|
@akolotov I run the tests and found one issue. function upgradeSecurityRoles(address _newOwner) public onlyProxyOwner {
require(owner() == address(0));
require(_newOwner != address(0));
setOwner(_newOwner);
} Then when testing the upgradability admin role, I wasn't able to claim tokens. function claimTokens(address _token, address _to) external onlyProxyOwner {
...
} I run some tests to understand what was causing the issue with modifier onlyProxyOwner() {
require(msg.sender == proxyOwner());
_;
} I found that methods defined on Bridge contracts that calls Any ideas or suggestion on how to fix this or any other approach on how can we avoid this situation? Besides this issue, the new roles worked as expected. |
@akolotov Found the issue, it was related to the way in how Fixing the order of inheritance made the trick contract Validatable is OwnedUpgradeabilityProxy, EternalStorage, Ownable {
} I pushed the fix, and updated the gists files. Also, I was able to re-test the steps that had issues, and now it worked as expected on the steps that used to fail. |
Great! Do you you know exactly the reason why the order matters? |
Unfortunately, I don't know the exact reason. I just tried having the same order as |
Honestly, I do not see any reasons why |
We still need |
|
Updated the contracts with proposed changes. Also gists files were updated. |
Did you perform tests as described above after the changes? |
Not yet, I'll perform the test and share the results |
# Conflicts: # contracts/upgradeable_contracts/U_ForeignBridge.sol # contracts/upgradeable_contracts/U_HomeBridge.sol # deploy/src/foreign.js # deploy/src/home.js # migrations/3_upgradeable_deployment.js # test/foreign_bridge_test.js # test/home_bridge_test.js
I updated the changes with solution similar to v2 contracts here 76f7793 If solution is OK, next step is to test the upgrade with this solution. |
@patitonar I have started reviewing the gist files you prepared and will provide the feedback soon. |
@akolotov OK, let me know if there is any change we should perform. I've tested the upgrade with the proposed changes, and everything worked as expected, no issues were found. State wasn't affected after the upgrades and bridge continue to work as normal. I started with version v1.0 of contracts, then upgrade them to new version implemented on #109 These were the steps for the upgrade of new roles: |
Since we didn't touch Since we know in advance which owner will be used during the upgrade we could simplify the upgrade procedure if we use in function upgradeFrom3To4() public {
require(owner() == address(0));
setOwner(validatorContract().owner());
} and in function upgradeFrom2To3() public {
require(owner() == address(0));
setOwner(validatorContract().owner());
} It will allow to call the methods in As you see I changed the name of the call in order to have explicit correspondence between the version which is used in |
@akolotov Updated the gist, please check the last changes. Home: https://gist.github.com/patitonar/8caa3631e5a89b85ff3269a27c429813 Should we run a new test with these updated Gist files? |
Yes, please. We cannot use untested changes for upgrade of the bridge in the production. |
@akolotov I followed the same steps mentioned on #116 (comment) except that this time I used |
Thank you! Did you test that the bridge parameters can be changed by the old owner of validator contract after changing the owner of the validator contract to some another account? |
Yes. After the upgrade I tested the following steps for that case:
|
Thanks! I will initiate the process to upgrade the contracts of the POA bridge. |
The upgraded version of contracts was applied to the ETH mainnet and the POA core: |
Relates to #111
Applied the new security roles, updated deploy script and tests.
Added
upgradeSecurityRoles
method to be called usingupgradeToAndCall
for already deployed bridge contracts that has not an owner set on initialization.