Skip to content

Commit

Permalink
Renamve prove -> evaluate
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-lj committed Oct 26, 2023
1 parent a821ffd commit 452cf6f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

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

22 changes: 22 additions & 0 deletions .idea/fastcrypto.iml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

14 changes: 7 additions & 7 deletions fastcrypto-cli/src/vdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum Command {
Discriminant(DiscriminantArguments),

/// Compute VDF output and proof.
Prove(ProveArguments),
Evaluate(EvaluateArguments),

/// Verify an output .
Verify(VerifyArguments),
Expand All @@ -36,7 +36,7 @@ struct DiscriminantArguments {
}

#[derive(Parser, Clone)]
struct ProveArguments {
struct EvaluateArguments {
/// The hex encoded discriminant.
#[clap(short, long)]
discriminant: String,
Expand Down Expand Up @@ -91,7 +91,7 @@ fn execute(cmd: Command) -> Result<String, Error> {
Ok(result)
}

Command::Prove(arguments) => {
Command::Evaluate(arguments) => {
let discriminant_bytes = hex::decode(arguments.discriminant)
.map_err(|_| Error::new(ErrorKind::InvalidInput, "Invalid discriminant."))?;
let discriminant = Discriminant::try_from_be_bytes(&discriminant_bytes)
Expand Down Expand Up @@ -150,7 +150,7 @@ fn execute(cmd: Command) -> Result<String, Error> {
#[cfg(test)]
mod tests {

use crate::{execute, Command, DiscriminantArguments, ProveArguments, VerifyArguments};
use crate::{execute, Command, DiscriminantArguments, EvaluateArguments, VerifyArguments};

#[test]
fn test_discriminant() {
Expand All @@ -165,10 +165,10 @@ mod tests {
}

#[test]
fn test_prove() {
fn test_evaluate() {
let discriminant = "ff6cb04c161319209d438b6f016a9c3703b69fef3bb701550eb556a7b2dfec8676677282f2dd06c5688c51439c59e5e1f9efe8305df1957d6b7bf3433493668680e8b8bb05262cbdf4d020dafa8d5a3433199b8b53f6d487b3f37a4ab59493f050d1e2b535b7e9be19c0201055c0d7a07db3aaa67fe0eed63b63d86558668a27".to_string();
let iterations = 1000u64;
let result = execute(Command::Prove(ProveArguments {
let result = execute(Command::Evaluate(EvaluateArguments {
discriminant,
iterations,
}))
Expand All @@ -177,7 +177,7 @@ mod tests {
assert_eq!(expected, result);

let invalid_discriminant = "abcx".to_string();
assert!(execute(Command::Prove(ProveArguments {
assert!(execute(Command::Evaluate(EvaluateArguments {
discriminant: invalid_discriminant,
iterations,
}))
Expand Down

0 comments on commit 452cf6f

Please sign in to comment.