Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions ArbGasInfo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

pragma solidity >=0.4.21 <0.9.0;

import {ArbMultiGasConstraintsTypes} from "./ArbMultiGasConstraintsTypes.sol";

/// @title Provides insight into the cost of using the chain.
/// @notice These methods have been adjusted to account for Nitro's heavy use of calldata compression.
/// Of note to end-users, we no longer make a distinction between non-zero and zero-valued calldata bytes.
Expand Down Expand Up @@ -141,4 +143,21 @@ interface ArbGasInfo {
/// @return constraints Array of triples (gas_target_per_second, adjustment_window_seconds, backlog)
/// @notice Available in ArbOS version 50 and above.
function getGasPricingConstraints() external view returns (uint64[3][] memory constraints);

/// @notice Get the current multi-gas pricing constraints used by the multi-dimensional multi-constraint pricing model.
/// @notice Each constraint includes its target throughput, adjustment window, backlog, and weighted resource configuration.
///
/// @notice The array contains one `ResourceConstraint` struct per active constraint.
/// @notice Each constraint provides the following fields:
/// - `resources`: list of (resource kind, weight) pairs (see the ArbMultiGasConstraintsTypes library for definitions)
/// - `adjustmentWindowSecs`: time window (seconds) over which the price rises by a factor of e if demand is 2x the target (uint64, seconds)
/// - `targetPerSec`: target gas usage per second for this constraint (uint64, gas/sec)
/// - `backlog`: current backlog value for this constraint (uint64, gas units)
/// @return constraints Array of `ResourceConstraint` structs representing the current multi-gas pricing configuration.
/// @notice Available in ArbOS version 60 and above.
/// @notice See the `ArbMultiGasConstraintsTypes` library for struct definitions and field details.
function getMultiGasPricingConstraints()
external
view
returns (ArbMultiGasConstraintsTypes.ResourceConstraint[] memory constraints);
}
44 changes: 44 additions & 0 deletions ArbMultiGasConstraintsTypes.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2025, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1

pragma solidity >=0.4.21 <0.9.0;

/// @title ArbMultiGasConstraintsTypes
/// @notice Type definitions for configuring and inspecting multi-dimensional gas pricing constraints.
/// @dev These structures are shared by the `ArbOwner` and `ArbGasInfo` precompiles.
library ArbMultiGasConstraintsTypes {
/// @notice Enumerates the distinct resource kinds used for multi-dimensional gas accounting.
/// @dev The numeric values of this enum must remain consistent with the corresponding
/// @dev The values defined here must stay synchronized with `go-ethereum/arbitrum/multigas/resources.go`.
enum ResourceKind {
Unknown,
Computation,
HistoryGrowth,
StorageAccess,
StorageGrowth,
L1Calldata,
L2Calldata,
WasmComputation
}

/// @notice Defines the relative contribution of a specific resource type within a constraint.
/// @param resource The resource kind being weighted.
/// @param weight The proportional weight that determines this resource kind’s influence on backlog growth.
struct WeightedResource {
ResourceKind resource;
uint64 weight;
}

/// @notice Describes a single pricing constraint that applies to one or more weighted resources.
/// @param resources The list of weighted resources that participate in this constraint.
/// @param adjustmentWindowSecs Time window (seconds) over which the price rises by a factor of e if demand is 2x the target (uint64, seconds)
/// @param targetPerSec The target gas usage per second for this constraint (uint64, gas/sec).
/// @param backlog The current or initial backlogfor this constraint (uint64, gas units).
struct ResourceConstraint {
WeightedResource[] resources;
uint32 adjustmentWindowSecs;
uint64 targetPerSec;
uint64 backlog;
}
}
27 changes: 27 additions & 0 deletions ArbOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

pragma solidity >=0.4.21 <0.9.0;

import {ArbMultiGasConstraintsTypes} from "./ArbMultiGasConstraintsTypes.sol";

/**
* @title Provides owners with tools for managing the rollup.
* @notice Calls by non-owners will always revert.
Expand Down Expand Up @@ -302,6 +304,31 @@ interface ArbOwner {
uint64[3][] calldata constraints
) external;

/// @notice Sets the list of multi-gas pricing constraints for the multi-dimensional multi-constraint pricing model.
/// @notice Replaces the existing configuration and initializes each constraint’s starting backlog value.
/// @notice Any previous multi-gas constraints are discarded.
///
/// @notice This method defines both the target throughput and relative weights
/// @notice of each resource kind participating in multi-dimensional gas pricing.
/// @notice Each constraint may specify multiple resources with different weight multipliers.
/// @notice The final base fee is determined by the most congested resource dimension.
///
/// @notice Model selection:
/// @notice - If one or more multi-gas constraints are provided, ArbOS switches to the multi-dimensional
/// @notice pricing model and uses exactly the provided parameters.
/// @notice - If zero constraints are provided, the chain reverts to the previous pricing model
/// @notice (either the single-constraint or single-dimensional multi-constraint configuration).
///
/// @notice Available in ArbOS version 60 and above.
/// @param constraints Array of `ResourceConstraint` structs, each containing:
/// - `resources`: list of (resource kind, weight) pairs (see the ArbMultiGasConstraintsTypes library for definitions)
/// - `adjustmentWindowSecs`: time window (seconds) over which the price rises by a factor of e if demand is 2x the target (uint64, seconds)
/// - `targetPerSec`: target gas usage per second for this constraint (uint64, gas/sec)
/// - `backlog`: initial backlog value for this constraint (uint64, gas units)
function setMultiGasPricingConstraints(
ArbMultiGasConstraintsTypes.ResourceConstraint[] calldata constraints
) external;

/// Emitted when a successful call is made to this precompile
event OwnerActs(bytes4 indexed method, address indexed owner, bytes data);
}