Skip to content

Commit

Permalink
gas price oracle: do not restrict gas price
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes committed Jun 2, 2021
1 parent 7447768 commit 52329ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
***************/
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -68,17 +60,15 @@ 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)

expect(await OVM_GasPriceOracle.gasPrice()).to.equal(gasPrice)
})

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
Expand Down

0 comments on commit 52329ee

Please sign in to comment.