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

improve DBHash in preparation for iota2.0 #3255

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

dessaya
Copy link
Collaborator

@dessaya dessaya commented Feb 6, 2024

There are now 3 "db hash" variants to choose for a test:

  • VerifyDBHash works as before: calculates a hash of the low-level DB contents (including the whole trie, all states, blocks, etc).
  • VerifyStateHash calculates a hash of the whole chain state at the latest state index.
  • VerifyContractStateHash calculates a hash of the state of a single core contract, at the latest state index. An optional prefix can be supplied to verify just a subset of the keys in the state.

There is also a new DB_DUMP environment variable that can be used to store a hex dump of the DB contents, and later compute a diff between two different branches.

There are now 3 "db hash" variants to choose for a test:

* `VerifyDBHash` works as before: calculates a hash of the low-level DB
  contents (including the whole trie, all states, blocks, etc).
* `VerifyStateHash` calculates a hash of the whole chain state at the
  latest state index.
* `VerifyContractStateHash` calculates a hash of the state of a single
  core contract, at the latest state index. An optional prefix can be
  supplied to verify just a subset of the keys in the state.

There is also a new DB_DUMP environment variable that can be used to
store a hex dump of the DB contents, and later compute a diff between
two different branches.
chainIDs := lo.Keys(env.chains)
slices.SortFunc(chainIDs, func(a, b isc.ChainID) int { return bytes.Compare(a.Bytes(), b.Bytes()) })
for _, chID := range chainIDs {
chID := chID // prevent loop variable aliasing
Copy link
Contributor

Choose a reason for hiding this comment

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

when go 1.22? 🙏

@dessaya dessaya merged commit 2830b3c into iotaledger:develop Feb 6, 2024
5 checks passed
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