Skip to content

Commit f6f102c

Browse files
refactor: rename get-vk-commitment to get-commitment (#608)
Co-authored-by: Mariano A. Nicolini <mariano.nicolini.91@gmail.com>
1 parent 39440ad commit f6f102c

4 files changed

Lines changed: 15 additions & 19 deletions

File tree

batcher/aligned-sdk/src/sdk.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ async fn _verify_proof_onchain(
308308
Ok(result)
309309
}
310310

311-
/// Returns the commitment for a given verification key.
311+
/// Returns the commitment for a given input. Input can be verification key, public input, etc.
312312
/// # Arguments
313-
/// * `content` - The verification key for which the commitment will be calculated.
313+
/// * `content` - The content for which the commitment will be calculated.
314314
/// # Returns
315-
/// * The verification key commitment.
315+
/// * The commitment.
316316
/// # Errors
317317
/// * None.
318-
pub fn get_verification_key_commitment(content: &[u8]) -> [u8; 32] {
318+
pub fn get_commitment(content: &[u8]) -> [u8; 32] {
319319
let mut hasher = Keccak256::new();
320320
hasher.update(content);
321321
hasher.finalize().into()

batcher/aligned/src/main.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ use log::{error, info};
1818
use transaction::eip2718::TypedTransaction;
1919

2020
use aligned_sdk::errors::{AlignedError, SubmitError};
21-
use aligned_sdk::sdk::{get_verification_key_commitment, submit_multiple, verify_proof_onchain};
21+
use aligned_sdk::sdk::{get_commitment, submit_multiple, verify_proof_onchain};
2222
use aligned_sdk::types::AlignedVerificationData;
2323
use aligned_sdk::types::Chain;
2424
use aligned_sdk::types::ProvingSystemId;
2525
use aligned_sdk::types::VerificationData;
2626

2727
use crate::AlignedCommands::DepositToBatcher;
28+
use crate::AlignedCommands::GetCommitment;
2829
use crate::AlignedCommands::GetUserBalance;
29-
use crate::AlignedCommands::GetVerificationKeyCommitment;
3030
use crate::AlignedCommands::Submit;
3131
use crate::AlignedCommands::VerifyProofOnchain;
3232

@@ -44,13 +44,9 @@ pub enum AlignedCommands {
4444
#[clap(about = "Verify the proof was included in a verified batch on Ethereum")]
4545
VerifyProofOnchain(VerifyProofOnchainArgs),
4646

47-
// GetVerificationKey, command name is get-vk-commitment
48-
#[clap(
49-
about = "Create verification key for proving system",
50-
name = "get-vk-commitment"
51-
)]
52-
GetVerificationKeyCommitment(GetVerificationKeyCommitmentArgs),
53-
// GetVericiationKey, command name is get-vk-commitment
47+
// Get commitment for file, command name is get-commitment
48+
#[clap(about = "Get commitment for file", name = "get-commitment")]
49+
GetCommitment(GetCommitmentArgs),
5450
#[clap(
5551
about = "Deposits Ethereum in the batcher to pay for proofs",
5652
name = "deposit-to-batcher"
@@ -155,7 +151,7 @@ pub struct VerifyProofOnchainArgs {
155151

156152
#[derive(Parser, Debug)]
157153
#[command(version, about, long_about = None)]
158-
pub struct GetVerificationKeyCommitmentArgs {
154+
pub struct GetCommitmentArgs {
159155
#[arg(name = "File name", long = "input")]
160156
input_file: PathBuf,
161157
#[arg(name = "Output file", long = "output")]
@@ -336,10 +332,10 @@ async fn main() -> Result<(), AlignedError> {
336332
info!("Your proof was not included in the batch.");
337333
}
338334
}
339-
GetVerificationKeyCommitment(args) => {
335+
GetCommitment(args) => {
340336
let content = read_file(args.input_file)?;
341337

342-
let hash = get_verification_key_commitment(&content);
338+
let hash = get_commitment(&content);
343339

344340
info!("Commitment: {}", hex::encode(hash));
345341
if let Some(output_file) = args.output_file {

docs/guides/1_SDK.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ pub async fn verify_proof_onchain(
100100
- `ParsingError` if there is an error parsing the address of the contract.
101101
- `EthError` if there is an error verifying the proof on-chain.
102102

103-
### get_verification_key_commitment
103+
### get_commitment
104104

105105
Generates a keccak256 hash commitment of the verification key.
106106

107107
```rust
108-
pub fn get_verification_key_commitment(
108+
pub fn get_commitment(
109109
content: &[u8]
110110
) -> [u8; 32]
111111
```

docs/guides/2_using_aligned_on_your_app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ without actually generating and submitting a proof.
3131
You can do this by running the following command:
3232

3333
```bash
34-
aligned get-vk-commitment --input <path_to_input_file>
34+
aligned get-commitment --input <path_to_input_file>
3535
```
3636

3737
For SP1 you would use the elf of the program as the input file.

0 commit comments

Comments
 (0)