From e7f9675ecfa6c98757f1ab72598c60519f76ca40 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 20 May 2021 09:29:21 -0400 Subject: [PATCH 01/16] feat[contracts]: add GasPriceOracle w/o predeploy Based on #912 * feat[contracts]: congestion price oracle * chore: add changeset * contracts: gas price oracle (#917) * contracts: gas price oracle * tests: update * fees: fix tests * contracts: simplify gas price oracle * lint: fix * test: execution price is at the 1st storage slot * chore: rename predeploy to GasPriceOracle * chore: rename gas price oracle test name Co-authored-by: Mark Tyneway Co-authored-by: Georgios Konstantopoulos --- .changeset/seven-carpets-tell.md | 5 ++ .../OVM/predeploys/OVM_GasPriceOracle.sol | 71 ++++++++++++++++ .../precompiles/OVM_GasPriceOracle.spec.ts | 84 +++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 .changeset/seven-carpets-tell.md create mode 100644 packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol create mode 100644 packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts diff --git a/.changeset/seven-carpets-tell.md b/.changeset/seven-carpets-tell.md new file mode 100644 index 000000000000..9be51c0a6974 --- /dev/null +++ b/.changeset/seven-carpets-tell.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Introduces the congestion price oracle contract diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol new file mode 100644 index 000000000000..6f11866b0857 --- /dev/null +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: MIT +pragma solidity >0.5.0 <0.8.0; + +/* External Imports */ +import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; + +/** + * @title OVM_GasPriceOracle + * @dev This contract exposes the current execution price, a measure of how congested the network + * currently is. This measure is used by the Sequencer to determine what fee to charge for + * transactions. When the system is more congested, the execution price will increase and fees + * will also increase as a result. + * + * Compiler used: optimistic-solc + * Runtime target: OVM + */ +contract OVM_GasPriceOracle is Ownable { + + /************* + * Variables * + *************/ + + // Current execution price + uint256 internal executionPrice; + + /*************** + * Constructor * + ***************/ + + /** + * @param _owner Address that will initially own this contract. + */ + constructor( + address _owner + ) + Ownable() + { + transferOwnership(_owner); + } + + + /******************** + * Public Functions * + ********************/ + + /** + * @return Current execution price. + */ + function getExecutionPrice() + public + view + returns ( + uint256 + ) + { + return executionPrice; + } + + /** + * Allows the owner to modify the execution price. + * @param _executionPrice New execution price. + */ + function setExecutionPrice( + uint256 _executionPrice + ) + public + onlyOwner + { + executionPrice = _executionPrice; + } +} diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts new file mode 100644 index 000000000000..4e86499ef9bb --- /dev/null +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -0,0 +1,84 @@ +import { expect } from '../../../setup' + +/* External Imports */ +import { ethers } from 'hardhat' +import { ContractFactory, Contract, Signer } from 'ethers' + +describe('OVM_GasPriceOracle', () => { + let signer1: Signer + let signer2: Signer + before(async () => { + ;[signer1, signer2] = await ethers.getSigners() + }) + + let Factory__OVM_GasPriceOracle: ContractFactory + before(async () => { + Factory__OVM_GasPriceOracle = await ethers.getContractFactory( + 'OVM_GasPriceOracle' + ) + }) + + let OVM_GasPriceOracle: Contract + beforeEach(async () => { + OVM_GasPriceOracle = await Factory__OVM_GasPriceOracle.deploy( + await signer1.getAddress() + ) + }) + + describe('owner', () => { + it('should have an owner', async () => { + expect(await OVM_GasPriceOracle.owner()).to.equal( + await signer1.getAddress() + ) + }) + }) + + describe('setExecutionPrice', () => { + it('should revert if called by someone other than the owner', async () => { + await expect(OVM_GasPriceOracle.connect(signer2).setExecutionPrice(1234)) + .to.be.reverted + }) + + it('should succeed if called by the owner', async () => { + await expect(OVM_GasPriceOracle.connect(signer1).setExecutionPrice(1234)) + .to.not.be.reverted + }) + }) + + describe('getExecutionPrice', () => { + it('should return zero at first', async () => { + expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal(0) + }) + + it('should change when setExecutionPrice is called', async () => { + const executionPrice = 1234 + + await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( + executionPrice + ) + + expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal( + executionPrice + ) + }) + + it('is the 1st storage slot', async () => { + const executionPrice = 1234 + const slot = 1 + + // set the price + await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( + executionPrice + ) + + // get the storage slot value + const priceAtSlot = await signer1.provider.getStorageAt( + OVM_GasPriceOracle.address, + slot + ) + expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal( + ethers.BigNumber.from(priceAtSlot) + ) + }) + }) +}) From 0d6d2e23d1db0a6d041037c4959a39139a641d60 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Fri, 21 May 2021 20:37:38 -0700 Subject: [PATCH 02/16] Add an L2 deploy script for gas oracle contract --- .../000-OVM_GasPriceOracle.deploy.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts diff --git a/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts b/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts new file mode 100644 index 000000000000..b67c4966af01 --- /dev/null +++ b/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts @@ -0,0 +1,24 @@ +/* Imports: External */ +import { DeployFunction } from 'hardhat-deploy/dist/types' + +/* Imports: Internal */ +import { getContractDefinition } from '../src' + +const deployFn: DeployFunction = async (hre: any) => { + const { deployments, getNamedAccounts } = hre + const { deploy } = deployments + const { deployer } = await getNamedAccounts() + + const gasPriceOracle = getContractDefinition('OVM_GasPriceOracle', true) + + await deploy('OVM_GasPriceOracle', { + contract: gasPriceOracle, + from: deployer, + args: [(hre as any).deployConfig.ovmSequencerAddress], + log: true, + }); +} + +deployFn.tags = ['OVM_GasPriceOracle'] + +export default deployFn From 40f5e28056e719ab9984cc336df21f2d46c59b17 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Fri, 21 May 2021 20:54:35 -0700 Subject: [PATCH 03/16] Add a kovan deployment artifact --- .../deployments/optimistic-kovan/.chainId | 1 + .../optimistic-kovan/OVM_GasPriceOracle.json | 158 ++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 packages/contracts/deployments/optimistic-kovan/.chainId create mode 100644 packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json diff --git a/packages/contracts/deployments/optimistic-kovan/.chainId b/packages/contracts/deployments/optimistic-kovan/.chainId new file mode 100644 index 000000000000..8c0474e3239f --- /dev/null +++ b/packages/contracts/deployments/optimistic-kovan/.chainId @@ -0,0 +1 @@ +69 \ No newline at end of file diff --git a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json new file mode 100644 index 000000000000..d63ee3134880 --- /dev/null +++ b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json @@ -0,0 +1,158 @@ +{ + "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "getExecutionPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_executionPrice", + "type": "uint256" + } + ], + "name": "setExecutionPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "receipt": { + "to": null, + "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", + "contractAddress": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "transactionIndex": 0, + "gasUsed": "1683084", + "logsBloom": "0x00000000000000000000000000000040000000000000000000840000000000000000000000000000000000100000000000000000000200040000000000000000000000000000000000000008000000000001000010000000000000000000000400000000020000200000000000008800000000000000000000000010000020400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000060000000000000000000000000000000000001000000000000000000000000000000", + "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05", + "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 168730, + "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "address": "0x4200000000000000000000000000000000000006", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818", + "0x0000000000000000000000004200000000000000000000000000000000000005" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000", + "logIndex": 0, + "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05" + }, + { + "transactionIndex": 0, + "blockNumber": 168730, + "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05" + }, + { + "transactionIndex": 0, + "blockNumber": 168730, + "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05" + } + ], + "blockNumber": 168730, + "cumulativeGasUsed": "1683084", + "status": 1, + "byzantium": true + }, + "args": [ + "0x18394B52d3Cb931dfA76F63251919D051953413d" + ], + "bytecode": "0x60806040523480156100195760008061001661023f565b50505b506040516109a03803806109a0833981810160405260208110156100455760008061004261023f565b50505b81019080805192506000915061005b90506100c6565b905080600060018161006b6102aa565b816001600160a01b0302191690836001600160a01b031602179061008d61030a565b5050506001600160a01b038116600060008051602061098083398151915260405160405180910390a3506100c0816100d6565b5061039e565b60005a6100d1610358565b905090565b6100de6100c6565b6001600160a01b03166100ef61021e565b6001600160a01b0316146101525760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061014f61023f565b50505b6001600160a01b0381166101a05760405162461bcd60e51b815260040180806020018281038252602681526020018061095a602691396040019150506040518091039061019d61023f565b50505b806001600160a01b03166000806101b56102aa565b906101000a90046001600160a01b03166001600160a01b031660008051602061098083398151915260405160405180910390a38060006001816101f66102aa565b816001600160a01b0302191690836001600160a01b031602179061021861030a565b50505050565b6000808061022a6102aa565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b8681101561027757808601518282016040015260200161025c565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610305576000828201526020016102ee565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206102ee565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206102ee565b6105ad806103ad6000396000f3fe60806040523480156100195760008061001661042c565b50505b50600436106100605760003560e01c8063447cca981461006e578063715018a6146100885780638da5cb5b14610092578063ee6d2073146100b6578063f2fde38b146100dc575b60008061006b61042c565b50505b61007661010b565b60405190815260200160405180910390f35b61009061011c565b005b61009a61021e565b6040516001600160a01b03909116815260200160405180910390f35b610090600480360360208110156100d5576000806100d261042c565b50505b503561023f565b610090600480360360208110156100fb576000806100f861042c565b50505b50356001600160a01b03166102cd565b60006001610117610497565b905090565b610124610421565b6001600160a01b031661013561021e565b6001600160a01b0316146101985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019561042c565b50505b600080806101a4610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101f7610497565b816001600160a01b0302191690836001600160a01b03160217906102196104f2565b505050565b6000808061022a610497565b906101000a90046001600160a01b0316905090565b610247610421565b6001600160a01b031661025861021e565b6001600160a01b0316146102bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102b861042c565b50505b808060016102c76104f2565b50505050565b6102d5610421565b6001600160a01b03166102e661021e565b6001600160a01b0316146103495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061034661042c565b50505b6001600160a01b0381166103975760405162461bcd60e51b8152600401808060200182810382526026815260200180610587602691396040019150506040518091039061039461042c565b50505b806001600160a01b03166000806103ac610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ff610497565b816001600160a01b0302191690836001600160a01b03160217906102c76104f2565b60005a610117610540565b632a2a7adb598160e01b8152600481016020815285602082015260005b86811015610464578086015182820160400152602001610449565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610219576000828201526020016104db565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104db565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104db56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "deployedBytecode": "0x60806040523480156100195760008061001661042c565b50505b50600436106100605760003560e01c8063447cca981461006e578063715018a6146100885780638da5cb5b14610092578063ee6d2073146100b6578063f2fde38b146100dc575b60008061006b61042c565b50505b61007661010b565b60405190815260200160405180910390f35b61009061011c565b005b61009a61021e565b6040516001600160a01b03909116815260200160405180910390f35b610090600480360360208110156100d5576000806100d261042c565b50505b503561023f565b610090600480360360208110156100fb576000806100f861042c565b50505b50356001600160a01b03166102cd565b60006001610117610497565b905090565b610124610421565b6001600160a01b031661013561021e565b6001600160a01b0316146101985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019561042c565b50505b600080806101a4610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101f7610497565b816001600160a01b0302191690836001600160a01b03160217906102196104f2565b505050565b6000808061022a610497565b906101000a90046001600160a01b0316905090565b610247610421565b6001600160a01b031661025861021e565b6001600160a01b0316146102bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102b861042c565b50505b808060016102c76104f2565b50505050565b6102d5610421565b6001600160a01b03166102e661021e565b6001600160a01b0316146103495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061034661042c565b50505b6001600160a01b0381166103975760405162461bcd60e51b8152600401808060200182810382526026815260200180610587602691396040019150506040518091039061039461042c565b50505b806001600160a01b03166000806103ac610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ff610497565b816001600160a01b0302191690836001600160a01b03160217906102c76104f2565b60005a610117610540565b632a2a7adb598160e01b8152600481016020815285602082015260005b86811015610464578086015182820160400152602001610449565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610219576000828201526020016104db565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104db565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104db56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373" +} \ No newline at end of file From ff28fc8a3fa6a643155f54b927b268d8b87c9b5b Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Fri, 21 May 2021 23:09:24 -0700 Subject: [PATCH 04/16] Add deployment to readme --- packages/contracts/deployments/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 16ba51c26020..9f962268fca7 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -1,6 +1,15 @@ # Optimism Regenesis Deployments ## LAYER 2 +## OPTIMISTIC-KOVAN + +Network : __undefined (chain id: 69)__ + +|Contract|Address| +|--|--| +|OVM_GasPriceOracle|[0x668E5b997b9aE88a56cd40409119d4Db9e6d752E](https://undefined.etherscan.io/address/0x668E5b997b9aE88a56cd40409119d4Db9e6d752E)| +--- + ### Chain IDs: - Mainnet: 10 - Kovan: 69 From b88023b91539ea36e5bc4af887c13273fc177a5f Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Mon, 24 May 2021 17:34:14 -0400 Subject: [PATCH 05/16] Add extra validation & initial execution price --- .../OVM/predeploys/OVM_GasPriceOracle.sol | 25 +++++------ .../000-OVM_GasPriceOracle.deploy.ts | 9 +++- packages/contracts/tasks/deploy.ts | 6 +++ .../precompiles/OVM_GasPriceOracle.spec.ts | 45 ++++++++++++++----- 4 files changed, 57 insertions(+), 28 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol index 6f11866b0857..4fc9a98304e5 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -21,7 +21,12 @@ contract OVM_GasPriceOracle is Ownable { *************/ // Current execution price - uint256 internal executionPrice; + uint256 public executionPrice; + + /************* + * Constants * + *************/ + uint256 public constant EXECUTION_PRICE_MULTIPLE = 100000001; /*************** * Constructor * @@ -31,11 +36,13 @@ contract OVM_GasPriceOracle is Ownable { * @param _owner Address that will initially own this contract. */ constructor( - address _owner + address _owner, + uint256 _initialExecutionPrice ) Ownable() { transferOwnership(_owner); + setExecutionPrice(_initialExecutionPrice); } @@ -43,19 +50,6 @@ contract OVM_GasPriceOracle is Ownable { * Public Functions * ********************/ - /** - * @return Current execution price. - */ - function getExecutionPrice() - public - view - returns ( - uint256 - ) - { - return executionPrice; - } - /** * Allows the owner to modify the execution price. * @param _executionPrice New execution price. @@ -66,6 +60,7 @@ contract OVM_GasPriceOracle is Ownable { public onlyOwner { + require(_executionPrice == 1 || _executionPrice % EXECUTION_PRICE_MULTIPLE == 0, "Execution price must be `1` OR a multiple of EXECUTION_PRICE_MULTIPLE."); executionPrice = _executionPrice; } } diff --git a/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts b/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts index b67c4966af01..96eb8fd1b175 100644 --- a/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts +++ b/packages/contracts/deploy-l2/000-OVM_GasPriceOracle.deploy.ts @@ -11,10 +11,17 @@ const deployFn: DeployFunction = async (hre: any) => { const gasPriceOracle = getContractDefinition('OVM_GasPriceOracle', true) + const gasOracleOwner = (hre as any).deployConfig.ovmSequencerAddress + const initialGasPrice = (hre as any).deployConfig.initialGasPriceOracleGasPrice + + if (!gasOracleOwner || !initialGasPrice) { + throw new Error('initialGasPrice & ovmSequencerAddress required to deploy gas price oracle') + } + await deploy('OVM_GasPriceOracle', { contract: gasPriceOracle, from: deployer, - args: [(hre as any).deployConfig.ovmSequencerAddress], + args: [gasOracleOwner, initialGasPrice], log: true, }); } diff --git a/packages/contracts/tasks/deploy.ts b/packages/contracts/tasks/deploy.ts index 35d2e041b692..8c3a793b062b 100644 --- a/packages/contracts/tasks/deploy.ts +++ b/packages/contracts/tasks/deploy.ts @@ -99,6 +99,12 @@ task('deploy') undefined, types.string ) + .addOptionalParam( + 'initialGasPriceOracleGasPrice', + 'The initial execution price for the gas price oracle.', + undefined, + types.int + ) .setAction(async (args, hre: any, runSuper) => { // Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks. const validateAddressArg = (argName: string) => { diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts index 4e86499ef9bb..6e8ce4986c8f 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -5,6 +5,7 @@ import { ethers } from 'hardhat' import { ContractFactory, Contract, Signer } from 'ethers' describe('OVM_GasPriceOracle', () => { + const initialExecutionPrice = 1 let signer1: Signer let signer2: Signer before(async () => { @@ -21,7 +22,8 @@ describe('OVM_GasPriceOracle', () => { let OVM_GasPriceOracle: Contract beforeEach(async () => { OVM_GasPriceOracle = await Factory__OVM_GasPriceOracle.deploy( - await signer1.getAddress() + await signer1.getAddress(), + initialExecutionPrice ) }) @@ -39,31 +41,50 @@ describe('OVM_GasPriceOracle', () => { .to.be.reverted }) - it('should succeed if called by the owner', async () => { - await expect(OVM_GasPriceOracle.connect(signer1).setExecutionPrice(1234)) - .to.not.be.reverted + it('should revert if NOT called by the owner and is a multiple of EXECUTION_PRICE_MULTIPLE', async () => { + const executionPrice = 1234 + + await expect( + OVM_GasPriceOracle.connect(signer1).setExecutionPrice(executionPrice) + ).to.be.reverted + }) + + it('should succeed if called by the owner and is a multiple of EXECUTION_PRICE_MULTIPLE', async () => { + const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() + const executionPrice = 1234 * executionPriceMultiple + + await expect( + OVM_GasPriceOracle.connect(signer1).setExecutionPrice(executionPrice) + ).to.not.be.reverted + }) + + it('should succeed if called by the owner and is equal to `1`', async () => { + await expect(OVM_GasPriceOracle.connect(signer1).setExecutionPrice(1)).to + .not.be.reverted }) }) - describe('getExecutionPrice', () => { + describe('get executionPrice', () => { it('should return zero at first', async () => { - expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal(0) + expect(await OVM_GasPriceOracle.executionPrice()).to.equal( + initialExecutionPrice + ) }) it('should change when setExecutionPrice is called', async () => { - const executionPrice = 1234 + const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() + const executionPrice = 1234 * executionPriceMultiple await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( executionPrice ) - expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal( - executionPrice - ) + expect(await OVM_GasPriceOracle.executionPrice()).to.equal(executionPrice) }) it('is the 1st storage slot', async () => { - const executionPrice = 1234 + const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() + const executionPrice = 1234 * executionPriceMultiple const slot = 1 // set the price @@ -76,7 +97,7 @@ describe('OVM_GasPriceOracle', () => { OVM_GasPriceOracle.address, slot ) - expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal( + expect(await OVM_GasPriceOracle.executionPrice()).to.equal( ethers.BigNumber.from(priceAtSlot) ) }) From 2af3c2f0cad208ef5a4d94b8ae5f4ae079cdfbf4 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Mon, 24 May 2021 17:53:27 -0400 Subject: [PATCH 06/16] Update README.md --- packages/contracts/deployments/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 9f962268fca7..5111658fd8d3 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -3,11 +3,11 @@ ## OPTIMISTIC-KOVAN -Network : __undefined (chain id: 69)__ +Network : __optimistic-kovan (chain id: 69)__ |Contract|Address| |--|--| -|OVM_GasPriceOracle|[0x668E5b997b9aE88a56cd40409119d4Db9e6d752E](https://undefined.etherscan.io/address/0x668E5b997b9aE88a56cd40409119d4Db9e6d752E)| +|OVM_GasPriceOracle|[0x668E5b997b9aE88a56cd40409119d4Db9e6d752E](https://kovan-optimistic.etherscan.io/address/0x668E5b997b9aE88a56cd40409119d4Db9e6d752E)| --- ### Chain IDs: From 175e1f545bc09dcb63de43d91304e1026e28a0b8 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Mon, 24 May 2021 18:25:34 -0400 Subject: [PATCH 07/16] Fix execution price logic --- .../OVM/predeploys/OVM_GasPriceOracle.sol | 4 ++-- .../OVM/precompiles/OVM_GasPriceOracle.spec.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol index 9f0db8e91141..52c1c7b539cb 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -26,7 +26,7 @@ contract OVM_GasPriceOracle is Ownable { /************* * Constants * *************/ - uint256 public constant EXECUTION_PRICE_MULTIPLE = 100000001; + uint256 public constant EXECUTION_PRICE_MULTIPLE = 100000000; /*************** * Constructor * @@ -60,7 +60,7 @@ contract OVM_GasPriceOracle is Ownable { public onlyOwner { - require(_executionPrice == 1 || _executionPrice % EXECUTION_PRICE_MULTIPLE == 0, "Execution price must be `1` OR a multiple of EXECUTION_PRICE_MULTIPLE."); + require(_executionPrice % EXECUTION_PRICE_MULTIPLE == 1, "Execution price must satisfy `price % EXECUTION_PRICE_MULTIPLE == 1`."); executionPrice = _executionPrice; } } diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts index 6e8ce4986c8f..0bdaf5ad62ab 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -41,7 +41,7 @@ describe('OVM_GasPriceOracle', () => { .to.be.reverted }) - it('should revert if NOT called by the owner and is a multiple of EXECUTION_PRICE_MULTIPLE', async () => { + it('should revert if DOES NOT satisfy `price % EXECUTION_PRICE_MULTIPLE == 1`', async () => { const executionPrice = 1234 await expect( @@ -49,9 +49,9 @@ describe('OVM_GasPriceOracle', () => { ).to.be.reverted }) - it('should succeed if called by the owner and is a multiple of EXECUTION_PRICE_MULTIPLE', async () => { + it('should revert if DOES NOT satisfy `price % EXECUTION_PRICE_MULTIPLE == 1`', async () => { const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() - const executionPrice = 1234 * executionPriceMultiple + const executionPrice = 1234 * executionPriceMultiple + 1 await expect( OVM_GasPriceOracle.connect(signer1).setExecutionPrice(executionPrice) @@ -73,7 +73,7 @@ describe('OVM_GasPriceOracle', () => { it('should change when setExecutionPrice is called', async () => { const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() - const executionPrice = 1234 * executionPriceMultiple + const executionPrice = 1234 * executionPriceMultiple + 1 await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( executionPrice @@ -84,7 +84,7 @@ describe('OVM_GasPriceOracle', () => { it('is the 1st storage slot', async () => { const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() - const executionPrice = 1234 * executionPriceMultiple + const executionPrice = 1234 * executionPriceMultiple + 1 const slot = 1 // set the price From a53ead45ffc6ba700255b6a863c083d0d561999e Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Mon, 24 May 2021 18:34:07 -0400 Subject: [PATCH 08/16] Perform new deployment with final contract --- packages/contracts/deployments/README.md | 2 +- .../optimistic-kovan/OVM_GasPriceOracle.json | 67 ++++++++++++------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 5111658fd8d3..1c46f760b391 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -7,7 +7,7 @@ Network : __optimistic-kovan (chain id: 69)__ |Contract|Address| |--|--| -|OVM_GasPriceOracle|[0x668E5b997b9aE88a56cd40409119d4Db9e6d752E](https://kovan-optimistic.etherscan.io/address/0x668E5b997b9aE88a56cd40409119d4Db9e6d752E)| +|OVM_GasPriceOracle|[0xFb3593931f0160476b942003c6F5A4AC7e3f49E4](https://kovan-optimistic.etherscan.io/address/0xFb3593931f0160476b942003c6F5A4AC7e3f49E4)| --- ### Chain IDs: diff --git a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json index d63ee3134880..2af338f08a6c 100644 --- a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json +++ b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json @@ -1,5 +1,5 @@ { - "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "address": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", "abi": [ { "inputs": [ @@ -7,6 +7,11 @@ "internalType": "address", "name": "_owner", "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialExecutionPrice", + "type": "uint256" } ], "stateMutability": "nonpayable", @@ -33,7 +38,20 @@ }, { "inputs": [], - "name": "getExecutionPrice", + "name": "EXECUTION_PRICE_MULTIPLE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "executionPrice", "outputs": [ { "internalType": "uint256", @@ -91,21 +109,21 @@ "type": "function" } ], - "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", "receipt": { "to": null, "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "contractAddress": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", "transactionIndex": 0, - "gasUsed": "1683084", - "logsBloom": "0x00000000000000000000000000000040000000000000000000840000000000000000000000000000000000100000000000000000000200040000000000000000000000000000000000000008000000000001000010000000000000000000000400000000020000200000000000008800000000000000000000000010000020400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000060000000000000000000000000000000000001000000000000000000000000000000", - "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05", - "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "gasUsed": "1376043", + "logsBloom": "0x00000020000000000000000000000040000000000000000000840000000000000000000000000000000000100000000000000000000000040000000000000000000000000000000000000008000000000001000010000000000000000000000400000000020080000000000000008800000000000000000000000010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000020000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000060000000000000000000000000000000000001000000000000000000000000000000", + "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317", + "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", "logs": [ { "transactionIndex": 0, - "blockNumber": 168730, - "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", + "blockNumber": 184144, + "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", "address": "0x4200000000000000000000000000000000000006", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", @@ -114,13 +132,13 @@ ], "data": "0x0000000000000000000000000000000000000000000000000000000000000000", "logIndex": 0, - "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05" + "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317" }, { "transactionIndex": 0, - "blockNumber": 168730, - "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", - "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "blockNumber": 184144, + "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", + "address": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -128,13 +146,13 @@ ], "data": "0x", "logIndex": 1, - "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05" + "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317" }, { "transactionIndex": 0, - "blockNumber": 168730, - "transactionHash": "0x462abd3d2d81ff8fc93d3474c3d97130b7b2b6a60a8860271a8fd26b30e344c0", - "address": "0x668E5b997b9aE88a56cd40409119d4Db9e6d752E", + "blockNumber": 184144, + "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", + "address": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818", @@ -142,17 +160,18 @@ ], "data": "0x", "logIndex": 2, - "blockHash": "0xe535ac12159e47d36cc8c40cd8687c91befafa6bf3f70bb8e145349f13097e05" + "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317" } ], - "blockNumber": 168730, - "cumulativeGasUsed": "1683084", + "blockNumber": 184144, + "cumulativeGasUsed": "1376043", "status": 1, "byzantium": true }, "args": [ - "0x18394B52d3Cb931dfA76F63251919D051953413d" + "0x18394B52d3Cb931dfA76F63251919D051953413d", + 100000001 ], - "bytecode": "0x60806040523480156100195760008061001661023f565b50505b506040516109a03803806109a0833981810160405260208110156100455760008061004261023f565b50505b81019080805192506000915061005b90506100c6565b905080600060018161006b6102aa565b816001600160a01b0302191690836001600160a01b031602179061008d61030a565b5050506001600160a01b038116600060008051602061098083398151915260405160405180910390a3506100c0816100d6565b5061039e565b60005a6100d1610358565b905090565b6100de6100c6565b6001600160a01b03166100ef61021e565b6001600160a01b0316146101525760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061014f61023f565b50505b6001600160a01b0381166101a05760405162461bcd60e51b815260040180806020018281038252602681526020018061095a602691396040019150506040518091039061019d61023f565b50505b806001600160a01b03166000806101b56102aa565b906101000a90046001600160a01b03166001600160a01b031660008051602061098083398151915260405160405180910390a38060006001816101f66102aa565b816001600160a01b0302191690836001600160a01b031602179061021861030a565b50505050565b6000808061022a6102aa565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b8681101561027757808601518282016040015260200161025c565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610305576000828201526020016102ee565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206102ee565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206102ee565b6105ad806103ad6000396000f3fe60806040523480156100195760008061001661042c565b50505b50600436106100605760003560e01c8063447cca981461006e578063715018a6146100885780638da5cb5b14610092578063ee6d2073146100b6578063f2fde38b146100dc575b60008061006b61042c565b50505b61007661010b565b60405190815260200160405180910390f35b61009061011c565b005b61009a61021e565b6040516001600160a01b03909116815260200160405180910390f35b610090600480360360208110156100d5576000806100d261042c565b50505b503561023f565b610090600480360360208110156100fb576000806100f861042c565b50505b50356001600160a01b03166102cd565b60006001610117610497565b905090565b610124610421565b6001600160a01b031661013561021e565b6001600160a01b0316146101985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019561042c565b50505b600080806101a4610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101f7610497565b816001600160a01b0302191690836001600160a01b03160217906102196104f2565b505050565b6000808061022a610497565b906101000a90046001600160a01b0316905090565b610247610421565b6001600160a01b031661025861021e565b6001600160a01b0316146102bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102b861042c565b50505b808060016102c76104f2565b50505050565b6102d5610421565b6001600160a01b03166102e661021e565b6001600160a01b0316146103495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061034661042c565b50505b6001600160a01b0381166103975760405162461bcd60e51b8152600401808060200182810382526026815260200180610587602691396040019150506040518091039061039461042c565b50505b806001600160a01b03166000806103ac610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ff610497565b816001600160a01b0302191690836001600160a01b03160217906102c76104f2565b60005a610117610540565b632a2a7adb598160e01b8152600481016020815285602082015260005b86811015610464578086015182820160400152602001610449565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610219576000828201526020016104db565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104db565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104db56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "deployedBytecode": "0x60806040523480156100195760008061001661042c565b50505b50600436106100605760003560e01c8063447cca981461006e578063715018a6146100885780638da5cb5b14610092578063ee6d2073146100b6578063f2fde38b146100dc575b60008061006b61042c565b50505b61007661010b565b60405190815260200160405180910390f35b61009061011c565b005b61009a61021e565b6040516001600160a01b03909116815260200160405180910390f35b610090600480360360208110156100d5576000806100d261042c565b50505b503561023f565b610090600480360360208110156100fb576000806100f861042c565b50505b50356001600160a01b03166102cd565b60006001610117610497565b905090565b610124610421565b6001600160a01b031661013561021e565b6001600160a01b0316146101985760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019561042c565b50505b600080806101a4610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101f7610497565b816001600160a01b0302191690836001600160a01b03160217906102196104f2565b505050565b6000808061022a610497565b906101000a90046001600160a01b0316905090565b610247610421565b6001600160a01b031661025861021e565b6001600160a01b0316146102bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102b861042c565b50505b808060016102c76104f2565b50505050565b6102d5610421565b6001600160a01b03166102e661021e565b6001600160a01b0316146103495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061034661042c565b50505b6001600160a01b0381166103975760405162461bcd60e51b8152600401808060200182810382526026815260200180610587602691396040019150506040518091039061039461042c565b50505b806001600160a01b03166000806103ac610497565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ff610497565b816001600160a01b0302191690836001600160a01b03160217906102c76104f2565b60005a610117610540565b632a2a7adb598160e01b8152600481016020815285602082015260005b86811015610464578086015182820160400152602001610449565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610219576000828201526020016104db565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104db565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104db56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373" + "bytecode": "0x60806040523480156200001c57600080620000196200033c565b50505b5060405162000bb838038062000bb8833981810160405260408110156200004d576000806200004a6200033c565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f620003a9565b816001600160a01b0302191690836001600160a01b0316021790620000a36200040b565b5050506001600160a01b038116600060008051602062000b9883398151915260405160405180910390a350620000d981620000fe565b620000e482620001d6565b5050620004a1565b60005a620000f96200045a565b905090565b62000108620000ec565b6001600160a01b03166200011b62000319565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000b788339815191526044820152606401604051809103906200016d6200033c565b50505b6305f5e1008106600114620001c25760405162461bcd60e51b815260040180806020018281038252604581526020018062000b336045913960600191505060405180910390620001bf6200033c565b50505b80806001620001d06200040b565b50505050565b620001e0620000ec565b6001600160a01b0316620001f362000319565b6001600160a01b031614620002485760405162461bcd60e51b8152602060048201819052602482015260008051602062000b78833981519152604482015260640160405180910390620002456200033c565b50505b6001600160a01b0381166200029a5760405162461bcd60e51b815260040180806020018281038252602681526020018062000b0d6026913960400191505060405180910390620002976200033c565b50505b806001600160a01b0316600080620002b1620003a9565b906101000a90046001600160a01b03166001600160a01b031660008051602062000b9883398151915260405160405180910390a3806000600181620002f5620003a9565b816001600160a01b0302191690836001600160a01b0316021790620001d06200040b565b6000808062000327620003a9565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156200037657808601518282016040015260200162000359565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156200040657600082820152602001620003ed565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020620003ed565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b80516000825293506020620003ed565b61065c80620004b16000396000f3fe608060405234801561001957600080610016610496565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b600080610076610496565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e5610496565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b610496565b50505b50356001600160a01b0316610332565b6305f5e10081565b6001610130610501565b81565b61013b610486565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac610496565b50505b600080806101bb610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610501565b816001600160a01b0302191690836001600160a01b031602179061023061055c565b505050565b60008080610241610501565b906101000a90046001600160a01b0316905090565b61025e610486565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf610496565b50505b6305f5e10081066001146103205760405162461bcd60e51b8152600401808060200182810382526045815260200180610617604591396060019150506040518091039061031d610496565b50505b8080600161032c61055c565b50505050565b61033a610486565b6001600160a01b031661034b610235565b6001600160a01b0316146103ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103ab610496565b50505b6001600160a01b0381166103fc5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f160269139604001915050604051809103906103f9610496565b50505b806001600160a01b0316600080610411610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000600181610464610501565b816001600160a01b0302191690836001600160a01b031602179061032c61055c565b60005a6104916105aa565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104ce5780860151828201604001526020016104b3565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561023057600082820152602001610545565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610545565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373457865637574696f6e207072696365206d757374207361746973667920607072696365202520455845435554494f4e5f50524943455f4d554c5449504c45203d3d2031602e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373457865637574696f6e207072696365206d757374207361746973667920607072696365202520455845435554494f4e5f50524943455f4d554c5449504c45203d3d2031602e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "deployedBytecode": "0x608060405234801561001957600080610016610496565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b600080610076610496565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e5610496565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b610496565b50505b50356001600160a01b0316610332565b6305f5e10081565b6001610130610501565b81565b61013b610486565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac610496565b50505b600080806101bb610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610501565b816001600160a01b0302191690836001600160a01b031602179061023061055c565b505050565b60008080610241610501565b906101000a90046001600160a01b0316905090565b61025e610486565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf610496565b50505b6305f5e10081066001146103205760405162461bcd60e51b8152600401808060200182810382526045815260200180610617604591396060019150506040518091039061031d610496565b50505b8080600161032c61055c565b50505050565b61033a610486565b6001600160a01b031661034b610235565b6001600160a01b0316146103ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103ab610496565b50505b6001600160a01b0381166103fc5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f160269139604001915050604051809103906103f9610496565b50505b806001600160a01b0316600080610411610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000600181610464610501565b816001600160a01b0302191690836001600160a01b031602179061032c61055c565b60005a6104916105aa565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104ce5780860151828201604001526020016104b3565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561023057600082820152602001610545565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610545565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373457865637574696f6e207072696365206d757374207361746973667920607072696365202520455845435554494f4e5f50524943455f4d554c5449504c45203d3d2031602e" } \ No newline at end of file From ebf471fd702f1a45b6190de9d7a65b4577386498 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 25 May 2021 19:40:08 -0700 Subject: [PATCH 09/16] contracts: better require in ovm gas price oracle --- .../OVM/predeploys/OVM_GasPriceOracle.sol | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol index 52c1c7b539cb..f78b158af2e1 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -60,7 +60,16 @@ contract OVM_GasPriceOracle is Ownable { public onlyOwner { - require(_executionPrice % EXECUTION_PRICE_MULTIPLE == 1, "Execution price must satisfy `price % EXECUTION_PRICE_MULTIPLE == 1`."); + require( + _executionPrice != 0, + "OVM_GasPriceOracle: execution price must not be zero" + ); + + require( + _executionPrice % EXECUTION_PRICE_MULTIPLE == 1, + "OVM_GasPriceOracle: execution price must satisfy x % (10**8) == 1" + ); + executionPrice = _executionPrice; } } From 16b080ce8ead95b578d3dbc8693911d94d7b2843 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 26 May 2021 12:29:52 -0400 Subject: [PATCH 10/16] Deploy L2GasPriceOracle --- packages/contracts/deployments/README.md | 2 +- .../optimistic-kovan/OVM_GasPriceOracle.json | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 1c46f760b391..3f93af932fe1 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -7,7 +7,7 @@ Network : __optimistic-kovan (chain id: 69)__ |Contract|Address| |--|--| -|OVM_GasPriceOracle|[0xFb3593931f0160476b942003c6F5A4AC7e3f49E4](https://kovan-optimistic.etherscan.io/address/0xFb3593931f0160476b942003c6F5A4AC7e3f49E4)| +|OVM_GasPriceOracle|[0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905](https://kovan-optimistic.etherscan.io/address/0xFb3593931f0160476b942003c6F5A4AC7e3f49E4)| --- ### Chain IDs: diff --git a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json index 2af338f08a6c..7cf7976c2536 100644 --- a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json +++ b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json @@ -1,5 +1,5 @@ { - "address": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", + "address": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", "abi": [ { "inputs": [ @@ -109,21 +109,21 @@ "type": "function" } ], - "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", + "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", "receipt": { "to": null, "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", + "contractAddress": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", "transactionIndex": 0, - "gasUsed": "1376043", - "logsBloom": "0x00000020000000000000000000000040000000000000000000840000000000000000000000000000000000100000000000000000000000040000000000000000000000000000000000000008000000000001000010000000000000000000000400000000020080000000000000008800000000000000000000000010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000020000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000060000000000000000000000000000000000001000000000000000000000000000000", - "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317", - "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", + "gasUsed": "1423279", + "logsBloom": "0x00000000000000000000000000000040000000000000000000840000000000000000000000000000000000100000080000000000000000040000000000000000080000000000000000000008000000000001000010000000000000000000000400000000020000000000000000008800000000000000000000000010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000060000000000000000000000000000000000001000000000000000000000000001000", + "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94", + "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", "logs": [ { "transactionIndex": 0, - "blockNumber": 184144, - "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", + "blockNumber": 225329, + "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", "address": "0x4200000000000000000000000000000000000006", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", @@ -132,13 +132,13 @@ ], "data": "0x0000000000000000000000000000000000000000000000000000000000000000", "logIndex": 0, - "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317" + "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94" }, { "transactionIndex": 0, - "blockNumber": 184144, - "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", - "address": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", + "blockNumber": 225329, + "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", + "address": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -146,13 +146,13 @@ ], "data": "0x", "logIndex": 1, - "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317" + "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94" }, { "transactionIndex": 0, - "blockNumber": 184144, - "transactionHash": "0xdc9dfeb2d1fe8ac9233a3f4c3181e9721beafac4768821004b815885d8bb5642", - "address": "0xFb3593931f0160476b942003c6F5A4AC7e3f49E4", + "blockNumber": 225329, + "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", + "address": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818", @@ -160,11 +160,11 @@ ], "data": "0x", "logIndex": 2, - "blockHash": "0x8af40bd1c0a0573d94e75a13259e8d76605536d834063ad1da80b50c615c5317" + "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94" } ], - "blockNumber": 184144, - "cumulativeGasUsed": "1376043", + "blockNumber": 225329, + "cumulativeGasUsed": "1423279", "status": 1, "byzantium": true }, @@ -172,6 +172,6 @@ "0x18394B52d3Cb931dfA76F63251919D051953413d", 100000001 ], - "bytecode": "0x60806040523480156200001c57600080620000196200033c565b50505b5060405162000bb838038062000bb8833981810160405260408110156200004d576000806200004a6200033c565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f620003a9565b816001600160a01b0302191690836001600160a01b0316021790620000a36200040b565b5050506001600160a01b038116600060008051602062000b9883398151915260405160405180910390a350620000d981620000fe565b620000e482620001d6565b5050620004a1565b60005a620000f96200045a565b905090565b62000108620000ec565b6001600160a01b03166200011b62000319565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000b788339815191526044820152606401604051809103906200016d6200033c565b50505b6305f5e1008106600114620001c25760405162461bcd60e51b815260040180806020018281038252604581526020018062000b336045913960600191505060405180910390620001bf6200033c565b50505b80806001620001d06200040b565b50505050565b620001e0620000ec565b6001600160a01b0316620001f362000319565b6001600160a01b031614620002485760405162461bcd60e51b8152602060048201819052602482015260008051602062000b78833981519152604482015260640160405180910390620002456200033c565b50505b6001600160a01b0381166200029a5760405162461bcd60e51b815260040180806020018281038252602681526020018062000b0d6026913960400191505060405180910390620002976200033c565b50505b806001600160a01b0316600080620002b1620003a9565b906101000a90046001600160a01b03166001600160a01b031660008051602062000b9883398151915260405160405180910390a3806000600181620002f5620003a9565b816001600160a01b0302191690836001600160a01b0316021790620001d06200040b565b6000808062000327620003a9565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156200037657808601518282016040015260200162000359565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156200040657600082820152602001620003ed565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020620003ed565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b80516000825293506020620003ed565b61065c80620004b16000396000f3fe608060405234801561001957600080610016610496565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b600080610076610496565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e5610496565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b610496565b50505b50356001600160a01b0316610332565b6305f5e10081565b6001610130610501565b81565b61013b610486565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac610496565b50505b600080806101bb610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610501565b816001600160a01b0302191690836001600160a01b031602179061023061055c565b505050565b60008080610241610501565b906101000a90046001600160a01b0316905090565b61025e610486565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf610496565b50505b6305f5e10081066001146103205760405162461bcd60e51b8152600401808060200182810382526045815260200180610617604591396060019150506040518091039061031d610496565b50505b8080600161032c61055c565b50505050565b61033a610486565b6001600160a01b031661034b610235565b6001600160a01b0316146103ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103ab610496565b50505b6001600160a01b0381166103fc5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f160269139604001915050604051809103906103f9610496565b50505b806001600160a01b0316600080610411610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000600181610464610501565b816001600160a01b0302191690836001600160a01b031602179061032c61055c565b60005a6104916105aa565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104ce5780860151828201604001526020016104b3565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561023057600082820152602001610545565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610545565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373457865637574696f6e207072696365206d757374207361746973667920607072696365202520455845435554494f4e5f50524943455f4d554c5449504c45203d3d2031602e4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373457865637574696f6e207072696365206d757374207361746973667920607072696365202520455845435554494f4e5f50524943455f4d554c5449504c45203d3d2031602e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "deployedBytecode": "0x608060405234801561001957600080610016610496565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b600080610076610496565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e5610496565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b610496565b50505b50356001600160a01b0316610332565b6305f5e10081565b6001610130610501565b81565b61013b610486565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac610496565b50505b600080806101bb610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610501565b816001600160a01b0302191690836001600160a01b031602179061023061055c565b505050565b60008080610241610501565b906101000a90046001600160a01b0316905090565b61025e610486565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf610496565b50505b6305f5e10081066001146103205760405162461bcd60e51b8152600401808060200182810382526045815260200180610617604591396060019150506040518091039061031d610496565b50505b8080600161032c61055c565b50505050565b61033a610486565b6001600160a01b031661034b610235565b6001600160a01b0316146103ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103ab610496565b50505b6001600160a01b0381166103fc5760405162461bcd60e51b81526004018080602001828103825260268152602001806105f160269139604001915050604051809103906103f9610496565b50505b806001600160a01b0316600080610411610501565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000600181610464610501565b816001600160a01b0302191690836001600160a01b031602179061032c61055c565b60005a6104916105aa565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104ce5780860151828201604001526020016104b3565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561023057600082820152602001610545565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610545565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373457865637574696f6e207072696365206d757374207361746973667920607072696365202520455845435554494f4e5f50524943455f4d554c5449504c45203d3d2031602e" + "bytecode": "0x60806040523480156200001c576000806200001962000385565b50505b5060405162000ca638038062000ca6833981810160405260408110156200004d576000806200004a62000385565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f620003f2565b816001600160a01b0302191690836001600160a01b0316021790620000a362000454565b5050506001600160a01b038116600060008051602062000c5283398151915260405160405180910390a350620000d981620000fe565b620000e4826200021f565b5050620004ea565b60005a620000f9620004a3565b905090565b62000108620000ec565b6001600160a01b03166200011b62000362565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000c328339815191526044820152606401604051809103906200016d62000385565b50505b80620001b95760405162461bcd60e51b815260040180806020018281038252603481526020018062000c726034913960400191505060405180910390620001b662000385565b50505b6305f5e10081066001146200020b5760405162461bcd60e51b815260040180806020018281038252604181526020018062000bcb60419139606001915050604051809103906200020862000385565b50505b808060016200021962000454565b50505050565b62000229620000ec565b6001600160a01b03166200023c62000362565b6001600160a01b031614620002915760405162461bcd60e51b8152602060048201819052602482015260008051602062000c328339815191526044820152606401604051809103906200028e62000385565b50505b6001600160a01b038116620002e35760405162461bcd60e51b815260040180806020018281038252602681526020018062000c0c6026913960400191505060405180910390620002e062000385565b50505b806001600160a01b0316600080620002fa620003f2565b906101000a90046001600160a01b03166001600160a01b031660008051602062000c5283398151915260405160405180910390a38060006001816200033e620003f2565b816001600160a01b0302191690836001600160a01b03160217906200021962000454565b6000808062000370620003f2565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b86811015620003bf578086015182820160400152602001620003a2565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156200044f5760008282015260200162000436565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b60008152602062000436565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602062000436565b6106d180620004fa6000396000f3fe6080604052348015610019576000806100166104db565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b6000806100766104db565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e56104db565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b6104db565b50505b50356001600160a01b0316610377565b6305f5e10081565b6001610130610546565b81565b61013b6104cb565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac6104db565b50505b600080806101bb610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610546565b816001600160a01b0302191690836001600160a01b03160217906102306105a1565b505050565b60008080610241610546565b906101000a90046001600160a01b0316905090565b61025e6104cb565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf6104db565b50505b806103175760405162461bcd60e51b815260040180806020018281038252603481526020018061069d60349139604001915050604051809103906103146104db565b50505b6305f5e10081066001146103655760405162461bcd60e51b815260040180806020018281038252604181526020018061063660419139606001915050604051809103906103626104db565b50505b808060016103716105a1565b50505050565b61037f6104cb565b6001600160a01b0316610390610235565b6001600160a01b0316146103f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103f06104db565b50505b6001600160a01b0381166104415760405162461bcd60e51b8152600401808060200182810382526026815260200180610677602691396040019150506040518091039061043e6104db565b50505b806001600160a01b0316600080610456610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104a9610546565b816001600160a01b0302191690836001600160a01b03160217906103716105a1565b60005a6104d66105ef565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156105135780860151828201604001526020016104f8565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156102305760008282015260200161058a565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b60008152602061058a565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061058a56fe4f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374207361746973667920782025202831302a2a3829203d3d20314f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374206e6f74206265207a65726f4f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374207361746973667920782025202831302a2a3829203d3d20314f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374206e6f74206265207a65726f", + "deployedBytecode": "0x6080604052348015610019576000806100166104db565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b6000806100766104db565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e56104db565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b6104db565b50505b50356001600160a01b0316610377565b6305f5e10081565b6001610130610546565b81565b61013b6104cb565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac6104db565b50505b600080806101bb610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610546565b816001600160a01b0302191690836001600160a01b03160217906102306105a1565b505050565b60008080610241610546565b906101000a90046001600160a01b0316905090565b61025e6104cb565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf6104db565b50505b806103175760405162461bcd60e51b815260040180806020018281038252603481526020018061069d60349139604001915050604051809103906103146104db565b50505b6305f5e10081066001146103655760405162461bcd60e51b815260040180806020018281038252604181526020018061063660419139606001915050604051809103906103626104db565b50505b808060016103716105a1565b50505050565b61037f6104cb565b6001600160a01b0316610390610235565b6001600160a01b0316146103f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103f06104db565b50505b6001600160a01b0381166104415760405162461bcd60e51b8152600401808060200182810382526026815260200180610677602691396040019150506040518091039061043e6104db565b50505b806001600160a01b0316600080610456610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104a9610546565b816001600160a01b0302191690836001600160a01b03160217906103716105a1565b60005a6104d66105ef565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156105135780860151828201604001526020016104f8565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156102305760008282015260200161058a565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b60008152602061058a565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061058a56fe4f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374207361746973667920782025202831302a2a3829203d3d20314f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374206e6f74206265207a65726f" } \ No newline at end of file From 842161dcc017dc0d0895e08e4789ac5d2464d789 Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 26 May 2021 21:36:52 -0400 Subject: [PATCH 11/16] Update contract to use new fee logic & rename to gas --- .../OVM/predeploys/OVM_GasPriceOracle.sol | 33 +++++------ .../precompiles/OVM_GasPriceOracle.spec.ts | 56 +++++++++---------- 2 files changed, 42 insertions(+), 47 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol index f78b158af2e1..e05d7e010c75 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -6,9 +6,9 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /** * @title OVM_GasPriceOracle - * @dev This contract exposes the current execution price, a measure of how congested the network + * @dev This contract exposes the current l2 gas price, a measure of how congested the network * currently is. This measure is used by the Sequencer to determine what fee to charge for - * transactions. When the system is more congested, the execution price will increase and fees + * transactions. When the system is more congested, the l2 gas price will increase and fees * will also increase as a result. * * Compiler used: optimistic-solc @@ -20,13 +20,13 @@ contract OVM_GasPriceOracle is Ownable { * Variables * *************/ - // Current execution price - uint256 public executionPrice; + // Current l2 gas price + uint256 public gasPrice; /************* * Constants * *************/ - uint256 public constant EXECUTION_PRICE_MULTIPLE = 100000000; + uint256 public constant GAS_PRICE_MULTIPLE = 100000000; /*************** * Constructor * @@ -37,11 +37,11 @@ contract OVM_GasPriceOracle is Ownable { */ constructor( address _owner, - uint256 _initialExecutionPrice + uint256 _initialGasPrice ) Ownable() { - setExecutionPrice(_initialExecutionPrice); + setGasPrice(_initialGasPrice); transferOwnership(_owner); } @@ -51,25 +51,20 @@ contract OVM_GasPriceOracle is Ownable { ********************/ /** - * Allows the owner to modify the execution price. - * @param _executionPrice New execution price. + * Allows the owner to modify the l2 gas price. + * @param _gasPrice New l2 gas price. */ - function setExecutionPrice( - uint256 _executionPrice + function setGasPrice( + uint256 _gasPrice ) public onlyOwner { require( - _executionPrice != 0, - "OVM_GasPriceOracle: execution price must not be zero" + _gasPrice % GAS_PRICE_MULTIPLE == 0, + "OVM_GasPriceOracle: l2 gas price must satisfy x % (10**8) == 0" ); - require( - _executionPrice % EXECUTION_PRICE_MULTIPLE == 1, - "OVM_GasPriceOracle: execution price must satisfy x % (10**8) == 1" - ); - - executionPrice = _executionPrice; + gasPrice = _gasPrice; } } diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts index 0bdaf5ad62ab..879f70fd8133 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -4,8 +4,8 @@ import { expect } from '../../../setup' import { ethers } from 'hardhat' import { ContractFactory, Contract, Signer } from 'ethers' -describe('OVM_GasPriceOracle', () => { - const initialExecutionPrice = 1 +describe.only('OVM_GasPriceOracle', () => { + const initialGasPrice = 0 let signer1: Signer let signer2: Signer before(async () => { @@ -23,7 +23,7 @@ describe('OVM_GasPriceOracle', () => { beforeEach(async () => { OVM_GasPriceOracle = await Factory__OVM_GasPriceOracle.deploy( await signer1.getAddress(), - initialExecutionPrice + initialGasPrice ) }) @@ -35,61 +35,61 @@ describe('OVM_GasPriceOracle', () => { }) }) - describe('setExecutionPrice', () => { + describe('setGasPrice', () => { it('should revert if called by someone other than the owner', async () => { - await expect(OVM_GasPriceOracle.connect(signer2).setExecutionPrice(1234)) + await expect(OVM_GasPriceOracle.connect(signer2).setGasPrice(1234)) .to.be.reverted }) - it('should revert if DOES NOT satisfy `price % EXECUTION_PRICE_MULTIPLE == 1`', async () => { - const executionPrice = 1234 + it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => { + const gasPrice = 1234 await expect( - OVM_GasPriceOracle.connect(signer1).setExecutionPrice(executionPrice) + OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) ).to.be.reverted }) - it('should revert if DOES NOT satisfy `price % EXECUTION_PRICE_MULTIPLE == 1`', async () => { - const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() - const executionPrice = 1234 * executionPriceMultiple + 1 + it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => { + const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() + const gasPrice = 1234 * gasPriceMultiple await expect( - OVM_GasPriceOracle.connect(signer1).setExecutionPrice(executionPrice) + OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) ).to.not.be.reverted }) - it('should succeed if called by the owner and is equal to `1`', async () => { - await expect(OVM_GasPriceOracle.connect(signer1).setExecutionPrice(1)).to + it('should succeed if called by the owner and is equal to `0`', async () => { + await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to .not.be.reverted }) }) - describe('get executionPrice', () => { + describe('get gasPrice', () => { it('should return zero at first', async () => { - expect(await OVM_GasPriceOracle.executionPrice()).to.equal( - initialExecutionPrice + expect(await OVM_GasPriceOracle.gasPrice()).to.equal( + initialGasPrice ) }) - it('should change when setExecutionPrice is called', async () => { - const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() - const executionPrice = 1234 * executionPriceMultiple + 1 + it('should change when setGasPrice is called', async () => { + const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() + const gasPrice = 1234 * gasPriceMultiple - await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( - executionPrice + await OVM_GasPriceOracle.connect(signer1).setGasPrice( + gasPrice ) - expect(await OVM_GasPriceOracle.executionPrice()).to.equal(executionPrice) + expect(await OVM_GasPriceOracle.gasPrice()).to.equal(gasPrice) }) it('is the 1st storage slot', async () => { - const executionPriceMultiple = await OVM_GasPriceOracle.EXECUTION_PRICE_MULTIPLE() - const executionPrice = 1234 * executionPriceMultiple + 1 + const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() + const gasPrice = 1234 * gasPriceMultiple const slot = 1 // set the price - await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( - executionPrice + await OVM_GasPriceOracle.connect(signer1).setGasPrice( + gasPrice ) // get the storage slot value @@ -97,7 +97,7 @@ describe('OVM_GasPriceOracle', () => { OVM_GasPriceOracle.address, slot ) - expect(await OVM_GasPriceOracle.executionPrice()).to.equal( + expect(await OVM_GasPriceOracle.gasPrice()).to.equal( ethers.BigNumber.from(priceAtSlot) ) }) From 6d50d92fd1f92fd49d989c433d0c9917fe0074fb Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 26 May 2021 21:38:39 -0400 Subject: [PATCH 12/16] Deploy updated contract --- packages/contracts/deployments/README.md | 2 +- .../optimistic-kovan/OVM_GasPriceOracle.json | 56 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index 3f93af932fe1..8e3a1f573170 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -7,7 +7,7 @@ Network : __optimistic-kovan (chain id: 69)__ |Contract|Address| |--|--| -|OVM_GasPriceOracle|[0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905](https://kovan-optimistic.etherscan.io/address/0xFb3593931f0160476b942003c6F5A4AC7e3f49E4)| +|OVM_GasPriceOracle|[0x67B08211026Ef9434a535E2464edA5dc2713F3Ff](https://kovan-optimistic.etherscan.io/address/0x67B08211026Ef9434a535E2464edA5dc2713F3Ff)| --- ### Chain IDs: diff --git a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json index 7cf7976c2536..94a253dbfe1f 100644 --- a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json +++ b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json @@ -1,5 +1,5 @@ { - "address": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", + "address": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", "abi": [ { "inputs": [ @@ -10,7 +10,7 @@ }, { "internalType": "uint256", - "name": "_initialExecutionPrice", + "name": "_initialGasPrice", "type": "uint256" } ], @@ -38,7 +38,7 @@ }, { "inputs": [], - "name": "EXECUTION_PRICE_MULTIPLE", + "name": "GAS_PRICE_MULTIPLE", "outputs": [ { "internalType": "uint256", @@ -51,7 +51,7 @@ }, { "inputs": [], - "name": "executionPrice", + "name": "gasPrice", "outputs": [ { "internalType": "uint256", @@ -86,11 +86,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_executionPrice", + "name": "_gasPrice", "type": "uint256" } ], - "name": "setExecutionPrice", + "name": "setGasPrice", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -109,21 +109,21 @@ "type": "function" } ], - "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", + "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", "receipt": { "to": null, "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", + "contractAddress": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", "transactionIndex": 0, - "gasUsed": "1423279", - "logsBloom": "0x00000000000000000000000000000040000000000000000000840000000000000000000000000000000000100000080000000000000000040000000000000000080000000000000000000008000000000001000010000000000000000000000400000000020000000000000000008800000000000000000000000010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000060000000000000000000000000000000000001000000000000000000000000001000", - "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94", - "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", + "gasUsed": "1370143", + "logsBloom": "0x00000000000000000000000000000040000000000000000000840000000000000000000000000000000000100000000000000000000000040000000000000000000000000000000000000008000000000001000010000000000000000000000400000000020000000000000000008800000000000000000000010010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000200000000000000040000000060000000000000000000000000000000000001000000000000000000000000000000", + "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206", + "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", "logs": [ { "transactionIndex": 0, - "blockNumber": 225329, - "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", + "blockNumber": 226481, + "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", "address": "0x4200000000000000000000000000000000000006", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", @@ -132,13 +132,13 @@ ], "data": "0x0000000000000000000000000000000000000000000000000000000000000000", "logIndex": 0, - "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94" + "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206" }, { "transactionIndex": 0, - "blockNumber": 225329, - "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", - "address": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", + "blockNumber": 226481, + "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", + "address": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -146,13 +146,13 @@ ], "data": "0x", "logIndex": 1, - "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94" + "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206" }, { "transactionIndex": 0, - "blockNumber": 225329, - "transactionHash": "0x7c3194d9b1e4f31518086abb94580c4641bd70e1d28ef3ff1a94e0dc3e0bb3b4", - "address": "0x28157e8a8E6d22A367c63Ad61dD56d9E6bDCE905", + "blockNumber": 226481, + "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", + "address": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818", @@ -160,18 +160,18 @@ ], "data": "0x", "logIndex": 2, - "blockHash": "0xf97fbfcbc12111df2b22cdbd38341411215ac8c620482542ec91c27e6a6f7e94" + "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206" } ], - "blockNumber": 225329, - "cumulativeGasUsed": "1423279", + "blockNumber": 226481, + "cumulativeGasUsed": "1370143", "status": 1, "byzantium": true }, "args": [ "0x18394B52d3Cb931dfA76F63251919D051953413d", - 100000001 + 10000000000000 ], - "bytecode": "0x60806040523480156200001c576000806200001962000385565b50505b5060405162000ca638038062000ca6833981810160405260408110156200004d576000806200004a62000385565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f620003f2565b816001600160a01b0302191690836001600160a01b0316021790620000a362000454565b5050506001600160a01b038116600060008051602062000c5283398151915260405160405180910390a350620000d981620000fe565b620000e4826200021f565b5050620004ea565b60005a620000f9620004a3565b905090565b62000108620000ec565b6001600160a01b03166200011b62000362565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000c328339815191526044820152606401604051809103906200016d62000385565b50505b80620001b95760405162461bcd60e51b815260040180806020018281038252603481526020018062000c726034913960400191505060405180910390620001b662000385565b50505b6305f5e10081066001146200020b5760405162461bcd60e51b815260040180806020018281038252604181526020018062000bcb60419139606001915050604051809103906200020862000385565b50505b808060016200021962000454565b50505050565b62000229620000ec565b6001600160a01b03166200023c62000362565b6001600160a01b031614620002915760405162461bcd60e51b8152602060048201819052602482015260008051602062000c328339815191526044820152606401604051809103906200028e62000385565b50505b6001600160a01b038116620002e35760405162461bcd60e51b815260040180806020018281038252602681526020018062000c0c6026913960400191505060405180910390620002e062000385565b50505b806001600160a01b0316600080620002fa620003f2565b906101000a90046001600160a01b03166001600160a01b031660008051602062000c5283398151915260405160405180910390a38060006001816200033e620003f2565b816001600160a01b0302191690836001600160a01b03160217906200021962000454565b6000808062000370620003f2565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b86811015620003bf578086015182820160400152602001620003a2565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156200044f5760008282015260200162000436565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b60008152602062000436565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602062000436565b6106d180620004fa6000396000f3fe6080604052348015610019576000806100166104db565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b6000806100766104db565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e56104db565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b6104db565b50505b50356001600160a01b0316610377565b6305f5e10081565b6001610130610546565b81565b61013b6104cb565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac6104db565b50505b600080806101bb610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610546565b816001600160a01b0302191690836001600160a01b03160217906102306105a1565b505050565b60008080610241610546565b906101000a90046001600160a01b0316905090565b61025e6104cb565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf6104db565b50505b806103175760405162461bcd60e51b815260040180806020018281038252603481526020018061069d60349139604001915050604051809103906103146104db565b50505b6305f5e10081066001146103655760405162461bcd60e51b815260040180806020018281038252604181526020018061063660419139606001915050604051809103906103626104db565b50505b808060016103716105a1565b50505050565b61037f6104cb565b6001600160a01b0316610390610235565b6001600160a01b0316146103f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103f06104db565b50505b6001600160a01b0381166104415760405162461bcd60e51b8152600401808060200182810382526026815260200180610677602691396040019150506040518091039061043e6104db565b50505b806001600160a01b0316600080610456610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104a9610546565b816001600160a01b0302191690836001600160a01b03160217906103716105a1565b60005a6104d66105ef565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156105135780860151828201604001526020016104f8565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156102305760008282015260200161058a565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b60008152602061058a565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061058a56fe4f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374207361746973667920782025202831302a2a3829203d3d20314f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374206e6f74206265207a65726f4f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374207361746973667920782025202831302a2a3829203d3d20314f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374206e6f74206265207a65726f", - "deployedBytecode": "0x6080604052348015610019576000806100166104db565b50505b506004361061006b5760003560e01c80632ba10eac14610079578063494b489b14610093578063715018a61461009b5780638da5cb5b146100a5578063ee6d2073146100c9578063f2fde38b146100ef575b6000806100766104db565b50505b61008161011e565b60405190815260200160405180910390f35b610081610126565b6100a3610133565b005b6100ad610235565b6040516001600160a01b03909116815260200160405180910390f35b6100a3600480360360208110156100e8576000806100e56104db565b50505b5035610256565b6100a36004803603602081101561010e5760008061010b6104db565b50505b50356001600160a01b0316610377565b6305f5e10081565b6001610130610546565b81565b61013b6104cb565b6001600160a01b031661014c610235565b6001600160a01b0316146101af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906101ac6104db565b50505b600080806101bb610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060018161020e610546565b816001600160a01b0302191690836001600160a01b03160217906102306105a1565b505050565b60008080610241610546565b906101000a90046001600160a01b0316905090565b61025e6104cb565b6001600160a01b031661026f610235565b6001600160a01b0316146102d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102cf6104db565b50505b806103175760405162461bcd60e51b815260040180806020018281038252603481526020018061069d60349139604001915050604051809103906103146104db565b50505b6305f5e10081066001146103655760405162461bcd60e51b815260040180806020018281038252604181526020018061063660419139606001915050604051809103906103626104db565b50505b808060016103716105a1565b50505050565b61037f6104cb565b6001600160a01b0316610390610235565b6001600160a01b0316146103f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906103f06104db565b50505b6001600160a01b0381166104415760405162461bcd60e51b8152600401808060200182810382526026815260200180610677602691396040019150506040518091039061043e6104db565b50505b806001600160a01b0316600080610456610546565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104a9610546565b816001600160a01b0302191690836001600160a01b03160217906103716105a1565b60005a6104d66105ef565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156105135780860151828201604001526020016104f8565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156102305760008282015260200161058a565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b60008152602061058a565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061058a56fe4f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374207361746973667920782025202831302a2a3829203d3d20314f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a20657865637574696f6e207072696365206d757374206e6f74206265207a65726f" + "bytecode": "0x60806040523480156200001c57600080620000196200033a565b50505b5060405162000ba638038062000ba6833981810160405260408110156200004d576000806200004a6200033a565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f620003a7565b816001600160a01b0302191690836001600160a01b0316021790620000a362000409565b5050506001600160a01b038116600060008051602062000b8683398151915260405160405180910390a350620000d981620000fe565b620000e482620001d4565b50506200049f565b60005a620000f962000458565b905090565b62000108620000ec565b6001600160a01b03166200011b62000317565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000b668339815191526044820152606401604051809103906200016d6200033a565b50505b6305f5e100810615620001c05760405162461bcd60e51b815260040180806020018281038252603e81526020018062000b28603e913960400191505060405180910390620001bd6200033a565b50505b80806001620001ce62000409565b50505050565b620001de620000ec565b6001600160a01b0316620001f162000317565b6001600160a01b031614620002465760405162461bcd60e51b8152602060048201819052602482015260008051602062000b66833981519152604482015260640160405180910390620002436200033a565b50505b6001600160a01b038116620002985760405162461bcd60e51b815260040180806020018281038252602681526020018062000b026026913960400191505060405180910390620002956200033a565b50505b806001600160a01b0316600080620002af620003a7565b906101000a90046001600160a01b03166001600160a01b031660008051602062000b8683398151915260405160405180910390a3806000600181620002f3620003a7565b816001600160a01b0302191690836001600160a01b0316021790620001ce62000409565b6000808062000325620003a7565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156200037457808601518282016040015260200162000357565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156200040457600082820152602001620003eb565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020620003eb565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b80516000825293506020620003eb565b61065380620004af6000396000f3fe608060405234801561001957600080610016610494565b50505b506004361061006b5760003560e01c8063456a4d9514610079578063715018a6146100935780638da5cb5b1461009d578063bf1fe420146100c1578063f2fde38b146100e7578063fe173b9714610116575b600080610076610494565b50505b61008161011e565b60405190815260200160405180910390f35b61009b610126565b005b6100a5610228565b6040516001600160a01b03909116815260200160405180910390f35b61009b600480360360208110156100e0576000806100dd610494565b50505b5035610249565b61009b6004803603602081101561010657600080610103610494565b50505b50356001600160a01b0316610323565b610081610477565b6305f5e10081565b61012e610484565b6001600160a01b031661013f610228565b6001600160a01b0316146101a25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019f610494565b50505b600080806101ae6104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816102016104ff565b816001600160a01b0302191690836001600160a01b031602179061022361055a565b505050565b600080806102346104ff565b906101000a90046001600160a01b0316905090565b610251610484565b6001600160a01b0316610262610228565b6001600160a01b0316146102c55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102c2610494565b50505b6305f5e1008106156103115760405162461bcd60e51b815260040180806020018281038252603e815260200180610615603e91396040019150506040518091039061030e610494565b50505b8080600161031d61055a565b50505050565b61032b610484565b6001600160a01b031661033c610228565b6001600160a01b03161461039f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061039c610494565b50505b6001600160a01b0381166103ed5760405162461bcd60e51b81526004018080602001828103825260268152602001806105ef60269139604001915050604051809103906103ea610494565b50505b806001600160a01b03166000806104026104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104556104ff565b816001600160a01b0302191690836001600160a01b031602179061031d61055a565b60016104816104ff565b81565b60005a61048f6105a8565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104cc5780860151828201604001526020016104b1565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561022357600082820152602001610543565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610543565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054356fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a206c3220676173207072696365206d757374207361746973667920782025202831302a2a3829203d3d20304f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a206c3220676173207072696365206d757374207361746973667920782025202831302a2a3829203d3d20304f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "deployedBytecode": "0x608060405234801561001957600080610016610494565b50505b506004361061006b5760003560e01c8063456a4d9514610079578063715018a6146100935780638da5cb5b1461009d578063bf1fe420146100c1578063f2fde38b146100e7578063fe173b9714610116575b600080610076610494565b50505b61008161011e565b60405190815260200160405180910390f35b61009b610126565b005b6100a5610228565b6040516001600160a01b03909116815260200160405180910390f35b61009b600480360360208110156100e0576000806100dd610494565b50505b5035610249565b61009b6004803603602081101561010657600080610103610494565b50505b50356001600160a01b0316610323565b610081610477565b6305f5e10081565b61012e610484565b6001600160a01b031661013f610228565b6001600160a01b0316146101a25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019f610494565b50505b600080806101ae6104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816102016104ff565b816001600160a01b0302191690836001600160a01b031602179061022361055a565b505050565b600080806102346104ff565b906101000a90046001600160a01b0316905090565b610251610484565b6001600160a01b0316610262610228565b6001600160a01b0316146102c55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102c2610494565b50505b6305f5e1008106156103115760405162461bcd60e51b815260040180806020018281038252603e815260200180610615603e91396040019150506040518091039061030e610494565b50505b8080600161031d61055a565b50505050565b61032b610484565b6001600160a01b031661033c610228565b6001600160a01b03161461039f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061039c610494565b50505b6001600160a01b0381166103ed5760405162461bcd60e51b81526004018080602001828103825260268152602001806105ef60269139604001915050604051809103906103ea610494565b50505b806001600160a01b03166000806104026104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104556104ff565b816001600160a01b0302191690836001600160a01b031602179061031d61055a565b60016104816104ff565b81565b60005a61048f6105a8565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104cc5780860151828201604001526020016104b1565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561022357600082820152602001610543565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610543565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054356fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a206c3220676173207072696365206d757374207361746973667920782025202831302a2a3829203d3d2030" } \ No newline at end of file From 8d6280798dc26919eb3e3170b3986d9e5144e0bc Mon Sep 17 00:00:00 2001 From: Karl Floersch Date: Wed, 26 May 2021 21:39:33 -0400 Subject: [PATCH 13/16] Fix lint --- .../precompiles/OVM_GasPriceOracle.spec.ts | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts index 879f70fd8133..dc4169dc4dd7 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -4,7 +4,7 @@ import { expect } from '../../../setup' import { ethers } from 'hardhat' import { ContractFactory, Contract, Signer } from 'ethers' -describe.only('OVM_GasPriceOracle', () => { +describe('OVM_GasPriceOracle', () => { const initialGasPrice = 0 let signer1: Signer let signer2: Signer @@ -37,47 +37,41 @@ describe.only('OVM_GasPriceOracle', () => { describe('setGasPrice', () => { it('should revert if called by someone other than the owner', async () => { - await expect(OVM_GasPriceOracle.connect(signer2).setGasPrice(1234)) - .to.be.reverted + await expect(OVM_GasPriceOracle.connect(signer2).setGasPrice(1234)).to.be + .reverted }) it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => { const gasPrice = 1234 - await expect( - OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) - ).to.be.reverted + await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)).to + .be.reverted }) it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => { const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() const gasPrice = 1234 * gasPriceMultiple - await expect( - OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) - ).to.not.be.reverted + await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)).to + .not.be.reverted }) it('should succeed if called by the owner and is equal to `0`', async () => { - await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to - .not.be.reverted + await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to.not.be + .reverted }) }) describe('get gasPrice', () => { it('should return zero at first', async () => { - expect(await OVM_GasPriceOracle.gasPrice()).to.equal( - initialGasPrice - ) + expect(await OVM_GasPriceOracle.gasPrice()).to.equal(initialGasPrice) }) it('should change when setGasPrice is called', async () => { const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() const gasPrice = 1234 * gasPriceMultiple - await OVM_GasPriceOracle.connect(signer1).setGasPrice( - gasPrice - ) + await OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) expect(await OVM_GasPriceOracle.gasPrice()).to.equal(gasPrice) }) @@ -88,9 +82,7 @@ describe.only('OVM_GasPriceOracle', () => { const slot = 1 // set the price - await OVM_GasPriceOracle.connect(signer1).setGasPrice( - gasPrice - ) + await OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) // get the storage slot value const priceAtSlot = await signer1.provider.getStorageAt( From 52329ee7e734728f9c6d329aae76ad0628131f06 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 2 Jun 2021 10:52:32 -0700 Subject: [PATCH 14/16] gas price oracle: do not restrict gas price --- .../OVM/predeploys/OVM_GasPriceOracle.sol | 10 ---------- .../OVM/precompiles/OVM_GasPriceOracle.spec.ts | 14 ++------------ 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol index e05d7e010c75..03cc96a860b0 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/predeploys/OVM_GasPriceOracle.sol @@ -23,11 +23,6 @@ contract OVM_GasPriceOracle is Ownable { // Current l2 gas price uint256 public gasPrice; - /************* - * Constants * - *************/ - uint256 public constant GAS_PRICE_MULTIPLE = 100000000; - /*************** * Constructor * ***************/ @@ -60,11 +55,6 @@ contract OVM_GasPriceOracle is Ownable { public onlyOwner { - require( - _gasPrice % GAS_PRICE_MULTIPLE == 0, - "OVM_GasPriceOracle: l2 gas price must satisfy x % (10**8) == 0" - ); - gasPrice = _gasPrice; } } diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts index dc4169dc4dd7..d3a460c94202 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -48,14 +48,6 @@ describe('OVM_GasPriceOracle', () => { .be.reverted }) - it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => { - const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() - const gasPrice = 1234 * gasPriceMultiple - - await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)).to - .not.be.reverted - }) - it('should succeed if called by the owner and is equal to `0`', async () => { await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to.not.be .reverted @@ -68,8 +60,7 @@ describe('OVM_GasPriceOracle', () => { }) it('should change when setGasPrice is called', async () => { - const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() - const gasPrice = 1234 * gasPriceMultiple + const gasPrice = 1234 await OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice) @@ -77,8 +68,7 @@ describe('OVM_GasPriceOracle', () => { }) it('is the 1st storage slot', async () => { - const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE() - const gasPrice = 1234 * gasPriceMultiple + const gasPrice = 1234 const slot = 1 // set the price From 5ce4fa3b206c75c5b8a99f7a83cdb855ae5741d1 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 2 Jun 2021 11:09:43 -0700 Subject: [PATCH 15/16] gas price oracle: new deployment --- packages/contracts/deployments/README.md | 2 +- .../optimistic-kovan/OVM_GasPriceOracle.json | 67 ++++++++----------- 2 files changed, 28 insertions(+), 41 deletions(-) diff --git a/packages/contracts/deployments/README.md b/packages/contracts/deployments/README.md index ed2261f507e5..a6d5b7156e9b 100644 --- a/packages/contracts/deployments/README.md +++ b/packages/contracts/deployments/README.md @@ -7,7 +7,7 @@ Network : __optimistic-kovan (chain id: 69)__ |Contract|Address| |--|--| -|OVM_GasPriceOracle|[0x67B08211026Ef9434a535E2464edA5dc2713F3Ff](https://kovan-optimistic.etherscan.io/address/0x67B08211026Ef9434a535E2464edA5dc2713F3Ff)| +|OVM_GasPriceOracle|[0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76](https://kovan-optimistic.etherscan.io/address/0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76)| --- ### Chain IDs: diff --git a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json index 94a253dbfe1f..3ad5351c0abc 100644 --- a/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json +++ b/packages/contracts/deployments/optimistic-kovan/OVM_GasPriceOracle.json @@ -1,5 +1,5 @@ { - "address": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", + "address": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", "abi": [ { "inputs": [ @@ -36,19 +36,6 @@ "name": "OwnershipTransferred", "type": "event" }, - { - "inputs": [], - "name": "GAS_PRICE_MULTIPLE", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "gasPrice", @@ -109,69 +96,69 @@ "type": "function" } ], - "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", "receipt": { "to": null, - "from": "0xd033f09cB85621F98F7A84C64dB381ac16Eff818", - "contractAddress": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", + "from": "0x18394B52d3Cb931dfA76F63251919D051953413d", + "contractAddress": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", "transactionIndex": 0, - "gasUsed": "1370143", - "logsBloom": "0x00000000000000000000000000000040000000000000000000840000000000000000000000000000000000100000000000000000000000040000000000000000000000000000000000000008000000000001000010000000000000000000000400000000020000000000000000008800000000000000000000010010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000200000000000000040000000060000000000000000000000000000000000001000000000000000000000000000000", - "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206", - "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", + "gasUsed": "1732518", + "logsBloom": "0x00000000000000000000000000000000000000000000000000840000000000000000000000000000000000100000000000000000000000140000000000000000000000000100000000000008000000000001000010000000000000000000000400000000020000000000000000008800000000000000000000400010000000400000000000000000000000000000000000000000002000000000000000000000000000000000000000010000000000000000000000000000000000000000000000008002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c", + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", "logs": [ { "transactionIndex": 0, - "blockNumber": 226481, - "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", + "blockNumber": 336546, + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", "address": "0x4200000000000000000000000000000000000006", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d", "0x0000000000000000000000004200000000000000000000000000000000000005" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000000", "logIndex": 0, - "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206" + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c" }, { "transactionIndex": 0, - "blockNumber": 226481, - "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", - "address": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", + "blockNumber": 336546, + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", + "address": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818" + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d" ], "data": "0x", "logIndex": 1, - "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206" + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c" }, { "transactionIndex": 0, - "blockNumber": 226481, - "transactionHash": "0xad527e4e96a235ee4563ca479bd334fcfea5f2caa8e38580a4fe663562125c0e", - "address": "0x67B08211026Ef9434a535E2464edA5dc2713F3Ff", + "blockNumber": 336546, + "transactionHash": "0xed5fd0757566bc0bc1f3f7d701e31199835d6fe7b1e74353ad502983f2f5e744", + "address": "0x038a8825A3C3B0c08d52Cc76E5E361953Cf6Dc76", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "0x000000000000000000000000d033f09cb85621f98f7a84c64db381ac16eff818", + "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d", "0x00000000000000000000000018394b52d3cb931dfa76f63251919d051953413d" ], "data": "0x", "logIndex": 2, - "blockHash": "0xa28462f2316146aca71a9afd18b07982ce7f91b13aa6619912c9d760907a4206" + "blockHash": "0x310208064b53df696581d48cee7439d3e94acac8c31a519e5d07e7cc542c920c" } ], - "blockNumber": 226481, - "cumulativeGasUsed": "1370143", + "blockNumber": 336546, + "cumulativeGasUsed": "1732518", "status": 1, "byzantium": true }, "args": [ "0x18394B52d3Cb931dfA76F63251919D051953413d", - 10000000000000 + 1000000 ], - "bytecode": "0x60806040523480156200001c57600080620000196200033a565b50505b5060405162000ba638038062000ba6833981810160405260408110156200004d576000806200004a6200033a565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f620003a7565b816001600160a01b0302191690836001600160a01b0316021790620000a362000409565b5050506001600160a01b038116600060008051602062000b8683398151915260405160405180910390a350620000d981620000fe565b620000e482620001d4565b50506200049f565b60005a620000f962000458565b905090565b62000108620000ec565b6001600160a01b03166200011b62000317565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000b668339815191526044820152606401604051809103906200016d6200033a565b50505b6305f5e100810615620001c05760405162461bcd60e51b815260040180806020018281038252603e81526020018062000b28603e913960400191505060405180910390620001bd6200033a565b50505b80806001620001ce62000409565b50505050565b620001de620000ec565b6001600160a01b0316620001f162000317565b6001600160a01b031614620002465760405162461bcd60e51b8152602060048201819052602482015260008051602062000b66833981519152604482015260640160405180910390620002436200033a565b50505b6001600160a01b038116620002985760405162461bcd60e51b815260040180806020018281038252602681526020018062000b026026913960400191505060405180910390620002956200033a565b50505b806001600160a01b0316600080620002af620003a7565b906101000a90046001600160a01b03166001600160a01b031660008051602062000b8683398151915260405160405180910390a3806000600181620002f3620003a7565b816001600160a01b0302191690836001600160a01b0316021790620001ce62000409565b6000808062000325620003a7565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156200037457808601518282016040015260200162000357565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156200040457600082820152602001620003eb565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020620003eb565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b80516000825293506020620003eb565b61065380620004af6000396000f3fe608060405234801561001957600080610016610494565b50505b506004361061006b5760003560e01c8063456a4d9514610079578063715018a6146100935780638da5cb5b1461009d578063bf1fe420146100c1578063f2fde38b146100e7578063fe173b9714610116575b600080610076610494565b50505b61008161011e565b60405190815260200160405180910390f35b61009b610126565b005b6100a5610228565b6040516001600160a01b03909116815260200160405180910390f35b61009b600480360360208110156100e0576000806100dd610494565b50505b5035610249565b61009b6004803603602081101561010657600080610103610494565b50505b50356001600160a01b0316610323565b610081610477565b6305f5e10081565b61012e610484565b6001600160a01b031661013f610228565b6001600160a01b0316146101a25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019f610494565b50505b600080806101ae6104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816102016104ff565b816001600160a01b0302191690836001600160a01b031602179061022361055a565b505050565b600080806102346104ff565b906101000a90046001600160a01b0316905090565b610251610484565b6001600160a01b0316610262610228565b6001600160a01b0316146102c55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102c2610494565b50505b6305f5e1008106156103115760405162461bcd60e51b815260040180806020018281038252603e815260200180610615603e91396040019150506040518091039061030e610494565b50505b8080600161031d61055a565b50505050565b61032b610484565b6001600160a01b031661033c610228565b6001600160a01b03161461039f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061039c610494565b50505b6001600160a01b0381166103ed5760405162461bcd60e51b81526004018080602001828103825260268152602001806105ef60269139604001915050604051809103906103ea610494565b50505b806001600160a01b03166000806104026104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104556104ff565b816001600160a01b0302191690836001600160a01b031602179061031d61055a565b60016104816104ff565b81565b60005a61048f6105a8565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104cc5780860151828201604001526020016104b1565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561022357600082820152602001610543565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610543565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054356fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a206c3220676173207072696365206d757374207361746973667920782025202831302a2a3829203d3d20304f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a206c3220676173207072696365206d757374207361746973667920782025202831302a2a3829203d3d20304f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", - "deployedBytecode": "0x608060405234801561001957600080610016610494565b50505b506004361061006b5760003560e01c8063456a4d9514610079578063715018a6146100935780638da5cb5b1461009d578063bf1fe420146100c1578063f2fde38b146100e7578063fe173b9714610116575b600080610076610494565b50505b61008161011e565b60405190815260200160405180910390f35b61009b610126565b005b6100a5610228565b6040516001600160a01b03909116815260200160405180910390f35b61009b600480360360208110156100e0576000806100dd610494565b50505b5035610249565b61009b6004803603602081101561010657600080610103610494565b50505b50356001600160a01b0316610323565b610081610477565b6305f5e10081565b61012e610484565b6001600160a01b031661013f610228565b6001600160a01b0316146101a25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061019f610494565b50505b600080806101ae6104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816102016104ff565b816001600160a01b0302191690836001600160a01b031602179061022361055a565b505050565b600080806102346104ff565b906101000a90046001600160a01b0316905090565b610251610484565b6001600160a01b0316610262610228565b6001600160a01b0316146102c55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102c2610494565b50505b6305f5e1008106156103115760405162461bcd60e51b815260040180806020018281038252603e815260200180610615603e91396040019150506040518091039061030e610494565b50505b8080600161031d61055a565b50505050565b61032b610484565b6001600160a01b031661033c610228565b6001600160a01b03161461039f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061039c610494565b50505b6001600160a01b0381166103ed5760405162461bcd60e51b81526004018080602001828103825260268152602001806105ef60269139604001915050604051809103906103ea610494565b50505b806001600160a01b03166000806104026104ff565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816104556104ff565b816001600160a01b0302191690836001600160a01b031602179061031d61055a565b60016104816104ff565b81565b60005a61048f6105a8565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156104cc5780860151828201604001526020016104b1565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b604081101561022357600082820152602001610543565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b600081526020610543565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061054356fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f564d5f47617350726963654f7261636c653a206c3220676173207072696365206d757374207361746973667920782025202831302a2a3829203d3d2030" + "bytecode": "0x60806040523480156200001c5760008062000019620002ea565b50505b5060405162000a7338038062000a73833981810160405260408110156200004d576000806200004a620002ea565b50505b81019080805192919060200180519250600091506200006d9050620000ec565b90508060006001816200007f62000357565b816001600160a01b0302191690836001600160a01b0316021790620000a3620003b9565b5050506001600160a01b038116600060008051602062000a5383398151915260405160405180910390a350620000d981620000fe565b620000e48262000184565b50506200044f565b60005a620000f962000408565b905090565b62000108620000ec565b6001600160a01b03166200011b620002c7565b6001600160a01b031614620001705760405162461bcd60e51b8152602060048201819052602482015260008051602062000a338339815191526044820152606401604051809103906200016d620002ea565b50505b808060016200017e620003b9565b50505050565b6200018e620000ec565b6001600160a01b0316620001a1620002c7565b6001600160a01b031614620001f65760405162461bcd60e51b8152602060048201819052602482015260008051602062000a33833981519152604482015260640160405180910390620001f3620002ea565b50505b6001600160a01b038116620002485760405162461bcd60e51b815260040180806020018281038252602681526020018062000a0d602691396040019150506040518091039062000245620002ea565b50505b806001600160a01b03166000806200025f62000357565b906101000a90046001600160a01b03166001600160a01b031660008051602062000a5383398151915260405160405180910390a3806000600181620002a362000357565b816001600160a01b0302191690836001600160a01b03160217906200017e620003b9565b60008080620002d562000357565b906101000a90046001600160a01b0316905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b868110156200032457808601518282016040015260200162000307565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015620003b4576000828201526020016200039b565b505050565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206200039b565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206200039b565b6105ae806200045f6000396000f3fe60806040523480156100195760008061001661042d565b50505b50600436106100605760003560e01c8063715018a61461006e5780638da5cb5b14610078578063bf1fe4201461009c578063f2fde38b146100c2578063fe173b97146100f1575b60008061006b61042d565b50505b61007661010b565b005b61008061020d565b6040516001600160a01b03909116815260200160405180910390f35b610076600480360360208110156100bb576000806100b861042d565b50505b503561022e565b610076600480360360208110156100e1576000806100de61042d565b50505b50356001600160a01b03166102bc565b6100f9610410565b60405190815260200160405180910390f35b61011361041d565b6001600160a01b031661012461020d565b6001600160a01b0316146101875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061018461042d565b50505b60008080610193610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101e6610498565b816001600160a01b0302191690836001600160a01b03160217906102086104f3565b505050565b60008080610219610498565b906101000a90046001600160a01b0316905090565b61023661041d565b6001600160a01b031661024761020d565b6001600160a01b0316146102aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102a761042d565b50505b808060016102b66104f3565b50505050565b6102c461041d565b6001600160a01b03166102d561020d565b6001600160a01b0316146103385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061033561042d565b50505b6001600160a01b0381166103865760405162461bcd60e51b8152600401808060200182810382526026815260200180610588602691396040019150506040518091039061038361042d565b50505b806001600160a01b031660008061039b610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ee610498565b816001600160a01b0302191690836001600160a01b03160217906102b66104f3565b600161041a610498565b81565b60005a610428610541565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b8681101561046557808601518282016040015260200161044a565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610208576000828201526020016104dc565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104dc565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104dc56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "deployedBytecode": "0x60806040523480156100195760008061001661042d565b50505b50600436106100605760003560e01c8063715018a61461006e5780638da5cb5b14610078578063bf1fe4201461009c578063f2fde38b146100c2578063fe173b97146100f1575b60008061006b61042d565b50505b61007661010b565b005b61008061020d565b6040516001600160a01b03909116815260200160405180910390f35b610076600480360360208110156100bb576000806100b861042d565b50505b503561022e565b610076600480360360208110156100e1576000806100de61042d565b50505b50356001600160a01b03166102bc565b6100f9610410565b60405190815260200160405180910390f35b61011361041d565b6001600160a01b031661012461020d565b6001600160a01b0316146101875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061018461042d565b50505b60008080610193610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000806001816101e6610498565b816001600160a01b0302191690836001600160a01b03160217906102086104f3565b505050565b60008080610219610498565b906101000a90046001600160a01b0316905090565b61023661041d565b6001600160a01b031661024761020d565b6001600160a01b0316146102aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401604051809103906102a761042d565b50505b808060016102b66104f3565b50505050565b6102c461041d565b6001600160a01b03166102d561020d565b6001600160a01b0316146103385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016040518091039061033561042d565b50505b6001600160a01b0381166103865760405162461bcd60e51b8152600401808060200182810382526026815260200180610588602691396040019150506040518091039061038361042d565b50505b806001600160a01b031660008061039b610498565b906101000a90046001600160a01b03166001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060006001816103ee610498565b816001600160a01b0302191690836001600160a01b03160217906102b66104f3565b600161041a610498565b81565b60005a610428610541565b905090565b632a2a7adb598160e01b8152600481016020815285602082015260005b8681101561046557808601518282016040015260200161044a565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b6040811015610208576000828201526020016104dc565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b6000815260206104dc565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b805160008252935060206104dc56fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373" } \ No newline at end of file From fe4c81c9313c8ef3b8f2850cc1b34f6ae4c534b8 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Wed, 2 Jun 2021 11:22:01 -0700 Subject: [PATCH 16/16] tests: delete dead test --- .../contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts index d3a460c94202..ead0baebf899 100644 --- a/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts +++ b/packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts @@ -41,13 +41,6 @@ describe('OVM_GasPriceOracle', () => { .reverted }) - it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => { - const gasPrice = 1234 - - await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)).to - .be.reverted - }) - it('should succeed if called by the owner and is equal to `0`', async () => { await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to.not.be .reverted