Skip to content

Commit f3e3e92

Browse files
committed
chore: document new aggregation function on sdk
1 parent 26f053d commit f3e3e92

File tree

1 file changed

+24
-8
lines changed
  • batcher/aligned-sdk/src/sdk/aggregation

1 file changed

+24
-8
lines changed

batcher/aligned-sdk/src/sdk/aggregation/mod.rs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,21 @@ pub async fn is_proof_verified(
6969
Err(ProofVerificationAggModeError::ProofNotFoundInLogs)
7070
}
7171

72-
/// Sames as [`is_proof_verified`] only that the verification is done in the ProofAggregationService contract on chain calling the function `verifyProofInclusion`
73-
/// This is done by fetching the aggregated proof blob and constructing the merkle tree and then calling `verifyProofInclusion` with:
74-
/// 1. The merkle path for the given [`AggregationModeVerificationData`]
75-
/// 2. The proof commitment
72+
/// Performs the same verification as [`is_proof_verified`], but instead of verifying locally, it simulates
73+
/// an on-chain verification by calling the `verifyProofInclusion` function on the `ProofAggregationService` contract.
7674
///
77-
/// For local verification, you probably want to call [`is_proof_verified`], the function `verifyProofInclusion` is useful in actual contract calls to verify a statement with Aligned
78-
/// This here is simulation an testing purposes
75+
/// This function:
76+
/// 1. Fetches the aggregated proof blob from the blockchain.
77+
/// 2. Constructs the corresponding Merkle tree from the proof commitments.
78+
/// 3. Calls the contract's `verifyProofInclusion` function with:
79+
/// - The Merkle path corresponding to the given [`AggregationModeVerificationData`].
80+
/// - The proof commitment, computed from the program ID and public inputs.
81+
///
82+
/// This is mainly useful for testing and simulation purposes to ensure that a given proof commitment
83+
/// would be accepted by the contract on-chain. For typical off-chain verification (e.g., in services or indexers),
84+
/// prefer using [`is_proof_verified`].
85+
///
86+
/// Note: This function does not perform the actual on-chain transaction but simulates the contract call.
7987
pub async fn is_proof_verified_on_chain(
8088
verification_data: AggregationModeVerificationData,
8189
network: Network,
@@ -117,8 +125,16 @@ pub async fn is_proof_verified_on_chain(
117125
Ok(res)
118126
}
119127

120-
/// Given [`AggregationModeVerificationData`] it fetches the logs starting from `from_block` until it finds it
121-
/// Once found, it retrieves the blob (if not expired) and constructs the respective merkle tree to return the merkle path for the proof.
128+
/// Given the [`AggregationModeVerificationData`], this function queries the blockchain logs starting from the
129+
/// specified `from_block` until it founds the proof.
130+
///
131+
/// Once the proof is found:
132+
/// 1. It retrieves the corresponding proof blob.
133+
/// 2. Constructs the Merkle tree based on the proof blob.
134+
/// 3. Returns the Merkle proof needed for verifying the proof.
135+
///
136+
/// Note: This function prepares the Merkle path for on-chain verification, and is typically used in combination with
137+
/// `verifyProofInclusion` to confirm proof validity within the ProofAggregationService contract.
122138
pub async fn get_merkle_path_for_proof(
123139
network: Network,
124140
eth_rpc_url: String,

0 commit comments

Comments
 (0)