1use alloy::sol;
2use celestia_types::nmt::{Namespace, NamespaceProof};
3use celestia_types::RowProof;
4use serde::{Deserialize, Serialize};
5
6#[cfg(feature = "utils")]
7mod error;
8#[cfg(feature = "utils")]
9pub use error::InclusionServiceError;
10
11#[cfg(feature = "grpc")]
12pub mod eqs {
14 include!("generated/eqs.rs");
15}
16
17#[derive(Serialize, Deserialize, Clone, Debug)]
26pub struct KeccakInclusionToDataRootProofInput {
27 pub data: Vec<u8>,
28 pub namespace_id: Namespace,
29 pub share_proofs: Vec<NamespaceProof>,
30 pub row_proof: RowProof,
31 pub data_root: [u8; 32],
32 pub keccak_hash: [u8; 32],
33}
34
35pub type KeccakInclusionToDataRootProofOutput = sol! {
38 tuple(bytes32, bytes32)
39};
40
41#[cfg(test)]
42mod test {
43 use super::*;
44
45 use alloy_primitives::FixedBytes;
46 use alloy_sol_types::{SolType, SolValue};
47
48 #[test]
49 fn test_abi_encoding() {
50 let f: FixedBytes<32> = FixedBytes::from([0; 32]);
51 let output = (
52 FixedBytes::<32>::from([0; 32]),
53 FixedBytes::<32>::from([0; 32]),
54 );
55 let encoded = output.abi_encode();
56 let decoded: (FixedBytes<32>, FixedBytes<32>) =
63 KeccakInclusionToDataRootProofOutput::abi_decode(&encoded, true).unwrap();
64 assert_eq!(output, decoded);
65 }
66}