Consensys / linea-constraints

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

Errors in `make define.go` #231

Open gusiri opened 3 months ago

gusiri commented 3 months ago

Problem:

define.go has a syntax error and other errors described in the Appendix. Temporarily, for testing purposes, I manually fixed all the errors, and zkevm-monorepo/prover's make test passes. However, we need to figure out why make define.go does not generate a complete define.go file.


How to reproduce

envrionment: rustc 1.78.0 (9b00956e5 2024-04-29) corset 9.7.10 - master branch (c729dbc) constraints - v0.1.0-prover-integration

run make define.go

error:

[INFO] Applying Sorts
[INFO] Applying Nhood
[INFO] Applying ExpandsIfs
[INFO] Applying Splatter
[INFO] Applying ColumnizeExpressions
[INFO] Applying ExpandInvs
[INFO] Compiling into constraint set, Elapsed=1.389492834s
[INFO] Running gofmt on define.go... 
[ERROR] failed:

define.go:2456:93: expected operand, found '.'
define.go:5617:3: missing ',' in argument list

define.go actually has some syntax errors. ex) SOMETHING.,Mul() instead of SOMETHING.Mul().


One could temporarily bypass the gofmt error by commenting out gofmt() in corset/src/exporters/mod.rs

fn gofmt(filename: &str) {
    info!("Running gofmt on {}... ", filename);
}

and

re-compile corset
make define.go

Appendix

Above trick will generate a define.go with many errors.

<1. Syntax Errors>

zkevm/arithmetization/define/define.go:2468:93: syntax error: unexpected ., expected expression zkevm/arithmetization/define/define.go:2469:93: syntax error: unexpected ., expected expression zkevm/arithmetization/define/define.go:2470:93: syntax error: unexpected ., expected expression zkevm/arithmetization/define/define.go:1386:87: syntax error: unexpected EOF in argument list; possibly missing comma or ) ... and more

<2. Duplicate variables> zkevm/arithmetization/define/define.go:580:33: no new variables on left side of := zkevm/arithmetization/define/define.go:614:33: no new variables on left side of := ... and more

<3. Missing prover config.TracesLimits > I added missing trace limits to the prover config file.

<4. Declared and not used> zkevm/arithmetization/define/define.go:533:2: mmioACC_1 declared and not used zkevm/arithmetization/define/define.go:534:2: mmio__ACC_2 declared and not used zkevm/arithmetization/define/define.go:535:2: mmioACC_3 declared and not used zkevm/arithmetization/define/define.go:536:2: mmioACC_4 declared and not used zkevm/arithmetization/define/define.go:538:2: mmio__BIT_1 declared and not used zkevm/arithmetization/define/define.go:539:2: mmioBIT_2 declared and not used zkevm/arithmetization/define/define.go:567:2: mmioPOW_256_1 declared and not used zkevm/arithmetization/define/define.go:568:2: mmioPOW_256_2 declared and not used zkevm/arithmetization/define/define.go:569:2: mmioSOURCE_BYTE_OFFSET declared and not used zkevm/arithmetization/define/define.go:570:2: mmioSOURCE_LIMB_OFFSET declared and not used zkevm/arithmetization/define/define.go:572:2: mmioTARGET_BYTE_OFFSET declared and not used zkevm/arithmetization/define/define.go:573:2: mmioTARGET_LIMB_OFFSET declared and not used

<5. Undefined Variables> zkevm/arithmetization/define/define.go:1510:62: undefined: mmioBYTE_B zkevm/arithmetization/define/define.go:1510:76: undefined: mmio__BYTE_LIMB zkevm/arithmetization/define/define.go:1510:93: undefined: mmioBYTE_A zkevm/arithmetization/define/define.go:1510:107: undefined: mmio__BYTE_C


DavePearce commented 3 months ago

Have created a corset issue to track these problems: https://github.com/Consensys/corset/issues/173

letypequividelespoubelles commented 3 months ago

<4. Declared and not used> zkevm/arithmetization/define/define.go:533:2: mmio__ACC_1 declared and not used zkevm/arithmetization/define/define.go:534:2: mmio__ACC_2 declared and not used ...

This is normal, all the mmio constraints are disabled in the Makefile

letypequividelespoubelles commented 3 months ago

linked with #143 ?

gusiri commented 3 months ago

In my case, #143 was resolved by #230