Moved all the bft_crdt stuff into its own module
This commit is contained in:
@@ -11,7 +11,7 @@ use syn::{
|
||||
|
||||
/// Helper to get tokenstream representing the parent crate
|
||||
fn get_crate_name() -> TokenStream {
|
||||
let cr8 = crate_name("bft-json-crdt").unwrap_or(FoundCrate::Itself);
|
||||
let cr8 = crate_name("bft-json-bft-crdt").unwrap_or(FoundCrate::Itself);
|
||||
match cr8 {
|
||||
FoundCrate::Itself => quote! { ::bft_json_crdt },
|
||||
FoundCrate::Name(name) => {
|
||||
|
||||
@@ -18,7 +18,7 @@ use fastcrypto::{
|
||||
// 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
|
||||
// object field order in JSON objects. However, the hash check impl in bft-json-bft-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 in an IndexMap for the moment to get the PoC working. To see the problem, replace this with
|
||||
|
||||
6
crates/bft-json-crdt/tests/editing-trace.js
generated
6
crates/bft-json-crdt/tests/editing-trace.js
generated
@@ -259796,7 +259796,7 @@ function insertAt(idx, elt) {
|
||||
const pos = new_log.findIndex(log => log[0] === parent_id)
|
||||
new_log.push([ID_COUNTER, pos, 0, elt])
|
||||
crdt.splice(raw_i + 1, 0, { deleted: false, content: elt, id: ID_COUNTER })
|
||||
// console.log(`insert at ${idx} translated as op [${ID_COUNTER}, ${pos}, ${0}, ${escape(elt)}] found at ${raw_i + 1}::`, crdt[raw_i + 1])
|
||||
// console.log(`insert at ${idx} translated as op [${ID_COUNTER}, ${pos}, ${0}, ${escape(elt)}] found at ${raw_i + 1}::`, bft-crdt[raw_i + 1])
|
||||
return
|
||||
}
|
||||
|
||||
@@ -259816,7 +259816,7 @@ function deleteAt(idx) {
|
||||
const pos = new_log.findIndex(log => log[0] === our_id)
|
||||
new_log.push([ID_COUNTER, pos, 1]);
|
||||
crdt[raw_i].deleted = true
|
||||
// console.log(`delete at ${idx} translated as op [${ID_COUNTER}, ${pos}, ${1}] found at ${raw_i} with our_id ${our_id}::`, crdt[raw_i])
|
||||
// console.log(`delete at ${idx} translated as op [${ID_COUNTER}, ${pos}, ${1}] found at ${raw_i} with our_id ${our_id}::`, bft-crdt[raw_i])
|
||||
return
|
||||
}
|
||||
|
||||
@@ -259853,7 +259853,7 @@ function rawJSString(edits) {
|
||||
// deleteAt(edit[0])
|
||||
// }
|
||||
// }
|
||||
// console.log(crdt)
|
||||
// console.log(bft-crdt)
|
||||
// rawJSString(mock_edits)
|
||||
// console.log(new_log)
|
||||
// const subset = edits.slice(0, 50000)
|
||||
|
||||
Reference in New Issue
Block a user