Skip to content

Commit

Permalink
fix(tlsn-formats): prevent duplicate json array commitment (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinui0 authored Feb 12, 2024
1 parent a439838 commit 82b9582
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tlsn/tlsn-formats/src/json/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ pub trait JsonCommit {
.commit(array, direction)
.map_err(|e| JsonCommitError::new_with_source("failed to commit array", e))?;

builder
.commit(&array.without_values(), direction)
.map_err(|e| {
JsonCommitError::new_with_source("failed to commit array excluding values", e)
})?;
if !array.elems.is_empty() {
builder
.commit(&array.without_values(), direction)
.map_err(|e| {
JsonCommitError::new_with_source("failed to commit array excluding values", e)
})?;
}

// TODO: Commit each value separately, but we need a strategy for handling
// separators.
Expand Down

0 comments on commit 82b9582

Please sign in to comment.