From ca140b32cc5267e7de0c2b403c85a0cdf297bb4c Mon Sep 17 00:00:00 2001 From: Bing-Yang Lin Date: Fri, 1 Nov 2024 19:36:30 +0800 Subject: [PATCH 1/7] Add more comments for try_get_object_before_version --- crates/iota-json-rpc-api/src/read.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/iota-json-rpc-api/src/read.rs b/crates/iota-json-rpc-api/src/read.rs index 4798ae83f5d..253a856b3a6 100644 --- a/crates/iota-json-rpc-api/src/read.rs +++ b/crates/iota-json-rpc-api/src/read.rs @@ -88,6 +88,12 @@ pub trait ReadApi { /// version exists/existed. The result may vary across nodes depending /// on their pruning policies. Returns the latest object information /// with a version less than or equal to the given version + /// Note that this endpoint is used by sui replay tool. Also the + /// implementation in `iota-json-rpc` uses internally the + /// `AuthorityState::find_object_lt_or_eq_version` method, which has + /// underlying utility, (e.g., `RemoteFetcher::get_child_object` uses + /// `try_get_object_before_version` to get the object with the versions <= + /// the given version). Thus we keep this endpoint for now. #[method(name = "tryGetObjectBeforeVersion", deprecated = "true")] async fn try_get_object_before_version( &self, From 57a188bca2d86c3e47fe3f6a2ad88479d3d5320f Mon Sep 17 00:00:00 2001 From: Bing-Yang Lin Date: Fri, 1 Nov 2024 19:39:36 +0800 Subject: [PATCH 2/7] Remove unnecessary parenthesis --- crates/iota-json-rpc-api/src/read.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/iota-json-rpc-api/src/read.rs b/crates/iota-json-rpc-api/src/read.rs index 253a856b3a6..97adcdaaecf 100644 --- a/crates/iota-json-rpc-api/src/read.rs +++ b/crates/iota-json-rpc-api/src/read.rs @@ -91,9 +91,9 @@ pub trait ReadApi { /// Note that this endpoint is used by sui replay tool. Also the /// implementation in `iota-json-rpc` uses internally the /// `AuthorityState::find_object_lt_or_eq_version` method, which has - /// underlying utility, (e.g., `RemoteFetcher::get_child_object` uses + /// underlying utility, e.g., `RemoteFetcher::get_child_object` uses /// `try_get_object_before_version` to get the object with the versions <= - /// the given version). Thus we keep this endpoint for now. + /// the given version. Thus we keep this endpoint for now. #[method(name = "tryGetObjectBeforeVersion", deprecated = "true")] async fn try_get_object_before_version( &self, From 858f9e85834287fb893a642a6a5fca08bc4db574 Mon Sep 17 00:00:00 2001 From: Bing-Yang <51323441+bingyanglin@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:42:41 +0800 Subject: [PATCH 3/7] Update crates/iota-json-rpc-api/src/read.rs Co-authored-by: Thibault Martinez --- crates/iota-json-rpc-api/src/read.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-json-rpc-api/src/read.rs b/crates/iota-json-rpc-api/src/read.rs index 97adcdaaecf..dfa2ea1bed7 100644 --- a/crates/iota-json-rpc-api/src/read.rs +++ b/crates/iota-json-rpc-api/src/read.rs @@ -88,7 +88,7 @@ pub trait ReadApi { /// version exists/existed. The result may vary across nodes depending /// on their pruning policies. Returns the latest object information /// with a version less than or equal to the given version - /// Note that this endpoint is used by sui replay tool. Also the + /// Note that this endpoint is used by iota replay tool. Also the /// implementation in `iota-json-rpc` uses internally the /// `AuthorityState::find_object_lt_or_eq_version` method, which has /// underlying utility, e.g., `RemoteFetcher::get_child_object` uses From 6dd98c86ad95d49096da14c3fad0fb076742697d Mon Sep 17 00:00:00 2001 From: Bing-Yang Lin Date: Fri, 1 Nov 2024 20:15:39 +0800 Subject: [PATCH 4/7] Remove deprecated mark --- crates/iota-json-rpc-api/src/read.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-json-rpc-api/src/read.rs b/crates/iota-json-rpc-api/src/read.rs index dfa2ea1bed7..a75e6959747 100644 --- a/crates/iota-json-rpc-api/src/read.rs +++ b/crates/iota-json-rpc-api/src/read.rs @@ -94,7 +94,7 @@ pub trait ReadApi { /// underlying utility, e.g., `RemoteFetcher::get_child_object` uses /// `try_get_object_before_version` to get the object with the versions <= /// the given version. Thus we keep this endpoint for now. - #[method(name = "tryGetObjectBeforeVersion", deprecated = "true")] + #[method(name = "tryGetObjectBeforeVersion")] async fn try_get_object_before_version( &self, /// the ID of the queried object From e0c4ec4a55bdacddc8ea4af4937c30bacc549e7b Mon Sep 17 00:00:00 2001 From: Bing-Yang Lin Date: Fri, 1 Nov 2024 20:54:18 +0800 Subject: [PATCH 5/7] Use code comments --- crates/iota-json-rpc-api/src/read.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/iota-json-rpc-api/src/read.rs b/crates/iota-json-rpc-api/src/read.rs index a75e6959747..f63d241ce38 100644 --- a/crates/iota-json-rpc-api/src/read.rs +++ b/crates/iota-json-rpc-api/src/read.rs @@ -88,12 +88,12 @@ pub trait ReadApi { /// version exists/existed. The result may vary across nodes depending /// on their pruning policies. Returns the latest object information /// with a version less than or equal to the given version - /// Note that this endpoint is used by iota replay tool. Also the - /// implementation in `iota-json-rpc` uses internally the - /// `AuthorityState::find_object_lt_or_eq_version` method, which has - /// underlying utility, e.g., `RemoteFetcher::get_child_object` uses - /// `try_get_object_before_version` to get the object with the versions <= - /// the given version. Thus we keep this endpoint for now. + // Note that this endpoint is used by iota replay tool. Also the + // implementation in `iota-json-rpc` uses internally the + // `AuthorityState::find_object_lt_or_eq_version` method, which has + // underlying utility, e.g., `RemoteFetcher::get_child_object` uses + // `try_get_object_before_version` to get the object with the versions <= + // the given version. Thus we keep this endpoint for now. #[method(name = "tryGetObjectBeforeVersion")] async fn try_get_object_before_version( &self, From 5c480e47797204a1b6c84308199c9d9225ca4837 Mon Sep 17 00:00:00 2001 From: Bing-Yang Lin Date: Fri, 1 Nov 2024 22:11:36 +0800 Subject: [PATCH 6/7] Add the deprecated flag back --- crates/iota-json-rpc-api/src/read.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-json-rpc-api/src/read.rs b/crates/iota-json-rpc-api/src/read.rs index f63d241ce38..cc3829faf0f 100644 --- a/crates/iota-json-rpc-api/src/read.rs +++ b/crates/iota-json-rpc-api/src/read.rs @@ -94,7 +94,7 @@ pub trait ReadApi { // underlying utility, e.g., `RemoteFetcher::get_child_object` uses // `try_get_object_before_version` to get the object with the versions <= // the given version. Thus we keep this endpoint for now. - #[method(name = "tryGetObjectBeforeVersion")] + #[method(name = "tryGetObjectBeforeVersion", deprecated = "true")] async fn try_get_object_before_version( &self, /// the ID of the queried object From 8abb3b9605353f0cb50e3f54026f5d97959559b1 Mon Sep 17 00:00:00 2001 From: Bing-Yang Lin Date: Mon, 4 Nov 2024 18:57:51 +0800 Subject: [PATCH 7/7] Enhance the code comment --- crates/iota-json-rpc-api/src/read.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/iota-json-rpc-api/src/read.rs b/crates/iota-json-rpc-api/src/read.rs index cc3829faf0f..9a78978d672 100644 --- a/crates/iota-json-rpc-api/src/read.rs +++ b/crates/iota-json-rpc-api/src/read.rs @@ -93,7 +93,8 @@ pub trait ReadApi { // `AuthorityState::find_object_lt_or_eq_version` method, which has // underlying utility, e.g., `RemoteFetcher::get_child_object` uses // `try_get_object_before_version` to get the object with the versions <= - // the given version. Thus we keep this endpoint for now. + // the given version. We have the `deprecated` flag here to not expose it in + // the generated spec file, and it should be only for internal usage. #[method(name = "tryGetObjectBeforeVersion", deprecated = "true")] async fn try_get_object_before_version( &self,