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

Adjust transaction retry from timestamp calculation #1044

Merged
merged 4 commits into from
Jan 3, 2025

Conversation

dhedey
Copy link
Contributor

@dhedey dhedey commented Dec 28, 2024

Summary

  • Adjusts the logic for calculation of how long to wait before allowing a recalculation of a transaction which wants to be in the mempool (or is already in the mempool, but got kicked out).
  • Refactors the mempool and cached to ensure we evict from mempool on re-evaluation

Testing

Test was added; related code was also refactored.

@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2024

Codecov Report

Attention: Patch coverage is 41.49660% with 172 lines in your changes missing coverage. Please review.

Project coverage is 42.5%. Comparing base (3eb74c0) to head (ef6d856).
Report is 3 commits behind head on release/cuttlefish.

Files with missing lines Patch % Lines
...-rust/state-manager/src/mempool/mempool_manager.rs 9.3% 107 Missing ⚠️
...er/src/mempool/pending_transaction_result_cache.rs 62.1% 56 Missing ⚠️
...e-rust/state-manager/src/transaction/validation.rs 0.0% 3 Missing ⚠️
core-rust/state-manager/src/state_manager.rs 77.7% 2 Missing ⚠️
...-rust/state-manager/src/transaction/preparation.rs 85.7% 2 Missing ⚠️
...-server/src/core_api/handlers/transaction_parse.rs 0.0% 1 Missing ⚠️
core-rust/state-manager/src/jni/mempool.rs 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                  @@
##             release/cuttlefish   #1044   +/-   ##
====================================================
  Coverage                  42.4%   42.5%           
- Complexity                 4624    4627    +3     
====================================================
  Files                      1782    1782           
  Lines                     55167   55175    +8     
  Branches                   1524    1524           
====================================================
+ Hits                      23406   23450   +44     
+ Misses                    31282   31248   -34     
+ Partials                    479     477    -2     
Flag Coverage Δ
rust 42.5% <41.4%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...-server/src/core_api/handlers/transaction_parse.rs 0.0% <0.0%> (ø)
core-rust/state-manager/src/jni/mempool.rs 0.0% <0.0%> (ø)
core-rust/state-manager/src/state_manager.rs 86.3% <77.7%> (-0.7%) ⬇️
...-rust/state-manager/src/transaction/preparation.rs 71.0% <85.7%> (+0.1%) ⬆️
...e-rust/state-manager/src/transaction/validation.rs 13.1% <0.0%> (+2.9%) ⬆️
...er/src/mempool/pending_transaction_result_cache.rs 71.3% <62.1%> (-0.8%) ⬇️
...-rust/state-manager/src/mempool/mempool_manager.rs 12.4% <9.3%> (-4.3%) ⬇️

... and 3 files with indirect coverage changes

Copy link

github-actions bot commented Dec 28, 2024

Docker tags
docker.io/radixdlt/private-babylon-node:pr-1044
docker.io/radixdlt/private-babylon-node:b805b3b1fd
docker.io/radixdlt/private-babylon-node:sha-b805b3b

multiplier_range: core::ops::Range<f32>,
) -> Self {
Self::calculated_or_never(|| {
let multiplier: f32 = 2.0_f32.powf(exponent).clamp(multiplier_range.start, multiplier_range.end);
Copy link
Member

Choose a reason for hiding this comment

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

maybe better to clamp exponent instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Out of interest, why do you think it would be better?

I actually originally had a clamp of the exponent, but I changed to clamping the multiplier as it felt more declarative / easier to understand; but maybe that assumption is wrong! I'm happy to change back though if you prefer?

For what it's worth, (2^100) = +Inf, which clamps to multiplier_range.end - will add some unit tests for this though.

@dhedey dhedey merged commit 46be634 into release/cuttlefish Jan 3, 2025
23 checks passed
@dhedey dhedey deleted the fix/retry-calculation branch January 3, 2025 10:04
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.

3 participants