Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the broken --version endpoint #115

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ semver = { version = "=1.0.23", features = [ "serde" ] }
lazy_static = "=1.5.0"
hex = "=0.4.3"

zkevm_opcode_defs = { git = "https://github.com/matter-labs/zksync-protocol", version = "=0.150.5" }
zkevm_opcode_defs = "=0.150.6"

era-compiler-common = { git = "https://github.com/matter-labs/era-compiler-common", branch = "main" }
era-compiler-llvm-context = { git = "https://github.com/matter-labs/era-compiler-llvm-context", branch = "main" }
Expand Down
12 changes: 8 additions & 4 deletions src/zkvyper/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,14 @@ impl Arguments {
}
}

if self.version && std::env::args().count() > 2 {
anyhow::bail!(
"Error: No other options are allowed while getting the compiler version."
);
if self.version {
if std::env::args().count() > 2 {
anyhow::bail!(
"Error: No other options are allowed while getting the compiler version."
hedgar2017 marked this conversation as resolved.
Show resolved Hide resolved
);
} else {
return Ok(());
}
}

if self.input_paths.is_empty() {
Expand Down
1 change: 1 addition & 0 deletions tests/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mod optimization;
mod output_dir;
mod overwrite;
mod supress;
mod version;
mod vyper;

/// The solidity contract name
Expand Down
30 changes: 30 additions & 0 deletions tests/cli/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use crate::{cli, common};
use predicates::prelude::*;

#[test]
fn test_version() -> anyhow::Result<()> {
let _ = common::setup();

let args = &["--version"];
let result = cli::execute_zkvyper(args)?;

result
.success()
.stdout(predicate::str::contains("Vyper compiler for ZKsync"));

Ok(())
}

#[test]
fn test_version_with_extra_args() -> anyhow::Result<()> {
let _ = common::setup();

let args = &["--version", cli::TEST_VYPER_CONTRACT_PATH];
let result = cli::execute_zkvyper(args)?;

result.failure().stderr(predicate::str::contains(
"Error: No other options are allowed while getting the compiler version.",
));

Ok(())
}