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

Make last_sync a field in ClientInner #982

Merged
merged 4 commits into from
Aug 1, 2023
Merged

Make last_sync a field in ClientInner #982

merged 4 commits into from
Aug 1, 2023

Conversation

PhilippGackstatter
Copy link
Contributor

Description of change

When using a private tangle with HRP tst and multiple client instances in Wasm, the HRP that is returned from get_network_info is smr on any of the client instances but the first one that calls it.

The issue with the current approach for storing the last sync time is that it is a static. It is thus the same across different client instances. For instance, when instantiating client1 and client2 and running client1.get_network_info(), client1 will have the fetched protocol params from the node set. It will also update the last synced time to only fetch the params again 60s from now. However, client2 will not have the fetched protocol params set, but because the last synced time is shared with client1, it will also not fetch them on the first call to get_network_info. Thus client2 will return the default protocol parameters from the client, which is smr for the HRP.

This PR changes the last sync time from a static to a field in the client, fixing the issue.

Links to any relevant issues

n/a

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

Tested locally in concert with examples in identity where the issue occurred.

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

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.

Changelog

Thoralf-M
Thoralf-M previously approved these changes Aug 1, 2023
DaughterOfMars
DaughterOfMars previously approved these changes Aug 1, 2023
Copy link

@DaughterOfMars DaughterOfMars left a comment

Choose a reason for hiding this comment

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

We can actually remove the lazy_static dependency if we want to.

@PhilippGackstatter
Copy link
Contributor Author

If you could publish this as a new sdk-wasm version after its merged, that'd be great!

@thibault-martinez
Copy link
Member

thibault-martinez commented Aug 1, 2023

If you could publish this as a new sdk-wasm version after its merged, that'd be great!

Can you prepare a release for it in this PR then? As in, put an actual date + bump package.json

@thibault-martinez thibault-martinez merged commit 5787052 into iotaledger:develop Aug 1, 2023
22 checks passed
@kwek20 kwek20 mentioned this pull request Aug 1, 2023
@PhilippGackstatter PhilippGackstatter deleted the chore/fix-get-network-info branch May 6, 2024 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants