Generalize cost function from payjoin-specific to conceptual terms#7
Open
0xZaddyy wants to merge 2 commits intopayjoin:masterfrom
Open
Generalize cost function from payjoin-specific to conceptual terms#70xZaddyy wants to merge 2 commits intopayjoin:masterfrom
0xZaddyy wants to merge 2 commits intopayjoin:masterfrom
Conversation
This removes scaffolding code and makes the cost function applicable to any privacy-enhancing or interactive protocol, not just payjoins.
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
e76e9c0 to
efc1b9e
Compare
arminsabouri
requested changes
Mar 2, 2026
|
|
||
| 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.
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
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.