Generalize cost function from payjoin-specific to conceptual terms#7
Merged
arminsabouri merged 1 commit intopayjoin:masterfrom Mar 5, 2026
Merged
Conversation
e76e9c0 to
efc1b9e
Compare
arminsabouri
requested changes
Mar 2, 2026
src/actions.rs
Outdated
|
|
||
| impl PaymentObligationHandledOutcome { | ||
| fn score(&self, payment_obligation_utility_factor: f64) -> ActionScore { | ||
| fn score(&self, weights: &CompositeScorer) -> ActionScore { |
Collaborator
There was a problem hiding this comment.
This is a regression. I would prefer a specific weight vs the CompositeScorer. This way you know exactly what weights influnce a particular score from just the function signature.
src/actions.rs
Outdated
Comment on lines
+151
to
+152
| let fee_benefit = self.fee_savings.to_float_in(bitcoin::Denomination::Satoshi) | ||
| * weights.fee_savings_weight; |
Collaborator
There was a problem hiding this comment.
This will currently be 0, correct? If so maybe we comment it out and leave a TODO
0ccc110 to
79b1051
Compare
Collaborator
|
Heads up lint and test failing |
Contributor
Author
|
oh shoot thought i fix that, doing it right away |
This removes scaffolding code and makes the cost function applicable to any privacy-enhancing or interactive protocol, not just payjoins. Decompose CompositeScorer into per-dimension weights Replace coarse per-action-type utility factors with independent per-dimension weights across all outcome scoring. All score() methods now accept &CompositeScorer directly instead of a single opaque f64, allowing each outcome to apply only the weights relevant to its dimensions. fix format errors Fix missed ScorerConfig field renames in lib.rs test fixtures pass specific weights to score() not CompositeScorer
79b1051 to
8346c21
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cost function coefficients were scaffolding that unnecessarily coupled decision-making to specific payjoin implementations. This refactors them to model fundamental user preferences that apply broadly, this makes the cost function reusable for any privacy or coordination protocol.