Skip to content

Commit

Permalink
Set opt-level to 3 (nexus-xyz#250)
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Co-authored-by: duc-nx <>
  • Loading branch information
duc-nx authored Jul 27, 2024
1 parent e46d1ca commit 1c90a25
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 32 deletions.
6 changes: 0 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ ark-bls12-381 = { git = "https://github.com/arkworks-rs/curves/", rev = "3fded1f
codegen-units = 1
lto = true

[profile.release-unoptimized]
inherits = "release"

[profile.release-unoptimized.package.example]
opt-level = 0

[profile.bench]
inherits = "release"
debug = true
7 changes: 0 additions & 7 deletions cli/src/command/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ fn setup_crate(host_path: PathBuf) -> anyhow::Result<()> {
"# Generated by cargo-nexus, do not remove!\n",
"#\n",
"# This profile is used for generating proofs, as Nexus VM support for compiler optimizations is still under development.\n",
"[profile.release-unoptimized]\n",
"inherits = \"release\"\n\n",
"[profile.release-unoptimized.package.guest]\n",
"opt-level = 0\n\n",

// https://doc.rust-lang.org/1.58.1/cargo/reference/overriding-dependencies.html#working-with-an-unpublished-minor-version
"# These patches are required for some of the underlying cryptography libraries used by Nexus.\n",
Expand Down Expand Up @@ -114,9 +110,6 @@ fn setup_crate(host_path: PathBuf) -> anyhow::Result<()> {
"# Generated by cargo-nexus, do not remove!\n",
"#\n",
"# This profile is used for generating proofs, as Nexus VM support for compiler optimizations is still under development.\n",
"[profile.release-unoptimized]\n",
"inherits = \"release\"\n",
"opt-level = 0"
)
)?;

Expand Down
3 changes: 0 additions & 3 deletions cli/src/command/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ fn setup_crate(path: PathBuf) -> anyhow::Result<()> {
"# Generated by cargo-nexus, do not remove!\n",
"#\n",
"# This profile is used for generating proofs, as Nexus VM support for compiler optimizations is still under development.\n",
"[profile.release-unoptimized]\n",
"inherits = \"release\"\n",
"opt-level = 0"
)
)?;

Expand Down
4 changes: 2 additions & 2 deletions cli/src/command/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub struct LocalProveArgs {

#[derive(Debug, Args)]
pub struct CommonProveArgs {
/// Build artifacts with the specified profile. "release-unoptimized" is default.
#[arg(long, default_value = "release-unoptimized")]
/// Build artifacts with the specified profile. "release" is default.
#[arg(long, default_value = "release")]
pub profile: String,

/// Name of the bin target to run.
Expand Down
6 changes: 3 additions & 3 deletions sdk/examples/hypernova.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ const EXAMPLE_NAME: &str = "example";

const TARGET_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../target/riscv32i-unknown-none-elf/release-unoptimized"
"/../target/riscv32i-unknown-none-elf/release"
);

fn main() {
let path = std::path::Path::new(TARGET_PATH).join(EXAMPLE_NAME);
if path.try_exists().is_err() {
panic!(
"{}{} was not found, make sure to compile the program \
with `cd examples && cargo build --release-unoptimized --bin {}`",
"target/riscv32i-unknown-none-elf/release-unoptimized/", EXAMPLE_NAME, EXAMPLE_NAME,
with `cd examples && cargo build --release --bin {}`",
"target/riscv32i-unknown-none-elf/release/", EXAMPLE_NAME, EXAMPLE_NAME,
);
}

Expand Down
6 changes: 3 additions & 3 deletions sdk/examples/nova_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ const EXAMPLE_NAME: &str = "input_output";

const TARGET_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../target/riscv32i-unknown-none-elf/release-unoptimized"
"/../target/riscv32i-unknown-none-elf/release"
);

fn main() {
let path = std::path::Path::new(TARGET_PATH).join(EXAMPLE_NAME);
if path.try_exists().is_err() {
panic!(
"{}{} was not found, make sure to compile the program \
with `cd examples && cargo build --release-unoptimized --bin {}`",
"target/riscv32i-unknown-none-elf/release-unoptimized/", EXAMPLE_NAME, EXAMPLE_NAME,
with `cd examples && cargo build --release --bin {}`",
"target/riscv32i-unknown-none-elf/release/", EXAMPLE_NAME, EXAMPLE_NAME,
);
}

Expand Down
6 changes: 3 additions & 3 deletions sdk/examples/nova_nobuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ const EXAMPLE_NAME: &str = "example";

const TARGET_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../target/riscv32i-unknown-none-elf/release-unoptimized"
"/../target/riscv32i-unknown-none-elf/release"
);

fn main() {
let path = std::path::Path::new(TARGET_PATH).join(EXAMPLE_NAME);
if path.try_exists().is_err() {
panic!(
"{}{} was not found, make sure to compile the program \
with `cd examples && cargo build --release-unoptimized --bin {}`",
"target/riscv32i-unknown-none-elf/release-unoptimized/", EXAMPLE_NAME, EXAMPLE_NAME,
with `cd examples && cargo build --release --bin {}`",
"target/riscv32i-unknown-none-elf/release/", EXAMPLE_NAME, EXAMPLE_NAME,
);
}

Expand Down
6 changes: 1 addition & 5 deletions sdk/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ impl CompileOpts {
// };
let target = "riscv32i-unknown-none-elf";

let profile = if self.debug {
"debug"
} else {
"release-unoptimized"
};
let profile = if self.debug { "debug" } else { "release" };

let envs = vec![("CARGO_ENCODED_RUSTFLAGS", rust_flags.join("\x1f"))];
let prog = self.binary.as_str();
Expand Down

0 comments on commit 1c90a25

Please sign in to comment.