Separate fee-calculation from SDK#2120
Conversation
|
An alternative, following @t-nelson's comment/idea, is that we could deprecate the entire FeeStructure in SDK, and move it into this new crate, leaving the |
|
Is |
We do not use nor is |
the tests uses that to set transaction fees to zero. So still need a version of "calculate zero fee for tests" |
That's |
right! sorry, i misread it. |
There was a problem hiding this comment.
Would like to sync up on lamports_per_signature == 0 case more, two versions of same-name-variable could have diff
values add confusion. One is from bank.fee_rate_governor (often as parameter to calculate_fee()), the other from bank.fee_structure (used in calculating signature fee).
| let fee = bank.fee_structure().calculate_fee( | ||
| let fee = solana_fee::calculate_fee( | ||
| message, | ||
| bank.get_lamports_per_signature(), |
There was a problem hiding this comment.
To keep inline with sdk version, the parameter should be bank.fee_structure().lamports_per_signature, which could be different from bank.get_lamports_per_signature() { bank.fee_rate_governor.lamports_per_signature }. iirc, fee_rate_governor's lamports_per_signature can change based on block utilization, but fee_structure's sig rate is static (need to verify it)
(also wondering how does this not break CI tests?)
There was a problem hiding this comment.
I don't think it actually changes, was just "future proofed" in order to allow it to change.
There was a problem hiding this comment.
but yeah I'll revert t using the fee_structure one; and will need some manual fix for all the tests that breaks.
LOL it's even worse, there's at least 3! Since we also have |
| serde = "1.0.112" # must match the serde_derive version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251 | ||
| serde_derive = "1.0.112" # must match the serde version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251 |
There was a problem hiding this comment.
CI yelled at me. I think because I edited file and we must have added formatting requirement since last edit 🤷♂️
Problem
FeeStructure'scalculate_feeandcalculate_fee_detailscannot be abstracted over traits if they live in SDK.runtimetosdkrecently, this was not an ideal move, and better if we just put it in a separate crate.Summary of Changes
Fixes #2116