Commit 5996d0bc authored by Roberto Bayardo's avatar Roberto Bayardo Committed by GitHub

fix baseFee naming consistency (#8954)

parent 09a8109c
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -9,11 +9,11 @@ import ( ...@@ -9,11 +9,11 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const L1BlockStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"number\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1001,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"timestamp\",\"offset\":8,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1002,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"basefee\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"},{\"astId\":1003,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"hash\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_bytes32\"},{\"astId\":1004,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"sequenceNumber\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_uint64\"},{\"astId\":1005,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBasefeeScalar\",\"offset\":8,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1006,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"basefeeScalar\",\"offset\":12,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1007,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"batcherHash\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_bytes32\"},{\"astId\":1008,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeOverhead\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_uint256\"},{\"astId\":1009,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeScalar\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_uint256\"},{\"astId\":1010,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBasefee\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_uint256\"}],\"types\":{\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"}}}" const L1BlockStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"number\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1001,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"timestamp\",\"offset\":8,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1002,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"basefee\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"},{\"astId\":1003,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"hash\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_bytes32\"},{\"astId\":1004,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"sequenceNumber\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_uint64\"},{\"astId\":1005,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBaseFeeScalar\",\"offset\":8,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1006,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"baseFeeScalar\",\"offset\":12,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1007,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"batcherHash\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_bytes32\"},{\"astId\":1008,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeOverhead\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_uint256\"},{\"astId\":1009,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeScalar\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_uint256\"},{\"astId\":1010,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBaseFee\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_uint256\"}],\"types\":{\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"}}}"
var L1BlockStorageLayout = new(solc.StorageLayout) var L1BlockStorageLayout = new(solc.StorageLayout)
var L1BlockDeployedBin = "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80637744864d11610097578063b80777ea11610066578063b80777ea14610212578063bfb14fb714610232578063e591b28214610252578063e81b2c6d1461029257600080fd5b80637744864d146101bb5780638381f58a146101ec5780638b239f73146102005780639e8c49661461020957600080fd5b806354fd4d50116100d357806354fd4d50146101335780635cf249691461017c57806364ca23ef1461018557806375c7e4a9146101b257600080fd5b8063015d8eb9146100fa57806309bd5a601461010f578063440a5e201461012b575b600080fd5b61010d61010836600461044c565b61029b565b005b61011860025481565b6040519081526020015b60405180910390f35b61010d6103da565b61016f6040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161012291906104be565b61011860015481565b6003546101999067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610122565b61011860075481565b6003546101d79068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610122565b6000546101999067ffffffffffffffff1681565b61011860055481565b61011860065481565b6000546101999068010000000000000000900467ffffffffffffffff1681565b6003546101d7906c01000000000000000000000000900463ffffffff1681565b61026d73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610122565b61011860045481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead000114610342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b6000805467ffffffffffffffff98891668010000000000000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116998916999099179890981790975560019490945560029290925560038054919094167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009190911617909255600491909155600555600655565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461040357633cc50b456000526004601cfd5b60043560801c60035560143560801c600055602435600155604435600755606435600255608435600455565b803567ffffffffffffffff8116811461044757600080fd5b919050565b600080600080600080600080610100898b03121561046957600080fd5b6104728961042f565b975061048060208a0161042f565b9650604089013595506060890135945061049c60808a0161042f565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208083528351808285015260005b818110156104eb578581018301518582016040015282016104cf565b818111156104fd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201604001939250505056fea164736f6c634300080f000a" var L1BlockDeployedBin = "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80638381f58a11610097578063c598591811610066578063c598591814610229578063e591b28214610249578063e81b2c6d14610289578063f82061401461029257600080fd5b80638381f58a146101e35780638b239f73146101f75780639e8c496614610200578063b80777ea1461020957600080fd5b806354fd4d50116100d357806354fd4d50146101335780635cf249691461017c57806364ca23ef1461018557806368d5dca6146101b257600080fd5b8063015d8eb9146100fa57806309bd5a601461010f578063440a5e201461012b575b600080fd5b61010d61010836600461044c565b61029b565b005b61011860025481565b6040519081526020015b60405180910390f35b61010d6103da565b61016f6040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161012291906104be565b61011860015481565b6003546101999067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610122565b6003546101ce9068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610122565b6000546101999067ffffffffffffffff1681565b61011860055481565b61011860065481565b6000546101999068010000000000000000900467ffffffffffffffff1681565b6003546101ce906c01000000000000000000000000900463ffffffff1681565b61026473deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610122565b61011860045481565b61011860075481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead000114610342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b6000805467ffffffffffffffff98891668010000000000000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116998916999099179890981790975560019490945560029290925560038054919094167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009190911617909255600491909155600555600655565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461040357633cc50b456000526004601cfd5b60043560801c60035560143560801c600055602435600155604435600755606435600255608435600455565b803567ffffffffffffffff8116811461044757600080fd5b919050565b600080600080600080600080610100898b03121561046957600080fd5b6104728961042f565b975061048060208a0161042f565b9650604089013595506060890135945061049c60808a0161042f565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208083528351808285015260005b818110156104eb578581018301518582016040015282016104cf565b818111156104fd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201604001939250505056fea164736f6c634300080f000a"
func init() { func init() {
......
...@@ -27,8 +27,8 @@ func TestL1BlockSlots(t *testing.T) { ...@@ -27,8 +27,8 @@ func TestL1BlockSlots(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
var l1BaseFeeSlot, overHeadSlot, scalarSlot common.Hash var l1BaseFeeSlot, overHeadSlot, scalarSlot common.Hash
var l1BasefeeScalarSlot, l1BlobBasefeeScalarSlot, blobBasefeeSlot common.Hash // new in Ecotone var l1BaseFeeScalarSlot, l1BlobBaseFeeScalarSlot, blobBaseFeeSlot common.Hash // new in Ecotone
var l1BasefeeScalarOffset, l1BlobBasefeeScalarOffset uint // new in Ecotone var l1BaseFeeScalarOffset, l1BlobBaseFeeScalarOffset uint // new in Ecotone
for _, entry := range layout.Storage { for _, entry := range layout.Storage {
switch entry.Label { switch entry.Label {
case "l1FeeOverhead": case "l1FeeOverhead":
...@@ -37,14 +37,14 @@ func TestL1BlockSlots(t *testing.T) { ...@@ -37,14 +37,14 @@ func TestL1BlockSlots(t *testing.T) {
scalarSlot = uintToHash(entry.Slot) scalarSlot = uintToHash(entry.Slot)
case "basefee": case "basefee":
l1BaseFeeSlot = uintToHash(entry.Slot) l1BaseFeeSlot = uintToHash(entry.Slot)
case "blobBasefee": case "blobBaseFee":
blobBasefeeSlot = uintToHash(entry.Slot) blobBaseFeeSlot = uintToHash(entry.Slot)
case "basefeeScalar": case "baseFeeScalar":
l1BasefeeScalarSlot = uintToHash(entry.Slot) l1BaseFeeScalarSlot = uintToHash(entry.Slot)
l1BasefeeScalarOffset = entry.Offset l1BaseFeeScalarOffset = entry.Offset
case "blobBasefeeScalar": case "blobBaseFeeScalar":
l1BlobBasefeeScalarSlot = uintToHash(entry.Slot) l1BlobBaseFeeScalarSlot = uintToHash(entry.Slot)
l1BlobBasefeeScalarOffset = entry.Offset l1BlobBaseFeeScalarOffset = entry.Offset
} }
} }
...@@ -52,9 +52,9 @@ func TestL1BlockSlots(t *testing.T) { ...@@ -52,9 +52,9 @@ func TestL1BlockSlots(t *testing.T) {
require.Equal(t, types.ScalarSlot, scalarSlot) require.Equal(t, types.ScalarSlot, scalarSlot)
require.Equal(t, types.L1BasefeeSlot, l1BaseFeeSlot) require.Equal(t, types.L1BasefeeSlot, l1BaseFeeSlot)
// new in Ecotone // new in Ecotone
require.Equal(t, types.L1BlobBasefeeSlot, blobBasefeeSlot) require.Equal(t, types.L1BlobBasefeeSlot, blobBaseFeeSlot)
require.Equal(t, types.L1FeeScalarsSlot, l1BasefeeScalarSlot) require.Equal(t, types.L1FeeScalarsSlot, l1BaseFeeScalarSlot)
require.Equal(t, types.L1FeeScalarsSlot, l1BlobBasefeeScalarSlot) require.Equal(t, types.L1FeeScalarsSlot, l1BlobBaseFeeScalarSlot)
require.Equal(t, uint(types.BasefeeScalarSlotOffset), l1BasefeeScalarOffset) require.Equal(t, uint(types.BasefeeScalarSlotOffset), l1BaseFeeScalarOffset)
require.Equal(t, uint(types.BlobBasefeeScalarSlotOffset), l1BlobBasefeeScalarOffset) require.Equal(t, uint(types.BlobBasefeeScalarSlotOffset), l1BlobBaseFeeScalarOffset)
} }
...@@ -48,12 +48,12 @@ ...@@ -48,12 +48,12 @@
"sourceCodeHash": "0xd787bd2a192ba5025fa0a8de2363af66a8de20de226e411bdb576adb64636cd0" "sourceCodeHash": "0xd787bd2a192ba5025fa0a8de2363af66a8de20de226e411bdb576adb64636cd0"
}, },
"src/L2/GasPriceOracle.sol": { "src/L2/GasPriceOracle.sol": {
"initCodeHash": "0xc980e2ca81850ca4f72fd207e8f8a4e5eebe966393c03e3ecc21c5e87a55aa05", "initCodeHash": "0xfd456e91d8c9714590a4f0a2c1046ba70e102f1c629ead886c4eebc3f921c3c3",
"sourceCodeHash": "0x9eea8b1f68dd6a244323d58aaef24a3938e166575c71b3665a804dd4f32060de" "sourceCodeHash": "0xde06becce9514f46ba78b4cb0732c7a714d49ba8f131258d56a5f5b22b51be7e"
}, },
"src/L2/L1Block.sol": { "src/L2/L1Block.sol": {
"initCodeHash": "0xecdd18698880762e6c9561d271a447e64fdad03f25d144580fb0ebb39bfb7148", "initCodeHash": "0xda6828a2a6e02d9fde7d5d9947f51b207f31abf5dbb538dd968cd491164e2115",
"sourceCodeHash": "0x271b6c80593bca95dfcd3543116bed541d8177f0751bbded611680b64a81818a" "sourceCodeHash": "0x775c399d93a729e1d3fe9a67c015f529f0c17a5986f93cd8d0f7806414fc5cdc"
}, },
"src/L2/L1FeeVault.sol": { "src/L2/L1FeeVault.sol": {
"initCodeHash": "0x2744d34573be83206d1b75d049d18a7bb37f9058e68c0803e5008c46b0dc2474", "initCodeHash": "0x2744d34573be83206d1b75d049d18a7bb37f9058e68c0803e5008c46b0dc2474",
......
...@@ -684,26 +684,26 @@ ...@@ -684,26 +684,26 @@
"filename_relative": "src/universal/Proxy.sol" "filename_relative": "src/universal/Proxy.sol"
}, },
{ {
"id": "8a3cbb409970f13c99fdfb6c1c35d7cdb67fa2ea79f2578425f5d167153382c3", "id": "fa673f7f315b9ee7fea38da72b4b0b0eb94babc8d0938536b00ce803ecc07fa2",
"impact": "High", "impact": "High",
"confidence": "High", "confidence": "High",
"check": "uninitialized-state", "check": "uninitialized-state",
"description": "L1Block.blobBasefee (src/L2/L1Block.sol#50) is never initialized. It is used in:\n\t- L1Block.setL1BlockValuesEcotone() (src/L2/L1Block.sol#101-118)\n", "description": "L1Block.blobBaseFee (src/L2/L1Block.sol#50) is never initialized. It is used in:\n\t- L1Block.setL1BlockValuesEcotone() (src/L2/L1Block.sol#101-118)\n",
"type": "variable", "type": "variable",
"name": "blobBasefee", "name": "blobBaseFee",
"start": 1897, "start": 1899,
"length": 26, "length": 26,
"filename_relative": "src/L2/L1Block.sol" "filename_relative": "src/L2/L1Block.sol"
}, },
{ {
"id": "8a3cbb409970f13c99fdfb6c1c35d7cdb67fa2ea79f2578425f5d167153382c3", "id": "fa673f7f315b9ee7fea38da72b4b0b0eb94babc8d0938536b00ce803ecc07fa2",
"impact": "High", "impact": "High",
"confidence": "High", "confidence": "High",
"check": "uninitialized-state", "check": "uninitialized-state",
"description": "L1Block.blobBasefee (src/L2/L1Block.sol#50) is never initialized. It is used in:\n\t- L1Block.setL1BlockValuesEcotone() (src/L2/L1Block.sol#101-118)\n", "description": "L1Block.blobBaseFee (src/L2/L1Block.sol#50) is never initialized. It is used in:\n\t- L1Block.setL1BlockValuesEcotone() (src/L2/L1Block.sol#101-118)\n",
"type": "function", "type": "function",
"name": "setL1BlockValuesEcotone", "name": "setL1BlockValuesEcotone",
"start": 3879, "start": 3886,
"length": 956, "length": 956,
"filename_relative": "src/L2/L1Block.sol" "filename_relative": "src/L2/L1Block.sol"
}, },
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "basefeeScalar", "name": "baseFeeScalar",
"outputs": [ "outputs": [
{ {
"internalType": "uint32", "internalType": "uint32",
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "blobBasefee", "name": "blobBaseFee",
"outputs": [ "outputs": [
{ {
"internalType": "uint256", "internalType": "uint256",
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "blobBasefeeScalar", "name": "blobBaseFeeScalar",
"outputs": [ "outputs": [
{ {
"internalType": "uint32", "internalType": "uint32",
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "basefee", "name": "baseFeeScalar",
"outputs": [ "outputs": [
{ {
"internalType": "uint256", "internalType": "uint32",
"name": "", "name": "",
"type": "uint256" "type": "uint32"
} }
], ],
"stateMutability": "view", "stateMutability": "view",
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "basefeeScalar", "name": "basefee",
"outputs": [ "outputs": [
{ {
"internalType": "uint32", "internalType": "uint256",
"name": "", "name": "",
"type": "uint32" "type": "uint256"
} }
], ],
"stateMutability": "view", "stateMutability": "view",
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "blobBasefee", "name": "blobBaseFee",
"outputs": [ "outputs": [
{ {
"internalType": "uint256", "internalType": "uint256",
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
}, },
{ {
"inputs": [], "inputs": [],
"name": "blobBasefeeScalar", "name": "blobBaseFeeScalar",
"outputs": [ "outputs": [
{ {
"internalType": "uint32", "internalType": "uint32",
......
...@@ -36,14 +36,14 @@ ...@@ -36,14 +36,14 @@
}, },
{ {
"bytes": "4", "bytes": "4",
"label": "blobBasefeeScalar", "label": "blobBaseFeeScalar",
"offset": 8, "offset": 8,
"slot": "3", "slot": "3",
"type": "uint32" "type": "uint32"
}, },
{ {
"bytes": "4", "bytes": "4",
"label": "basefeeScalar", "label": "baseFeeScalar",
"offset": 12, "offset": 12,
"slot": "3", "slot": "3",
"type": "uint32" "type": "uint32"
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "blobBasefee", "label": "blobBaseFee",
"offset": 0, "offset": 0,
"slot": "7", "slot": "7",
"type": "uint256" "type": "uint256"
......
...@@ -87,20 +87,20 @@ contract GasPriceOracle is ISemver { ...@@ -87,20 +87,20 @@ contract GasPriceOracle is ISemver {
/// @notice Retrieves the current blob base fee. /// @notice Retrieves the current blob base fee.
/// @return Current blob base fee. /// @return Current blob base fee.
function blobBasefee() public view returns (uint256) { function blobBaseFee() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBasefee(); return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFee();
} }
/// @notice Retrieves the current base fee scalar. /// @notice Retrieves the current base fee scalar.
/// @return Current base fee scalar. /// @return Current base fee scalar.
function basefeeScalar() public view returns (uint32) { function baseFeeScalar() public view returns (uint32) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefeeScalar(); return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).baseFeeScalar();
} }
/// @notice Retrieves the current blob base fee scalar. /// @notice Retrieves the current blob base fee scalar.
/// @return Current blob base fee scalar. /// @return Current blob base fee scalar.
function blobBasefeeScalar() public view returns (uint32) { function blobBaseFeeScalar() public view returns (uint32) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBasefeeScalar(); return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFeeScalar();
} }
/// @custom:legacy /// @custom:legacy
...@@ -137,9 +137,9 @@ contract GasPriceOracle is ISemver { ...@@ -137,9 +137,9 @@ contract GasPriceOracle is ISemver {
/// @return L1 fee that should be paid for the tx /// @return L1 fee that should be paid for the tx
function _getL1FeeEcotone(bytes memory _data) internal view returns (uint256) { function _getL1FeeEcotone(bytes memory _data) internal view returns (uint256) {
uint256 l1GasUsed = _getCalldataGas(_data); uint256 l1GasUsed = _getCalldataGas(_data);
uint256 scaledBasefee = basefeeScalar() * 16 * l1BaseFee(); uint256 scaledBaseFee = baseFeeScalar() * 16 * l1BaseFee();
uint256 scaledBlobBasefee = blobBasefeeScalar() * blobBasefee(); uint256 scaledBlobBaseFee = blobBaseFeeScalar() * blobBaseFee();
uint256 fee = l1GasUsed * (scaledBasefee + scaledBlobBasefee); uint256 fee = l1GasUsed * (scaledBaseFee + scaledBlobBaseFee);
return fee / (16 * 10 ** DECIMALS); return fee / (16 * 10 ** DECIMALS);
} }
......
...@@ -20,7 +20,7 @@ contract L1Block is ISemver { ...@@ -20,7 +20,7 @@ contract L1Block is ISemver {
/// @notice The latest L1 timestamp known by the L2 system. /// @notice The latest L1 timestamp known by the L2 system.
uint64 public timestamp; uint64 public timestamp;
/// @notice The latest L1 basefee. /// @notice The latest L1 base fee.
uint256 public basefee; uint256 public basefee;
/// @notice The latest L1 blockhash. /// @notice The latest L1 blockhash.
...@@ -30,10 +30,10 @@ contract L1Block is ISemver { ...@@ -30,10 +30,10 @@ contract L1Block is ISemver {
uint64 public sequenceNumber; uint64 public sequenceNumber;
/// @notice The scalar value applied to the L1 blob base fee portion of the blob-capable L1 cost func. /// @notice The scalar value applied to the L1 blob base fee portion of the blob-capable L1 cost func.
uint32 public blobBasefeeScalar; uint32 public blobBaseFeeScalar;
/// @notice The scalar value applied to the L1 base fee portion of the blob-capable L1 cost func. /// @notice The scalar value applied to the L1 base fee portion of the blob-capable L1 cost func.
uint32 public basefeeScalar; uint32 public baseFeeScalar;
/// @notice The versioned hash to authenticate the batcher by. /// @notice The versioned hash to authenticate the batcher by.
bytes32 public batcherHash; bytes32 public batcherHash;
...@@ -46,8 +46,8 @@ contract L1Block is ISemver { ...@@ -46,8 +46,8 @@ contract L1Block is ISemver {
/// @custom:legacy /// @custom:legacy
uint256 public l1FeeScalar; uint256 public l1FeeScalar;
/// @notice The latest L1 blob basefee. /// @notice The latest L1 blob base fee.
uint256 public blobBasefee; uint256 public blobBaseFee;
/// @custom:semver 1.2.0 /// @custom:semver 1.2.0
string public constant version = "1.2.0"; string public constant version = "1.2.0";
...@@ -89,13 +89,13 @@ contract L1Block is ISemver { ...@@ -89,13 +89,13 @@ contract L1Block is ISemver {
/// @notice Updates the L1 block values for an Ecotone upgraded chain. /// @notice Updates the L1 block values for an Ecotone upgraded chain.
/// Params are packed and passed in as raw msg.data instead of ABI to reduce calldata size. /// Params are packed and passed in as raw msg.data instead of ABI to reduce calldata size.
/// Params are expected to be in the following order: /// Params are expected to be in the following order:
/// 1. _basefeeScalar L1 basefee scalar /// 1. _baseFeeScalar L1 base fee scalar
/// 2. _blobBasefeeScalar L1 blob basefee scalar /// 2. _blobBaseFeeScalar L1 blob base fee scalar
/// 3. _sequenceNumber Number of L2 blocks since epoch start. /// 3. _sequenceNumber Number of L2 blocks since epoch start.
/// 4. _timestamp L1 timestamp. /// 4. _timestamp L1 timestamp.
/// 5. _number L1 blocknumber. /// 5. _number L1 blocknumber.
/// 6. _basefee L1 basefee. /// 6. _basefee L1 base fee.
/// 7. _blobBasefee L1 blobBasefee. /// 7. _blobBaseFee L1 blob base fee.
/// 8. _hash L1 blockhash. /// 8. _hash L1 blockhash.
/// 9. _batcherHash Versioned hash to authenticate batcher by. /// 9. _batcherHash Versioned hash to authenticate batcher by.
function setL1BlockValuesEcotone() external { function setL1BlockValuesEcotone() external {
...@@ -106,12 +106,12 @@ contract L1Block is ISemver { ...@@ -106,12 +106,12 @@ contract L1Block is ISemver {
revert(0x1C, 0x04) // returns the stored 4-byte selector from above revert(0x1C, 0x04) // returns the stored 4-byte selector from above
} }
let data := calldataload(4) let data := calldataload(4)
// sequencenum (uint64), blobBasefeeScalar (uint32), basefeeScalar (uint32) // sequencenum (uint64), blobBaseFeeScalar (uint32), baseFeeScalar (uint32)
sstore(sequenceNumber.slot, shr(128, calldataload(4))) sstore(sequenceNumber.slot, shr(128, calldataload(4)))
// number (uint64) and timestamp (uint64) // number (uint64) and timestamp (uint64)
sstore(number.slot, shr(128, calldataload(20))) sstore(number.slot, shr(128, calldataload(20)))
sstore(basefee.slot, calldataload(36)) // uint256 sstore(basefee.slot, calldataload(36)) // uint256
sstore(blobBasefee.slot, calldataload(68)) // uint256 sstore(blobBaseFee.slot, calldataload(68)) // uint256
sstore(hash.slot, calldataload(100)) // bytes32 sstore(hash.slot, calldataload(100)) // bytes32
sstore(batcherHash.slot, calldataload(132)) // bytes32 sstore(batcherHash.slot, calldataload(132)) // bytes32
} }
......
...@@ -135,23 +135,23 @@ library Encoding { ...@@ -135,23 +135,23 @@ library Encoding {
} }
/// @notice Returns an appropriately encoded call to L1Block.setL1BlockValuesEcotone /// @notice Returns an appropriately encoded call to L1Block.setL1BlockValuesEcotone
/// @param basefeeScalar L1 basefee Scalar /// @param baseFeeScalar L1 base fee Scalar
/// @param blobBasefeeScalar L1 blob basefee Scalar /// @param blobBaseFeeScalar L1 blob base fee Scalar
/// @param sequenceNumber Number of L2 blocks since epoch start. /// @param sequenceNumber Number of L2 blocks since epoch start.
/// @param timestamp L1 timestamp. /// @param timestamp L1 timestamp.
/// @param number L1 blocknumber. /// @param number L1 blocknumber.
/// @param basefee L1 basefee. /// @param baseFee L1 base fee.
/// @param blobBasefee L1 blob basefee. /// @param blobBaseFee L1 blob base fee.
/// @param hash L1 blockhash. /// @param hash L1 blockhash.
/// @param batcherHash Versioned hash to authenticate batcher by. /// @param batcherHash Versioned hash to authenticate batcher by.
function encodeSetL1BlockValuesEcotone( function encodeSetL1BlockValuesEcotone(
uint32 basefeeScalar, uint32 baseFeeScalar,
uint32 blobBasefeeScalar, uint32 blobBaseFeeScalar,
uint64 sequenceNumber, uint64 sequenceNumber,
uint64 timestamp, uint64 timestamp,
uint64 number, uint64 number,
uint256 basefee, uint256 baseFee,
uint256 blobBasefee, uint256 blobBaseFee,
bytes32 hash, bytes32 hash,
bytes32 batcherHash bytes32 batcherHash
) )
...@@ -162,13 +162,13 @@ library Encoding { ...@@ -162,13 +162,13 @@ library Encoding {
bytes4 functionSignature = bytes4(keccak256("setL1BlockValuesEcotone()")); bytes4 functionSignature = bytes4(keccak256("setL1BlockValuesEcotone()"));
return abi.encodePacked( return abi.encodePacked(
functionSignature, functionSignature,
basefeeScalar, baseFeeScalar,
blobBasefeeScalar, blobBaseFeeScalar,
sequenceNumber, sequenceNumber,
timestamp, timestamp,
number, number,
basefee, baseFee,
blobBasefee, blobBaseFee,
hash, hash,
batcherHash batcherHash
); );
......
...@@ -17,15 +17,15 @@ contract GasPriceOracle_Test is CommonTest { ...@@ -17,15 +17,15 @@ contract GasPriceOracle_Test is CommonTest {
// The initial L1 context values // The initial L1 context values
uint64 constant number = 10; uint64 constant number = 10;
uint64 constant timestamp = 11; uint64 constant timestamp = 11;
uint256 constant basefee = 2 * (10 ** 6); uint256 constant baseFee = 2 * (10 ** 6);
uint256 constant blobBasefee = 3 * (10 ** 6); uint256 constant blobBaseFee = 3 * (10 ** 6);
bytes32 constant hash = bytes32(uint256(64)); bytes32 constant hash = bytes32(uint256(64));
uint64 constant sequenceNumber = 0; uint64 constant sequenceNumber = 0;
bytes32 constant batcherHash = bytes32(uint256(777)); bytes32 constant batcherHash = bytes32(uint256(777));
uint256 constant l1FeeOverhead = 310; uint256 constant l1FeeOverhead = 310;
uint256 constant l1FeeScalar = 10; uint256 constant l1FeeScalar = 10;
uint32 constant blobBasefeeScalar = 15; uint32 constant blobBaseFeeScalar = 15;
uint32 constant basefeeScalar = 20; uint32 constant baseFeeScalar = 20;
/// @dev Sets up the test suite. /// @dev Sets up the test suite.
function setUp() public virtual override { function setUp() public virtual override {
...@@ -43,7 +43,7 @@ contract GasPriceOracleBedrock_Test is GasPriceOracle_Test { ...@@ -43,7 +43,7 @@ contract GasPriceOracleBedrock_Test is GasPriceOracle_Test {
l1Block.setL1BlockValues({ l1Block.setL1BlockValues({
_number: number, _number: number,
_timestamp: timestamp, _timestamp: timestamp,
_basefee: basefee, _basefee: baseFee,
_hash: hash, _hash: hash,
_sequenceNumber: sequenceNumber, _sequenceNumber: sequenceNumber,
_batcherHash: batcherHash, _batcherHash: batcherHash,
...@@ -54,7 +54,7 @@ contract GasPriceOracleBedrock_Test is GasPriceOracle_Test { ...@@ -54,7 +54,7 @@ contract GasPriceOracleBedrock_Test is GasPriceOracle_Test {
/// @dev Tests that `l1BaseFee` is set correctly. /// @dev Tests that `l1BaseFee` is set correctly.
function test_l1BaseFee_succeeds() external { function test_l1BaseFee_succeeds() external {
assertEq(gasPriceOracle.l1BaseFee(), basefee); assertEq(gasPriceOracle.l1BaseFee(), baseFee);
} }
/// @dev Tests that `gasPrice` is set correctly. /// @dev Tests that `gasPrice` is set correctly.
...@@ -112,7 +112,7 @@ contract GasPriceOracleEcotone_Test is GasPriceOracle_Test { ...@@ -112,7 +112,7 @@ contract GasPriceOracleEcotone_Test is GasPriceOracle_Test {
super.setUp(); super.setUp();
bytes memory calldataPacked = Encoding.encodeSetL1BlockValuesEcotone( bytes memory calldataPacked = Encoding.encodeSetL1BlockValuesEcotone(
basefeeScalar, blobBasefeeScalar, sequenceNumber, timestamp, number, basefee, blobBasefee, hash, batcherHash baseFeeScalar, blobBaseFeeScalar, sequenceNumber, timestamp, number, baseFee, blobBaseFee, hash, batcherHash
); );
// Execute the function call // Execute the function call
...@@ -158,22 +158,22 @@ contract GasPriceOracleEcotone_Test is GasPriceOracle_Test { ...@@ -158,22 +158,22 @@ contract GasPriceOracleEcotone_Test is GasPriceOracle_Test {
/// @dev Tests that `l1BaseFee` is set correctly. /// @dev Tests that `l1BaseFee` is set correctly.
function test_l1BaseFee_succeeds() external { function test_l1BaseFee_succeeds() external {
assertEq(gasPriceOracle.l1BaseFee(), basefee); assertEq(gasPriceOracle.l1BaseFee(), baseFee);
} }
/// @dev Tests that `blobBasefee` is set correctly. /// @dev Tests that `blobBaseFee` is set correctly.
function test_blobBasefee_succeeds() external { function test_blobBaseFee_succeeds() external {
assertEq(gasPriceOracle.blobBasefee(), blobBasefee); assertEq(gasPriceOracle.blobBaseFee(), blobBaseFee);
} }
/// @dev Tests that `basefeeScalar` is set correctly. /// @dev Tests that `baseFeeScalar` is set correctly.
function test_basefeeScalar_succeeds() external { function test_baseFeeScalar_succeeds() external {
assertEq(gasPriceOracle.basefeeScalar(), basefeeScalar); assertEq(gasPriceOracle.baseFeeScalar(), baseFeeScalar);
} }
/// @dev Tests that `blobBasefeeScalar` is set correctly. /// @dev Tests that `blobBaseFeeScalar` is set correctly.
function test_blobBasefeeScalar_succeeds() external { function test_blobBaseFeeScalar_succeeds() external {
assertEq(gasPriceOracle.blobBasefeeScalar(), blobBasefeeScalar); assertEq(gasPriceOracle.blobBaseFeeScalar(), blobBaseFeeScalar);
} }
/// @dev Tests that `decimals` is set correctly. /// @dev Tests that `decimals` is set correctly.
......
...@@ -65,33 +65,33 @@ contract L1BlockBedrock_Test is L1BlockTest { ...@@ -65,33 +65,33 @@ contract L1BlockBedrock_Test is L1BlockTest {
contract L1BlockEcotone_Test is L1BlockTest { contract L1BlockEcotone_Test is L1BlockTest {
/// @dev Tests that setL1BlockValuesEcotone updates the values appropriately. /// @dev Tests that setL1BlockValuesEcotone updates the values appropriately.
function testFuzz_setL1BlockValuesEcotone_succeeds( function testFuzz_setL1BlockValuesEcotone_succeeds(
uint32 basefeeScalar, uint32 baseFeeScalar,
uint32 blobBasefeeScalar, uint32 blobBaseFeeScalar,
uint64 sequenceNumber, uint64 sequenceNumber,
uint64 timestamp, uint64 timestamp,
uint64 number, uint64 number,
uint256 basefee, uint256 baseFee,
uint256 blobBasefee, uint256 blobBaseFee,
bytes32 hash, bytes32 hash,
bytes32 batcherHash bytes32 batcherHash
) )
external external
{ {
bytes memory functionCallDataPacked = Encoding.encodeSetL1BlockValuesEcotone( bytes memory functionCallDataPacked = Encoding.encodeSetL1BlockValuesEcotone(
basefeeScalar, blobBasefeeScalar, sequenceNumber, timestamp, number, basefee, blobBasefee, hash, batcherHash baseFeeScalar, blobBaseFeeScalar, sequenceNumber, timestamp, number, baseFee, blobBaseFee, hash, batcherHash
); );
vm.prank(depositor); vm.prank(depositor);
(bool success,) = address(l1Block).call(functionCallDataPacked); (bool success,) = address(l1Block).call(functionCallDataPacked);
assertTrue(success, "Function call failed"); assertTrue(success, "Function call failed");
assertEq(l1Block.basefeeScalar(), basefeeScalar); assertEq(l1Block.baseFeeScalar(), baseFeeScalar);
assertEq(l1Block.blobBasefeeScalar(), blobBasefeeScalar); assertEq(l1Block.blobBaseFeeScalar(), blobBaseFeeScalar);
assertEq(l1Block.sequenceNumber(), sequenceNumber); assertEq(l1Block.sequenceNumber(), sequenceNumber);
assertEq(l1Block.timestamp(), timestamp); assertEq(l1Block.timestamp(), timestamp);
assertEq(l1Block.number(), number); assertEq(l1Block.number(), number);
assertEq(l1Block.basefee(), basefee); assertEq(l1Block.basefee(), baseFee);
assertEq(l1Block.blobBasefee(), blobBasefee); assertEq(l1Block.blobBaseFee(), blobBaseFee);
assertEq(l1Block.hash(), hash); assertEq(l1Block.hash(), hash);
assertEq(l1Block.batcherHash(), batcherHash); assertEq(l1Block.batcherHash(), batcherHash);
......
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