Consensys / linea-constraints

Implementation of the constraint system of Linea, specified in the linea-specification repo.
Other
11 stars 4 forks source link

OOB constraints names #301

Closed OlivierBBB closed 2 months ago

OlivierBBB commented 2 months ago

Main point

Rename constraints to have meaningful names.

Issue

Many of the OOB module constraints have very obscure / nondescript names. E.g. it's not clear what computations / checks the following constraints are supposed to represent

valid-prc-sha2-prc-ripemd-prc-identity-future-future
valid-prc-sha2-prc-ripemd-prc-identity-future-future-future

Have some compassion for the auditors at veridise @lorenzogentile404 😄 (and for our future selves 🙂)

Solution

Use conventions that have been established e.g. in the HUB. The idea is roughly that we represent the path (chapter/section/subsection/[name in the description]) in the constraint name

;; long convention
precompile---sha2-ripemd-identity---computing-ceiling-of-cds-over-32
precompile---sha2-ripemd-identity---comparing-gas-cost-to-call-gas

;; alternative convention
sha2-ripemd-identity---computing-ceiling-of-cds-over-32
sha2-ripemd-identity---comparing-gas-cost-to-call-gas

Similarly for opcodes the best would be to follow a convention e.g.

;; long convention
opcode---jumpi---compare-bla-bla
opcode---jumpi---justifying-hub-predictions

;; alternative convention
jumpi---compare-bla-bla
jumpi---justifying-hub-predictions

I would personally prefer the long convention.


Real life encounter:

image

lorenzogentile404 commented 2 months ago

Ok, I'll go for the short convention