Skip to content

Conversation

@itsyaasir
Copy link

No description provided.

Copy link

@Maximkaaa Maximkaaa left a comment

Choose a reason for hiding this comment

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

I also think we need at least one test that will check that the calculated hash is what is expected.

}

/// Calculates POW hash based on the given trie state.
/// Calculates POW hash

Choose a reason for hiding this comment

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

please add some tests

Copy link

@Maximkaaa Maximkaaa left a comment

Choose a reason for hiding this comment

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

All looks fine. But I wonder, can we write a test to check the exact value of the hash. And have the same test in the EVM. To make sure that the calculation produces the same resullt in both code bases? Or is it impossible to mock exactly same state in both repos?

Copy link

@ufoscout ufoscout left a comment

Choose a reason for hiding this comment

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

Please fix the existing conflicts so we can proceed with the review

@itsyaasir itsyaasir requested a review from ufoscout February 20, 2025 08:20
Copy link

@ufoscout ufoscout left a comment

Choose a reason for hiding this comment

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

@itsyaasir everything looks but I would like to add a new test:

  • append to the blockchain a predetermined set of hardcoded blocks
  • calculate the state root and check it is the expected hardcoded one
  • calculate the pow and check it is the expected hardcoded one

A test with the same blocks and expected values should then be added to the evm-canister

Copy link

@ufoscout ufoscout left a comment

Choose a reason for hiding this comment

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

@itsyaasir Bitfinity tests are failing in CI

}

#[tokio::test]
async fn test_pow_hash_with_empty_execution() {
Copy link

Choose a reason for hiding this comment

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

all tests should be prefixed with bitfinity_

Copy link
Author

Choose a reason for hiding this comment

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

Missed this! Thanks

@itsyaasir itsyaasir marked this pull request as ready for review March 7, 2025 09:28
@itsyaasir itsyaasir requested a review from ufoscout March 7, 2025 09:28
@itsyaasir itsyaasir self-assigned this Mar 7, 2025
@ufoscout ufoscout merged commit 51d14c8 into maxim/block_validation Mar 7, 2025
3 of 37 checks passed
@ufoscout ufoscout deleted the feat/pow-hashing-validation branch March 7, 2025 09:37
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.

4 participants