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

Change 5 #5

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Change 5 #5

wants to merge 27 commits into from

Conversation

NeoZ666
Copy link
Owner

@NeoZ666 NeoZ666 commented Sep 20, 2024

No description provided.

delcin-raj and others added 27 commits February 29, 2024 21:56
Defining SelectionOutput type and some Error Variants
* Added FIFO

* Added changes to use value of the input as identifier for FIFO algorithm

* Added changes to use sort_by_key method and check for conditions including feerate and weight calculation

* Removed Partial Imp and added one test case for fifo

* Removed custom implementations of ordering

* Added FIFO

Merged with main according to updates

* Added changes to use sort_by_key method and check for conditions including feerate and weight calculation

* Removed Partial Imp and added one test case for fifo

* Removed custom implementations of ordering

* Performed fmt checks

* Addressed issues raised by clippy and checked fmt
* Single Random Draw rough implementation

* fmt changes

* Tests for SRD

* fmt changes

* Clippy suggestions

* check for not empty

* Spelling corrections and merge from upstream/main
* bnp function declaration

* Clippy suggestion
* inputs type is changed to &[OutputGroup]

Singalling the fact that selected_outputs should refer to indices of
the given inputs and that the order of the given inputs are not changed
with respect to the user.

* fmt fix
* Added FIFO

* Added changes to use value of the input as identifier for FIFO algorithm

* Added changes to use sort_by_key method and check for conditions including feerate and weight calculation

* Removed Partial Imp and added one test case for fifo

* Removed custom implementations of ordering

* Defining SelectionOutput type and some Error Variants

* Changing the comments according to new types

* Added FIFO

Merged with main according to updates

* Added changes to use sort_by_key method and check for conditions including feerate and weight calculation

* Removed Partial Imp and added one test case for fifo

* Removed custom implementations of ordering

* Performed fmt checks

* Addressed issues raised by clippy and checked fmt

* FIFO selection algorithm (Bitshala-Incubator#9)

* Added FIFO

* Added changes to use value of the input as identifier for FIFO algorithm

* Added changes to use sort_by_key method and check for conditions including feerate and weight calculation

* Removed Partial Imp and added one test case for fifo

* Removed custom implementations of ordering

* Added FIFO

Merged with main according to updates

* Added changes to use sort_by_key method and check for conditions including feerate and weight calculation

* Removed Partial Imp and added one test case for fifo

* Removed custom implementations of ordering

* Performed fmt checks

* Addressed issues raised by clippy and checked fmt

* Minor fmt edit

* Addressed issues causing test to fail

* Removed comments about using values/indexes in FIFO

* bnp function declaration (Bitshala-Incubator#13)

* bnp function declaration

* Clippy suggestion

* inputs type is changed to &[OutputGroup] (Bitshala-Incubator#14)

* inputs type is changed to &[OutputGroup]

Singalling the fact that selected_outputs should refer to indices of
the given inputs and that the order of the given inputs are not changed
with respect to the user.

* fmt fix

* Pulled changes from main and modified fifo accodingly

* Removed a redundant utility function. Substituted its function with the existing utility function

* Fmt fix

* removed redundat codes and replaced them with utility functions.

* Modified SelectionError msg to Insufficient funds

* Made changes w.r.t estimated_fees in accumulated_value conditionals.

* Removed unnecessary files committed earlier

* removed DS_Store and launch.json files

* signed commit

* Fresh commit after signing and rebasing

---------

Co-authored-by: delcin-raj <[email protected]>
Co-authored-by: Delcin Maria Koilraj <[email protected]>
* Lower largest selection algorithm

* Implement select_coin_lowestlarger function
* Add two test cases

* Fix for PR comments

* refactor: add target variable

* feat: effective_value function

* fix: use the effective_value to sort the inputs

* refactor: we always add at least one input

* refactor: if condition before loop

* refactor: add #[inline] macro to fn effective_value

* refactor: receive only the feerate, not the entire option

* refactor: check underflow in effective_value
* Added FIFO - rebased on 7 July 2024

* The following changes were made
- Added changes to use sort_by_key method
- check for conditions including feerate and weight calculation

* Removed Partial Imp and added test case for fifo

* Removed custom implementations of ordering

* Removed comments about using value/indexe in FIFO

* Pulled changes from main and modified fifo

* Removed a redundant utility function

* Fmt fix

* Replaced redundat codes with utility functions.

* Modified SelectionError msg to Insufficient funds

* Changed
estimated_fees in accumulated_value conditionals.

* Removing .DS_Store and .vscode

* First draft of knapsack algorithm

* replaced clone() with clone_from()

* Added test cases for knapsack

* replaced vec with hashsets inside knapsack function

* Modified code to use only index of outputgrpup vectors and not the elements themselves. Modified the HashSets to be of type usize.

* Implemented the following changes
    - renamed the variable j in for loop to pass
    - moved the initialization of ThreadRng object out of the for loop
    - removed the use of variable prob
    - effective value of an input will be accumulated rather than its actual value
    - added a condition to check if target is not reached and raise a NoSolutionFound error
    - removed the txt file
    - removed the test.rs file

* Removed unused variables initialized to store previous input values.

* Added the following changes
- removed the use target_reached flag
- updated the NoSolutionFound condition to check for best_set_value == u64::MAX
- Reframed kapsack test vectors according to core's vectors
- Added two test vectors of core

* Changed the following
- changed the variable 'u' to 'coin' for better readability
- changed the logic under the condition accumulated_value >= adjusted_target
- changed the name of the function knap_sack_calculate_accumulated_weight to calculate_accumulated_weight for better readability
- increased the weights of lower valued coins (2,1,5) CENTS in testvector 37.

* Added more test vectors for knapsack

* Following changes were made
- Refactored the code under knap_sack to avoid creating a tuple of index and coin
- Modified the test vector involving picking 16 CENTS worth of inputs
- Added more test vectors
- Added a function "add_to_output_group" to add inputs to an existing set of inputs.

* Made the folllowing changes
- added comments above WasteMetric struct
- refactored calculate_waste() function to implement the following implementation closely
https://bitcoin.stackexchange.com/questions/113622/what-does-waste-metric-mean-in-the-context-of-coin-selection

* Refactored the conditonals in calculate_waste()

* Contains the following changes:
- Refactored calculate_waste() to eliminate redundant conditional calls
- added two more test vectors
    - pick 1 CENT worth of inputs out of 0.1,0,2,0.3,0.4,0.5
    - pick 10 nos of 50,000 COINS inputs to make 500,000 COINS

* Following changes were made and test vecs added
1. Two new functions knapsack_setup_outputgroups and knapsack_setup_options are added to handle adition of inputs and options. These functions take into consideration the use of effective_value in knapsack.
2. In the knapsack algorithm, while removing the input that raised the selection above adjusted_target, the actual value of the input was used. It is now corrected to effective_value of the input.
3. Added test vectors to test selection with multiple inputs of the same value
4. Added test vectors to test the randomness of the algorithm's selection

* Replaced vec.get(0) with vec.first()

* Added test vector
- to check if the algorithm avoids creating small changes

* Rebased to address signed commit issues

* Fixed an fmt error
…or#33)

* feat: Implement coin selection using scoped threads

* Handle insufficient funds

* Fix clippy warnings

* Refactor result handling using match for better readability

* Fix fmt warnings

* Add knapsack algorithm

* Remove unnecessary variable
* feat: Implement coin selection using scoped threads (Bitshala-Incubator#33)

* feat: Implement coin selection using scoped threads

* Handle insufficient funds

* Fix clippy warnings

* Refactor result handling using match for better readability

* Fix fmt warnings

* Add knapsack algorithm

* Remove unnecessary variable

* linting and formatting

---------

Co-authored-by: BEULAHEVANJALIN <[email protected]>
…itshala-Incubator#47)

* Update FIFO selection to prioritize OutputGroups with None sequence

* Prioritize OutputGroups with sequence numbers

* Fix Clippy warning by using  instead of
…or#50)

* Update FIFO selection to prioritize OutputGroups with None sequence

* Prioritize OutputGroups with sequence numbers

* Fix Clippy warning by using  instead of

* Check inputs with creation_sequence are sorted
Signed-off-by: neoz666 <[email protected]>
Signed-off-by: neoz666 <[email protected]>
Signed-off-by: neoz666 <[email protected]>
Signed-off-by: neoz666 <[email protected]>
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.

7 participants