aere-node/patches/0004-aere-basefee-floor.patch
Aere Network 35911fb5c7 The three patches apply again with plain git apply, proven on a pristine checkout
The licence-note edits had normalized whitespace inside hunks, so the recipe
this repository tells its reader to run failed at step one with 'patch does
not apply'; only --ignore-whitespace passed, and the README nowhere says to
use it. Each patch was re-applied to pristine d2032017 with whitespace
tolerance, then regenerated from the resulting tree with its prose header
kept, and the full sequence 0001, 0003, 0004 was applied with PLAIN git
apply on a fresh pristine checkout before this commit was made.
2026-08-15 13:26:35 +03:00

137 lines
6.4 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.
NOT ACTIVE ON AERE NETWORK CHAIN 2800. No fork block has been set on mainnet.
Arming it is a governance decision that has not been taken.
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
@@ -12,6 +12,24 @@
*
* 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