diff --git a/Cargo.lock b/Cargo.lock index 0985b319db..fecc9441c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -1104,6 +1104,7 @@ dependencies = [ "bytes", "console_error_panic_hook", "const-hex", + "crdts", "evmlib", "eyre", "futures", @@ -8735,6 +8736,7 @@ dependencies = [ "libp2p 0.54.1", "prometheus-client", "prost 0.9.0", + "pyo3", "rand 0.8.5", "rayon", "reqwest 0.12.7", diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 3ac4f23e66..3c67020d14 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -29,6 +29,7 @@ extension-module = ["pyo3/extension-module"] bip39 = "2.0.0" bls = { package = "blsttc", version = "8.0.1" } bytes = { version = "1.0.1", features = ["serde"] } +crdts = { version = "7.3", default-features = false, features = ["merkle"] } curv = { version = "0.10.1", package = "sn_curv", default-features = false, features = [ "num-bigint", ] } diff --git a/autonomi/src/client/registers.rs b/autonomi/src/client/registers.rs index 40f79ead0b..f17fe86946 100644 --- a/autonomi/src/client/registers.rs +++ b/autonomi/src/client/registers.rs @@ -8,6 +8,7 @@ /// Register Secret Key pub use bls::SecretKey as RegisterSecretKey; +use crdts::merkle_reg::MerkleReg; use sn_evm::Amount; use sn_evm::AttoTokens; use sn_evm::EvmWalletError; @@ -78,6 +79,12 @@ impl Register { .collect() } + /// Get the low-level CRDT of the register + pub fn inner_merkle_reg(&self) -> &MerkleReg> { + // Unstable method according to documentation. + self.crdt_reg.merkle_reg() + } + fn new( initial_value: Option, name: XorName, diff --git a/autonomi/src/lib.rs b/autonomi/src/lib.rs index 38459bf4c3..94f1f0181e 100644 --- a/autonomi/src/lib.rs +++ b/autonomi/src/lib.rs @@ -53,6 +53,8 @@ pub use utils::receipt_from_quotes_and_payments; #[doc(no_inline)] // Place this under 'Re-exports' in the docs. pub use bytes::Bytes; #[doc(no_inline)] // Place this under 'Re-exports' in the docs. +pub use crdts::merkle_reg::MerkleReg; +#[doc(no_inline)] // Place this under 'Re-exports' in the docs. pub use libp2p::Multiaddr; pub use client::Client;