From 05f6e1cdf2dcc59d553f76dd9b289e9055ce2386 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 29 Nov 2026 17:04:40 +0000 Subject: [PATCH] proto.eth.tx.new: remove fee check disabling for contract transactions If necessary, the limit can be raised on an individual transaction basis with --eth-max-tx-fee. --- mmgen/proto/eth/tx/new.py | 3 +-- mmgen/proto/eth/tx/signed.py | 1 - mmgen/tx/base.py | 1 - mmgen/tx/new.py | 5 ++--- test/cmdtest_d/ethdev.py | 1 + 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/mmgen/proto/eth/tx/new.py b/mmgen/proto/eth/tx/new.py index 43c83dca..0ae18746 100644 --- a/mmgen/proto/eth/tx/new.py +++ b/mmgen/proto/eth/tx/new.py @@ -38,7 +38,6 @@ class New(VmNew, Base, TxBase.New): assert len(data) <= self.proto.max_data_len, ( f'{len(data)}: data length too large (>{self.proto.max_data_len})') self.usr_contract_data = data - self.disable_fee_check = True def process_data_output_arg(self, arg): pass @@ -111,7 +110,7 @@ class New(VmNew, Base, TxBase.New): def convert_and_check_fee(self, fee, desc): if (abs_fee := self.feespec2abs(fee, None)) is False: return False - if not self.disable_fee_check and (abs_fee > self.proto.max_tx_fee): + if abs_fee > self.proto.max_tx_fee: from ....tx.util import fee_too_high_msg msg(fee_too_high_msg(self.proto, abs_fee, desc=desc)) return False diff --git a/mmgen/proto/eth/tx/signed.py b/mmgen/proto/eth/tx/signed.py index 68409e95..35ca760c 100644 --- a/mmgen/proto/eth/tx/signed.py +++ b/mmgen/proto/eth/tx/signed.py @@ -39,7 +39,6 @@ class Signed(Completed, TxBase.Signed): if o['data'] and not o['to']: # token- or contract-creating transaction # NB: could be a non-token contract address: o['token_addr'] = ContractAddr(self.proto, etx.creates.hex()) - self.disable_fee_check = True txid = CoinTxID(etx.hash.hex()) assert txid == self.coin_txid, "txid in tx.serialized doesn't match value in MMGen transaction file" self.txobj = o diff --git a/mmgen/tx/base.py b/mmgen/tx/base.py index 16a7b3ec..adc5f418 100644 --- a/mmgen/tx/base.py +++ b/mmgen/tx/base.py @@ -85,7 +85,6 @@ class Base(MMGenObject): is_compat = False compat_data = None has_comment = True - disable_fee_check = False swap_attrs = { 'swap_proto': None, 'swap_quote_expiry': None, diff --git a/mmgen/tx/new.py b/mmgen/tx/new.py index 0e89465a..bf503e7d 100644 --- a/mmgen/tx/new.py +++ b/mmgen/tx/new.py @@ -157,9 +157,8 @@ class New(Base): desc = 'User-selected' def check_fee(self): - if not self.disable_fee_check: - from .util import check_fee - check_fee(self.proto, self.usr_fee) + from .util import check_fee + check_fee(self.proto, self.usr_fee) # we don't know fee yet, so perform preliminary check with fee == 0 async def precheck_sufficient_funds(self, inputs_sum, sel_unspent, outputs_sum): diff --git a/test/cmdtest_d/ethdev.py b/test/cmdtest_d/ethdev.py index 148091df..da06b8a9 100644 --- a/test/cmdtest_d/ethdev.py +++ b/test/cmdtest_d/ethdev.py @@ -274,6 +274,7 @@ class CmdTestEthdevMethods: args = [ '-B', f'--fee={gas_price}', + f'--{self.proto.coin.lower()}-max-tx-fee=0.05', f'--gas={gas}', f'--contract-data={fn}', f'--inputs={dfl_devaddr}',