Skip to content

Commit f49a488

Browse files
authored
Merge pull request #22 from OffchainLabs/fixup-mult-constraint-pricer-methods
Align multi-constraint pricing methods with updated requirements
2 parents 223728b + 3fb6b67 commit f49a488

File tree

2 files changed

+38
-29
lines changed

2 files changed

+38
-29
lines changed

ArbGasInfo.sol

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ interface ArbGasInfo {
4949
function getPricesInArbGas() external view returns (uint256, uint256, uint256);
5050

5151
/// @notice Get the gas accounting parameters. `gasPoolMax` is always zero, as the exponential pricing model has no such notion.
52-
/// @notice Starting from ArbOS version 50, returns `speedLimitPerSecond` as the target from the longest-period constraint.
53-
/// @notice For new integrations, prefer `getMaxBlockGasLimit` and `getGasPricingConstraints`.
52+
/// @notice Starting from ArbOS version 50, `speedLimitPerSecond` corresponds to the target of the single-constraint pricing model.
53+
/// @notice For multi-constraint pricing model, use `getGasPricingConstraints` to retrieve the constraint set.
5454
/// @return (speedLimitPerSecond, gasPoolMax, maxBlockGasLimit)
55-
/// @dev Deprecated starting from ArbOS version 50.
5655
function getGasAccountingParams() external view returns (uint256, uint256, uint256);
5756

5857
/// @notice Get the maxTxGasLimit
@@ -83,21 +82,18 @@ interface ArbGasInfo {
8382
function getCurrentTxL1GasFees() external view returns (uint256);
8483

8584
/// @notice Get the backlogged amount of gas burnt in excess of the speed limit
86-
/// @notice Starting from ArbOS version 50, returns the backlog of the longest-period constraint among all configured constraints.
87-
/// @notice For new integrations, prefer `getGasPricingConstraints`.
88-
/// @dev Deprecated starting from ArbOS version 50.
85+
/// @notice Starting from ArbOS version 50, returns the backlog value from the single-constraint pricing model.
86+
/// @notice For multi-constraint pricing model, use `getGasPricingConstraints` to get backlog values for each configured constraint.
8987
function getGasBacklog() external view returns (uint64);
9088

9189
/// @notice Get how slowly ArbOS updates the L2 basefee in response to backlogged gas
92-
/// @notice Starting from ArbOS version 50, returns the inertia value derived from the longest-period constraint
90+
/// @notice Starting from ArbOS version 50, returns the inertia value used by the single-constraint pricing model.
9391
/// @notice For new integrations, prefer `getGasPricingConstraints`.
94-
/// @dev Deprecated starting from ArbOS version 50.
9592
function getPricingInertia() external view returns (uint64);
9693

9794
/// @notice Get the forgivable amount of backlogged gas ArbOS will ignore when raising the basefee
98-
/// @notice Starting from ArbOS version 50, this function always returns zero.
99-
/// @notice There is no tolerance for backlogged gas in the new pricing model.
100-
/// @dev Deprecated starting from ArbOS version 50.
95+
/// @notice Starting from ArbOS version 50, returns the backlog tolerance value used by the single-constraint pricing model.
96+
/// @notice There is no tolerance for backlogged gas in the new multi-constraint pricing model.
10197
function getGasBacklogTolerance() external view returns (uint64);
10298

10399
/// @notice Returns the surplus of funds for L1 batch posting payments (may be negative).
@@ -137,12 +133,12 @@ interface ArbGasInfo {
137133
/// @notice Available in ArbOS version 50 and above
138134
function getMaxBlockGasLimit() external view returns (uint64);
139135

140-
/// @notice Get the current gas pricing constraints used by the Multi-Constraint Pricer.
136+
/// @notice Get the current gas pricing constraints used by the multi-constraint pricing model.
141137
/// @notice Each constraint contains the following values:
142-
/// - `uint64 gas_target_per_second`: target gas usage per second
143-
/// - `uint64 time_constant_seconds`: time constant in seconds
144-
/// - `uint64 backlog`: current backlog in gas units
145-
/// @return constraints Array of triples (gas_target_per_second, time_constant_seconds, backlog)
138+
/// - gas_target_per_second: target gas usage per second for the constraint (uint64, gas/sec)
139+
/// - adjustment_window_seconds: time over which the price will rise by a factor of e if demand is 2x the target (uint64, seconds)
140+
/// - uint64 backlog: current backlog in gas units for this constraint (uint64, gas units)
141+
/// @return constraints Array of triples (gas_target_per_second, adjustment_window_seconds, backlog)
146142
/// @notice Available in ArbOS version 50 and above.
147143
function getGasPricingConstraints() external view returns (uint64[3][] memory constraints);
148144
}

ArbOwner.sol

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ interface ArbOwner {
7777
) external;
7878

7979
/// @notice Set the computational speed limit for the chain
80-
/// @notice Starting from ArbOS version 50, this function always returns an error.
81-
/// @notice Use `setGasPricingConstraints` instead, which supports configuring multiple constraints.
82-
/// @dev Deprecated starting from ArbOS version 50.
80+
/// @notice Starting from ArbOS version 50, continues to set the legacy single-constraint speed limit value.
81+
/// @notice It does not modify the multi-constraint pricing model configuration. To configure multiple constraints, use `setGasPricingConstraints`.
8382
function setSpeedLimit(
8483
uint64 limit
8584
) external;
@@ -96,17 +95,15 @@ interface ArbOwner {
9695
) external;
9796

9897
/// @notice Set the L2 gas pricing inertia
99-
/// @notice Starting from ArbOS version 50, this function always returns an error.
100-
/// @notice Use `setGasPricingConstraints` instead, which supports configuring multiple constraints.
101-
/// @dev Deprecated starting from ArbOS version 50.
98+
/// @notice Starting from ArbOS version 50, continues to set the single-constraint pricing inertia value.
99+
/// @notice It does not modify the multi-constraint pricing model configuration. To configure multiple constraints, use `setGasPricingConstraints`.
102100
function setL2GasPricingInertia(
103101
uint64 sec
104102
) external;
105103

106104
/// @notice Set the L2 gas backlog tolerance
107-
/// @notice Starting from ArbOS version 50, this function always returns an error.
108-
/// @notice Use `setGasPricingConstraints` instead, which supports configuring multiple constraints.
109-
/// @dev Deprecated starting from ArbOS version 50.
105+
/// @notice Starting from ArbOS version 50, continues to set the single-constraint backlog tolerance value.
106+
/// @notice It does not modify the multi-constraint pricing model configuration. There is no tolerance for backlogged gas in the new multi-constraint pricing model.
110107
function setL2GasBacklogTolerance(
111108
uint64 sec
112109
) external;
@@ -277,14 +274,30 @@ interface ArbOwner {
277274
bool enable
278275
) external;
279276

280-
/// @notice Sets the list of gas pricing constraints for the Multi-Constraint Pricer.
277+
/// @notice Set the backlogged amount of gas burnt used by the single-constraint pricing model only.
278+
/// @notice To configure backlogs for the multi-constraint pricing model, use `setGasPricingConstraints()`.
279+
/// @param backlog The backlog value in gas units to assign to the single-constraint pricing model.
280+
function setGasBacklog(
281+
uint64 backlog
282+
) external;
283+
284+
/// @notice Sets the list of gas pricing constraints for the multi-constraint pricing model.
281285
/// @notice Replaces the existing constraints configuration and sets each constraint's starting backlog value.
282286
/// @notice All existing backlogs are replaced by the provided values.
283-
/// @notice Any changes to gas targets, periods, or starting backlogs may cause immediate price fluctuations.
287+
/// @notice Any changes to gas targets, inertia, or starting backlogs may cause immediate price fluctuations.
284288
/// @notice Operators are fully responsible for the resulting behavior and should adjust parameters carefully.
285-
/// @notice Use ArbGasInfo.getGasPricingConstraints() to retrieve the current configuration.
289+
/// @notice Use `ArbGasInfo.getGasPricingConstraints()` to retrieve the current configuration.
290+
/// @notice Model selection:
291+
/// @notice - If one or more constraints are provided, the chain switches to the multi-constraint pricing model
292+
/// @notice and uses exactly the provided parameters.
293+
/// @notice - If zero constraints are provided, the chain uses the single-constraint pricing model.
294+
/// @notice In that case, the single-constraint backlog can be set via `setBacklog`, which you may derive from multi-constraint
295+
/// @notice parameters if desired.
286296
/// @notice Available in ArbOS version 50 and above.
287-
/// @param constraints Array of triples (gas_target_per_second, period_seconds, starting_backlog_value)
297+
/// @param constraints Array of triples (gas_target_per_second, adjustment_window_seconds, starting_backlog_value)
298+
/// - gas_target_per_second: target gas usage per second for the constraint (uint64, gas/sec)
299+
/// - adjustment_window_seconds: time over which the price will rise by a factor of e if demand is 2x the target (uint64, seconds)
300+
/// - starting_backlog_value: initial backlog for this constraint (uint64, gas units)
288301
function setGasPricingConstraints(
289302
uint64[3][] calldata constraints
290303
) external;

0 commit comments

Comments
 (0)