From 4a15b42b7aeb24b50a46a03c18af0cf61e318312 Mon Sep 17 00:00:00 2001 From: Joshua Colvin Date: Sun, 20 Aug 2023 17:24:34 -0700 Subject: [PATCH 1/2] Add stylus programSize and programMemoryFootprint precompiles --- src/precompiles/ArbWasm.sol | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/precompiles/ArbWasm.sol b/src/precompiles/ArbWasm.sol index 14716c19..45fc895c 100644 --- a/src/precompiles/ArbWasm.sol +++ b/src/precompiles/ArbWasm.sol @@ -22,6 +22,14 @@ interface ArbWasm { // @return version the program version (0 for EVM contracts) function programVersion(address program) external view returns (uint16 version); + // @notice gets the uncompressed size of the program at the given address in bytes + // @return version the program version (0 for EVM contracts) + function programSize(address program) external view returns (uint32 size); + + // @notice gets the memory footprint of the program at the given address in pages + // @return version the program version (0 for EVM contracts) + function programMemoryFootprint(address program) external view returns (uint16 footprint); + // @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); From d5ce0937222aa51f67eda9b3b5f3a1cc833df2a1 Mon Sep 17 00:00:00 2001 From: Joshua Colvin Date: Tue, 5 Sep 2023 22:06:41 -0700 Subject: [PATCH 2/2] Fix docstrings --- src/precompiles/ArbWasm.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/precompiles/ArbWasm.sol b/src/precompiles/ArbWasm.sol index e81c66c4..0741e961 100644 --- a/src/precompiles/ArbWasm.sol +++ b/src/precompiles/ArbWasm.sol @@ -27,11 +27,11 @@ interface ArbWasm { function programVersion(address program) external view returns (uint16 version); // @notice gets the uncompressed size of the program at the given address in bytes - // @return version the program version (0 for EVM contracts) + // @return size the size of the program in bytes rounded up to a multiple of 512 function programSize(address program) external view returns (uint32 size); // @notice gets the memory footprint of the program at the given address in pages - // @return version the program version (0 for EVM contracts) + // @return footprint the memory footprint of program in pages function programMemoryFootprint(address program) external view returns (uint16 footprint); // @notice gets the conversion rate between gas and ink