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.
This commit is contained in:
The MMGen Project 2026-11-29 17:04:40 +00:00
commit 05f6e1cdf2
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 4 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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):

View file

@ -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}',