Skip to content
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

standardize BlobTxMissingBlobs error message #8129

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static string BlobTxGasLimitExceeded(ulong totalDataGas, ulong maxBlobGas
$"BlobTxGasLimitExceeded: Transaction's totalDataGas={totalDataGas} exceeded MaxBlobGas per transaction={maxBlobGas}.";

public const string BlobTxMissingBlobs =
"BlobTxMissingBlobs: Blob transaction must have blobs.";
"blob transaction missing blob hashes";

public const string MissingBlobVersionedHash =
"MissingBlobVersionedHash: Must be set.";
Expand Down
9 changes: 3 additions & 6 deletions src/Nethermind/Nethermind.Facade/BlockchainBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ public CallOutput Call(BlockHeader header, Transaction tx, Dictionary<Address, A
TransactionResult tryCallResult = TryCallAndRestore(scope, header, tx, false,
callOutputTracer.WithCancellation(cancellationToken));

return new CallOutput
return new CallOutput(tryCallResult.Success ? callOutputTracer.Error : tryCallResult.Error, tx.GasLimit)
{
Error = tryCallResult.Success ? callOutputTracer.Error : tryCallResult.Error,
GasSpent = callOutputTracer.GasSpent,
OutputData = callOutputTracer.ReturnValue,
InputError = !tryCallResult.Success
Expand Down Expand Up @@ -202,9 +201,8 @@ public CallOutput EstimateGas(BlockHeader header, Transaction tx, int errorMargi
GasEstimator gasEstimator = new(scope.TransactionProcessor, scope.WorldState, _specProvider, _blocksConfig);
long estimate = gasEstimator.Estimate(tx, header, estimateGasTracer, errorMargin, cancellationToken);

return new CallOutput
return new CallOutput(tryCallResult.Success ? estimateGasTracer.Error : tryCallResult.Error, tx.GasLimit)
{
Error = tryCallResult.Success ? estimateGasTracer.Error : tryCallResult.Error,
GasSpent = estimate,
InputError = !tryCallResult.Success
};
Expand All @@ -221,9 +219,8 @@ public CallOutput CreateAccessList(BlockHeader header, Transaction tx, Cancellat
TransactionResult tryCallResult = TryCallAndRestore(_processingEnv.Build(header.StateRoot!), header, tx, false,
new CompositeTxTracer(callOutputTracer, accessTxTracer).WithCancellation(cancellationToken));

return new CallOutput
return new CallOutput(tryCallResult.Success ? callOutputTracer.Error : tryCallResult.Error, tx.GasLimit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer explicit setting the Error property as it was. Just create here a helper method to create error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created a helper function ConstructErrorMessage

{
Error = tryCallResult.Success ? callOutputTracer.Error : tryCallResult.Error,
GasSpent = accessTxTracer.GasSpent,
OperationGas = callOutputTracer.OperationGas,
OutputData = callOutputTracer.ReturnValue,
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Facade/CallOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace Nethermind.Facade;

public class CallOutput
public class CallOutput(string? error, long gasLimit)
{
public string? Error { get; set; }
public string? Error => error == null ? error : $"err: {error} (supplied gas {gasLimit})";

public byte[] OutputData { get; set; } = [];

Expand Down
Loading