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: don't unpin blocks that may show up again #1368

Merged
merged 23 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fc057b9
backend(fix): Early unpin for pruned blocks with no active `BlockRef`
lexnv Jan 15, 2024
bca0fe6
backend/tests: Check unpinning only after max_life time
lexnv Jan 16, 2024
8232d29
backend/tests: Remove unpinning when droped tests
lexnv Jan 16, 2024
2a5ac61
backend/tests: Ensure new blocks are not unpinned
lexnv Jan 16, 2024
a74fb4b
backend: Add only pruned blocks to unpin hashset and add a test
lexnv Jan 16, 2024
b4cc97e
backend: Introduce the `UnpinPolicy`
lexnv Jan 16, 2024
b2b9395
Update subxt/src/backend/unstable/follow_stream_unpin.rs
lexnv Jan 16, 2024
43f850d
backend: Fix clippy
lexnv Jan 16, 2024
867e80b
Only unpin blocks that have been pruned by the backend
jsdw Jan 16, 2024
23a2f09
Fix comments
jsdw Jan 16, 2024
ee47111
Mark initialized and finalized blocks as 'can_be_unpinned' too and tests
jsdw Jan 16, 2024
c79e6ca
fmt
jsdw Jan 16, 2024
00df0b9
tweak a couple more comments
jsdw Jan 16, 2024
9da0bb7
tidy tests and fix undeterministic check
jsdw Jan 16, 2024
b49fcfc
Fix wrong names in comments
jsdw Jan 16, 2024
cb4beaa
tweak another test to focus it a bit more
jsdw Jan 16, 2024
29ad17d
clippy
jsdw Jan 16, 2024
6967ae4
wee rename of args in a couple of test helpers
jsdw Jan 16, 2024
b29841f
add some logs and simplify submit_transaction in the same way Alex did
jsdw Jan 16, 2024
245865a
ditch logging again and keep to the experiment pr
jsdw Jan 16, 2024
8c36e94
cargo fmt
jsdw Jan 16, 2024
135f071
reduce CI timeouts to 30mins
jsdw Jan 16, 2024
4805b3c
Handle Init and Stop events in submit_transaction too, just in case
jsdw Jan 16, 2024
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
7 changes: 5 additions & 2 deletions subxt/src/backend/unstable/follow_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,13 @@ pub(super) mod test_utils {
}

/// A finalized event
pub fn ev_finalized(ns: impl IntoIterator<Item = u64>) -> FollowEvent<H256> {
pub fn ev_finalized(
ns: impl IntoIterator<Item = u64>,
pruned: impl IntoIterator<Item = u64>,
jsdw marked this conversation as resolved.
Show resolved Hide resolved
) -> FollowEvent<H256> {
FollowEvent::Finalized(Finalized {
finalized_block_hashes: ns.into_iter().map(H256::from_low_u64_le).collect(),
pruned_block_hashes: vec![],
pruned_block_hashes: pruned.into_iter().map(H256::from_low_u64_le).collect(),
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions subxt/src/backend/unstable/follow_stream_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ mod test {
Ok(ev_initialized(0)),
Ok(ev_new_block(0, 1)),
Ok(ev_best_block(1)),
Ok(ev_finalized([1])),
Ok(ev_finalized([1], [])),
Err(Error::Other("ended".to_owned())),
]
},
Expand Down Expand Up @@ -465,7 +465,7 @@ mod test {
Ok(ev_initialized(0)),
Ok(ev_new_block(0, 1)),
Ok(ev_best_block(1)),
Ok(ev_finalized([1])),
Ok(ev_finalized([1], [])),
Ok(ev_new_block(1, 2)),
Ok(ev_new_block(2, 3)),
Err(Error::Other("ended".to_owned())),
Expand Down Expand Up @@ -517,7 +517,7 @@ mod test {
Ok(ev_best_block(1)),
Ok(ev_new_block(1, 2)),
Ok(ev_new_block(2, 3)),
Ok(ev_finalized([1])),
Ok(ev_finalized([1], [])),
Err(Error::Other("ended".to_owned())),
]
},
Expand Down
Loading
Loading