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

Allow disabling limits after deployment #1492

Merged
merged 15 commits into from
Jul 29, 2021

Conversation

karlb
Copy link
Contributor

@karlb karlb commented Jul 22, 2021

We want to be able to remove the limits without redeploying the contracts. We do this by setting the limits to MAX_INT.

Closes #1481.

To safely allow 3rd parties to create token networks after the limit removal, creating new TNs must not involve any parametrization. This is done by forcing the limits to be MAX_INT after the limits have been removed from the TNR.

Closes #1416.

@karlb karlb force-pushed the disable-limits branch 2 times, most recently from 1040d13 to 7c4e3e9 Compare July 22, 2021 14:25
@karlb karlb marked this pull request as ready for review July 22, 2021 14:42
@karlb karlb requested a review from palango July 22, 2021 14:43
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #1492 (e776673) into master (742ece6) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1492   +/-   ##
=======================================
  Coverage   80.84%   80.84%           
=======================================
  Files          22       22           
  Lines        1566     1566           
  Branches      189      189           
=======================================
  Hits         1266     1266           
  Misses        253      253           
  Partials       47       47           
Impacted Files Coverage Δ
raiden_contracts/deploy/contract_deployer.py 89.28% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 742ece6...e776673. Read the comment docs.

Copy link
Contributor

@palango palango left a comment

Choose a reason for hiding this comment

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

Looks good in general, nice small commits make this easy to review. After seeing the additions of changeController, I think we should add a base class Controllable (or some other name) to bundle the ownership related functionality.

Also in the last commit you should update the gas costs file.

raiden_contracts/data/source/raiden/TokenNetwork.sol Outdated Show resolved Hide resolved
@@ -200,8 +200,8 @@ contract TokenNetwork is Utils {
bytes32 participant2_locksroot
);

modifier onlyDeprecationExecutor() {
require(msg.sender == deprecation_executor, "Can only be called by deprecation_executor");
modifier onlyController() {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could split this into a base class like done in https://docs.openzeppelin.com/contracts/4.x/api/access#Ownable

I don't think it will give any improvements in code size, but might make the code more concise.

@karlb karlb force-pushed the disable-limits branch 3 times, most recently from 928d408 to 1002951 Compare July 29, 2021 09:39
@karlb karlb requested a review from palango July 29, 2021 12:07
@palango palango mentioned this pull request Jul 29, 2021
19 tasks
karlb added 15 commits July 29, 2021 14:52
This is just a convenience function, but I think it will be nice to have
once we start removing the limits from the code base.
This user can now also remove limits. It is renamed to make this clear.
We want the limit removal to be completely done once we do it. When new
TN are deployed afterwards, they must be deployed without limits.

Closes raiden-network#1416
Solidity allows to have constants outside the contract. Unfortunately,
solium does seem to understand this and throws a syntax errors. Those
can't be silenced, since they break parsing for the whole file.
Less duplication, better separation of concerns.
This requires turning off solium for
raiden_contracts/data/source/lib/TokenNetworkUtils.sol, since it does
not understand declarations outside of the contract.

Also write the number as `2**256 - 1` to make it more clear that this is
the right value.
It never belonged into the service dir. I just got confused.
This does not only reduce redundancy in code, but also allows to change
the controller of the ServiceRegistry.
Copy link
Contributor

@palango palango left a comment

Choose a reason for hiding this comment

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

Great!

@palango
Copy link
Contributor

palango commented Jul 29, 2021

We need to add a changelog entry, but this can be done in a different PR.

@palango palango merged commit 9de04e6 into raiden-network:master Jul 29, 2021
@palango palango mentioned this pull request Jul 29, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add function to remove limits after deployment Allow 3rd parties to register new token networks
2 participants