Unable to have gas price of 0
Closed this issue · 3 comments
Some dev networks allows gas price of 0 but when I try it here, I get
File .../ledger-eth-lib/ledgereth/transactions.py", line 217, in create_transaction
raise ValueError("gas_price or max_fee_per_gas must be provided")
ValueError: gas_price or max_fee_per_gas must be provided
The code is:
# we need a gas price for a valid transaction
if not gas_price and not max_fee_per_gas:
raise ValueError("gas_price or max_fee_per_gas must be provided")
it probably should be
# we need a gas price for a valid transaction
if gas_price is None and max_fee_per_gas is None:
raise ValueError("gas_price or max_fee_per_gas must be provided")
I have verified this fixes is my issue
I had no idea 0 gas price was valid. Good to know, thanks.
Making this change has some other implications as well. The defaults are hinky, then since they're all 0
:
ledger-eth-lib/ledgereth/transactions.py
Lines 159 to 161 in 0b15b55
Maybe gas_price
should default to None
and the others as 0
but in create_transaction()
that would mean it would fallback to a type 0 transaction:
ledger-eth-lib/ledgereth/transactions.py
Line 220 in 0b15b55
Probably want to default them all to None
then and then do some shitty logic checking for access lists to make sure it's not a type 1 tx before setting a default gas price or max fee. Or just use defaults at object instantiation...
Thinking about it a bit, if gas_price
and max_fee_per_gas
is zero, a type 0 tx would be just fine anyway. We should just remove that check, then. EZ