From cd40a6e39d8197e37e3eab6ad876820cea9ddaee Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Mon, 10 Apr 2023 14:23:26 -0600 Subject: [PATCH] make naming more consistent --- circuits/poseidon-digest.circom | 14 +++++++------- circuits/storer.circom | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/circuits/poseidon-digest.circom b/circuits/poseidon-digest.circom index 3a7a767..c3590b7 100644 --- a/circuits/poseidon-digest.circom +++ b/circuits/poseidon-digest.circom @@ -13,24 +13,24 @@ function roundUpDiv(x, n) { return div; } -template parallel PoseidonDigest(BLOCK_SIZE, CHUNK_SIZE) { +template parallel PoseidonDigest(BLOCK_SIZE, DIGEST_CHUNK) { // BLOCK_SIZE - size of the input block array - // CHUNK_SIZE - number of elements to hash at once + // DIGEST_CHUNK - number of elements to hash at once signal input block[BLOCK_SIZE]; // Input block array signal output hash; // Output hash - // Split array into chunks of size CHUNK_SIZE, usually 2 - var NUM_CHUNKS = roundUpDiv(BLOCK_SIZE, CHUNK_SIZE); + // Split array into chunks of size DIGEST_CHUNK, usually 2 + var NUM_CHUNKS = roundUpDiv(BLOCK_SIZE, DIGEST_CHUNK); // Initialize an array to store hashes of each block component hashes[NUM_CHUNKS]; // Loop over chunks and hash them using Poseidon() for (var i = 0; i < NUM_CHUNKS; i++) { - hashes[i] = Poseidon(CHUNK_SIZE); + hashes[i] = Poseidon(DIGEST_CHUNK); - var start = i * CHUNK_SIZE; - var end = start + CHUNK_SIZE; + var start = i * DIGEST_CHUNK; + var end = start + DIGEST_CHUNK; for (var j = start; j < end; j++) { if (j >= BLOCK_SIZE) { hashes[i].inputs[j - start] <== 0; diff --git a/circuits/storer.circom b/circuits/storer.circom index e5702cf..c0e500a 100644 --- a/circuits/storer.circom +++ b/circuits/storer.circom @@ -34,11 +34,11 @@ template parallel MerkleProof(LEVELS) { root <== hasher[LEVELS - 1].out; } -template StorageProver(BLOCK_SIZE, QUERY_LEN, LEVELS, CHUNK_SIZE) { +template StorageProver(BLOCK_SIZE, QUERY_LEN, LEVELS, DIGEST_CHUNK) { // BLOCK_SIZE: size of block in symbols // QUERY_LEN: query length, i.e. number if indices to be proven // LEVELS: size of Merkle Tree in the manifest - // CHUNK_SIZE: number of symbols to hash in one go + // DIGEST_CHUNK: number of symbols to hash in one go signal input chunks[QUERY_LEN][BLOCK_SIZE]; // chunks to be proven signal input siblings[QUERY_LEN][LEVELS]; // siblings hashes of chunks to be proven signal input path[QUERY_LEN]; // path of chunks to be proven @@ -50,7 +50,7 @@ template StorageProver(BLOCK_SIZE, QUERY_LEN, LEVELS, CHUNK_SIZE) { component hashers[QUERY_LEN]; for (var i = 0; i < QUERY_LEN; i++) { - hashers[i] = PoseidonDigest(BLOCK_SIZE, CHUNK_SIZE); + hashers[i] = PoseidonDigest(BLOCK_SIZE, DIGEST_CHUNK); hashers[i].block <== chunks[i]; hashers[i].hash === hashes[i]; }