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 state fingerprint available #4188

Merged
merged 4 commits into from
Jul 3, 2023
Merged

Conversation

damip
Copy link
Member

@damip damip commented Jun 30, 2023

  • document all added functions
  • try in sandbox /simulation/labnet
  • unit tests on the added/changed features
    • make tests compile
    • make tests pass
  • add logs allowing easy debugging in case the changes caused problems
  • if the API has changed, update the API specification

@damip damip mentioned this pull request Jun 30, 2023
@damip damip changed the title add state fingerprint in api make state fingerprint available Jun 30, 2023
@Leo-Besancon
Copy link
Collaborator

Leo-Besancon commented Jun 30, 2023

The code looks pretty straightforward to me. However, we have to be careful about timings. Because we do not have a "final_state_hash" field on the final_state, two nodes may show a different fingerprint if atomicity is not verified during a slot.
I think it should not cause a problem in most cases, but it could.

For example: we edit the final_state_hash_snapshot of a cycle after finalizing a slot, which changes the hash.

We could solve this by restoring a final_state_hash field that syncs with the db hash while finalizing, or by querying the last available final_state_hash_snapshot in cycle history, or some other way I have not think about :)

@damip
Copy link
Member Author

damip commented Jul 2, 2023

@Leo-Besancon writes to the final state happen only under an execution write lock. And query_state read-locks it. So it should be ok. Do you confirm ?

@Leo-Besancon
Copy link
Collaborator

@Leo-Besancon writes to the final state happen only under an execution write lock. And query_state read-locks it. So it should be ok. Do you confirm ?

Yes it makes sence, as the versioning batches are also written on finalization now. Maybe we should add a comment in the fingerprint function that this is the expected behaviour for it to work (only one write, with a lock, per slot).

@damip damip merged commit c45a98b into testnet_24 Jul 3, 2023
@AurelienFT AurelienFT deleted the add_state_fingerprint_in_api branch October 23, 2023 08:48
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.

2 participants