151 lines
7.2 KiB
Diff
151 lines
7.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aere Network <node@aere.network>
|
|
Date: Mon, 3 Aug 2026 04:00:00 +0300
|
|
Subject: [PATCH] Aere Network: fork-gated consensus floor for the EIP-1559
|
|
base fee
|
|
|
|
Adds a real consensus minimum base fee to LondonFeeMarket, gated on a fork
|
|
block. When the block number reaches aere.basefee.floor.forkBlock, the computed
|
|
EIP-1559 base fee is clamped to max(computed, aere.basefee.floor.value).
|
|
|
|
computeBaseFee is used for BOTH block production and block validation, so this
|
|
is a genuine consensus rule and not a display trick: every node must carry the
|
|
change, and a node without it computes the old, lower base fee and rejects the
|
|
floored block.
|
|
|
|
Default forkBlock is Long.MAX_VALUE, so with no configuration the behaviour is
|
|
identical to the unmodified file and pre-fork blocks validate unchanged.
|
|
|
|
ACTIVE ON AERE NETWORK CHAIN 2800 since block 10,141,734, with a floor of
|
|
1,000,000,000 wei, delivered to every node as system properties
|
|
(-Daere.basefee.floor.forkBlock=10141734 -Daere.basefee.floor.value=1000000000,
|
|
see RUN-A-NODE.md). A node without this patch, or with the properties unset,
|
|
computes a lower base fee from that height on and rejects every block.
|
|
|
|
Upstream-Status: Inappropriate [Aere Network specific consensus rule]
|
|
|
|
Modified upstream files. One file touched by this patch is a modified copy of a
|
|
Hyperledger Besu source, not new work by Aere Network:
|
|
|
|
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
|
|
|
|
Aere Network changed it, against upstream commit
|
|
d2032017bb3b8cb215a97303980a1e4a643f7180. Its original "Copyright ConsenSys AG"
|
|
header is kept unchanged, which is what Apache License 2.0 section 4(c)
|
|
requires, and this patch adds below it a separate "Modifications Copyright"
|
|
block naming exactly what was changed. That in-file block is the notice
|
|
required by Apache License 2.0 section 4(b). It travels inside the diff, so a
|
|
tree with this patch applied carries the notice whether you used git am or git
|
|
apply. This patch creates no new files.
|
|
|
|
Note that the copyright holder on this file is ConsenSys AG, not "contributors
|
|
to Hyperledger Besu" as on the files touched by patches 0001 and 0002. Both
|
|
holders are named in NOTICE, as Apache License 2.0 section 4(d) requires.
|
|
---
|
|
.../mainnet/feemarket/LondonFeeMarket.java | 48 +++++++++++++++++--
|
|
1 file changed, 45 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
|
|
index 0ee4f7409..83a639c1b 100644
|
|
--- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
|
|
+++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java
|
|
@@ -1,17 +1,35 @@
|
|
/*
|
|
* Copyright ConsenSys AG.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
|
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations under the License.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
+
|
|
+/*
|
|
+ * Modifications Copyright 2026 Aere Network.
|
|
+ *
|
|
+ * This file was changed by Aere Network: a fork-gated consensus minimum for the
|
|
+ * EIP-1559 base fee was added. Two system properties configure it
|
|
+ * (aere.basefee.floor.forkBlock, aere.basefee.floor.value), a private helper
|
|
+ * applyAereBaseFeeFloor was added, and the three return paths of computeBaseFee
|
|
+ * now pass through that helper. The default fork block is Long.MAX_VALUE, so an
|
|
+ * unconfigured node behaves exactly as the unmodified file does. Nothing upstream
|
|
+ * was removed or rewritten.
|
|
+ *
|
|
+ * The unmodified original is Hyperledger Besu commit
|
|
+ * d2032017bb3b8cb215a97303980a1e4a643f7180. The upstream copyright header above is
|
|
+ * left exactly as it was found.
|
|
+ *
|
|
+ * This notice is required by Apache License 2.0 section 4(b).
|
|
+ */
|
|
package org.hyperledger.besu.ethereum.mainnet.feemarket;
|
|
|
|
import org.hyperledger.besu.config.GenesisConfig;
|
|
@@ -34,6 +52,19 @@ public class LondonFeeMarket implements BaseFeeMarket {
|
|
|
|
private static final Wei DEFAULT_BASEFEE_FLOOR = Wei.of(7L);
|
|
|
|
+ // === AERE base-fee floor fork (fork-gated, system-property configured) ===
|
|
+ // A real consensus minimum base fee, not a display trick. When the running block
|
|
+ // number reaches AERE_BASEFEE_FLOOR_FORK_BLOCK, the EIP-1559 base fee is clamped to
|
|
+ // max(computed, AERE_BASEFEE_FLOOR_VALUE). Because computeBaseFee is used for BOTH
|
|
+ // block production AND block validation, this is a genuine consensus rule: every node
|
|
+ // must agree, and a node without this change computes the old (lower) base fee and
|
|
+ // rejects the floored block. Default forkBlock = Long.MAX_VALUE => never active =>
|
|
+ // byte-identical behavior to stock Besu (pre-fork blocks are unchanged).
|
|
+ private static final long AERE_BASEFEE_FLOOR_FORK_BLOCK =
|
|
+ Long.getLong("aere.basefee.floor.forkBlock", Long.MAX_VALUE);
|
|
+ private static final Wei AERE_BASEFEE_FLOOR_VALUE =
|
|
+ Wei.of(Long.getLong("aere.basefee.floor.value", 1_000_000_000L));
|
|
+
|
|
protected final Wei baseFeeInitialValue;
|
|
private final long londonForkBlockNumber;
|
|
private final TransactionPriceCalculator txPriceCalculator;
|
|
@@ -83,6 +114,17 @@ public class LondonFeeMarket implements BaseFeeMarket {
|
|
.isPresent();
|
|
}
|
|
|
|
+ // AERE base-fee floor fork: clamp the computed base fee to the floor once the fork
|
|
+ // block is reached. No-op before the fork block (and always a no-op when the fork is
|
|
+ // unset, i.e. forkBlock = Long.MAX_VALUE), so pre-fork blocks validate byte-identically.
|
|
+ private Wei applyAereBaseFeeFloor(final long blockNumber, final Wei fee) {
|
|
+ if (blockNumber >= AERE_BASEFEE_FLOOR_FORK_BLOCK
|
|
+ && !fee.greaterOrEqualThan(AERE_BASEFEE_FLOOR_VALUE)) {
|
|
+ return AERE_BASEFEE_FLOOR_VALUE;
|
|
+ }
|
|
+ return fee;
|
|
+ }
|
|
+
|
|
@Override
|
|
public Wei computeBaseFee(
|
|
final long blockNumber,
|
|
@@ -90,13 +132,13 @@ public class LondonFeeMarket implements BaseFeeMarket {
|
|
final long parentBlockGasUsed,
|
|
final long targetGasUsed) {
|
|
if (londonForkBlockNumber == blockNumber) {
|
|
- return getInitialBasefee();
|
|
+ return applyAereBaseFeeFloor(blockNumber, getInitialBasefee());
|
|
}
|
|
|
|
long gasDelta;
|
|
Wei feeDelta, baseFee;
|
|
if (parentBlockGasUsed == targetGasUsed) {
|
|
- return parentBaseFee;
|
|
+ return applyAereBaseFeeFloor(blockNumber, parentBaseFee);
|
|
} else if (parentBlockGasUsed > targetGasUsed) {
|
|
gasDelta = parentBlockGasUsed - targetGasUsed;
|
|
final long denominator = getBasefeeMaxChangeDenominator();
|
|
@@ -117,7 +159,7 @@ public class LondonFeeMarket implements BaseFeeMarket {
|
|
parentBlockGasUsed,
|
|
targetGasUsed,
|
|
baseFee);
|
|
- return baseFee;
|
|
+ return applyAereBaseFeeFloor(blockNumber, baseFee);
|
|
}
|
|
|
|
@Override
|