Skip to content

Commit 2d2cfaf

Browse files
committed
renamed evmGasUsed to baselineGas
Signed-off-by: Daniel Lehrner <[email protected]>
1 parent c6f0c3a commit 2d2cfaf

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionValidator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,13 @@ private ValidationResult<TransactionInvalidReason> validateCostAndFee(
253253
}
254254
}
255255

256-
final long evmGasUsed =
256+
final long baselineGas =
257257
clampedAdd(
258258
transaction.getAccessList().map(gasCalculator::accessListGasCost).orElse(0L),
259259
gasCalculator.delegateCodeGasCost(transaction.codeDelegationListSize()));
260260
final long intrinsicGasCost =
261261
gasCalculator.transactionIntrinsicGasCost(
262-
transaction.getPayload(), transaction.isContractCreation(), evmGasUsed);
262+
transaction.getPayload(), transaction.isContractCreation(), baselineGas);
263263
if (Long.compareUnsigned(intrinsicGasCost, transaction.getGasLimit()) > 0) {
264264
return ValidationResult.invalid(
265265
TransactionInvalidReason.INTRINSIC_GAS_EXCEEDS_GAS_LIMIT,

ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/IntrinsicGasTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void validateGasCost(
118118
Transaction t = Transaction.readFrom(RLP.input(rlp));
119119
Assertions.assertThat(
120120
gasCalculator.transactionIntrinsicGasCost(
121-
t.getPayload(), t.isContractCreation(), evmGasUsed(gasCalculator, t)))
121+
t.getPayload(), t.isContractCreation(), baselineGas(gasCalculator, t)))
122122
.isEqualTo(expectedGas);
123123
}
124124

@@ -129,7 +129,7 @@ void dryRunDetector() {
129129
.isTrue();
130130
}
131131

132-
long evmGasUsed(final GasCalculator gasCalculator, final Transaction transaction) {
132+
long baselineGas(final GasCalculator gasCalculator, final Transaction transaction) {
133133
final List<AccessListEntry> accessListEntries = transaction.getAccessList().orElse(List.of());
134134

135135
int accessListStorageCount = 0;

ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/core/TransactionTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ public void milestone(
192192

193193
assertThat(transaction.getSender()).isEqualTo(expected.getSender());
194194
assertThat(transaction.getHash()).isEqualTo(expected.getHash());
195-
final long evmGasUsed =
195+
final long baselineGas =
196196
transaction.getAccessList().map(gasCalculator::accessListGasCost).orElse(0L) +
197197
gasCalculator.delegateCodeGasCost(transaction.codeDelegationListSize());
198198
final long intrinsicGasCost = gasCalculator.transactionIntrinsicGasCost(
199199
transaction.getPayload(),
200200
transaction.isContractCreation(),
201-
evmGasUsed);
201+
baselineGas);
202202
assertThat(intrinsicGasCost).isEqualTo(expected.getIntrinsicGas());
203203
} catch (final Exception e) {
204204
if (expected.isSucceeds()) {

evm/src/main/java/org/hyperledger/besu/evm/gascalculator/FrontierGasCalculator.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ public FrontierGasCalculator() {
130130

131131
@Override
132132
public long transactionIntrinsicGasCost(
133-
final Bytes payload, final boolean isContractCreation, final long evmGasUsed) {
133+
final Bytes payload, final boolean isContractCreation, final long baselineGas) {
134134
final long dynamicIntrinsicGasCost =
135-
dynamicIntrinsicGasCost(payload, isContractCreation, evmGasUsed);
135+
dynamicIntrinsicGasCost(payload, isContractCreation, baselineGas);
136136

137137
if (dynamicIntrinsicGasCost == Long.MIN_VALUE || dynamicIntrinsicGasCost == Long.MAX_VALUE) {
138138
return dynamicIntrinsicGasCost;
@@ -145,14 +145,14 @@ public long transactionIntrinsicGasCost(
145145
*
146146
* @param payload the call data payload
147147
* @param isContractCreation whether the transaction is a contract creation
148-
* @param evmGasUsed how much gas is used by access lists and code delegations
148+
* @param baselineGas how much gas is used by access lists and code delegations
149149
* @return the dynamic part of the intrinsic gas cost
150150
*/
151151
protected long dynamicIntrinsicGasCost(
152-
final Bytes payload, final boolean isContractCreation, final long evmGasUsed) {
152+
final Bytes payload, final boolean isContractCreation, final long baselineGas) {
153153
final int payloadSize = payload.size();
154154
final long zeroBytes = zeroBytes(payload);
155-
long cost = clampedAdd(callDataCost(payloadSize, zeroBytes), evmGasUsed);
155+
long cost = clampedAdd(callDataCost(payloadSize, zeroBytes), baselineGas);
156156

157157
if (cost == Long.MIN_VALUE || cost == Long.MAX_VALUE) {
158158
return cost;

evm/src/main/java/org/hyperledger/besu/evm/gascalculator/GasCalculator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,11 @@ default long modExpGasCost(final Bytes input) {
543543
*
544544
* @param transactionPayload The encoded transaction, as bytes
545545
* @param isContractCreation Is this transaction a contract creation transaction?
546-
* @param evmGasUsed The gas used by access lists and code delegation authorizations
546+
* @param baselineGas The gas used by access lists and code delegation authorizations
547547
* @return the transaction's intrinsic gas cost
548548
*/
549549
long transactionIntrinsicGasCost(
550-
Bytes transactionPayload, boolean isContractCreation, long evmGasUsed);
550+
Bytes transactionPayload, boolean isContractCreation, long baselineGas);
551551

552552
/**
553553
* Returns the gas cost of the explicitly declared access list.

evm/src/main/java/org/hyperledger/besu/evm/gascalculator/PragueGasCalculator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public long calculateDelegateCodeGasRefund(final long alreadyExistingAccounts) {
7676

7777
@Override
7878
public long transactionIntrinsicGasCost(
79-
final Bytes payload, final boolean isContractCreation, final long evmGasUsed) {
79+
final Bytes payload, final boolean isContractCreation, final long baselineGas) {
8080
final long dynamicIntrinsicGasCost =
81-
dynamicIntrinsicGasCost(payload, isContractCreation, evmGasUsed);
81+
dynamicIntrinsicGasCost(payload, isContractCreation, baselineGas);
8282
final long totalCostFloor =
8383
tokensInCallData(payload.size(), zeroBytes(payload)) * TOTAL_COST_FLOOR_PER_TOKEN;
8484

0 commit comments

Comments
 (0)