From 12e7fc67b2db384d000a80c0d14f3645934f8705 Mon Sep 17 00:00:00 2001 From: raxhvl Date: Mon, 16 Feb 2026 06:08:00 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(EIP-7708):=20Burn=20logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs | 2 +- src/Nethermind/Nethermind.Evm.Test/Eip7708Tests.cs | 8 ++++---- .../Instructions/EvmInstructions.ControlFlow.cs | 2 +- .../TransactionProcessing/TransactionProcessor.cs | 2 +- src/Nethermind/Nethermind.Evm/TransferLog.cs | 8 ++++---- src/Nethermind/Nethermind.Evm/VirtualMachine.cs | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs b/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs index a3669527702..1dc9895fd30 100644 --- a/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs +++ b/src/Nethermind/Nethermind.Core/Specs/IReleaseSpec.cs @@ -459,7 +459,7 @@ public interface IReleaseSpec : IEip1559Spec, IReceiptSpec bool BlockLevelAccessListsEnabled => IsEip7928Enabled; /// - /// EIP-7708: ETH transfers emit a log + /// EIP-7708: ETH transfers and burns emit a log /// public bool IsEip7708Enabled { get; } diff --git a/src/Nethermind/Nethermind.Evm.Test/Eip7708Tests.cs b/src/Nethermind/Nethermind.Evm.Test/Eip7708Tests.cs index e7bc3c70774..716d4d9508b 100644 --- a/src/Nethermind/Nethermind.Evm.Test/Eip7708Tests.cs +++ b/src/Nethermind/Nethermind.Evm.Test/Eip7708Tests.cs @@ -32,8 +32,8 @@ private Task CreateChain() private static LogEntry ExpectedTransferLog(Address from, Address to, UInt256 value) => new(TransferLog.Sender, value.ToBigEndian(), [TransferLog.TransferSignature, from.ToHash().ToHash256(), to.ToHash().ToHash256()]); - private static LogEntry ExpectedSelfDestructLog(Address account, UInt256 value) => - new(TransferLog.Sender, value.ToBigEndian(), [TransferLog.SelfDestructSignature, account.ToHash().ToHash256()]); + private static LogEntry ExpectedBurnLog(Address account, UInt256 value) => + new(TransferLog.Sender, value.ToBigEndian(), [TransferLog.BurnSignature, account.ToHash().ToHash256()]); private void AssertLogs(TxReceipt[] receipts, LogEntry[] expectedLogs, bool logCondition = true) { @@ -196,7 +196,7 @@ public async Task SelfDestruct_ToSelf_EmitsSelfDestructLog(ulong contractBalance Block block = await chain.AddBlock(callTx); - AssertLogs(chain.ReceiptStorage.Get(block), [ExpectedSelfDestructLog(contractAddress, contractBalance)], contractBalance != 0); + AssertLogs(chain.ReceiptStorage.Get(block), [ExpectedBurnLog(contractAddress, contractBalance)], contractBalance != 0); } [Test] @@ -275,7 +275,7 @@ public async Task SelfDestruct_ThenReceivesEth_EmitsLogs() ExpectedTransferLog(contractBAddress, contractAAddress, contractABalance), ExpectedTransferLog(contractAAddress, inheritorA, contractABalance), ExpectedTransferLog(contractBAddress, contractAAddress, ethToSend), - ExpectedSelfDestructLog(contractAAddress, ethToSend) + ExpectedBurnLog(contractAAddress, ethToSend) ]); } } diff --git a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs index 5913f91905a..71341d276c0 100644 --- a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs +++ b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.ControlFlow.cs @@ -244,7 +244,7 @@ private static EvmExceptionType InstructionSelfDestruct(VirtualMachi if (executingAccount == inheritor) { - vm.AddSelfDestructLog(executingAccount, result); + vm.AddBurnLog(executingAccount, result); } else { diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs index b5c1003112c..3ba77dffa3e 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs @@ -775,7 +775,7 @@ private int ExecuteEvmCall( UInt256 balance = WorldState.GetBalance(toBeDestroyed); if (!balance.IsZero) { - substate.Logs.Add(TransferLog.CreateSelfDestruct(toBeDestroyed, balance)); + substate.Logs.Add(TransferLog.CreateBurn(toBeDestroyed, balance)); } } diff --git a/src/Nethermind/Nethermind.Evm/TransferLog.cs b/src/Nethermind/Nethermind.Evm/TransferLog.cs index 0db51ecd135..3f112cdced6 100644 --- a/src/Nethermind/Nethermind.Evm/TransferLog.cs +++ b/src/Nethermind/Nethermind.Evm/TransferLog.cs @@ -11,16 +11,16 @@ public static class TransferLog { // keccak256('Transfer(address,address,uint256)') public static readonly Hash256 TransferSignature = new("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"); - // keccak256('Selfdestruct(address,uint256)') - public static readonly Hash256 SelfDestructSignature = new("0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083"); + // keccak256('Burn(address,uint256)') + public static readonly Hash256 BurnSignature = new("0xcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5"); public static readonly Address Sender = Address.SystemUser; public static readonly Address Erc20Sender = new("0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); public static LogEntry CreateTransfer(Address from, Address to, in UInt256 amount) => CreateTransferInternal(Sender, from, to, amount); - public static LogEntry CreateSelfDestruct(Address contract, in UInt256 amount) => - new(Sender, amount.ToBigEndian(), [SelfDestructSignature, contract.ToHash().ToHash256()]); + public static LogEntry CreateBurn(Address account, in UInt256 amount) => + new(Sender, amount.ToBigEndian(), [BurnSignature, account.ToHash().ToHash256()]); public static LogEntry CreateSimulateTransfer(Address from, Address to, in UInt256 amount) => CreateTransferInternal(Erc20Sender, from, to, amount); diff --git a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs index dea1ff1ebae..efb276f8db9 100644 --- a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs +++ b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs @@ -1500,11 +1500,11 @@ internal void AddTransferLog(Address from, Address to, in UInt256 value) } } - internal void AddSelfDestructLog(Address contract, in UInt256 value) + internal void AddBurnLog(Address account, in UInt256 value) { if (Spec.IsEip7708Enabled && !value.IsZero) { - AddLog(TransferLog.CreateSelfDestruct(contract, value)); + AddLog(TransferLog.CreateBurn(account, value)); } } }