Skip to content

Commit 7cff454

Browse files
committed
Rename base gas fee transaction to dynamic fee txn
This seems to be a commonly used name, and is definitely better than BaseGasFee.
1 parent 373c18a commit 7cff454

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

eth/tools/factories/transaction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def new_access_list_transaction(
8080

8181

8282
@curry
83-
def new_fee_burn_transaction(
83+
def new_dynamic_fee_transaction(
8484
vm,
8585
from_,
8686
to,
@@ -103,7 +103,7 @@ def new_fee_burn_transaction(
103103
if access_list is None:
104104
access_list = []
105105

106-
tx = vm.get_transaction_builder().new_unsigned_fee_burn_transaction(
106+
tx = vm.get_transaction_builder().new_unsigned_dynamic_fee_transaction(
107107
chain_id=chain_id,
108108
nonce=nonce,
109109
max_priority_fee_per_gas=max_priority_fee_per_gas,

eth/vm/forks/london/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
)
55

66
# EIP 1559
7-
BASE_GAS_FEE_TRANSACTION_TYPE = 2
8-
BASE_GAS_FEE_ADDRESS_COST = ACCESS_LIST_ADDRESS_COST_EIP_2930
9-
BASE_GAS_FEE_STORAGE_KEY_COST = ACCESS_LIST_STORAGE_KEY_COST_EIP_2930
7+
DYNAMIC_FEE_TRANSACTION_TYPE = 2
8+
DYNAMIC_FEE_ADDRESS_COST = ACCESS_LIST_ADDRESS_COST_EIP_2930
9+
DYNAMIC_FEE_STORAGE_KEY_COST = ACCESS_LIST_STORAGE_KEY_COST_EIP_2930
1010

1111
BASE_FEE_MAX_CHANGE_DENOMINATOR = 8
1212
INITIAL_BASE_FEE = 1000000000

eth/vm/forks/london/receipts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
ACCESS_LIST_TRANSACTION_TYPE,
1414
)
1515

16-
from .constants import BASE_GAS_FEE_TRANSACTION_TYPE
16+
from .constants import DYNAMIC_FEE_TRANSACTION_TYPE
1717

1818

1919
class LondonReceiptBuilder(BerlinReceiptBuilder):
2020
codecs: Dict[int, Type[Receipt]] = {
2121
ACCESS_LIST_TRANSACTION_TYPE: Receipt,
22-
BASE_GAS_FEE_TRANSACTION_TYPE: Receipt,
22+
DYNAMIC_FEE_TRANSACTION_TYPE: Receipt,
2323
}

eth/vm/forks/london/transactions.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
ISTANBUL_TX_GAS_SCHEDULE,
5454
)
5555

56-
from .constants import BASE_GAS_FEE_TRANSACTION_TYPE
56+
from .constants import DYNAMIC_FEE_TRANSACTION_TYPE
5757

5858

5959
class LondonLegacyTransaction(BerlinLegacyTransaction):
@@ -78,8 +78,8 @@ def as_signed_transaction(self,
7878
)
7979

8080

81-
class UnsignedBaseGasFeeTransaction(rlp.Serializable):
82-
_type_id = BASE_GAS_FEE_TRANSACTION_TYPE
81+
class UnsignedDynamicFeeTransaction(rlp.Serializable):
82+
_type_id = DYNAMIC_FEE_TRANSACTION_TYPE
8383
fields = [
8484
('chain_id', big_endian_int),
8585
('nonce', big_endian_int),
@@ -105,7 +105,7 @@ def as_signed_transaction(self, private_key: PrivateKey) -> 'TypedTransaction':
105105
signature = private_key.sign_msg(message)
106106
y_parity, r, s = signature.vrs
107107

108-
signed_transaction = BaseGasFeeTransaction(
108+
signed_transaction = DynamicFeeTransaction(
109109
self.chain_id,
110110
self.nonce,
111111
self.max_priority_fee_per_gas,
@@ -122,8 +122,8 @@ def as_signed_transaction(self, private_key: PrivateKey) -> 'TypedTransaction':
122122
return LondonTypedTransaction(self._type_id, signed_transaction)
123123

124124

125-
class BaseGasFeeTransaction(rlp.Serializable, SignedTransactionMethods, SignedTransactionAPI):
126-
_type_id = BASE_GAS_FEE_TRANSACTION_TYPE
125+
class DynamicFeeTransaction(rlp.Serializable, SignedTransactionMethods, SignedTransactionAPI):
126+
_type_id = DYNAMIC_FEE_TRANSACTION_TYPE
127127
fields = [
128128
('chain_id', big_endian_int),
129129
('nonce', big_endian_int),
@@ -141,14 +141,15 @@ class BaseGasFeeTransaction(rlp.Serializable, SignedTransactionMethods, SignedTr
141141

142142
@property
143143
def gas_price(self) -> None:
144-
# maybe add a warning, or raise an exception instead?
145-
return None
144+
raise AttributeError(
145+
"Gas price is no longer available. See max_priority_fee_per_gas or max_fee_per_gas"
146+
)
146147

147148
def get_sender(self) -> Address:
148149
return extract_transaction_sender(self)
149150

150151
def get_message_for_signing(self) -> bytes:
151-
unsigned = UnsignedBaseGasFeeTransaction(
152+
unsigned = UnsignedDynamicFeeTransaction(
152153
self.chain_id,
153154
self.nonce,
154155
self.max_priority_fee_per_gas,
@@ -206,16 +207,16 @@ def make_receipt(
206207
)
207208

208209

209-
class BaseGasFeePayloadDecoder(TransactionDecoderAPI):
210+
class DynamicFeePayloadDecoder(TransactionDecoderAPI):
210211
@classmethod
211212
def decode(cls, payload: bytes) -> SignedTransactionAPI:
212-
return rlp.decode(payload, sedes=BaseGasFeeTransaction)
213+
return rlp.decode(payload, sedes=DynamicFeeTransaction)
213214

214215

215216
class LondonTypedTransaction(TypedTransaction):
216217
decoders: Dict[int, Type[TransactionDecoderAPI]] = {
217218
ACCESS_LIST_TRANSACTION_TYPE: AccessListPayloadDecoder,
218-
BASE_GAS_FEE_TRANSACTION_TYPE: BaseGasFeePayloadDecoder,
219+
DYNAMIC_FEE_TRANSACTION_TYPE: DynamicFeePayloadDecoder,
219220
}
220221

221222

@@ -225,7 +226,7 @@ class LondonTransactionBuilder(BerlinTransactionBuilder):
225226
typed_transaction = LondonTypedTransaction
226227

227228
@classmethod
228-
def new_unsigned_fee_burn_transaction(
229+
def new_unsigned_dynamic_fee_transaction(
229230
cls,
230231
chain_id: int,
231232
nonce: int,
@@ -236,7 +237,7 @@ def new_unsigned_fee_burn_transaction(
236237
value: int,
237238
data: bytes,
238239
access_list: Sequence[Tuple[Address, Sequence[int]]],) -> LondonTypedTransaction:
239-
transaction = UnsignedBaseGasFeeTransaction(
240+
transaction = UnsignedDynamicFeeTransaction(
240241
chain_id,
241242
nonce,
242243
max_priority_fee_per_gas,
@@ -250,7 +251,7 @@ def new_unsigned_fee_burn_transaction(
250251
return transaction
251252

252253
@classmethod
253-
def new_fee_burn_transaction(
254+
def new_dynamic_fee_transaction(
254255
cls,
255256
chain_id: int,
256257
nonce: int,
@@ -264,7 +265,7 @@ def new_fee_burn_transaction(
264265
y_parity: int,
265266
r: int,
266267
s: int) -> LondonTypedTransaction:
267-
transaction = BaseGasFeeTransaction(
268+
transaction = DynamicFeeTransaction(
268269
chain_id,
269270
nonce,
270271
max_priority_fee_per_gas,
@@ -278,4 +279,4 @@ def new_fee_burn_transaction(
278279
r,
279280
s,
280281
)
281-
return LondonTypedTransaction(BASE_GAS_FEE_TRANSACTION_TYPE, transaction)
282+
return LondonTypedTransaction(DYNAMIC_FEE_TRANSACTION_TYPE, transaction)

tests/core/vm/test_rewards.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
london_at,
2626
genesis,
2727
)
28-
from eth.tools.factories.transaction import new_fee_burn_transaction
28+
from eth.tools.factories.transaction import new_dynamic_fee_transaction
2929

3030

3131
@pytest.mark.parametrize(
@@ -348,7 +348,7 @@ def test_eip1559_txn_rewards(
348348
),
349349
)
350350
vm = chain.get_vm()
351-
txn = new_fee_burn_transaction(
351+
txn = new_dynamic_fee_transaction(
352352
vm,
353353
from_=funded_address,
354354
to=funded_address,

tests/core/vm/test_validate_transaction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from eth._utils.address import force_bytes_to_address
55
from eth.chains.base import MiningChain
66
from eth.constants import GAS_TX
7-
from eth.tools.factories.transaction import new_fee_burn_transaction
7+
from eth.tools.factories.transaction import new_dynamic_fee_transaction
88
from eth.vm.forks import LondonVM
99

1010

@@ -36,7 +36,7 @@ def test_transaction_cost_valid(london_plus_miner, funded_address, funded_addres
3636

3737
account_balance = vm.state.get_balance(funded_address)
3838

39-
tx = new_fee_burn_transaction(
39+
tx = new_dynamic_fee_transaction(
4040
vm,
4141
from_=funded_address,
4242
to=ADDRESS_A,
@@ -66,7 +66,7 @@ def test_transaction_cost_invalid(london_plus_miner, funded_address, funded_addr
6666

6767
account_balance = vm.state.get_balance(funded_address)
6868

69-
tx = new_fee_burn_transaction(
69+
tx = new_dynamic_fee_transaction(
7070
vm,
7171
from_=funded_address,
7272
to=ADDRESS_A,

0 commit comments

Comments
 (0)