waku-org / waku-rlnv2-contract

rln-v2 Contracts for Waku
MIT License
0 stars 0 forks source link

Distinguish idCommitment and rateCommitment in the code #12

Open s-tikhomirov opened 2 weeks ago

s-tikhomirov commented 2 weeks ago

The contract deals with two types of objects called "commitment": ID commitments and rate commitments. Using just "commitment" in variable names might be confusing. Suggestion: always use either idCommitment or rateCommitment, including in variable names such as isValidCommitment or commitmentIndex.

alrevuelta commented 2 weeks ago

Not sure I follow. afaikìdCommitment and rateCommitment are different things.

uint256 rateCommitment = PoseidonT3.hash([idCommitment, userMessageLimit]); idCommitment = hash of your rln secret.

s-tikhomirov commented 2 weeks ago

Sure, I understand they are different things. This is purely a naming issue. Some variables in the code are simply called commitment (or its derivative like isValidCommitment), and for a novice (myself included) it's not always obvious whether we're talking about ID commitment or rate commitment. I suggest always using distinct naming to free up code readers' brain cycles.