Skip to content

Commit

Permalink
Add Default Prefix to New Fee Estimation Constant Names
Browse files Browse the repository at this point in the history
  • Loading branch information
tholonious committed Apr 22, 2024
1 parent 6a5aca6 commit 79547eb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
32 changes: 16 additions & 16 deletions lib/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -5014,10 +5014,10 @@ func (bc *Blockchain) CreateMaxSpend(
txn,
minFeeRateNanosPerKB,
// TODO: Make these flags or GlobalParams
bc.params.MempoolCongestionFactorBasisPoints,
bc.params.MempoolPriorityPercentileBasisPoints,
bc.params.PastBlocksCongestionFactorBasisPoints,
bc.params.PastBlocksPriorityPercentileBasisPoints,
bc.params.DefaultMempoolCongestionFactorBasisPoints,
bc.params.DefaultMempoolPriorityPercentileBasisPoints,
bc.params.DefaultPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultPastBlocksPriorityPercentileBasisPoints,
maxBlockSizeBytes)
if err != nil {
return nil, 0, 0, 0, errors.Wrapf(err, "CreateMaxSpend: Problem estimating fee: ")
Expand Down Expand Up @@ -5157,10 +5157,10 @@ func (bc *Blockchain) AddInputsAndChangeToTransactionWithSubsidy(
txArg,
minFeeRateNanosPerKB,
// TODO: Make these flags or GlobalParams
bc.params.MempoolCongestionFactorBasisPoints,
bc.params.MempoolPriorityPercentileBasisPoints,
bc.params.PastBlocksCongestionFactorBasisPoints,
bc.params.PastBlocksPriorityPercentileBasisPoints,
bc.params.DefaultMempoolCongestionFactorBasisPoints,
bc.params.DefaultMempoolPriorityPercentileBasisPoints,
bc.params.DefaultPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultPastBlocksPriorityPercentileBasisPoints,
maxBlockSizeBytes)
UpdateTxnFee(txArg, newTxFee)
if err != nil {
Expand Down Expand Up @@ -5879,10 +5879,10 @@ func (bc *Blockchain) CreateAtomicTxnsWrapper(
// TODO: Allow the caller to specify minFeeRateNanosPerKB
0,
// TODO: Make these flags or GlobalParams
bc.params.MempoolCongestionFactorBasisPoints,
bc.params.MempoolPriorityPercentileBasisPoints,
bc.params.PastBlocksCongestionFactorBasisPoints,
bc.params.PastBlocksPriorityPercentileBasisPoints,
bc.params.DefaultMempoolCongestionFactorBasisPoints,
bc.params.DefaultMempoolPriorityPercentileBasisPoints,
bc.params.DefaultPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultPastBlocksPriorityPercentileBasisPoints,
maxBlockSizeBytes)
if err != nil {
return nil, 0, errors.Wrapf(err, "CreateAtomicTxnsWrapper: failed to recompute fee estimate")
Expand Down Expand Up @@ -5972,10 +5972,10 @@ func (bc *Blockchain) CreateAtomicTxnsWrapper(
atomicTxn,
0,
// TODO: Make these flags or GlobalParams
bc.params.MempoolCongestionFactorBasisPoints,
bc.params.MempoolPriorityPercentileBasisPoints,
bc.params.PastBlocksCongestionFactorBasisPoints,
bc.params.PastBlocksPriorityPercentileBasisPoints,
bc.params.DefaultMempoolCongestionFactorBasisPoints,
bc.params.DefaultMempoolPriorityPercentileBasisPoints,
bc.params.DefaultPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultPastBlocksPriorityPercentileBasisPoints,
maxBlockSizeBytes)
if err != nil {
return nil, 0, errors.Wrapf(err, "CreateAtomicTxnsWrapper: failed to compute "+
Expand Down
34 changes: 20 additions & 14 deletions lib/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,18 @@ type DeSoParams struct {
// this setting.
DefaultMempoolFeeEstimatorNumPastBlocks uint64

// DefaultMempoolCongestionFactorBasisPoints and DefaultPastBlocksCongestionFactorBasisPoints are the default values
// for GlobalParams.MempoolCongestionFactorBasisPoints and GlobalParams.DefaultPastBlocksCongestionFactorBasisPoints.
/// See comments in GlobalParamsEntry for a description of their usage.
DefaultMempoolCongestionFactorBasisPoints uint64
DefaultPastBlocksCongestionFactorBasisPoints uint64

// DefaultMempoolPriorityPercentileBasisPoints and DefaultPastBlocksPriorityPercentileBasisPoints are the default values
// for GlobalParams.DefaultMempoolPriorityPercentileBasisPoints and GlobalParams.DefaultPastBlocksPriorityPercentileBasisPoints.
// See comments in GlobalParamsEntry for a description of their usage.
DefaultMempoolPriorityPercentileBasisPoints uint64
DefaultPastBlocksPriorityPercentileBasisPoints uint64

// DefaultMaxBlockSizeBytesPoS is the default value for GlobalParamsEntry.MaxBlockSizeBytesPoS.
// This is the initial value for the maximum block size in bytes that we allow for PoS blocks.
DefaultMaxBlockSizeBytesPoS uint64
Expand Down Expand Up @@ -823,12 +835,6 @@ type DeSoParams struct {

ForkHeights ForkHeights

// See comment on the DeSoMainnetParams settings of these values
MempoolCongestionFactorBasisPoints uint64
MempoolPriorityPercentileBasisPoints uint64
PastBlocksCongestionFactorBasisPoints uint64
PastBlocksPriorityPercentileBasisPoints uint64

EncoderMigrationHeights *EncoderMigrationHeights
EncoderMigrationHeightsList []*MigrationHeight
}
Expand Down Expand Up @@ -1362,8 +1368,8 @@ var DeSoMainnetParams = DeSoParams{
// Using the 90th percentile allows the fee market to be aggressive, but it's better than using
// 100% because that can have some rounding issues. For example, if you use 100% and blocks are
// 99% full, the fee market won't adapt. So it's better to have a little slack.
MempoolCongestionFactorBasisPoints: uint64(9000),
PastBlocksCongestionFactorBasisPoints: uint64(9000),
DefaultMempoolCongestionFactorBasisPoints: uint64(9000),
DefaultPastBlocksCongestionFactorBasisPoints: uint64(9000),
// The priority percentile determines what benchmark we use to increase the fee we're paying. For
// past blocks, we set a percentile of 90%, which means we'll take the fee paid by the 90th percentile
// txn in the past N blocks and increase it by one fee bucket. This works nicely with N=50 blocks
Expand All @@ -1372,8 +1378,8 @@ var DeSoMainnetParams = DeSoParams{
// the highest 1 block's worth of txns in the mempool. We use a lower percentile here because the mempool
// has a much tighter window of a single block, and so by outbidding *anybody* in that block, you're
// already highly likely to get in.
MempoolPriorityPercentileBasisPoints: uint64(1000),
PastBlocksPriorityPercentileBasisPoints: uint64(9000),
DefaultMempoolPriorityPercentileBasisPoints: uint64(1000),
DefaultPastBlocksPriorityPercentileBasisPoints: uint64(9000),

ForkHeights: MainnetForkHeights,
EncoderMigrationHeights: GetEncoderMigrationHeights(&MainnetForkHeights),
Expand Down Expand Up @@ -1684,10 +1690,10 @@ var DeSoTestnetParams = DeSoParams{
DisableNetworkManagerRoutines: false,

// See comment on DeSoMainnetParams
MempoolCongestionFactorBasisPoints: uint64(9000),
PastBlocksCongestionFactorBasisPoints: uint64(9000),
MempoolPriorityPercentileBasisPoints: uint64(1000),
PastBlocksPriorityPercentileBasisPoints: uint64(9000),
DefaultMempoolCongestionFactorBasisPoints: uint64(9000),
DefaultPastBlocksCongestionFactorBasisPoints: uint64(9000),
DefaultMempoolPriorityPercentileBasisPoints: uint64(1000),
DefaultPastBlocksPriorityPercentileBasisPoints: uint64(9000),

ForkHeights: TestnetForkHeights,
EncoderMigrationHeights: GetEncoderMigrationHeights(&TestnetForkHeights),
Expand Down

0 comments on commit 79547eb

Please sign in to comment.