Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Replace assert! with debug_assert! and add a new profile release-debug #310

Conversation

scroll-dev
Copy link
Collaborator

Close #288

Summary

  1. Only replace assert! with debug_assert! in no-test code.
  2. Add a new profile release-debug inherited from release profile.

Reference comment #288 (comment), we set debug = true for debug symbols. And overflow-checks = true for enabling integer overflow checks, incremental = true for incremental compilation.

It seems that the profile name debug is reserved. An error occurred when adding a custom profile named debug as below.

error: failed to parse manifest at `/zkevm-circuits/Cargo.toml`

Caused by:
  profile name `debug` is reserved
  To configure the default development profile, use the name `dev` as in [profile.dev]
  See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configuring profiles.

@github-actions github-actions bot added crate-bus-mapping Issues related to the bus-mapping workspace member crate-keccak Issues related to the keccak workspace member T-opcode Type: opcode-related and focused PR/Issue labels Jan 28, 2022
Copy link
Member

@ed255 ed255 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Nevertheless, since now we have debug_asserts, we need to make sure that we never test with release (otherwise we are testing ignoring the asserts). So I think we need to change all the places where we are testing with release and switch to --target release-debug.

That would be:

  • Makefile -> test
  • .github/workflows/ci.yml -> test
  • integration-tests/run.sh -> line 100

@CPerezz
Copy link
Contributor

CPerezz commented Jan 28, 2022

Looks good! Nevertheless, since now we have debug_asserts, we need to make sure that we never test with release (otherwise we are testing ignoring the asserts). So I think we need to change all the places where we are testing with release and switch to --target release-debug.

That would be:

* `Makefile` -> `test`

* `.github/workflows/ci.yml` -> `test`

* `integration-tests/run.sh` -> line 100

I think it would be better to simply overwrite the release profile in Cargo.toml and set it like:

[profile.release]
opt-level = 3
debug = false
debug-assertions = true
overflow-checks = false
rpath = false
lto = "thin"
incremental = false

@ed255
Copy link
Member

ed255 commented Jan 28, 2022

I think it would be better to simply overwrite the release profile in Cargo.toml and set it like:

[profile.release]
opt-level = 3
debug = false
debug-assertions = true
overflow-checks = false
rpath = false
lto = "thin"
incremental = false

I think it would be very good to run our tests with overflow-checks = true, so if we use profile release for tests, at least I'd ask to enable that.

Notice that right now we are testing with release, which means no overflow checks, and I think that's not ideal.

@CPerezz
Copy link
Contributor

CPerezz commented Jan 28, 2022

SGTM. overflow-checks is not a concern in regards of test speed.
I just added it to get faster compilations. But it's not a big deal at all. And you're right @ed255 that it will provide useful checks.

@ed255 ed255 merged commit 7dc7b4c into privacy-scaling-explorations:main Jan 31, 2022
@ed255
Copy link
Member

ed255 commented Jan 31, 2022

Thanks for applying the requested changes! Good work :)

@silathdiir silathdiir deleted the replace-assert-with-debug-assert branch February 21, 2022 01:16
zemse pushed a commit to zemse/zkevm-circuits that referenced this pull request Mar 22, 2023
…#310)

* fix sig verify challenge api

* enable all checks

* add phase 2 flex gate config

* fix bug

* works now

* clean up

* minor optimization: remove 1 phase 2 column

* optimization: use one less column

* fix

* pass make tx_bench

* lint

---------

Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
crate-bus-mapping Issues related to the bus-mapping workspace member crate-keccak Issues related to the keccak workspace member T-opcode Type: opcode-related and focused PR/Issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace assert! with debug_assert! of constraint limitation
4 participants