Commit 0df27c84 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

Merge pull request #4586 from ethereum-optimism/develop

fix(ctb): correct GPO abi and layout (#4582)
parents 26c0c318 89de7ae0
This diff is collapsed.
This diff is collapsed.
......@@ -28,13 +28,14 @@ DeployerWhitelist_Test:test_owner_succeeds() (gas: 7538)
DeployerWhitelist_Test:test_storageSlots_succeeds() (gas: 33395)
FeeVault_Test:test_constructor_succeeds() (gas: 10647)
FeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 10668)
GasPriceOracle_Test:test_baseFee_succeeds() (gas: 8291)
GasPriceOracle_Test:test_baseFee_succeeds() (gas: 8280)
GasPriceOracle_Test:test_decimals_succeeds() (gas: 6145)
GasPriceOracle_Test:test_gasPrice_succeeds() (gas: 8294)
GasPriceOracle_Test:test_l1BaseFee_succeeds() (gas: 10656)
GasPriceOracle_Test:test_overhead_succeeds() (gas: 10546)
GasPriceOracle_Test:test_scalar_succeeds() (gas: 10611)
GasPriceOracle_Test:test_setGasPrice_doesNotExist_reverts() (gas: 5910)
GasPriceOracle_Test:test_setL1BaseFee_doesNotExist_reverts() (gas: 5910)
GasPriceOracle_Test:test_l1BaseFee_succeeds() (gas: 10634)
GasPriceOracle_Test:test_overhead_succeeds() (gas: 10614)
GasPriceOracle_Test:test_scalar_succeeds() (gas: 10655)
GasPriceOracle_Test:test_setGasPrice_doesNotExist_reverts() (gas: 5888)
GasPriceOracle_Test:test_setL1BaseFee_doesNotExist_reverts() (gas: 5888)
GovernanceToken_Test:test_approve_succeeds() (gas: 133293)
GovernanceToken_Test:test_burnFrom_succeeds() (gas: 122733)
GovernanceToken_Test:test_burn_succeeds() (gas: 114610)
......
......@@ -154,6 +154,8 @@
| spacer_3_0_32 | uint256 | 3 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle |
|---------------+---------+------+--------+-------+------------------------------------------------|
| spacer_4_0_32 | uint256 | 4 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle |
|---------------+---------+------+--------+-------+------------------------------------------------|
| spacer_5_0_32 | uint256 | 5 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle |
+---------------+---------+------+--------+-------+------------------------------------------------+
=======================
......
......@@ -57,10 +57,17 @@ contract GasPriceOracle is Semver {
*/
uint256 private spacer_4_0_32;
/**
* @custom:legacy
* @custom:spacer decimals
* @notice Spacer for backwards compatibility.
*/
uint256 private spacer_5_0_32;
/**
* @notice Number of decimals used in the scalar.
*/
uint256 public constant decimals = 6;
uint256 public constant DECIMALS = 6;
/**
* @custom:semver 0.0.1
......@@ -78,7 +85,7 @@ contract GasPriceOracle is Semver {
function getL1Fee(bytes memory _data) external view returns (uint256) {
uint256 l1GasUsed = getL1GasUsed(_data);
uint256 l1Fee = l1GasUsed * l1BaseFee();
uint256 divisor = 10**decimals;
uint256 divisor = 10**DECIMALS;
uint256 unscaled = l1Fee * scalar();
uint256 scaled = unscaled / divisor;
return scaled;
......@@ -129,6 +136,16 @@ contract GasPriceOracle is Semver {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefee();
}
/**
* @custom:legacy
* @notice Retrieves the number of decimals used in the scalar.
*
* @return Number of decimals used in the scalar.
*/
function decimals() public pure returns (uint256) {
return DECIMALS;
}
/**
* @notice Computes the amount of L1 gas used for a transaction. Adds the overhead which
* represents the per-transaction gas overhead of posting the transaction and state
......
......@@ -74,6 +74,11 @@ contract GasPriceOracle_Test is CommonTest {
assertEq(gasOracle.overhead(), l1FeeOverhead);
}
function test_decimals_succeeds() external {
assertEq(gasOracle.decimals(), 6);
assertEq(gasOracle.DECIMALS(), 6);
}
// Removed in bedrock
function test_setGasPrice_doesNotExist_reverts() external {
(bool success, bytes memory returndata) = address(gasOracle).call(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment