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

SMR-1677 Flow Rate #41

Merged
merged 58 commits into from
Nov 19, 2023
Merged

SMR-1677 Flow Rate #41

merged 58 commits into from
Nov 19, 2023

Conversation

proletesseract
Copy link
Contributor

@proletesseract proletesseract commented Nov 16, 2023

The flow rate implementation should be code complete.

Callouts

All unit tests for the flow rate have been ported over except the tests around pausing the bridge since that is not merged into main yet.

The withdraw integration tests have been updated to use the RootERC20BridgeFlowRate.

No additional integration tests have been added at this stage.

Todo

  • Add the unit tests for pausing when that is merged
  • Decide if we want to add more integration tests or the ones we have provide enough coverage

Review Focus

The main two files to review are;

src/root/RootERC20Bridge.sol
src/root/flowrate/RootERC20BridgeFlowRate.sol

The interface for the flow rate has been split out to here;

src/interfaces/root/flowrate/IRootERC20BridgeFlowRate.sol

The detection and queue files should be unchanged ;

src/root/flowrate/FlowRateDetection.sol
src/root/flowrate/FlowRateWithdrawalQueue.sol

The Unit tests have all been ported except the ones related to pausing. I did remove some stuff to do with asserting the charlie remainder which i couldnt figure out what it was doing and it was failing the tests.

test/unit/root/flowrate/RootERC20BridgeFlowRate.t.sol

The withdraw integration tests have been updated to use the flowRate bridge;

test/integration/root/withdrawals.t.sol/RootERC20BridgeWithdraw.t.sol

@platform-sa
Copy link

platform-sa commented Nov 16, 2023

📃CI Report

Compiling 146 files with 0.8.19
Solc 0.8.19 finished in 15.78s
Compiler run �[32msuccessful!�[0m
Analysing contracts...
Running tests...

File % Lines % Statements % Branches % Funcs
script/DeployChildContracts.s.sol 0.00% (0/22) 0.00% (0/32) 100.00% (0/0) 0.00% (0/1)
script/DeployRootContracts.s.sol 0.00% (0/27) 0.00% (0/37) 0.00% (0/2) 0.00% (0/1)
script/InitializeChildContracts.s.sol 0.00% (0/10) 0.00% (0/15) 100.00% (0/0) 0.00% (0/1)
script/InitializeRootContracts.s.sol 0.00% (0/10) 0.00% (0/15) 100.00% (0/0) 0.00% (0/1)
script/Utils.sol 0.00% (0/12) 0.00% (0/16) 0.00% (0/2) 0.00% (0/2)
src/child/ChildAxelarBridgeAdaptor.sol 100.00% (16/16) 100.00% (19/19) 100.00% (6/6) 100.00% (3/3)
src/child/ChildERC20.sol 100.00% (14/14) 100.00% (15/15) 50.00% (1/2) 100.00% (7/7)
src/child/ChildERC20Bridge.sol 96.97% (128/132) 97.77% (175/179) 92.31% (72/78) 100.00% (14/14)
src/child/WIMX.sol 0.00% (0/19) 0.00% (0/22) 0.00% (0/8) 0.00% (0/6)
src/common/BridgeRoles.sol 100.00% (8/8) 100.00% (8/8) 100.00% (0/0) 100.00% (8/8)
src/lib/EIP712MetaTransaction.sol 8.00% (2/25) 9.68% (3/31) 8.33% (1/12) 14.29% (1/7)
src/lib/EIP712Upgradeable.sol 73.33% (11/15) 60.87% (14/23) 0.00% (0/2) 50.00% (2/4)
src/root/RootAxelarBridgeAdaptor.sol 100.00% (18/18) 100.00% (24/24) 100.00% (8/8) 100.00% (3/3)
src/root/RootERC20Bridge.sol 94.37% (134/142) 96.17% (201/209) 90.54% (67/74) 90.48% (19/21)
src/root/flowrate/FlowRateDetection.sol 90.00% (27/30) 90.91% (30/33) 78.57% (11/14) 100.00% (4/4)
src/root/flowrate/FlowRateWithdrawalQueue.sol 67.39% (31/46) 61.67% (37/60) 50.00% (7/14) 85.71% (6/7)
src/root/flowrate/RootERC20BridgeFlowRate.sol 100.00% (43/43) 98.00% (49/50) 100.00% (10/10) 100.00% (9/9)

For a full HTML report run: forge coverage --report lcov && genhtml --ignore-errors category --branch-coverage --output-dir coverage lcov.info

* @param newRootWETHToken Address of ERC20 WETH on the root chain.
* @param newChildChain Name of child chain.
* @param newImxCumulativeDepositLimit The cumulative IMX deposit limit.
* @dev Can only be called once.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be called multiple times since its not gated by initializer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do we want to do about this? should we check if the roles or other variables set on the initialiser are set and if they are revert? so it can only be called once? Or is the fact its internal and only be accessed through the bridge or flowrate initializers enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

It being internal is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ill just remove the dev comment then :)

if (address(rootToken) == address(0)) {
revert ZeroAddress();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Why aren't rootIMXToken and NATIVE_ETH stored in the mapping, so you can check them all at once rather than doing an if/else?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree. I recall raising this a while back, in a different PR... the discussions around that are here for context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will be split out to another ticket as to not hold up this PR

@proletesseract proletesseract marked this pull request as ready for review November 19, 2023 23:37
@proletesseract proletesseract merged commit a5a9f06 into main Nov 19, 2023
4 checks passed
@proletesseract proletesseract deleted the SMR-1677-FlowRate branch November 19, 2023 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants