-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix gas fees accounting in TransactionProcessor.Trace #5743
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using FluentAssertions; | ||
using Nethermind.Core; | ||
using Nethermind.Core.Test.Builders; | ||
using Nethermind.Evm.Tracing.ParityStyle; | ||
using Nethermind.Int256; | ||
using Nethermind.Specs; | ||
using NUnit.Framework; | ||
|
||
namespace Nethermind.Evm.Test; | ||
|
||
public class TransactionProcessorTraceTest : VirtualMachineTestsBase | ||
{ | ||
protected override long BlockNumber => MainnetSpecProvider.GrayGlacierBlockNumber; | ||
protected override ulong Timestamp => MainnetSpecProvider.ShanghaiBlockTimestamp; | ||
|
||
[TestCase(21000)] | ||
[TestCase(50000)] | ||
public void Traces_gas_fess_properly(long gasLimit) | ||
{ | ||
(Block block, Transaction transaction) = PrepareTx(BlockNumber, gasLimit); | ||
ParityLikeTxTracer tracer = new(block, transaction, ParityTraceTypes.All); | ||
_processor.Trace(transaction, block.Header, tracer); | ||
var senderBalance = tracer.BuildResult().StateChanges[TestItem.AddressA].Balance; | ||
(senderBalance.Before - senderBalance.After).Should().Be((UInt256)21000 + transaction.Value); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,7 +241,7 @@ private void Execute(Transaction transaction, BlockHeader block, ITxTracer txTra | |
} | ||
} | ||
|
||
UInt256 senderReservedGasPayment = noValidation ? UInt256.Zero : (ulong)gasLimit * effectiveGasPrice; | ||
UInt256 senderReservedGasPayment = (ulong)gasLimit * effectiveGasPrice; | ||
deffrian marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you write an explanation for TransactionProcessor changes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How it works right now:
After the fix:
Another issue: |
||
|
||
if (notSystemTransaction) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark it nullable