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

Block header repo removed #2286

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ErakhtinB
Copy link
Contributor

Referenced issues

Closes #2255

Description of the Change

Possible Drawbacks

Checklist Before Opening a PR

Before you open a Pull Request (PR), please make sure you've completed the following steps and confirm by answering 'Yes' to each item:

  1. Code is formatted: Have you run your code through clang-format to ensure it adheres to the project's coding standards? [Yes|No]
  2. Code is documented: Have you added comments and documentation to your code according to the guidelines in the project's contributing guidelines? [Yes|No]
  3. Self-review: Have you reviewed your own code to ensure it is free of typos, syntax errors, logical errors, and unresolved TODOs or FIXME without linking to an issue? [Yes|No]
  4. Zombienet Tests: Have you ensured that the zombienet tests are passing? Zombienet is a network simulation and testing tool used in this project. It's important to ensure that these tests pass to maintain the stability and reliability of the project. [Yes|No]

@ErakhtinB ErakhtinB linked an issue Nov 21, 2024 that may be closed by this pull request
@ErakhtinB ErakhtinB requested review from Harrm and kamilsa November 21, 2024 14:58
@@ -60,7 +60,7 @@ namespace kagome::blockchain {
outcome::result<primitives::BlockHash> putBlockHeader(
const primitives::BlockHeader &header) override;

outcome::result<std::optional<primitives::BlockHeader>> getBlockHeader(
outcome::result<primitives::BlockHeader> getBlockHeader(
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be the other way around, BlockHeaderRepository should return an optional header. However, it's hard to refactor it now since it's used in a mighty lot of places. So here where it's already done correctly changing it to the worse BlockHeaderRepository interface is not supported by me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In many (if not all) cases nullopt result was considered as an error but processed outside. It's much more simple to return block_not_found error right from this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added tryGetBlockHeader to block_storage so as unit tests for both get and tryGet methods

@ErakhtinB ErakhtinB force-pushed the 2255-enhancement-refactor-block-tree-and-header-repo branch 3 times, most recently from f1d8bcd to ad8b83b Compare December 5, 2024 12:30
@ErakhtinB ErakhtinB force-pushed the 2255-enhancement-refactor-block-tree-and-header-repo branch from 18554b8 to 23eef0b Compare December 5, 2024 14:00
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.

[Enhancement]: Refactor block tree and header repo
3 participants