From d77e31c966a8d301b36a68cbd0e7542c94d152c2 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Mon, 16 Dec 2024 16:49:10 +0100 Subject: [PATCH] refactor(autonomi): deprecate registers --- ant-cli/src/commands/register.rs | 2 ++ ant-node/tests/data_with_churn.rs | 3 +++ ant-node/tests/verify_data_location.rs | 3 +++ autonomi/README.md | 4 ++++ autonomi/src/client/registers.rs | 10 ++++++++++ autonomi/tests/register.rs | 1 + 6 files changed, 23 insertions(+) diff --git a/ant-cli/src/commands/register.rs b/ant-cli/src/commands/register.rs index 17c30b2559..5598fc0544 100644 --- a/ant-cli/src/commands/register.rs +++ b/ant-cli/src/commands/register.rs @@ -6,6 +6,8 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +#![allow(deprecated)] + use crate::utils::collect_upload_summary; use crate::wallet::load_wallet; use autonomi::client::registers::RegisterAddress; diff --git a/ant-node/tests/data_with_churn.rs b/ant-node/tests/data_with_churn.rs index 4112863140..87261779c4 100644 --- a/ant-node/tests/data_with_churn.rs +++ b/ant-node/tests/data_with_churn.rs @@ -6,6 +6,9 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +// TODO: Remove this once the registers are removed +#![expect(deprecated)] + mod common; use crate::common::{ diff --git a/ant-node/tests/verify_data_location.rs b/ant-node/tests/verify_data_location.rs index a15a0e18be..e8e2c6938a 100644 --- a/ant-node/tests/verify_data_location.rs +++ b/ant-node/tests/verify_data_location.rs @@ -6,7 +6,10 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +// TODO: Remove this once the registers are removed +#![expect(deprecated)] #![allow(clippy::mutable_key_type)] + mod common; use ant_logging::LogBuilder; diff --git a/autonomi/README.md b/autonomi/README.md index 63235554a1..8f8180e80e 100644 --- a/autonomi/README.md +++ b/autonomi/README.md @@ -51,6 +51,10 @@ let wallet = Wallet::new_from_private_key(EvmNetwork::ArbitrumSepolia, key)?; let wallet = Wallet::new_from_private_key(EvmNetwork::new_custom("", "", ""), key)?; ``` +# Registers + +Registers are deprecated and planned to be replaced by transactions and pointers. Currently, transactions can already be used. For example usage, see [the transaction test](tests/transaction.rs). Pointers are not yet implemented, but will follow soon. + ## Running tests To run the tests, we can run a local network: diff --git a/autonomi/src/client/registers.rs b/autonomi/src/client/registers.rs index d2ae5f203a..dc56e37b45 100644 --- a/autonomi/src/client/registers.rs +++ b/autonomi/src/client/registers.rs @@ -6,6 +6,8 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +#![allow(deprecated)] + use crate::client::data::PayError; use crate::client::Client; use crate::client::ClientEvent; @@ -53,6 +55,10 @@ pub enum RegisterError { PayeesMissing, } +#[deprecated( + since = "0.2.4", + note = "Use transactions instead (see Client::transaction_put)" +)] #[derive(Clone, Debug)] pub struct Register { signed_reg: SignedRegister, @@ -122,6 +128,10 @@ impl Register { } } +#[deprecated( + since = "0.2.4", + note = "Use transactions instead (see Client::transaction_put)" +)] impl Client { /// Generate a new register key pub fn register_generate_key() -> RegisterSecretKey { diff --git a/autonomi/tests/register.rs b/autonomi/tests/register.rs index e698809d46..862b4896e6 100644 --- a/autonomi/tests/register.rs +++ b/autonomi/tests/register.rs @@ -7,6 +7,7 @@ // permissions and limitations relating to use of the SAFE Network Software. #![cfg(feature = "registers")] +#![allow(deprecated)] use ant_logging::LogBuilder; use autonomi::Client;