solana icon indicating copy to clipboard operation
solana copied to clipboard

Remove congestion multiplier from calculate_fee function

Open tao-stones opened this issue 1 year ago • 4 comments

Problem

bank.calculate_fee() takes a parameter with misleading name (lamports_per_signature) for testing congestion multiplier to be zero, which has been removed everywhere. That parameter should also be removed.

Due to legacy or perhaps misleading name of the parameter, call sites are calling extra code to resolve lamports_per_signature before calling calculate_fee(), in some instances, it locks hash_queue to do so. All of these are not necessary.

Summary of Changes

  • remove congestion_multiplier within calculate_fee()
  • remove lamports_per_signature input parameter of calculate_fee(), durable transaction also uses fee rate from time of execution.
  • remove code that fetches lamports_per_signature from nonce account leading to call of calculate_fee()

Fixes #

tao-stones avatar Dec 19 '23 23:12 tao-stones

I agree that this code is messy but I'm not sure that this is the right way to clean it up. I believe the reason that the lamports_per_signature is passed here is so that it can be overridden for durable nonce transactions. Maybe @t-nelson can add more context on what the latest discussion on durable nonce tx fees was?

jstarry avatar Jan 10 '24 00:01 jstarry

I agree that this code is messy but I'm not sure that this is the right way to clean it up. I believe the reason that the lamports_per_signature is passed here is so that it can be overridden for durable nonce transactions. Maybe @t-nelson can add more context on what the latest discussion on durable nonce tx fees was?

was this supposed to be a line comment? where's "here"?

t-nelson avatar Jan 10 '24 20:01 t-nelson

I agree that this code is messy but I'm not sure that this is the right way to clean it up. I believe the reason that the lamports_per_signature is passed here is so that it can be overridden for durable nonce transactions. Maybe @t-nelson can add more context on what the latest discussion on durable nonce tx fees was?

was this supposed to be a line comment? where's "here"?

"here" is calculate_fee().

It suppose to be an innocent PR to remove unused stuff 😇 But it revealed few issues. The first one is: have we been wrong in calculating nonce tx signature fee? line commente here.

tao-stones avatar Jan 10 '24 20:01 tao-stones

Convert this PR to Draft, going to break it into smaller and separated PRs:

  • just remove congestion_multiplier from fee calculation, and fix/harden all tests
  • new issue/PR to state durable transaction will be charged with current bank's fee rate, not by fee rate in nonce account, remove related code.

tao-stones avatar Jan 14 '24 00:01 tao-stones