forked from kaspanet/rusty-kaspa
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
O(k log n) mempool transaction sampler + Fee estimation API (kaspanet…
…#513) * initial fee estimation logic + a python notebook detailing a challenge * initial usage of btreeset for ready transactions * initial frontier + sampling logic * mempool sampling benchmark (wip) * Use arc tx rather than tx id in order to save the indirect map access as well as reduce frontier sizes + filter all the top bucket and not only selected ones * Modify mempool bmk and simnet settings * Temp: rpc message initial * Move sample to rand utils * Fix top bucket sampling to match analysis * Add outliers to the bmk * sample comments and doc * use b plus tree with argument customization in order to implement a highly-efficient O(k log n) one-shot mempool sampling * todo * keep a computed weight field * Test feerate weight queries + an implied fix (change <= to <) * temp remove warns * 1. use inner BPlusTree in order to allow access to iterator as double ended 2. reduce collisions by removing the top element from the range if it was hit * rename * test btree rev iter * clamp the query to the bounds (logically) * use a larger tree for tests, add checks for clamped search bounds * Add benchmarks for frontier insertions and removals * add item removal to the queries test * Important numeric stability improvement: use the visitor api to implement a prefix weight counter to be used for search narrowing * test highly irregular sampling * Implement initial selectors + order the code a bit * Enhance and use the new selectors * rename * minor refactor * minor optimizations etc * increase default devnet prealloc amount to 100 tkas * cleanup * cleanup * initial build_feerate_estimator * todos * minor * Remove obsolete constant * Restructure search tree methods into an encapsulated struct * Rename module * documentation and comments * optimization: cmp with cached weight rather than compute feerate * minor * Finalize build fee estimator and add tests * updated notebook * fee estimator todos * expose get_realtime_feerate_estimations from the mining manager * min feerate from config * sample_inplace doc * test_total_mass_tracking * test prefix weights * test sequence selector * fix rpc feerate structs + comment * utils: expiring cache * rpc core fee estimate call * fee estimate verbose * grpc fee estimate calls * Benchmark worst-case collision cases + an optimization addressing these cases * Expose SearchTree * cli support (with @coderofstuff) * addressing a few minor review comments * feerate estimator - handle various edge cases (with @tiram88) * one more test (with @tiram88) * build_feerate_estimator - fix edge case of not trying the estimator without all frontier txs (+loop logic is more streamlined now) * monitor feerate estimations (debug print every 10 secs) * follow rpc naming conventions * proto leave blank index range * insert in correct abc location (keeping rest of the array as is for easier omega merge) * fix comment to reflect the most updated final algo * document feerate * update notebook * add an additional point to normal feerate buckets (between normal and low) * enum order * with 1 sec there are rare cases where mempool size does not change and we exit early * final stuff
- Loading branch information
1 parent
6bf1c75
commit 958bc64
Showing
55 changed files
with
2,826 additions
and
143 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
/// Policy houses the policy (configuration parameters) which is used to control | ||
/// the generation of block templates. See the documentation for | ||
/// NewBlockTemplate for more details on each of these parameters are used. | ||
/// NewBlockTemplate for more details on how each of these parameters are used. | ||
#[derive(Clone)] | ||
pub(crate) struct Policy { | ||
pub struct Policy { | ||
/// max_block_mass is the maximum block mass to be used when generating a block template. | ||
pub(crate) max_block_mass: u64, | ||
} | ||
|
||
impl Policy { | ||
pub(crate) fn new(max_block_mass: u64) -> Self { | ||
pub fn new(max_block_mass: u64) -> Self { | ||
Self { max_block_mass } | ||
} | ||
} |
Oops, something went wrong.