Skip to content

Commit

Permalink
Merge pull request #10 from OffchainLabs/stylus-hostio-timings
Browse files Browse the repository at this point in the history
Stylus hostio timings
  • Loading branch information
rachel-bousfield authored Aug 10, 2023
2 parents 48f4559 + b133512 commit 780ee20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
10 changes: 4 additions & 6 deletions src/precompiles/ArbOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,18 @@ interface ArbOwner {
// @notice Releases surplus funds from L1PricerFundsPoolAddress for use
function releaseL1PricerSurplusFunds(uint256 maxWeiToRelease) external returns (uint256);

// @notice sets the price (in evm gas basis points) of ink
function setInkPrice(uint64 price) external;
// @notice sets the amount of ink 1 gas buys
// @param price the conversion rate (must fit in a uint24)
function setInkPrice(uint32 price) external;

// @notice sets the maximum depth (in wasm words) a wasm stack may grow
function setWasmMaxDepth(uint32 depth) external;

// @notice sets the cost of starting a stylus hostio call
function setWasmHostioInk(uint64 ink) external;

// @notice sets the number of free wasm pages a tx gets
function setWasmFreePages(uint16 pages) external;

// @notice sets the base cost of each additional wasm page
function setWasmPageGas(uint32 gas) external;
function setWasmPageGas(uint16 gas) external;

// @notice sets the ramp that drives exponential wasm memory costs
function setWasmPageRamp(uint64 ramp) external;
Expand Down
18 changes: 7 additions & 11 deletions src/precompiles/ArbWasm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,31 @@ interface ArbWasm {
// @notice compile a wasm program
// @param program the program to compile
// @return version the stylus version the program was compiled against
function compileProgram(address program) external returns (uint32 version);
function compileProgram(address program) external returns (uint16 version);

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

// @notice gets the stylus version the program was most recently compiled against.
// @return version the program version (0 for EVM contracts)
function programVersion(address program) external view returns (uint32 version);
function programVersion(address program) external view returns (uint16 version);

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

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

// @notice gets the fixed-cost overhead needed to initiate a hostio call
// @return ink the cost of starting a stylus hostio call
function wasmHostioInk() external view returns (uint64 ink);

// @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)
// @return gas base amount of gas needed to grow another wasm page
function pageGas() external view returns (uint32 gas);
function pageGas() external view returns (uint16 gas);

// @notice gets the ramp that drives exponential memory costs
// @return ramp bits representing the floating point value
Expand All @@ -51,6 +47,6 @@ interface ArbWasm {
function pageLimit() external view returns (uint16 limit);

error ProgramNotCompiled();
error ProgramOutOfDate(uint32 version);
error ProgramOutOfDate(uint16 version);
error ProgramUpToDate();
}

0 comments on commit 780ee20

Please sign in to comment.