Noted the problem with json field ordering

This commit is contained in:
Dave Hrycyszyn
2024-06-18 11:24:21 +01:00
parent a4441af53a
commit 9837916874

View File

@@ -17,6 +17,12 @@ use fastcrypto::{
traits::{KeyPair, ToFromBytes}, traits::{KeyPair, ToFromBytes},
// Verifier, // Verifier,
}; };
// TODO: serde's json object serialization and deserialization (correctly) do not define anything
// object field order in JSON objects. However, the hash check impl in bft-json-crdt does take order
// into account. This is going to cause problems later for non-Rust implementations, BFT hash checking
// currently depends on JSON serialization/deserialization object order. This shouldn't be the case
// but I've hacked it for the moment to get the PoC working. To see the problem, replace this with
// a std HashMap, everything will screw up (annoyingly, only *most* of the time).
use indexmap::IndexMap; use indexmap::IndexMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_with::{serde_as, Bytes}; use serde_with::{serde_as, Bytes};