Skip to content

Feat: linea migration script#763

Merged
kevincheng96 merged 43 commits intocompound-finance:linea/usdc-deployfrom
Consensys:feat/linea-migration-script
Jun 22, 2023
Merged

Feat: linea migration script#763
kevincheng96 merged 43 commits intocompound-finance:linea/usdc-deployfrom
Consensys:feat/linea-migration-script

Conversation

@Julink-eth
Copy link
Copy Markdown
Contributor

@Julink-eth Julink-eth commented Jun 16, 2023

PR for the linea migration script.
The linea-goerli COMP address needs to be replaced once the contract created on LInea Goerli.

Please review the values used in the script and the configuration.json, I tried to use the ones used for base-goerli.

Only the very last commit needs to be reviewed, the other commits are pending this PR: #758

@Julink-eth Julink-eth marked this pull request as draft June 16, 2023 15:39
@Julink-eth Julink-eth marked this pull request as ready for review June 16, 2023 15:41
Copy link
Copy Markdown
Contributor

@kevincheng96 kevincheng96 left a comment

Choose a reason for hiding this comment

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

Left a few comments that may prevent the proposal from running successfully. The scenarios should actually fail and catch these problems, so let me know if that isn't the case.

Other than that, this looks really good and almost ready to run!

@Julink-eth
Copy link
Copy Markdown
Contributor Author

Julink-eth commented Jun 18, 2023

Alright, I think we are almost there, when I try to simulate the proposal I get the error:
'GovernorBravo::propose: proposer votes below proposal threshold'

But I'm guessing that's because I need 1000 COMP in my wallet ?

Also we should be able to send the USDC to the timelock very soon, we need to redeploy the USDC bridge to do the transfer L2 -> L1, it should be done tomorrow (06/19)

@kevincheng96
Copy link
Copy Markdown
Contributor

Alright, I think we are almost there, when I try to simulate the proposal I get the error: 'GovernorBravo::propose: proposer votes below proposal threshold'

But I'm guessing that's because I need 1000 COMP in my wallet ?

Correct, when you simulate a proposal, it uses the address that you have set up with hardhat to run the script. To test your script, you can either:

  • Test the migration script in scenarios. Your migration script should automatically get picked up and run by the scenario framework if it hasn't been enacted yet.
  • Temporarily modify your migration script to impersonate an address that has enough COMP to make a proposal (0xbBFE34E868343E6F4f5E8B5308de980d7bd88c46).

@Julink-eth
Copy link
Copy Markdown
Contributor Author

Julink-eth commented Jun 19, 2023

Alright, I think we are almost there, when I try to simulate the proposal I get the error: 'GovernorBravo::propose: proposer votes below proposal threshold'
But I'm guessing that's because I need 1000 COMP in my wallet ?

Correct, when you simulate a proposal, it uses the address that you have set up with hardhat to run the script. To test your script, you can either:

  • Test the migration script in scenarios. Your migration script should automatically get picked up and run by the scenario framework if it hasn't been enacted yet.
  • Temporarily modify your migration script to impersonate an address that has enough COMP to make a proposal (0xbBFE34E868343E6F4f5E8B5308de980d7bd88c46).

I tried the scenarios but I'm getting for 17 of them:
Error RangeError: Division by zero

And 206 are successful

It seems that something is wrong in my configuration, the cross chain proposal scenario seems to go through though.
Could you review my configuration again ?

@kevincheng96
Copy link
Copy Markdown
Contributor

I tried the scenarios but I'm getting for 17 of them:
Error RangeError: Division by zero

Looks like the division by zero errors are because the collateral factors are 0. That's fine and should be resolved after the proposal runs.

@kevincheng96
Copy link
Copy Markdown
Contributor

I fixed the migration script issues in this commit: ffbdd22

I don't have permission to push to your branch, so feel free to copy the changes over.

@Julink-eth
Copy link
Copy Markdown
Contributor Author

I fixed the migration script issues in this commit: ffbdd22

I don't have permission to push to your branch, so feel free to copy the changes over.

I applied your changes in the last commit, please let me know if there is anything else I need to do.

@kevincheng96
Copy link
Copy Markdown
Contributor

Looks good! One final thing before we execute this, are there any other collateral assets we could use other than WETH? e.g. WBTC?

WETH requires users to wrap ETH, which is a scarce resource even on testnet these days. Ideally, we'd want a collateral asset that the user can deposit a decent amount of so they can borrow USDC.

@Julink-eth
Copy link
Copy Markdown
Contributor Author

Looks good! One final thing before we execute this, are there any other collateral assets we could use other than WETH? e.g. WBTC?

WETH requires users to wrap ETH, which is a scarce resource even on testnet these days. Ideally, we'd want a collateral asset that the user can deposit a decent amount of so they can borrow USDC.

As discussed on discord I just added WBTC as a collateral in the last commit, please review

Julink-eth and others added 25 commits June 21, 2023 23:58
The Comet repo currently has rules set up for both Prettier and ESLint, even though we only enforce the rules for ESLint. The move from Prettier to ESLint was decided in #321. 

Keeping the Prettier configs in the repo while not enforcing them is arguably worse than just not having the configs in the first place, since contributors may end up running the Prettier (e.g. via VSCode auto-format) for some files and introduce very large diffs. Removing Prettier should help reduce the formatting diffs introduced by contributors.
This change should extend the `OptimismBridgeReceiver` with some functionality to sweep ERC20 and native tokens.
* feat: messageService wrapper (WIP)

* feat: deployment script (WIP)

* feat: deployment script - adapt for Linea

* feat: config - adapt for Linea

* chore: delete unnecessary file

* feat: update hardhat config (WIP)

* fix: pragma conflict

* fix: LineaBridgeReceiver issue

* feat: add Linea config

* fix: add lineascan_key

* fix: add lineascan_key to github actions

* feat: wip linea deployment

* feat: added linea cross chain governance scenario

* feat: added Linea L1 message service contract in the configuration

* feat: added relayMessage for linea

* feat: working solution, missing verification on etherscan

* chore: rename arg no-deploy to noDeploy

* fix: cross chain governance tests for linea-goerli

* feat: mage LineaBridgeReceiver fallback payable and removed comments

* chore: new deployment with different account

* feat: added missing changes for linea deployment/scenarios

* fix: take into account compound team's comment except the migration file

* feat: fixed formatting, reset configuration.json and added lineaL1TokenBridge to the configuration

* feat: reduced baseMinForRewards to 1000e6

---------

Co-authored-by: Arthur <arthur@coeos.xyz>
Copy link
Copy Markdown
Contributor

@kevincheng96 kevincheng96 left a comment

Choose a reason for hiding this comment

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

Think it's good to merge

@kevincheng96 kevincheng96 merged commit 3eed8fc into compound-finance:linea/usdc-deploy Jun 22, 2023
kevincheng96 added a commit that referenced this pull request Jun 22, 2023
@Julink-eth Julink-eth deleted the feat/linea-migration-script branch June 22, 2023 08:33
kevincheng96 added a commit that referenced this pull request Jun 28, 2023
This PR supports a cUSDCv3 deployment on Linea Goerli (deploy script + migration script). Most of the work was done by the Linea dev team.

* Linea Goerli cUSDCv3 deploy (#758)

* feat: messageService wrapper (WIP)

* feat: deployment script (WIP)

* feat: deployment script - adapt for Linea

* feat: config - adapt for Linea

* chore: delete unnecessary file

* feat: update hardhat config (WIP)

* fix: pragma conflict

* fix: LineaBridgeReceiver issue

* feat: add Linea config

* fix: add lineascan_key

* fix: add lineascan_key to github actions

* feat: wip linea deployment

* feat: added linea cross chain governance scenario

* feat: added Linea L1 message service contract in the configuration

* feat: added relayMessage for linea

* feat: working solution, missing verification on etherscan

* chore: rename arg no-deploy to noDeploy

* fix: cross chain governance tests for linea-goerli

* feat: mage LineaBridgeReceiver fallback payable and removed comments

* chore: new deployment with different account

* feat: added missing changes for linea deployment/scenarios

* fix: take into account compound team's comment except the migration file

* feat: fixed formatting, reset configuration.json and added lineaL1TokenBridge to the configuration

* feat: reduced baseMinForRewards to 1000e6

---------

Co-authored-by: Arthur <arthur@coeos.xyz>

* Feat: linea migration script (#763)

* feat: messageService wrapper (WIP)

* feat: deployment script (WIP)

* feat: deployment script - adapt for Linea

* feat: config - adapt for Linea

* chore: delete unnecessary file

* feat: update hardhat config (WIP)

* fix: pragma conflict

* fix: LineaBridgeReceiver issue

* feat: add Linea config

* fix: add lineascan_key

* fix: add lineascan_key to github actions

* feat: wip linea deployment

* Base Goerli cWETHv3 deploy (#751)

This PR introduces the cWETHv3 deployment on Base Goerli as well as the proposal to initialize the market there.

When initializing the cWETHv3 market, we bridge over some WETH reserves. However, Optimism/Base does not support bridging WETH directly, so we bridge over ETH instead and wrap it before sending it to cWETHv3. I had to add some logic to our mock relayer code to support bridging of ETH.

* Deploy script for cWETHv3 on Base Goerli

* Create proposal to initialize cWETHv3 and bridge ETH as reserves

* Run base-goerli-weth in scenarios CI

* Fix pricefeeds path after rebase

* Address PR comments

* Modified deployment roots from GitHub Actions

* Update proposal

* Modified migration from GitHub Actions

---------

Co-authored-by: GitHub Actions Bot <>

* Adding the Semgrep worflow by Decurity (#742)

This Semgrep workflow runs 2 rule sets over all the pull requests.
The rule sets include both generic Solidity security detections and the comet-specific ones.
We've reviewed the comet repository issues, pull requests and commits and created a few rules according to the fixes that were proposed by OZ/ChainSecurity/Certora and have been accepted by Compound.
Most of the issues have been closed without fixes, and some of others are unfeasible to detect with Semgrep.

You can see it in action here: Decurity#2

Right now if you run these rules over the whole comet codebase, the stats is as follows:
Ran 9 rules on 36 files: 32 findings.

23 of these are missing sanity checks on constructor arguments (each argument = 1 finding). Of course many of them might not require the sanity checks so this rule can spam the alerts if run over the whole codebase but can be useful if run over the new contracts (there's only one constructor, so there won't be overwhelmingly many findings)

Also there's a couple of "A constant name is not in UPPER_CASE like other constant variables." and "Event parameters with type 'address' should be indexed" findings.

* Create .github/workflows/semgrep.yml

* add compound specific semgrep rules

* add env vars

---------

Co-authored-by: Raz0r <me@raz0r.name>

* feat: added Linea L1 message service contract in the configuration

* feat: working solution, missing verification on etherscan

* chore: rename arg no-deploy to noDeploy

* feat: added linea cross chain governance scenario

* feat: added relayMessage for linea

* fix: cross chain governance tests for linea-goerli

* feat: mage LineaBridgeReceiver fallback payable and removed comments

* chore: new deployment with different account

* feat: added missing changes for linea deployment/scenarios

* fix: take into account compound team's comment except the migration file

* feat: fixed formatting, reset configuration.json and added lineaL1TokenBridge to the configuration

* feat: reduced baseMinForRewards to 1000e6

* feat: added migration script for linea-goerli to set reward config and ens text record

* feat: added linea comp address in the migration script, remove COMP asset from the configuration.json

* feat: fixed typo unit256 to uint256 + changed config values to be the the same as base goerli

* Remove prettier (#760)

The Comet repo currently has rules set up for both Prettier and ESLint, even though we only enforce the rules for ESLint. The move from Prettier to ESLint was decided in #321. 

Keeping the Prettier configs in the repo while not enforcing them is arguably worse than just not having the configs in the first place, since contributors may end up running the Prettier (e.g. via VSCode auto-format) for some files and introduce very large diffs. Removing Prettier should help reduce the formatting diffs introduced by contributors.

* Make OptimismBridgeReceiver sweepable (#759)

This change should extend the `OptimismBridgeReceiver` with some functionality to sweep ERC20 and native tokens.

* Linea Goerli cUSDCv3 deploy (#758)

* feat: messageService wrapper (WIP)

* feat: deployment script (WIP)

* feat: deployment script - adapt for Linea

* feat: config - adapt for Linea

* chore: delete unnecessary file

* feat: update hardhat config (WIP)

* fix: pragma conflict

* fix: LineaBridgeReceiver issue

* feat: add Linea config

* fix: add lineascan_key

* fix: add lineascan_key to github actions

* feat: wip linea deployment

* feat: added linea cross chain governance scenario

* feat: added Linea L1 message service contract in the configuration

* feat: added relayMessage for linea

* feat: working solution, missing verification on etherscan

* chore: rename arg no-deploy to noDeploy

* fix: cross chain governance tests for linea-goerli

* feat: mage LineaBridgeReceiver fallback payable and removed comments

* chore: new deployment with different account

* feat: added missing changes for linea deployment/scenarios

* fix: take into account compound team's comment except the migration file

* feat: fixed formatting, reset configuration.json and added lineaL1TokenBridge to the configuration

* feat: reduced baseMinForRewards to 1000e6

---------

Co-authored-by: Arthur <arthur@coeos.xyz>

* fix: LineaBridgeReceiver artifact path

* feat: updated linea COMP address

* fix: migration issues

* feat: added WBTC as collateral

* feat: added verification for liquidateCollateralFactor

* fix: WBTC contract + added usdc specific bridge to transfer usdc from L1 to linea

* fix: usdc decimals

* fix: fixed WBTC contract + use usdcbridge in the scenario

* fix: fixed last isssues

---------

Co-authored-by: Arthur <arthur@coeos.xyz>
Co-authored-by: Kevin Cheng <kevincheng96@hotmail.com>
Co-authored-by: Omar Ganiev <beched@decurity.io>
Co-authored-by: Raz0r <me@raz0r.name>

* Small clean up

* More fixes

* Modified migration from GitHub Actions

* feat: increase supply caps for ETH and WBTC for the linea quest (#772)

* feat: increase supply caps for ETH and WBTC for the linea quest

* feat: removed unecessary spider call + nit

* Fix supply cap migration script

* Modified migration from GitHub Actions

* Remove empty roots.json

* Fix min borrow amount

* Add COMP whale

---------

Co-authored-by: Julink <julien.fontanel12@gmail.com>
Co-authored-by: Arthur <arthur@coeos.xyz>
Co-authored-by: Omar Ganiev <beched@decurity.io>
Co-authored-by: Raz0r <me@raz0r.name>
Co-authored-by: GitHub Actions Bot <>
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.

4 participants