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

Fix for low fee 0.1DGB/KB #171

Merged
merged 3 commits into from
Feb 7, 2024
Merged

Fix for low fee 0.1DGB/KB #171

merged 3 commits into from
Feb 7, 2024

Conversation

ghost
Copy link

@ghost ghost commented Feb 4, 2024

issue #169 Minimum tx fee per kb and maxfee

Screenshot from 2024-02-04 20-30-17

Screenshot from 2024-02-04 20-31-04

https://github.com/DigiByte-Core/digibyte/releases/
Screenshot from 2024-02-04 20-49-40

After pr update:
Minimal fee: 0.1DGB/KB
Total maximum custom fee: 100 DGB/transaction ($0,74) Before: 1 DGB/transaction ($0,0074) - 2024-02-06

Jan added 2 commits February 4, 2024 20:36
Mintxfee default from 100000 to 10000000
maxtxfee from 1.000 to 10.000
@beggsdl
Copy link

beggsdl commented Feb 4, 2024

Thanks @Jongjan88. I will test this soon.

JaredTate
JaredTate previously approved these changes Feb 5, 2024
Copy link

@JaredTate JaredTate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Looks like same issue I had run into, but I only tested up to 50 inputs. When I did 60 inputs I was able to recreate the problem so we didn't fully fix it with #159. Looks like this does fix this. I just tested it with 50+ inputs. Client compiles & runs.

ycagel
ycagel previously approved these changes Feb 5, 2024
Copy link
Member

@ycagel ycagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cACK.

@ycagel
Copy link
Member

ycagel commented Feb 5, 2024

@beggsdl Were you able to test this?

@beggsdl
Copy link

beggsdl commented Feb 6, 2024

@beggsdl Were you able to test this?

I think there is still an issue. I will post some screenshots in a little bit.

Update maxtxfee default
Update maxtxfee warn
@ghost ghost dismissed stale reviews from ycagel and JaredTate via ec1c9f0 February 6, 2024 13:19
@ghost
Copy link
Author

ghost commented Feb 6, 2024

@beggsdl Were you able to test this?

I think there is still an issue. I will post some screenshots in a little bit.

Screenshot from 2024-02-06 15-03-47

Windows and Linux bins with the update of this pr are online.

@beggsdl
Copy link

beggsdl commented Feb 6, 2024

Here are testing results for the following:

  • min fee/kB must be >= 0.1: success
  • max tx fee must be <= 100: success

Test proof

Min fee/kB must be >= 0.1
Typed 0.01
image

When moving out of the field, it reset to 0.1 (SUCCESS)
image

Max TX fee must be <= 100
Sent 1 000 000 DGB with default fee of 0.1 DGB/kB (SUCCESS)
image

Sent 1 000 000 DGB with fee of 1.0 DGB/kB (SUCCESS)
image

Attempted to send 1 000 000 DGB with fee of 2.0 DGB/kB, but failed due to TX fee being too large. TX fee would have been 149.2 DGB. (SUCCESS)
image

@ghost
Copy link
Author

ghost commented Feb 6, 2024

Here are testing results for the following:

* min fee/kB must be >= 0.1:  success

* max tx fee must be <= 100:  success

Test proof

Min fee/kB must be >= 0.1 Typed 0.01 image

When moving out of the field, it reset to 0.1 image

Max TX fee must be <= 100 Sent 1 000 000 DGB with default fee of 0.1 DGB/kB image

Sent 1 000 000 DGB with fee of 1.0 DGB/kB image

Attempted to send 1 000 000 DGB with fee of 2.0 DGB/kB, but failed due to TX fee being too large. TX fee would have been 149.2 DGB. image


We cannot change the kB size. So if you have 75kb * 2dgb * 1.000.000 = 150dgb.
Then we need to change the 100 DGB/transaction limit. Don't think that is good.

You can easy send 75kb * 0.1dgb * 10.000.000 dgb = 75dgb

But i think with this kind of transactions use -maxtxfee ... if you wanna set a high fee.

@beggsdl
Copy link

beggsdl commented Feb 6, 2024

That test of 1 000 000 at 2.0/kB was just to verify that it would fail when the fee was over the max.

@ghost
Copy link
Author

ghost commented Feb 6, 2024

That test of 1 000 000 at 2.0/kB was just to verify that it would fail when the fee was over the max.

Sorry Tnx!!!!

Copy link
Member

@ycagel ycagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cACK. Glad to see the additional testing and update of this PR. Appreciate all the work. Will look to @JaredTate and @gto90 for their thoughts and review.

Copy link
Member

@gto90 gto90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@JaredTate
Copy link

This compiles & runs for me. My question is should this be even higher? If someone dedusts a few 1000 utxos, it could be a lot higher fee. We do not want to prevent that ability. What does everyone think?

If we look at BTC:
//! static const CAmount DEFAULT_TRANSACTION_MINFEE = 1000;
https://github.com/bitcoin/bitcoin/blob/7b397025133cbc4c37be6cabc9e55b4c9a38f8ee/src/wallet/wallet.h#L110-L111
//! constexpr CAmount DEFAULT_TRANSACTION_MAXFEE{COIN / 10};
https://github.com/bitcoin/bitcoin/blob/7b397025133cbc4c37be6cabc9e55b4c9a38f8ee/src/wallet/wallet.h#L137-L138

@beggsdl
Copy link

beggsdl commented Feb 7, 2024

This compiles & runs for me. My question is should this be even higher? If someone dedusts a few 1000 utxos, it could be a lot higher fee. We do not want to prevent that ability. What does everyone think?

My problem when testing was that I was running into “transaction too large” before I was hitting the max tx fee. I got this when I would try to send a couple million DGB, mostly from Coinbase TXs. Could dedusting run into the same thing and not often hit the max tx fee?

@JaredTate
Copy link

This compiles & runs for me. My question is should this be even higher? If someone dedusts a few 1000 utxos, it could be a lot higher fee. We do not want to prevent that ability. What does everyone think?

My problem when testing was that I was running into “transaction too large” before I was hitting the max tx fee. I got this when I would try to send a couple million DGB, mostly from Coinbase TXs. Could dedusting run into the same thing and not often hit the max tx fee?

You were probably hitting the max size limit for a transaction to be. That's probably our answer for how high fees should be. We should hit the “transaction too large” before the fee to high error. If that's the case now then we are probably good with this.

The max size of a TX to relay/mine and source of "Transaction too large" error is MAX_STANDARD_TX_WEIGHT found here:

/** The maximum weight for transactions we're willing to relay/mine */
static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;

But these can also limit TX size:

/** The maximum number of witness stack items in a standard P2WSH script */
static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS = 100;
/** The maximum size in bytes of each witness stack item in a standard P2WSH script */
static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80;
/** The maximum size in bytes of each witness stack item in a standard BIP 342 script (Taproot, leaf version 0xc0) */
static const unsigned int MAX_STANDARD_TAPSCRIPT_STACK_ITEM_SIZE = 80;
/** The maximum size in bytes of a standard witnessScript */
static const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600;
/** The maximum size of a standard ScriptSig */
static const unsigned int MAX_STANDARD_SCRIPTSIG_SIZE = 1650;

The "Transaction too large" error is defined here, which is triggered by MAX_STANDARD_TX_WEIGHT:

// Limit size
if ((sign && GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT) ||
(!sign && tx_sizes.weight > MAX_STANDARD_TX_WEIGHT))
{
error = _("Transaction too large");
return false;
}

Copy link

@JaredTate JaredTate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Thanks a ton for everyone's help on this!

@ghost
Copy link
Author

ghost commented Feb 7, 2024

ACK. Thanks a ton for everyone's help on this!

@JaredTate Thank you for all the work you do for DigiByte!!

@ycagel ycagel merged commit 9a1bc4a into DigiByte-Core:develop Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants