-
Notifications
You must be signed in to change notification settings - Fork 12
Review Fee Calculation (Backport from Cardano-SL) #70
Review Fee Calculation (Backport from Cardano-SL) #70
Conversation
So, basically, by conflating a bit the selected entries and changes, a lot of things become easier. At the price of one thing: fairness. The previous code was splitting fee across change proportionally to inputs. So here, I just split the fee across all changes, regardless of the input. So everyone's got to pay the same part of for the transaction. One could see it as another type of fairness 🙃 ... But that's also a lot simpler to handle, because we can just manipulate all inputs and all changes directly and compute fee for those directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsafe usage of error
should be removed and replaced with the error mechanism in the CoinSelT
stack.
|
||
let neInps = case inps' of | ||
[] -> error "adjustForFees: empty list of inputs" | ||
i:is -> i :| is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoinSelT
has an error branch. We should be using that instead of error
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that here, those aren't error case we want to handle but actual invariant violation.
The kerbel uses this error "pattern" in multiple places to put light on invariant. This is not something we want to shove in our error type.
|
||
let neOuts = case outs' of | ||
[] -> error "adjustForFees: empty list of outputs" | ||
o:os -> o :| os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
dismissing remaining review comments: not sure if you're in Regensburg training or not? Plus. this is really just a backport from cardano-sl so I'd rather have no conceptual changes done within this PR; but rather in a second one as a follow-up.
Linked Issue
input-output-hk/cardano-sl/pull/3861
Acceptance criteria:
¯\_(ツ)_/¯
Comments
This is just a backport of the fix done in
cardano-sl/develop
andcardano-sl/release-2.0.0
until we get this submodules setup correctly done....Checklist