Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
txCacheSize methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-bousfield committed Apr 10, 2024
1 parent dd08a3e commit c1a66f9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
3 changes: 3 additions & 0 deletions src/precompiles/ArbOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ interface ArbOwner {
/// @notice Sets the age a program must be to perform a keepalive
function setWasmKeepaliveDays(uint16 _days) external;

/// @notice Sets the number of extra programs ArbOS caches during a given tx
function setWasmTxCacheSize(uint8 count) external;

/// @notice Adds account as a wasm cache manager
function addWasmCacheManager(address manager) external;

Expand Down
40 changes: 22 additions & 18 deletions src/precompiles/ArbWasm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pragma solidity >=0.4.21 <0.9.0;
* @notice Precompiled contract that exists in every Arbitrum chain at 0x0000000000000000000000000000000000000071.
*/
interface ArbWasm {
/// @notice activate a wasm program
/// @notice Activate a wasm program
/// @param program the program to activate
/// @return version the stylus version the program was activated against
/// @return dataFee the data fee paid to store the activated program
Expand All @@ -18,80 +18,84 @@ interface ArbWasm {
payable
returns (uint16 version, uint256 dataFee);

/// @notice gets the latest stylus version
/// @notice Gets the latest stylus version
/// @return version the stylus version
function stylusVersion() external view returns (uint16 version);

/// @notice gets the stylus version the program with codehash was most recently activated against
/// @notice Gets the stylus version the program with codehash was most recently activated against
/// @return version the program version (reverts for EVM contracts)
function codehashVersion(bytes32 codehash) external view returns (uint16 version);

/// @notice extends a program's expiration date.
/// @notice Extends a program's expiration date.
/// Reverts if too soon or if the program is not up to date.
function codehashKeepalive(bytes32 codehash) external payable;

/// @notice gets a program's asm size.
/// @notice Gets a program's asm size.
/// Reverts if program is not active.
/// @return size the size in bytes
function codehashAsmSize(bytes32 codehash) external view returns (uint32 size);

/// @notice gets the stylus version the program was most recently activated against
/// @notice Gets the stylus version the program was most recently activated against
/// @return version the program version (reverts for EVM contracts)
function programVersion(address program) external view returns (uint16 version);

/// @notice gets the cost to invoke the program (not including minInitGas)
/// @notice Gets the cost to invoke the program (not including minInitGas)
/// @return gas the amount of gas
/// @return gasWhenCached the amount of gas if the program was recently used
function programInitGas(address program)
external
view
returns (uint16 gas, uint16 gasWhenCached);

/// @notice gets the memory footprint of the program at the given address in pages
/// @notice Gets the memory footprint of the program at the given address in pages
/// @return footprint the memory footprint of program in pages (reverts for EVM contracts)
function programMemoryFootprint(address program) external view returns (uint16 footprint);

/// @notice gets the amount of time remaining until the program expires
/// @notice Gets the amount of time remaining until the program expires
/// @return _secs the time left in seconds (reverts for EVM contracts)
function programTimeLeft(address program) external view returns (uint64 _secs);

/// @notice gets the conversion rate between gas and ink
/// @notice Gets the conversion rate between gas and ink
/// @return price the amount of ink 1 gas buys
function inkPrice() external view returns (uint32 price);

/// @notice gets the wasm stack size limit
/// @notice Gets the wasm stack size limit
/// @return depth the maximum depth (in wasm words) a wasm stack may grow
function maxStackDepth() external view returns (uint32 depth);

/// @notice gets the number of free wasm pages a program gets
/// @notice Gets the number of free wasm pages a program gets
/// @return pages the number of wasm pages (2^16 bytes)
function freePages() external view returns (uint16 pages);

/// @notice gets the base cost of each additional wasm page (2^16 bytes)
/// @notice Gets the base cost of each additional wasm page (2^16 bytes)
/// @return gas base amount of gas needed to grow another wasm page
function pageGas() external view returns (uint16 gas);

/// @notice gets the ramp that drives exponential memory costs
/// @notice Gets the ramp that drives exponential memory costs
/// @return ramp bits representing the floating point value
function pageRamp() external view returns (uint64 ramp);

/// @notice gets the maximum number of pages a wasm may allocate
/// @notice Gets the maximum number of pages a wasm may allocate
/// @return limit the number of pages
function pageLimit() external view returns (uint16 limit);

/// @notice gets the minimum costs to invoke a program
/// @notice Gets the minimum costs to invoke a program
/// @return gas amount of gas in increments of 256 when not cached
/// @return cached amount of gas in increments of 64 when cached
function minInitGas() external view returns (uint8 gas, uint8 cached);

/// @notice gets the number of days after which programs deactivate
/// @notice Gets the number of days after which programs deactivate
/// @return _days the number of days
function expiryDays() external view returns (uint16 _days);

/// @notice gets the age a program must be to perform a keepalive
/// @notice Gets the age a program must be to perform a keepalive
/// @return _days the number of days
function keepaliveDays() external view returns (uint16 _days);

/// @notice Gets the number of extra programs ArbOS caches during a given tx.
/// @return count the number of same-tx programs.
function txCacheSize() external view returns (uint8 count);

event ProgramActivated(
bytes32 indexed codehash,
bytes32 moduleHash,
Expand Down

0 comments on commit c1a66f9

Please sign in to comment.