Commit 3907111e authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into op-program-host-client

parents d7aa58a1 ce69e706
...@@ -19,7 +19,9 @@ type TxMetricer interface { ...@@ -19,7 +19,9 @@ type TxMetricer interface {
type TxMetrics struct { type TxMetrics struct {
TxL1GasFee prometheus.Gauge TxL1GasFee prometheus.Gauge
txFees prometheus.Counter
TxGasBump prometheus.Gauge TxGasBump prometheus.Gauge
txFeeHistogram prometheus.Histogram
LatencyConfirmedTx prometheus.Gauge LatencyConfirmedTx prometheus.Gauge
currentNonce prometheus.Gauge currentNonce prometheus.Gauge
txPublishError *prometheus.CounterVec txPublishError *prometheus.CounterVec
...@@ -49,6 +51,19 @@ func MakeTxMetrics(ns string, factory metrics.Factory) TxMetrics { ...@@ -49,6 +51,19 @@ func MakeTxMetrics(ns string, factory metrics.Factory) TxMetrics {
Help: "L1 gas fee for transactions in GWEI", Help: "L1 gas fee for transactions in GWEI",
Subsystem: "txmgr", Subsystem: "txmgr",
}), }),
txFees: factory.NewCounter(prometheus.CounterOpts{
Namespace: ns,
Name: "tx_fee_gwei_total",
Help: "Sum of fees spent for all transactions in GWEI",
Subsystem: "txmgr",
}),
txFeeHistogram: factory.NewHistogram(prometheus.HistogramOpts{
Namespace: ns,
Name: "tx_fee_histogram_gwei",
Help: "Tx Fee in GWEI",
Subsystem: "txmgr",
Buckets: []float64{0.5, 1, 2, 5, 10, 20, 40, 60, 80, 100, 200, 400, 800, 1600},
}),
TxGasBump: factory.NewGauge(prometheus.GaugeOpts{ TxGasBump: factory.NewGauge(prometheus.GaugeOpts{
Namespace: ns, Namespace: ns,
Name: "tx_gas_bump", Name: "tx_gas_bump",
...@@ -90,8 +105,12 @@ func (t *TxMetrics) RecordNonce(nonce uint64) { ...@@ -90,8 +105,12 @@ func (t *TxMetrics) RecordNonce(nonce uint64) {
// TxConfirmed records lots of information about the confirmed transaction // TxConfirmed records lots of information about the confirmed transaction
func (t *TxMetrics) TxConfirmed(receipt *types.Receipt) { func (t *TxMetrics) TxConfirmed(receipt *types.Receipt) {
fee := float64(receipt.EffectiveGasPrice.Uint64() * receipt.GasUsed / params.GWei)
t.confirmEvent.Record(receiptStatusString(receipt)) t.confirmEvent.Record(receiptStatusString(receipt))
t.TxL1GasFee.Set(float64(receipt.EffectiveGasPrice.Uint64() * receipt.GasUsed / params.GWei)) t.TxL1GasFee.Set(fee)
t.txFees.Add(fee)
t.txFeeHistogram.Observe(fee)
} }
func (t *TxMetrics) RecordGasBumpCount(times int) { func (t *TxMetrics) RecordGasBumpCount(times int) {
......
import { DeployConfig } from '../src/deploy-config'
const config: DeployConfig = {
finalSystemOwner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
controller: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
portalGuardian: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
proxyAdminOwner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
l1StartingBlockTag:
'0x126e52a0cc0ae18948f567ee9443f4a8f0db67c437706e35baee424eb314a0d0',
l1ChainID: 1,
l2ChainID: 10,
l2BlockTime: 2,
maxSequencerDrift: 600,
sequencerWindowSize: 3600,
channelTimeout: 300,
p2pSequencerAddress: '0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65',
batchInboxAddress: '0xff00000000000000000000000000000000000010',
batchSenderAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
l2OutputOracleSubmissionInterval: 20,
l2OutputOracleStartingTimestamp: 1679069195,
l2OutputOracleStartingBlockNumber: 79149704,
l2OutputOracleProposer: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
l2OutputOracleChallenger: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
finalizationPeriodSeconds: 2,
baseFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
l1FeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
sequencerFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
governanceTokenName: 'Optimism',
governanceTokenSymbol: 'OP',
governanceTokenOwner: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
l2GenesisBlockGasLimit: '0x17D7840',
l2GenesisBlockCoinbase: '0x4200000000000000000000000000000000000011',
l2GenesisBlockBaseFeePerGas: '0x3b9aca00',
gasPriceOracleOverhead: 2100,
gasPriceOracleScalar: 1000000,
eip1559Denominator: 50,
eip1559Elasticity: 10,
l2GenesisRegolithTimeOffset: '0x0',
}
export default config
...@@ -7,6 +7,7 @@ const config: DeployConfig = { ...@@ -7,6 +7,7 @@ const config: DeployConfig = {
finalSystemOwner: '0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A', finalSystemOwner: '0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A',
controller: '0x78339d822c23d943e4a2d4c3dd5408f66e6d662d', controller: '0x78339d822c23d943e4a2d4c3dd5408f66e6d662d',
portalGuardian: '0x78339d822c23d943e4a2d4c3dd5408f66e6d662d', portalGuardian: '0x78339d822c23d943e4a2d4c3dd5408f66e6d662d',
proxyAdminOwner: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
l1StartingBlockTag: l1StartingBlockTag:
'0x126e52a0cc0ae18948f567ee9443f4a8f0db67c437706e35baee424eb314a0d0', '0x126e52a0cc0ae18948f567ee9443f4a8f0db67c437706e35baee424eb314a0d0',
...@@ -28,7 +29,6 @@ const config: DeployConfig = { ...@@ -28,7 +29,6 @@ const config: DeployConfig = {
l2OutputOracleChallenger: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC', l2OutputOracleChallenger: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
finalizationPeriodSeconds: 2, finalizationPeriodSeconds: 2,
proxyAdminOwner: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
baseFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906', baseFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
l1FeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906', l1FeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
sequencerFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906', sequencerFeeVaultRecipient: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
......
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
getDeploymentAddress, getDeploymentAddress,
doOwnershipTransfer, doOwnershipTransfer,
doPhase, doPhase,
liveDeployer,
} from '../src/deploy-utils' } from '../src/deploy-utils'
const uint128Max = ethers.BigNumber.from('0xffffffffffffffffffffffffffffffff') const uint128Max = ethers.BigNumber.from('0xffffffffffffffffffffffffffffffff')
...@@ -66,8 +67,12 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -66,8 +67,12 @@ const deployFn: DeployFunction = async (hre) => {
]) ])
// If we have the key for the controller then we don't need to wait for external txns. // If we have the key for the controller then we don't need to wait for external txns.
const isLiveDeployer = // Set the DISABLE_LIVE_DEPLOYER=true in the env to ensure the script will pause to simulate scenarios
deployer.toLowerCase() === hre.deployConfig.controller.toLowerCase() // where the controller is not the deployer.
const isLiveDeployer = await liveDeployer({
hre,
disabled: process.env.DISABLE_LIVE_DEPLOYER,
})
// Transfer ownership of the ProxyAdmin to the SystemDictator. // Transfer ownership of the ProxyAdmin to the SystemDictator.
if ((await ProxyAdmin.owner()) !== SystemDictator.address) { if ((await ProxyAdmin.owner()) !== SystemDictator.address) {
......
...@@ -15,6 +15,7 @@ import { ...@@ -15,6 +15,7 @@ import {
doStep, doStep,
printTenderlySimulationLink, printTenderlySimulationLink,
printCastCommand, printCastCommand,
liveDeployer,
} from '../src/deploy-utils' } from '../src/deploy-utils'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
...@@ -82,8 +83,12 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -82,8 +83,12 @@ const deployFn: DeployFunction = async (hre) => {
]) ])
// If we have the key for the controller then we don't need to wait for external txns. // If we have the key for the controller then we don't need to wait for external txns.
const isLiveDeployer = // Set the DISABLE_LIVE_DEPLOYER=true in the env to ensure the script will pause to simulate scenarios
deployer.toLowerCase() === hre.deployConfig.controller.toLowerCase() // where the controller is not the deployer.
const isLiveDeployer = await liveDeployer({
hre,
disabled: process.env.DISABLE_LIVE_DEPLOYER,
})
// Step 3 clears out some state from the AddressManager. // Step 3 clears out some state from the AddressManager.
await doStep({ await doStep({
......
...@@ -22,6 +22,14 @@ const config: HardhatUserConfig = { ...@@ -22,6 +22,14 @@ const config: HardhatUserConfig = {
hardhat: { hardhat: {
live: false, live: false,
}, },
local: {
live: false,
url: 'http://localhost:8545',
saveDeployments: false,
accounts: [
'ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
],
},
// NOTE: The 'mainnet' network is currently being used for mainnet rehearsals. // NOTE: The 'mainnet' network is currently being used for mainnet rehearsals.
mainnet: { mainnet: {
url: process.env.L1_RPC || 'https://mainnet-l1-rehearsal.optimism.io', url: process.env.L1_RPC || 'https://mainnet-l1-rehearsal.optimism.io',
......
...@@ -355,6 +355,28 @@ export const doOwnershipTransfer = async (opts: { ...@@ -355,6 +355,28 @@ export const doOwnershipTransfer = async (opts: {
} }
} }
/**
* Check if the script should submit the transaction or wait for the deployer to do it manually.
*
* @param hre HardhatRuntimeEnvironment.
* @param ovveride Allow m
* @returns True if the current step is the target step.
*/
export const liveDeployer = async (opts: {
hre: HardhatRuntimeEnvironment
disabled: string | undefined
}): Promise<boolean> => {
let ret: boolean
if (!!opts.disabled) {
ret = false
}
const { deployer } = await opts.hre.getNamedAccounts()
ret =
deployer.toLowerCase() === opts.hre.deployConfig.controller.toLowerCase()
console.log('Setting live deployer to', ret)
return ret
}
/** /**
* Mini helper for checking if the current step is a target step. * Mini helper for checking if the current step is a target step.
* *
......
...@@ -118,8 +118,9 @@ Although we define only one new transaction type, we can distinguish between two ...@@ -118,8 +118,9 @@ Although we define only one new transaction type, we can distinguish between two
transactions, based on their positioning in the L2 block: transactions, based on their positioning in the L2 block:
1. The first transaction MUST be a [L1 attributes deposited transaction][l1-attr-deposit], followed by 1. The first transaction MUST be a [L1 attributes deposited transaction][l1-attr-deposit], followed by
2. an array of zero-or-more [user-deposited transactions][user-deposited] submitted to the deposit 2. an array of zero-or-more [user-deposited transactions][user-deposited]
feed contract on L1 (called `OptimismPortal`). User-deposited transactions are only present in the first block of a L2 epoch. submitted to the deposit feed contract on L1 (called `OptimismPortal`).
User-deposited transactions are only present in the first block of a L2 epoch.
We only define a single new transaction type in order to minimize modifications to L1 client We only define a single new transaction type in order to minimize modifications to L1 client
software, and complexity in general. software, and complexity in general.
...@@ -288,8 +289,8 @@ The predeploy stores the following values: ...@@ -288,8 +289,8 @@ The predeploy stores the following values:
and reset to 0 at the start of a new epoch. and reset to 0 at the start of a new epoch.
- System configurables tied to the L1 block, see [System configuration specification](./system_config.md): - System configurables tied to the L1 block, see [System configuration specification](./system_config.md):
- `batcherHash` (`bytes32`): A versioned commitment to the batch-submitter(s) currently operating. - `batcherHash` (`bytes32`): A versioned commitment to the batch-submitter(s) currently operating.
- `l1FeeOverhead` (`uint256`): The L1 fee overhead to apply to L1 cost computation of transactions in this L2 block. - `overhead` (`uint256`): The L1 fee overhead to apply to L1 cost computation of transactions in this L2 block.
- `l1FeeScalar` (`uint256`): The L1 fee scalar to apply to L1 cost computation of transactions in this L2 block. - `scalar` (`uint256`): The L1 fee scalar to apply to L1 cost computation of transactions in this L2 block.
The contract implements an authorization scheme, such that it only accepts state-changing calls from The contract implements an authorization scheme, such that it only accepts state-changing calls from
the [depositor account][depositor-account]. the [depositor account][depositor-account].
...@@ -320,7 +321,8 @@ generated by the [L2 Chain Derivation][g-derivation] process. The content of eac ...@@ -320,7 +321,8 @@ generated by the [L2 Chain Derivation][g-derivation] process. The content of eac
transaction are determined by the corresponding `TransactionDeposited` event emitted by the transaction are determined by the corresponding `TransactionDeposited` event emitted by the
[deposit contract][deposit-contract] on L1. [deposit contract][deposit-contract] on L1.
1. `from` is unchanged from the emitted value (though it may have been transformed to an alias in `OptimismPortal`, the deposit feed contract). 1. `from` is unchanged from the emitted value (though it may
have been transformed to an alias in `OptimismPortal`, the deposit feed contract).
2. `to` is any 20-byte address (including the zero address) 2. `to` is any 20-byte address (including the zero address)
- In case of a contract creation (cf. `isCreation`), this address is set to `null`. - In case of a contract creation (cf. `isCreation`), this address is set to `null`.
3. `mint` is set to the emitted value. 3. `mint` is set to the emitted value.
......
...@@ -93,7 +93,7 @@ def clamp(v: i256, min: u128, max: u128) -> u128: ...@@ -93,7 +93,7 @@ def clamp(v: i256, min: u128, max: u128) -> u128:
if prev_num == now_num: if prev_num == now_num:
now_basefee = prev_basefee now_basefee = prev_basefee
now_bought_gas = prev_bought_gas + requested_gas now_bought_gas = prev_bought_gas + requested_gas
elif prev_num != now_num : elif prev_num != now_num:
# Width extension and conversion to signed integer math # Width extension and conversion to signed integer math
gas_used_delta = int128(prev_bought_gas) - int128(TARGET_RESOURCE_LIMIT) gas_used_delta = int128(prev_bought_gas) - int128(TARGET_RESOURCE_LIMIT)
# Use truncating (round to 0) division - solidity's default. # Use truncating (round to 0) division - solidity's default.
...@@ -101,18 +101,18 @@ elif prev_num != now_num : ...@@ -101,18 +101,18 @@ elif prev_num != now_num :
base_fee_per_gas_delta = prev_basefee * gas_used_delta / TARGET_RESOURCE_LIMIT / BASE_FEE_MAX_CHANGE_DENOMINATOR base_fee_per_gas_delta = prev_basefee * gas_used_delta / TARGET_RESOURCE_LIMIT / BASE_FEE_MAX_CHANGE_DENOMINATOR
now_basefee_wide = prev_basefee + base_fee_per_gas_delta now_basefee_wide = prev_basefee + base_fee_per_gas_delta
now_basefee = clamp(now_basefee_wide, min=MINIMUM_BASEFEE, max=UINT_64_MAX_VALUE) now_basefee = clamp(now_basefee_wide, min=MINIMUM_BASEFEE, max=UINT_128_MAX_VALUE)
now_bought_gas = requested_gas now_bought_gas = requested_gas
# If we skipped multiple blocks between the previous block and now update the basefee again. # If we skipped multiple blocks between the previous block and now update the basefee again.
# This is not exactly the same as iterating the above function, but quite close for reasonable # This is not exactly the same as iterating the above function, but quite close for reasonable
# gas target values. It is also constant time wrt the number of missed blocks which is important # gas target values. It is also constant time wrt the number of missed blocks which is important
# for keeping gas usage stable. # for keeping gas usage stable.
if prev_num + 1 < now_num: if prev_num + 1 < now_num:
n = now_num - prev_num - 1 n = now_num - prev_num - 1
# Apply 7/8 reduction to prev_basefee for the n empty blocks in a row. # Apply 7/8 reduction to prev_basefee for the n empty blocks in a row.
now_basefee_wide = prev_basefee * pow(1-(1/BASE_FEE_MAX_CHANGE_DENOMINATOR), n) now_basefee_wide = now_basefee * pow(1-(1/BASE_FEE_MAX_CHANGE_DENOMINATOR), n)
now_basefee = clamp(now_basefee_wide, min=MINIMUM_BASEFEE, max=UINT_64_MAX_VALUE) now_basefee = clamp(now_basefee_wide, min=MINIMUM_BASEFEE, max=type(uint128).max)
require(now_bought_gas < MAX_RESOURCE_LIMIT) require(now_bought_gas < MAX_RESOURCE_LIMIT)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- [System config contents (version 0)](#system-config-contents-version-0) - [System config contents (version 0)](#system-config-contents-version-0)
- [`batcherHash` (`bytes32`)](#batcherhash-bytes32) - [`batcherHash` (`bytes32`)](#batcherhash-bytes32)
- [`l1FeeOverhead` and `l1FeeScalar` (`uint256,uint256`)](#l1feeoverhead-and-l1feescalar-uint256uint256) - [`overhead` and `scalar` (`uint256,uint256`)](#overhead-and-scalar-uint256uint256)
- [`gasLimit` (`uint64`)](#gaslimit-uint64) - [`gasLimit` (`uint64`)](#gaslimit-uint64)
- [`unsafeBlockSigner` (`address`)](#unsafeblocksigner-address) - [`unsafeBlockSigner` (`address`)](#unsafeblocksigner-address)
- [Writing the system config](#writing-the-system-config) - [Writing the system config](#writing-the-system-config)
...@@ -31,7 +31,7 @@ Version `0` embeds the current batch submitter ethereum address (`bytes20`) in t ...@@ -31,7 +31,7 @@ Version `0` embeds the current batch submitter ethereum address (`bytes20`) in t
In the future this versioned hash may become a commitment to a more extensive configuration, In the future this versioned hash may become a commitment to a more extensive configuration,
to enable more extensive redundancy and/or rotation configurations. to enable more extensive redundancy and/or rotation configurations.
### `l1FeeOverhead` and `l1FeeScalar` (`uint256,uint256`) ### `overhead` and `scalar` (`uint256,uint256`)
The L1 fee parameters, also known as Gas Price Oracle (GPO) parameters, The L1 fee parameters, also known as Gas Price Oracle (GPO) parameters,
are updated in conjunction and apply new L1 costs to the L2 transactions. are updated in conjunction and apply new L1 costs to the L2 transactions.
...@@ -70,7 +70,7 @@ A rollup node initializes its derivation process by finding a starting point bas ...@@ -70,7 +70,7 @@ A rollup node initializes its derivation process by finding a starting point bas
- When started from L2 genesis, the initial system configuration is retrieved from the rollup chain configuration. - When started from L2 genesis, the initial system configuration is retrieved from the rollup chain configuration.
- When started from an existing L2 chain, a previously included L1 block is determined as derivation starting point, - When started from an existing L2 chain, a previously included L1 block is determined as derivation starting point,
and the system config can thus be retrieved from the last L2 block that referenced the L1 block as L1 origin: and the system config can thus be retrieved from the last L2 block that referenced the L1 block as L1 origin:
- `batcherHash`, `l1FeeOverhead` and `l1FeeScalar` are retrieved from the L1 block info transaction. - `batcherHash`, `overhead` and `scalar` are retrieved from the L1 block info transaction.
- `gasLimit` is retrieved from the L2 block header. - `gasLimit` is retrieved from the L2 block header.
- other future variables may also be retrieved from other contents of the L2 block, such as the header. - other future variables may also be retrieved from other contents of the L2 block, such as the header.
...@@ -86,8 +86,9 @@ The contained log events are filtered and processed as follows: ...@@ -86,8 +86,9 @@ The contained log events are filtered and processed as follows:
- the remaining event data is opaque, encoded as ABI bytes (i.e. includes offset and length data), - the remaining event data is opaque, encoded as ABI bytes (i.e. includes offset and length data),
and encodes the configuration update. In version `0` the following types are supported: and encodes the configuration update. In version `0` the following types are supported:
- type `0`: `batcherHash` overwrite, as `bytes32` payload. - type `0`: `batcherHash` overwrite, as `bytes32` payload.
- type `1`: `l1FeeOverhead` and `l1FeeScalar` overwrite, as two packed `uint256` entries. - type `1`: `overhead` and `scalar` overwrite, as two packed `uint256` entries.
- type `2`: `gasLimit` overwrite, as `uint64` payload. - type `2`: `gasLimit` overwrite, as `uint64` payload.
- type `3`: `unsafeBlockSigner` overwrite, as `address` payload.
Note that individual derivation stages may be processing different L1 blocks, Note that individual derivation stages may be processing different L1 blocks,
and should thus maintain individual system configuration copies, and should thus maintain individual system configuration copies,
......
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