Data type json deserialization failed

let private_inputs:<Tree, DefaultPieceHasher>   = stacked::PrivateInputs::<Tree, DefaultPieceHasher> {
    p_aux,
    t_aux: t_aux_cache,
};

data structure type of data:
"TemporaryAuxCache { labels: LabelsCache { labels: [DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 37, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-1.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 38, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-2.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 39, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-3.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 40, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-4.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 41, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-5.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 42, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-6.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 43, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-7.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 44, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-8.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 45, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-9.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 46, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-10.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }, DiskStore { len: 1073741824, elem_len: 32, _e: PhantomData, file: File { fd: 47, path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0/sc-02-data-layer-11.dat", read: true, write: false }, loaded_from_disk: true, store_size: 34359738368 }] }, tree_d: MerkleTreeWrapper { inner: MerkleTree { data: enum Data, leafs: 1073741824, len: 2147483647, row_count: 31, root: Sha256Domain(a7d1cfb5270939489a1fb4c47c061f4755a15dcdd1b833640266a6643cd98728) }, Hasher: "sha256_hasher" }, tree_r_last: MerkleTreeWrapper { inner: MerkleTree { data: enum Data, leafs: 1073741824, len: 1227133513, row_count: 11, root: PoseidonDomain([25, 34, 189, 192, 135, 106, 120, 164, 51, 251, 200, 248, 1, 63, 130, 41, 47, 122, 98, 18, 217, 21, 95, 239, 207, 39, 94, 32, 153, 117, 26, 36]) }, Hasher: "poseidon_hasher" }, tree_r_last_config_rows_to_discard: 2, tree_c: MerkleTreeWrapper { inner: MerkleTree { data: enum Data, leafs: 1073741824, len: 1227133513, row_count: 11, root: PoseidonDomain([240, 162, 122, 41, 0, 45, 132, 70, 249, 198, 39, 206, 125, 24, 128, 131, 66, 27, 207, 112, 47, 155, 18, 135, 37, 97, 208, 83, 155, 197, 75, 2]) }, Hasher: "poseidon_hasher" }, t_aux: TemporaryAux { labels: Labels { labels: [StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-1", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-2", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-3", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-4", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-5", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-6", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-7", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-8", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-9", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-10", size: Some(1073741824), rows_to_discard: 7 }, StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "layer-11", size: Some(1073741824), rows_to_discard: 7 }], _h: PhantomData }, tree_d_config: StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "tree-d", size: Some(2147483647), rows_to_discard: 7 }, tree_r_last_config: StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "tree-r-last", size: Some(153391689), rows_to_discard: 2 }, tree_c_config: StoreConfig { path: "/mnt/md0/kz/bench844499628/cache/s-t01000-0", id: "tree-c", size: Some(153391689), rows_to_discard: 2 }, _g: PhantomData }, replica_path: "/mnt/md0/kz/bench844499628/sealed/s-t01000-0" }"

You really should put that giant snippet of text in a code block.

Beyond that, you have not given enough information for us to help you. What I can say is that the text you posted is not JSON.

2 Likes

error[E0308]: mismatched types
--> /root/dev/rust-fil-proofs/filecoin-proofs/src/api/seal.rs:475:91
|
475 | let sk = serde_json::from_value::<stacked::PrivateInputs::<Tree, DefaultPieceHasher>>(&jdata);
| ^^^^^^ expected enum Value, found &std::string::String

error[E0277]: the trait bound for<'de> storage_proofs_porep::stacked::PrivateInputs<Tree, Sha256Hasher>: Deserialize<'de> is not satisfied
--> /root/dev/rust-fil-proofs/filecoin-proofs/src/api/seal.rs:475:39
|
475 | let sk = serde_json::from_value::<stacked::PrivateInputs::<Tree, DefaultPieceHasher>>(&jdata);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait for<'de> Deserialize<'de> is not implemented for storage_proofs_porep::stacked::PrivateInputs<Tree, Sha256Hasher>
|
::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.68/src/value/mod.rs:982:8
|
982 | T: DeserializeOwned,
| ---------------- required by this bound in from_value
|
= note: required because of the requirements on the impl of DeserializeOwned for storage_proofs_porep::stacked::PrivateInputs<Tree, Sha256Hasher>

error: aborting due to 2 previous errors

This is my json data deserialization error above

That's completely unreadable. Please put it in a code block.

1 Like

// if path.is_file() {

// info!("temp = {}", temp);

// info!("Serialized data");

// let jdata = fs::read_to_string(&temp)?;

// let jvalue = serde_json::from_str(&jdata)?;

// t_aux_cache = serde_json::from_value::<TemporaryAuxCache<_, _>>(jvalue)?;

// info!("{:#?}",t_aux_cache);

// // let sdata = serde_json::to_string(  &TemporaryAuxCache::new(&t_aux, replica_path.as_ref().to_path_buf()).context("failed to restore contents of t_aux"))?;

// // let mut f = File::create(&temp).expect("File creation failed temp Error");

// // f.write_all(&sdata.as_bytes()).expect("Failed to write");

// info!("temp  {}", temp);

// }

// }else{

// info!("file error");

let t_aux_cache: TemporaryAuxCache<Tree, DefaultPieceHasher> =

    TemporaryAuxCache::new(&t_aux, replica_path.as_ref().to_path_buf())

        .context("failed to restore contents of t_aux")?; // check  verification  error

// let dats = format!("{:?}", &t_aux_cache);

// let sdata = serde_json::to_string(&dats)?;

// let mut f = File::create(&temp).expect("File creation failed temp Error");

// f.write_all(&sdata.as_bytes()).expect("Failed to write");

// info!("temp  {:?}", temp);

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.