Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(iota-core): Add more comments for ReadApi::try_get_object_before_version #3844

Merged
merged 11 commits into from
Nov 4, 2024

Conversation

bingyanglin
Copy link
Contributor

@bingyanglin bingyanglin commented Nov 1, 2024

Description of change

  • Added more comments to explain why we still keep it.

Links to any relevant issues

Part of #2092

Type of change

  • Enhancement

How the change has been tested

Ran the local network with RUST_LOG=info cargo run --release --bin iota start --force-regenesis --with-faucet

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

@bingyanglin bingyanglin added the node Issues related to the Core Node team label Nov 1, 2024
@bingyanglin bingyanglin self-assigned this Nov 1, 2024
@bingyanglin bingyanglin requested review from a team as code owners November 1, 2024 08:52
@bingyanglin bingyanglin mentioned this pull request Nov 1, 2024
18 tasks
Copy link
Contributor

@kodemartin kodemartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please elaborate on why this is deprecated?

@bingyanglin
Copy link
Contributor Author

bingyanglin commented Nov 1, 2024

Could you please elaborate on why this is deprecated?

Yeah this is a good question.
From my side I saw there is a deprecated mark for try_get_object_before_version.

    #[method(name = "tryGetObjectBeforeVersion", deprecated = "true")]
    async fn try_get_object_before_version(

This was listed in #2092 and identified by @thibault-martinez, maybe Thibault can elaborate better?

@thibault-martinez
Copy link
Member

This was listed in #2092 and identified by @thibault-martinez, maybe Thibault can elaborate better?

I'm afraid I can't expand on the why... I just listed everything flagged as deprecated for further investigation.

@bingyanglin
Copy link
Contributor Author

bingyanglin commented Nov 1, 2024

@kodemartin @thibault-martinez

Based on the original SUI PR here for the deprecated mark, it says this is only used by sui replay tool. I think it might be fine to keep it for now.

Would like to know your opinions, thanks.

@kodemartin
Copy link
Contributor

Thanks for your answers @bingyanglin @thibault-martinez! I missed the deprecated flag.

I see that the implementation in iota-json-rpc uses internally the AuthorityState::find_object_lt_or_eq_version method that is delegated to

/// Return the object with version less then or eq to the provided seq
/// number. This is used by indexer to find the correct version of
/// dynamic field child object. We do not store the version of the child
/// object, but because of lamport timestamp, we know the child must
/// have version number less then or eq to the parent.
pub fn find_object_lt_or_eq_version(

Given that it seems to be some underlying utility, and that the calling method is not deprecated I agree with @bingyanglin that we should keep it as well.

@thibault-martinez
Copy link
Member

Given that it seems to be some underlying utility, and that the calling method is not deprecated I agree with @bingyanglin that we should keep it as well.

Definitely fine by me! Maybe I would transform this PR into leaving a small comment about why it's deprecated and kept, but it's also fine without.

@bingyanglin bingyanglin force-pushed the core-node/feat/remove-try-get-object-before-version branch from a069036 to ca140b3 Compare November 1, 2024 11:36
@bingyanglin
Copy link
Contributor Author

Given that it seems to be some underlying utility, and that the calling method is not deprecated I agree with @bingyanglin that we should keep it as well.

Definitely fine by me! Maybe I would transform this PR into leaving a small comment about why it's deprecated and kept, but it's also fine without.

Thanks @kodemartin and @thibault-martinez for the reply. I added more comments in ca140b3 and keep this endpoint.

@bingyanglin bingyanglin changed the title refactor(iota-core): Remove ReadApi::try_get_object_before_version refactor(iota-core): Add more comments for ReadApi::try_get_object_before_version Nov 1, 2024
@kodemartin
Copy link
Contributor

Why not remove the deprecated flag altogether? @bingyanglin @thibault-martinez

@bingyanglin
Copy link
Contributor Author

Why not remove the deprecated flag altogether? @bingyanglin @thibault-martinez

Agreed. Removed the flag at 6dd98c8.

Copy link
Contributor

@kodemartin kodemartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🌸

Copy link
Member

@thibault-martinez thibault-martinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was introduced as already deprecated to avoid people calling it directly, if we think that's not an issue then LGTM!

// 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")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the deprecated flag here.
As far as I understand, having the flag causes it to not be exposed in the generated spec file.
Since it should be only for internal usage, I guess the comment is enough to not remove the function, even though it is marked as deprecated (I guess they did it for the same reason as explained).

Copy link
Contributor Author

@bingyanglin bingyanglin Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the flag to make it clearer. Added the flag at 5c480e4.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also enhanced the comment at 8abb3b9.

@muXxer muXxer merged commit 02f1459 into develop Nov 4, 2024
38 of 40 checks passed
@muXxer muXxer deleted the core-node/feat/remove-try-get-object-before-version branch November 4, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node Issues related to the Core Node team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants