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

bug: registers API only updates the MerkleReg on register_get() #2443

Open
happybeing opened this issue Nov 14, 2024 · 3 comments
Open

bug: registers API only updates the MerkleReg on register_get() #2443

happybeing opened this issue Nov 14, 2024 · 3 comments

Comments

@happybeing
Copy link
Contributor

happybeing commented Nov 14, 2024

cc @b-zee
I've adapted my client code to use the updated client registers API (autonomi v0.2.2).

To do so I have made a minor tweak to the API to access the merkle register by adding the method inner_merkle_reg(), which is also scheduled for inclusion in the API here: #2426).

Access to the merkle register is necessary for access the full history but this appears not to being updated by APIs other than register_get() which is unexpected behaviour.

This may be by design, in which case a comment on the API inner_merkle_reg() should be added.

Alternatively perhaps the merkle register should be updated when accessed (or when register_update() is called).

@b-zee
Copy link
Contributor

b-zee commented Nov 18, 2024

this appears not to being updated by APIs other than register_get() which is unexpected behaviour.

From a Rust point of view, this is quite expected actually. The register has no shared ownership (no Arc/Mutex). It's like reading a file into a string, then updating the file, but the string that you just read is the same. However, I understand this isn't ideal as calling register_get is a very crude way to get the updated history.

@happybeing
Copy link
Contributor Author

I think it's 'unexpected' from the point of view of ordinary level devs (like me) using the API. Though if you start delving into the MReg this will be just one of many dragons! Still good to find a way to make it easier if we can, even if just documenting the behaviour.

@happybeing
Copy link
Contributor Author

A further thought is that it might be useful to have (or bring back) register_sync() so that you can know your register has been put, merged and has the most recent state.

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

No branches or pull requests

2 participants