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 finalization after conclude dispute against candidate #1809

Merged
merged 28 commits into from
Sep 29, 2023
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1acaf27
fix: finalization after conclusion against candidate
xDimon Sep 18, 2023
247adc4
fix: processing of active leaves update
xDimon Sep 18, 2023
01bdcd0
fix: review issue
xDimon Sep 19, 2023
2646c54
refactor: remove unused member of block executor
xDimon Sep 19, 2023
6eff1cf
feature: marking block as reverted
xDimon Sep 19, 2023
939ea85
refactor: TreeNode ctor and use getBlockInfo
xDimon Sep 19, 2023
b31df3a
refactor: rename best *leaf* to best *block*
xDimon Sep 19, 2023
6e79e90
feature: method for force refresh best block
xDimon Sep 19, 2023
435ae2c
feature: force refresh best block if needed after some block reversion
xDimon Sep 19, 2023
a2a0d9f
refactor: BlockTree::getBestContaining for considering reverted block
xDimon Sep 19, 2023
1a1cb9d
refactor: BlockTree test
xDimon Sep 19, 2023
29697b6
fix: processing of on chain disputes
xDimon Sep 19, 2023
345bb1e
Merge branch 'master' into fix/finalization_after_dispute
xDimon Sep 21, 2023
c9d0458
tmp: STABLE
xDimon Sep 19, 2023
e29fd8c
refactor: use bestBlock() instead getBestChain() where it is possible
xDimon Sep 28, 2023
fdd9552
fix: misprint
xDimon Sep 28, 2023
7b34898
fix: review issues
xDimon Sep 28, 2023
028e03a
fix: review issue
xDimon Sep 28, 2023
5a65021
git: Merge branch 'master' into fix/finalization_after_dispute
xDimon Sep 28, 2023
751a5ce
hotfix
xDimon Sep 28, 2023
4604e74
hotfix
xDimon Sep 28, 2023
78f55df
Merge branch 'master' into fix/finalization_after_dispute
xDimon Sep 29, 2023
060dc1f
fix: review issues
xDimon Sep 29, 2023
bca2ca9
fix: review issues
xDimon Sep 29, 2023
6eaaad1
fix: review issue
xDimon Sep 29, 2023
98e6141
Revert "tmp: STABLE"
xDimon Sep 29, 2023
34eb716
git: Merge branch 'master' into fix/finalization_after_dispute
xDimon Sep 29, 2023
b4410b8
fix: for cxx20
xDimon Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: review issues
xDimon committed Sep 28, 2023

Verified

This commit was signed with the committer’s verified signature.
xDimon Dmitriy Khaustov
commit 7b34898e3b56d6be9f6835c6ad0dbbc921e03a1f
7 changes: 4 additions & 3 deletions core/blockchain/impl/block_tree_impl.cpp
Original file line number Diff line number Diff line change
@@ -1285,12 +1285,12 @@ namespace kagome::blockchain {
return BlockTreeError::BLOCK_ON_DEAD_END;
}

target = root.findByHash(root.block_hash);
return bestBlockNoLock(p);
}

auto metadata = p.tree_->getMetadata();

std::multiset<std::shared_ptr<TreeNode>> candidates{};
std::set<std::shared_ptr<TreeNode>> candidates;
for (auto &leaf : metadata.leaves) {
if (auto node = target->findByHash(leaf)) {
candidates.emplace(std::move(node));
@@ -1310,7 +1310,8 @@ namespace kagome::blockchain {
continue;
}

if (metadata.getWeight(best) < metadata.getWeight(tree_node)) {
if (metadata.getWeight(best) < metadata.getWeight(tree_node)
and hasDirectChainNoLock(p, target, tree_node)) {
best = tree_node;
}
}
2 changes: 1 addition & 1 deletion core/blockchain/impl/cached_tree.cpp
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ namespace kagome::blockchain {

void TreeMeta::forceRefreshBest() {
auto root = last_finalized.lock();
std::multiset<std::shared_ptr<TreeNode>> candidates{};
std::set<std::shared_ptr<TreeNode>> candidates;
for (auto &leaf : leaves) {
if (auto node = root->findByHash(leaf)) {
candidates.emplace(std::move(node));