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

fix(kura): correctly handle replace_top_block #4870

Merged
merged 4 commits into from
Aug 26, 2024

Conversation

Erigara
Copy link
Contributor

@Erigara Erigara commented Jul 22, 2024

Description

I've noticed multiple issues with kura which this PR is aimed to fix.

  1. Quick sequential call of replace_top_block and store_block cause kura to omit overwriting soft-fork block
    • this happened because kura checked latest_written_block hash against latest_block_hash which is not correct because between kura loop iteration more than one block could be added
  2. Call store_block before or just after start cause kura to incorrectly assume amount of already written blocks

Benefits

Fewer bugs.

How to test

To check this issues create_blocks test was added.

core/src/kura.rs Outdated Show resolved Hide resolved
core/Cargo.toml Outdated Show resolved Hide resolved
core/src/kura.rs Outdated Show resolved Hide resolved
DCNick3
DCNick3 previously approved these changes Aug 7, 2024
core/src/kura.rs Outdated Show resolved Hide resolved
core/src/kura.rs Show resolved Hide resolved
core/src/kura.rs Outdated Show resolved Hide resolved
DCNick3
DCNick3 previously approved these changes Aug 8, 2024
@Erigara
Copy link
Contributor Author

Erigara commented Aug 26, 2024

@mversic @DCNick3 updated, reapprove pls

Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
@nxsaken nxsaken merged commit 168b0b3 into hyperledger-iroha:main Aug 26, 2024
12 of 14 checks passed
mversic pushed a commit that referenced this pull request Aug 30, 2024
* test(kura): add test kura not miss replace top block call
* fix(kura): properly initialize kura
* fix(kura): correctly handle replace_top_block
* fix(kura): fix warnings inside kura
---------
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
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