Skip to content

Commit

Permalink
Get Traces Limits From prover/backend/config package. (#52)
Browse files Browse the repository at this point in the history
### Context
In [this issue](https://github.com/Consensys/zkevm-monorepo/issues/1420)
we are adding a new `config` pkg responsible for reading in TOML
configuration files defining configuration variables for the prover.
The existing `corset` code responsible for producing a `WizardIOP`
constraint system assumes that said configuration variables (the traces
limits) are hard-coded as go constants (e.g., see
[these](https://github.com/Consensys/zkevm-monorepo/blob/main/prover/zkevm/define/size.go)
[two](https://github.com/Consensys/zkevm-monorepo/blob/main/prover/zkevm/define/size_large.go)
files).

As part of the issue linked above, the new `config` pkg reads in the
traces limits from the configuration file, then subsequent code embeds
them into a `*zkevm.Builder` object passed as parameter
[here](https://github.com/Consensys/corset/blob/f8ca04a74435012447630fad76ebd23a52f07c9d/src/exporters/wizardiop.go#L50).
Therefore, the `corset` code has to slightly change to now read the
traces limits from this object.

### This Change
The only change is the formatting string in the `wizardiop.rs`
responsible for generating the go code.

### Test
Tested the change with
```
cargo run -- wizard-iop -o  $WORKSPACE/zkevm-constraints/mxp $WORKSPACE/zkevm-constraints/lookup_tables/tables/instruction_decoder.lisp
```

---------

Co-authored-by: delehef <franklin.delehelle@odena.eu>
  • Loading branch information
alesforz and delehef authored Nov 9, 2023
1 parent 8bd7937 commit 0a489d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
42 changes: 1 addition & 41 deletions src/exporters/wizardiop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,12 @@ package define
import (
_ "embed"

// "github.com/BurntSushi/toml"
"github.com/consensys/accelerated-crypto-monorepo/symbolic"
"github.com/consensys/accelerated-crypto-monorepo/zkevm"
)


// type traces_limits struct {
// ADD int
// BIN int
// BIN_RT int
// EC_DATA int
// EXT int
// HASH_DATA int `toml:"PUB_HASH"`
// HASH_INFO int `toml:"PUB_HASH_INFO"`
// HUB int
// INSTRUCTION_DECODER int
// LOG_DATA int `toml:"PUB_LOG"`
// LOG_INFO int `toml:"PUB_LOG_INFO"`
// MMIO int
// MMU int
// MOD int
// MUL int
// MXP int
// PHONEY_RLP int
// RLP int
// ROM int
// SHF int
// SHF_RT int
// TX_RLP int
// WCP int
// }

// func fromToml(input string) (sizes traces_limits) {
// var r map[string]traces_limits
// _, err := toml.Decode(input, &r)
// if err != nil {
// panic(err)
// }
// return r["traces-limits"]
// }

// TODO: __go:embed traces-limits-v1.toml
// TODO: var limitStr string

func ZkEVMDefine(build *zkevm.Builder) {
// TODO: sizes := fromToml(limitStr)


//
// Corset-computed columns
Expand Down
3 changes: 1 addition & 2 deletions src/exporters/wizardiop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ fn render_constraints(cs: &ConstraintSet) -> Vec<String> {
}

fn make_size(h: &Handle, sizes: &mut HashSet<String>) -> String {
// let r = format!("sizes.{}", h.mangled_module().to_case(Case::ScreamingSnake));
let r = format!("SIZE_{}", h.mangled_module());
let r = format!("build.{}", h.mangled_module().to_case(Case::ScreamingSnake));
sizes.insert(r.clone());
r
}
Expand Down

0 comments on commit 0a489d0

Please sign in to comment.