Fix inconsistent BABE fork-choice by storing block weights in shared state#7550
Fix inconsistent BABE fork-choice by storing block weights in shared state#7550Nathy-bajo wants to merge 8 commits intoparitytech:masterfrom
Conversation
|
I'm not done with the implementation and I am yet to test it. |
|
Please review @bkchr |
bkchr
left a comment
There was a problem hiding this comment.
A good thing to start would be to try to write some unit test for the issue.
Yeah, I think I'm getting to understand the issue better now. |
d716ee9 to
e78de64
Compare
rockbmb
left a comment
There was a problem hiding this comment.
Could you add some test(s) that verify #6013 is now fixed?
I ran revert_prunes_epoch_changes_and_removes_weights against this PR's latest commit (e025b63) and it passes; however, running it against latest master also sees it pass, which means it wasn't catching #6013 regardless.
Ideally the test(s), when run against latest master, fails in a situation described in #6013, and passes against this PR's tip.
|
@rockbmb Done |
There was a problem hiding this comment.
@Nathy-bajo thanks; this change breaks some things, though; e.g. this refactor
polkadot-sdk/substrate/bin/node/cli/src/command.rs
Lines 225 to 228 in 0130e98
| "Shared storage and database should have same weight" | ||
| ); | ||
|
|
||
| // Now test that prune_finalized also removes from shared storage |
There was a problem hiding this comment.
@Nathy-bajo my comment here is still not done? Because you just say "test xy", but you don't test it? You just finalize, but have no idea if it gets pruned.
|
@bkchr All done. Please review |
bkchr
left a comment
There was a problem hiding this comment.
It isn't helping when you just ignore my comments. You still don't have a test for the original problematic behavior.
| "Shared storage and database should have same weight" | ||
| ); | ||
|
|
||
| // Now test that prune_finalized also removes from shared storage |
There was a problem hiding this comment.
@Nathy-bajo my comment here is still not done? Because you just say "test xy", but you don't test it? You just finalize, but have no idea if it gets pruned.
| // Wait a bit for the async finality notification to be processed | ||
| tokio::time::sleep(tokio::time::Duration::from_millis(100)).await; |
There was a problem hiding this comment.
This will for sure make this test flaky.
|
@bkchr I have removed the flaky tests and added tests for the original problematic behavior. |
Attempts to resolve #6013
Description
Introduced
SharedBlockWeightStorage- a thread-safe, in-memory cache for block weights that provides immediate visibility across all import operations.