Skip to content

contracts: add set-l2-gasprice task#1102

Merged
tynes merged 1 commit intodevelopfrom
feat/l2gasprice-task
Jul 7, 2021
Merged

contracts: add set-l2-gasprice task#1102
tynes merged 1 commit intodevelopfrom
feat/l2gasprice-task

Conversation

@tynes
Copy link
Copy Markdown
Contributor

@tynes tynes commented Jun 15, 2021

Description
Adds a simple task for updating the L2 Gas Price. This shouldn't be used in production but is useful for testnet/local deployments. It checks that the correct key was passed through and then will set the L2 gas price in the OVM_GasPriceOracle.

This contract is owned so only a single key can update the gas price currently

CONTRACTS_TARGET_NETWORK=... \
CONTRACTS_DEPLOYER_KEY=... \
CONTRACTS_RPC_URL=... \
    npx hardhat set-l2-gasprice --network ... --l2-gas-price $(seth --to-wei 10 gwei)

Additional context
Is automated in #1103

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jun 15, 2021

🦋 Changeset detected

Latest commit: 694cf42

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@eth-optimism/contracts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tynes
Copy link
Copy Markdown
Contributor Author

tynes commented Jun 15, 2021

@smartcontracts is there some hardhat native way that I could be doing things? It cannot build because its trying to import something that doesn't exist until after the contracts compile, it seems like there is a way to get the artifacts dynamically with hre and also a provider/signer without needing to use the env vars

@snario snario force-pushed the regenesis/0.4.0 branch from 2bd4973 to db1574a Compare June 18, 2021 16:49
Base automatically changed from regenesis/0.4.0 to develop June 22, 2021 19:48
@tynes
Copy link
Copy Markdown
Contributor Author

tynes commented Jun 28, 2021

This needs to be refactored to use a pattern similar to: https://github.com/ethereum-optimism/optimism/pull/1108/files#diff-3fab190d4aa76d3281d1b051d819ee93be20949e67caaa328e2db6830ec41a95R12
This has been refactored

@tynes tynes force-pushed the feat/l2gasprice-task branch 4 times, most recently from 7760d27 to 3eebe5b Compare June 29, 2021 22:40
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #1102 (3eebe5b) into develop (21e47e1) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1102   +/-   ##
========================================
  Coverage    86.02%   86.02%           
========================================
  Files           48       48           
  Lines         1932     1932           
  Branches       306      306           
========================================
  Hits          1662     1662           
  Misses         270      270           

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 21e47e1...3eebe5b. Read the comment docs.


const addr = await signer.getAddress()
console.log(`Using signer ${addr}`)
const owner = await GasPriceOracle.callStatic.owner()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm do we use this in prod? A little sus if the owner of the GPO is just a private key sitting on a machine somewhere...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See the comment in the PR message above: This shouldn't be used in production but is useful for testnet/local deployments.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#1103 is what will be used in prod

@tynes tynes force-pushed the feat/l2gasprice-task branch from 3eebe5b to 694cf42 Compare July 1, 2021 17:17
This task allows a user to update the L2 gas price using hardhat.
An example of doing so would be:

```bash
$ export CONTRACTS_DEPLOYER_KEY=0x..
$ CONTRACTS_RPC_URL=https://kovan.optimism.io npx hardhat set-l2-gasprice \
    --l2-gas-price 1
```

This hardcodes the predeploy address of the `OVM_GasPriceOracle` smart
contract and the Owner must be used to do the updating, otherwise the
transaction will revert.
@tynes tynes merged commit 94cb32b into develop Jul 7, 2021
@tynes tynes deleted the feat/l2gasprice-task branch July 7, 2021 23:57
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.

3 participants