Skip to content

Commit ddc16e5

Browse files
feat: add ResourceKind enum and fix comments
1 parent ed418cb commit ddc16e5

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

ArbOwner.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ interface ArbOwner {
259259
) external;
260260

261261
/// @notice Adds or updates a resource constraint
262-
/// @notice Available on ArbOS version 50 and above
262+
/// @notice Available on ArbOS version 60 and above
263263
/// @param resources an array of resource–weight pairs (see Nitro documentation for the list of resources)
264264
/// @param periodSecs the time window for the constraint
265265
/// @param targetPerSec allowed usage per second across weighted resources
@@ -270,10 +270,13 @@ interface ArbOwner {
270270
) external;
271271

272272
/// @notice Removes a resource constraint
273-
/// @notice Available on ArbOS version 50 and above
273+
/// @notice Available on ArbOS version 60 and above
274274
/// @param resources the list of resource kinds to be removed (see Nitro documentation for the list of resources)
275275
/// @param periodSecs the time window for the constraint
276-
function clearConstraint(uint8[] calldata resources, uint32 periodSecs) external;
276+
function clearConstraint(
277+
ArbResourceConstraintsTypes.ResourceKind[] calldata resources,
278+
uint32 periodSecs
279+
) external;
277280

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

ArbResourceConstraintsTypes.sol

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,23 @@ pragma solidity >=0.4.21 <0.9.0;
77
/// @title ArbResourceConstraintsTypes
88
/// @notice Resource constraints type definitions used by ArbOwner and ArbOwnerPublic precompiles.
99
library ArbResourceConstraintsTypes {
10+
/// @notice Enumerates the distinct resource kinds used for multi-dimensional gas accounting.
11+
/// @dev The numeric values of this enum must remain consistent with the corresponding
12+
/// @dev The values defined here must stay synchronized with `go-ethereum/arbitrum/multigas/resources.go`.
13+
enum ResourceKind {
14+
Unknown,
15+
Computation,
16+
HistoryGrowth,
17+
StorageAccess,
18+
StorageGrowth,
19+
L1Calldata,
20+
L2Calldata,
21+
WasmComputation
22+
}
23+
1024
/// @notice A pair representing a resource kind and its weight in constraint calculations.
1125
struct ResourceWeight {
12-
uint8 resource;
26+
ResourceKind resource;
1327
uint64 weight;
1428
}
1529

@@ -18,6 +32,5 @@ library ArbResourceConstraintsTypes {
1832
ResourceWeight[] resources;
1933
uint32 periodSecs;
2034
uint64 targetPerSec;
21-
uint64 backlog;
2235
}
2336
}

0 commit comments

Comments
 (0)