Skip to content

refactor: root chunk_id should be equal to app_hash#301

Merged
ogabrielides merged 6 commits into
developfrom
refactor/state_sync_adjustements
Jun 3, 2024
Merged

refactor: root chunk_id should be equal to app_hash#301
ogabrielides merged 6 commits into
developfrom
refactor/state_sync_adjustements

Conversation

@ogabrielides
Copy link
Copy Markdown
Contributor

@ogabrielides ogabrielides commented Jun 3, 2024

Issue being fixed or feature implemented

What was done?

  • Root chunk id is expected to be equal to app_hash instead of null_hash (This facilitates Tenderdash in state sync init phase)
  • Changed API of appy_chunk to accept separately parameters and not in tuple (better clarity)

How Has This Been Tested?

Updated tutorial replication

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@ogabrielides ogabrielides changed the title refactor: root chunk_id should be equal to app_hash refactor: root chunk_id should be equal to app_hash Jun 3, 2024
// Returns the StateSyncInfo transferring ownership back to the caller)
pub fn start_snapshot_syncing<'db>(
&'db self,
mut state_sync_info: MultiStateSyncInfo<'db>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

perhaps could be a &mut without that ownership return trick

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this PR doesn't contain changes of #300

Comment thread grovedb/src/replication.rs Outdated
Comment thread grovedb/src/replication.rs Outdated
Comment on lines +123 to +128
if global_chunk_id == app_hash {
let array_of_zeros: [u8; 32] = [0; 32];
let root_chunk_prefix_key: crate::SubtreePrefix = array_of_zeros;
return Ok((root_chunk_prefix_key, vec![]));
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In rust you shouldn't have special numbers, meaning that [0;32] shouldn't have a special signicance, instead you should use enums or Options

@ogabrielides ogabrielides merged commit 36f7468 into develop Jun 3, 2024
@ogabrielides ogabrielides deleted the refactor/state_sync_adjustements branch June 3, 2024 18:12
ogabrielides added a commit that referenced this pull request Jun 3, 2024
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.

3 participants