Skip to content

Conversation

tomt1664
Copy link
Member

@tomt1664 tomt1664 commented Jul 18, 2025

Apply HasValidFee and fee MoneyRange checks only to the policyAsset. This will enable issued asset fee amounts (in individual outputs, total in transaction and total in a block) greater than MAX_MONEY

This is a consensus change and technically a hardfork, but can be added safely to a release and deployed as any issued asset fee paying transactions are currently prevented from being confirmed by policy rules.

Extension of #1333

HasValidFee (called from CheckInputs) is a consensus check for each tx that
1) any fee output does not exceed MAX_MONEY
2) any fee output is not 0 value
3) the total fees for a tx do not exceed MAX_MONEY

Another check in CheckInputs checks that the total fees for a block do not exceed MAX_MONEY

To enable both zero fee outputs and for total block and tx fee outputs (and total fee outputs) to exceed MAX_MONEY (fee outputs can be issued assets in addition to pegged asset, which total supply can exceed MAX_MONEY) and new chain config option is added: -con_allow_any_fee

@tomt1664 tomt1664 requested a review from delta1 July 18, 2025 14:55
@jsarenik
Copy link

I would just like to note here that a zero fee raw tx worked for me fine on the unofficial liquidtestnet4 already some time ago. Not tested with any other assets back then.

See https://kitchen.anyone.eu.org/lt4/zero.txt - the tx is present in current lt4 blockchain. Confidential. No fee (Liquid "fee" structure empty).

@tomt1664
Copy link
Member Author

I would just like to note here that a zero fee raw tx worked for me fine on the unofficial liquidtestnet4 already some time ago. Not tested with any other assets back then.

See https://kitchen.anyone.eu.org/lt4/zero.txt - the tx is present in current lt4 blockchain. Confidential. No fee (Liquid "fee" structure empty).

A transaction can have a zero fee if there is no fee output (e.g. this lt4 tx) - that is consensus valid. But it cannot include an explicit fee output that has zero value (gets checked here:

if (fee == 0 || !MoneyRange(fee))
).

@tomt1664 tomt1664 marked this pull request as draft July 21, 2025 16:10
@tomt1664
Copy link
Member Author

I've updated #1333 so the wallet does not add a fee output if the fee is zero - this is valid in current consensus rules.

The PR - enabling any fee value - is relevant to using issued assets as fees. I'll leave it open in draft - it is unlikely to be useful before issuance beyond MAX_MONEY is also enabled.

@tomt1664 tomt1664 self-assigned this Jul 22, 2025
@tomt1664 tomt1664 force-pushed the feature_allow_any_fee_asset branch from 4c25924 to 15d09d0 Compare September 10, 2025 14:23
@tomt1664 tomt1664 marked this pull request as ready for review September 10, 2025 15:03
@tomt1664 tomt1664 changed the title Allow any fee config Fee MoneyRange checks only apply to policyAsset Sep 10, 2025
Copy link
Member

@delta1 delta1 left a comment

Choose a reason for hiding this comment

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

I think this probably needs to be tested in a functional test

Comment on lines +41 to +43
if(fee < 0) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this to check for overflow?

Suggested change
if(fee < 0) {
return false;
}
if (fee < 0) {
return false;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually was from a previous version. I have updated it now so that for policyAsset the check is MoneyRange, but if not policy asset check that fee < 0.

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.

3 participants