From a90e2c0e8b4a588fab6b3904b2c23a496c86415a Mon Sep 17 00:00:00 2001 From: vladbochok Date: Fri, 3 Nov 2023 16:49:22 +0400 Subject: [PATCH] Add missing comments --- contracts/precompiles/Keccak256.yul | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/contracts/precompiles/Keccak256.yul b/contracts/precompiles/Keccak256.yul index ba69e8dd6..8a1194789 100644 --- a/contracts/precompiles/Keccak256.yul +++ b/contracts/precompiles/Keccak256.yul @@ -11,12 +11,21 @@ object "Keccak256" { // CONSTANTS //////////////////////////////////////////////////////////////// - /// @dev The size of the processing keccak256 block in bytes. + /// @dev Returns the block size used by the keccak256 hashing function. + /// The value 136 bytes corresponds to the size of the input data block that the keccak256 + /// algorithm processes in each round, as defined in the keccak256 specification. This is derived + /// from the formula (1600 - 2 * bit length of the digest) / 8, where the bit length for keccak256 + /// is 256 bits. For more details, refer to the Keccak specification at + /// https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf#page=30 function BLOCK_SIZE() -> ret { ret := 136 } /// @dev The gas cost of processing one keccak256 round. + /// @dev This constant is made equal to the corresponding constant in + /// https://github.com/matter-labs/era-zkevm_opcode_defs/blob/v1.4.1/src/circuit_prices.rs, + /// which was automatically generated depending on the capacity of rounds for a + /// single Keccak256 circuit. function KECCAK_ROUND_GAS_COST() -> ret { ret := 40 }