Skip to content

Commit f8ed41a

Browse files
taturosatiuri-99
andauthored
fix: dont upload nonce to bucket (#699)
Co-authored-by: Urix <43704209+uri-99@users.noreply.github.com>
1 parent ce153f7 commit f8ed41a

7 files changed

Lines changed: 19 additions & 245 deletions

File tree

batcher/aligned-batcher/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ use std::sync::Arc;
1515

1616
use aligned_sdk::core::types::{
1717
BatchInclusionData, ClientMessage, NoncedVerificationData, ResponseMessage,
18-
ValidityResponseMessage, VerificationCommitmentBatch, VerificationDataCommitment,
18+
ValidityResponseMessage, VerificationCommitmentBatch, VerificationData,
19+
VerificationDataCommitment,
1920
};
2021
use aws_sdk_s3::client::Client as S3Client;
2122
use eth::BatcherPaymentService;
@@ -464,12 +465,17 @@ impl Batcher {
464465
block_number: u64,
465466
finalized_batch: BatchQueue,
466467
) -> Result<(), BatcherError> {
467-
let batch_verification_data: Vec<NoncedVerificationData> = finalized_batch
468+
let nonced_batch_verifcation_data: Vec<NoncedVerificationData> = finalized_batch
468469
.clone()
469470
.into_iter()
470471
.map(|(data, _, _, _)| data)
471472
.collect();
472473

474+
let batch_verification_data: Vec<VerificationData> = nonced_batch_verifcation_data
475+
.iter()
476+
.map(|vd| vd.verification_data.clone())
477+
.collect();
478+
473479
let batch_bytes = serde_json::to_vec(batch_verification_data.as_slice())
474480
.expect("Failed to serialize batch");
475481

batcher/aligned-sdk/src/core/types.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ pub struct VerificationDataCommitment {
5858

5959
impl From<&NoncedVerificationData> for VerificationDataCommitment {
6060
fn from(nonced_verification_data: &NoncedVerificationData) -> Self {
61-
let verification_data = nonced_verification_data.verification_data.clone();
61+
nonced_verification_data.verification_data.clone().into()
62+
}
63+
}
6264

65+
impl From<VerificationData> for VerificationDataCommitment {
66+
fn from(verification_data: VerificationData) -> Self {
6367
let mut hasher = Keccak256::new();
6468

6569
// compute proof commitment

batcher/aligned-sdk/src/types.rs

Lines changed: 0 additions & 225 deletions
This file was deleted.

explorer/lib/explorer_web/live/utils.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ defmodule Utils do
129129
batch_json
130130
|> Enum.map(
131131
fn s3_object ->
132-
:crypto.hash(:sha3_256, s3_object["verification_data"]["proof"])
132+
:crypto.hash(:sha3_256, s3_object["proof"])
133133
end)
134134
end
135135

operator/merkle_tree/lib/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use aligned_sdk::core::types::{
2-
NoncedVerificationData, VerificationCommitmentBatch, VerificationDataCommitment,
2+
VerificationCommitmentBatch, VerificationData, VerificationDataCommitment,
33
};
44
use lambdaworks_crypto::merkle_tree::merkle::MerkleTree;
55

@@ -15,15 +15,15 @@ pub extern "C" fn verify_merkle_tree_batch_ffi(
1515

1616
let batch_bytes = unsafe { std::slice::from_raw_parts(batch_ptr, batch_len) };
1717

18-
let batch = match serde_json::from_slice::<Vec<NoncedVerificationData>>(batch_bytes) {
18+
let batch = match serde_json::from_slice::<Vec<VerificationData>>(batch_bytes) {
1919
Ok(batch) => batch,
2020
Err(_e) => {
2121
return false;
2222
}
2323
};
2424

2525
let batch_data_comm: Vec<VerificationDataCommitment> =
26-
batch.into_iter().map(|v| v.clone().into()).collect();
26+
batch.into_iter().map(|v| v.into()).collect();
2727

2828
let computed_batch_merkle_tree: MerkleTree<VerificationCommitmentBatch> =
2929
MerkleTree::build(&batch_data_comm);

operator/pkg/s3.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,12 @@ func (o *Operator) getBatchFromS3(batchURL string, expectedMerkleRoot [32]byte)
5050
}
5151
o.Logger.Infof("Batch merkle tree verified")
5252

53-
var batch []NoncedVerificationData
53+
var batch []VerificationData
5454

5555
err = json.Unmarshal(batchBytes, &batch)
5656
if err != nil {
5757
return nil, err
5858
}
5959

60-
// get only the verification data
61-
var batchData []VerificationData
62-
for _, data := range batch {
63-
batchData = append(batchData, data.VerificationData)
64-
}
65-
66-
return batchData, nil
60+
return batch, nil
6761
}

operator/pkg/verification_data.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@ type VerificationData struct {
1111
VerificationKey []byte `json:"verification_key"`
1212
VmProgramCode []byte `json:"vm_program_code"`
1313
}
14-
15-
type NoncedVerificationData struct {
16-
VerificationData VerificationData `json:"verification_data"`
17-
Nonce []byte `json:"nonce"`
18-
}

0 commit comments

Comments
 (0)