Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Default Prefix to New Fee Estimation Constant Names #1256

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.DefaultMempoolPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints,
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.DefaultMempoolPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints,
maxBlockSizeBytes)
UpdateTxnFee(txArg, newTxFee)
if err != nil {
Expand Down Expand Up @@ -5879,10 +5879,10 @@ func (bc *Blockchain) CreateAtomicTxnsWrapper(
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.DefaultMempoolPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints,
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.DefaultMempoolPastBlocksCongestionFactorBasisPoints,
bc.params.DefaultMempoolPastBlocksPriorityPercentileBasisPoints,
maxBlockSizeBytes)
if err != nil {
return nil, 0, errors.Wrapf(err, "CreateAtomicTxnsWrapper: failed to compute "+
Expand Down
36 changes: 21 additions & 15 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 DefaultMempoolPastBlocksCongestionFactorBasisPoints are the default values
// for GlobalParams.MempoolCongestionFactorBasisPoints and GlobalParams.DefaultMempoolPastBlocksCongestionFactorBasisPoints.
/// See comments in DeSoMainnetParams for a description of their usage.
DefaultMempoolCongestionFactorBasisPoints uint64
DefaultMempoolPastBlocksCongestionFactorBasisPoints uint64

// DefaultMempoolPriorityPercentileBasisPoints and DefaultMempoolPastBlocksPriorityPercentileBasisPoints are the default values
// for GlobalParams.DefaultMempoolPriorityPercentileBasisPoints and GlobalParams.DefaultMempoolPastBlocksPriorityPercentileBasisPoints.
// See comments in DeSoMainnetParams for a description of their usage.
DefaultMempoolPriorityPercentileBasisPoints uint64
DefaultMempoolPastBlocksPriorityPercentileBasisPoints 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 @@ -1353,7 +1359,7 @@ var DeSoMainnetParams = DeSoParams{

// The congestion factor determines when we will start to increase or decrease fees.
// We set the congestion factor to 90% for past blocks and mempool. This makes it so that we will
// start to increase fees when the past N blocks (DefaultMempoolFeeEstimatorNumPastBlocks) are
// start to increase fees when the past N blocks (DefaultMempoolPastBlocksCongestionFactorBasisPoints) are
tholonious marked this conversation as resolved.
Show resolved Hide resolved
// 90% full on average or the mempool has 90% of 1 block's worth of txns in it (actually 90% of
// DefaultMempoolFeeEstimatorNumMempoolBlocks). This is good because it ensures that the typical
// fee estimate we give will be highly likely to get one's transaction included in the next block
Expand All @@ -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),
DefaultMempoolPastBlocksCongestionFactorBasisPoints: 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),
DefaultMempoolPastBlocksPriorityPercentileBasisPoints: 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),
DefaultMempoolPastBlocksCongestionFactorBasisPoints: uint64(9000),
DefaultMempoolPriorityPercentileBasisPoints: uint64(1000),
DefaultMempoolPastBlocksPriorityPercentileBasisPoints: uint64(9000),

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