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

incremental hash #4197

Merged
merged 16 commits into from
Jul 11, 2023
Merged

incremental hash #4197

merged 16 commits into from
Jul 11, 2023

Conversation

damip
Copy link
Member

@damip damip commented Jul 3, 2023

Todo

  • define the trail hash
  • take into account the trail hash in Execution outputs
  • use the trail hash for PRNG seeding in Execution
  • write the trail hash to the final state (compatible with bootstrap, included in XOF hash)
  • read the trail hash from the final state
  • initialize the trail hash in the final state to Hash::zero() on genesis

Checklist

  • 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 marked this pull request as draft July 3, 2023 13:56
@damip damip self-assigned this Jul 3, 2023
@AurelienFT AurelienFT changed the base branch from testnet_24 to testnet_25 July 4, 2023 08:32
Copy link
Contributor

@Leo-Besancon Leo-Besancon left a comment

Choose a reason for hiding this comment

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

Another thing to handle is the reset of the final state.
You should delete your prefix at two places:
FinalState::reset()
FinalState::new(), if the reset_final_state argument is set to true

You can call the .delete_prefix() function on the db to do that.

massa-final-state/src/final_state.rs Outdated Show resolved Hide resolved
massa-final-state/src/final_state.rs Outdated Show resolved Hide resolved
@damip
Copy link
Member Author

damip commented Jul 8, 2023

Another thing to handle is the reset of the final state. You should delete your prefix at two places: FinalState::reset() FinalState::new(), if the reset_final_state argument is set to true

You can call the .delete_prefix() function on the db to do that.

Improvement: remove the new(reset_final_state) and reset() concepts completely through #3728 => final_state is initialized from a db, and when re-attempting a bootstrap, the final_state object is just re-created.

@damip damip marked this pull request as ready for review July 11, 2023 09:43
@damip damip marked this pull request as draft July 11, 2023 09:51
@damip
Copy link
Member Author

damip commented Jul 11, 2023

@Leo-Besancon the bootstrap test fails. Any idea ?

@Leo-Besancon
Copy link
Contributor

Leo-Besancon commented Jul 11, 2023

@Leo-Besancon the bootstrap test fails. Any idea ?

I'd check if the helper function that inits the new hash key is called by the server. Otherwise, it's never created and the is_db_valid of the client fails.

Edit: it seems to be the case: 'Client's DB is not valid after bootstrap'!

@damip damip marked this pull request as ready for review July 11, 2023 13:56
@damip damip requested a review from Leo-Besancon July 11, 2023 13:56
Copy link
Contributor

@Leo-Besancon Leo-Besancon left a comment

Choose a reason for hiding this comment

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

Looks like everything is taken care of.
Sidenote: We must not forget to init the execution trail hash in the db if we want to convert from a previous version (e.g. if we want to keep the testnet24 db for testnet25, or when converting the buildnet ledger)

massa-final-state/src/final_state.rs Outdated Show resolved Hide resolved
massa-hash/src/hash.rs Show resolved Hide resolved
@damip
Copy link
Member Author

damip commented Jul 11, 2023

Looks like everything is taken care of. Sidenote: We must not forget to init the execution trail hash in the db if we want to convert from a previous version (e.g. if we want to keep the testnet24 db for testnet25, or when converting the buildnet ledger)

Yes but if we unify things as we expect to do, restarting from an existing state will preserve the previous hash which is good

@damip damip merged commit 232bdf7 into testnet_25 Jul 11, 2023
8 checks passed
@damip
Copy link
Member Author

damip commented Jul 11, 2023

thanks @Leo-Besancon for the review and corrections !

@AurelienFT AurelienFT deleted the incremental_hash branch October 23, 2023 08:49
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