Skip to content

Commit

Permalink
format files
Browse files Browse the repository at this point in the history
  • Loading branch information
rjnrohit committed Aug 16, 2024
1 parent 7707396 commit cbd73ae
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.BlockValidation/BlockValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Nethermind.BlockValidation;

public class BlockValidation: INethermindPlugin
public class BlockValidation : INethermindPlugin
{
public virtual string Name => "BlockValidation";
public virtual string Description => "BlockValidation";
Expand All @@ -23,4 +23,4 @@ public Task Init(INethermindApi api)
}

public ValueTask DisposeAsync() => ValueTask.CompletedTask;
}
}
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.BlockValidation/Data/BidTrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Nethermind.BlockValidation.Data;

public readonly struct BidTrace
public readonly struct BidTrace
{
public ulong Slot { get; }
public Hash256 ParentHash { get; }
Expand All @@ -18,4 +18,4 @@ public readonly struct BidTrace
public long GasLimit { get; }
public long GasUsed { get; }
public UInt256 Value { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public static class BlockValidationStatus
/// The submissions are valid.
/// </summary>
public const string Valid = "Valid";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public class BuilderBlockValidationRequest
public ulong RegisterGasLimit { get; set; }

public SubmitBlockRequest BlockRequest { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@

namespace Nethermind.BlockValidation.Data;

public readonly struct SubmitBlockRequest {
public readonly struct SubmitBlockRequest
{
private readonly ExecutionPayload _executionPayload;
private readonly BlobsBundleV1 _blobsBundle;

public SubmitBlockRequest(ExecutionPayload executionPayload, BlobsBundleV1 blobsBundle, BidTrace message) {
public SubmitBlockRequest(ExecutionPayload executionPayload, BlobsBundleV1 blobsBundle, BidTrace message)
{
_executionPayload = executionPayload;
_blobsBundle = blobsBundle;
Message = message;
}
public readonly ExecutionPayload ExecutionPayload => _executionPayload;
public readonly BlobsBundleV1 BlobsBundle => _blobsBundle;
public BidTrace Message { get;}
}
public BidTrace Message { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Nethermind.BlockValidation;

public class FlashbotsRpcModule: IFlashbotsRpcModule
public class FlashbotsRpcModule : IFlashbotsRpcModule
{
private readonly ValidateSubmissionHandler _validateSubmissionHandler;

Expand All @@ -17,7 +17,7 @@ public FlashbotsRpcModule(ValidateSubmissionHandler validateSubmissionHandler)
_validateSubmissionHandler = validateSubmissionHandler;
}

Task<ResultWrapper<BlockValidationResult>> IFlashbotsRpcModule.flashbots_validateBuilderSubmissionV3(BuilderBlockValidationRequest @params) =>
Task<ResultWrapper<BlockValidationResult>> IFlashbotsRpcModule.flashbots_validateBuilderSubmissionV3(BuilderBlockValidationRequest @params) =>
_validateSubmissionHandler.ValidateSubmission(@params);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ private bool ValidateBlock(Block block, BidTrace message, ulong registerGasLimit
return false;
}

if(message.GasLimit != block.GasLimit)
if (message.GasLimit != block.GasLimit)
{
error = $"Gas limit mismatch. Expected {message.GasLimit} but got {block.GasLimit}";
return false;
}

if(message.GasUsed != block.GasUsed)
if (message.GasUsed != block.GasUsed)
{
error = $"Gas used mismatch. Expected {message.GasUsed} but got {block.GasUsed}";
return false;
}

return true;
}

public Task<ResultWrapper<BlockValidationResult>> ValidateSubmission(BuilderBlockValidationRequest request)
{
ExecutionPayload payload = request.BlockRequest.ExecutionPayload;
Expand All @@ -59,10 +59,10 @@ public Task<ResultWrapper<BlockValidationResult>> ValidateSubmission(BuilderBloc
string payloadStr = $"BuilderBlock: {payload}";

_logger.Info($"blobs bundle blobs {blobsBundle.Blobs.Length} commits {blobsBundle.Commitments.Length} proofs {blobsBundle.Proofs.Length}");
if(!payload.TryGetBlock(out Block? block))

if (!payload.TryGetBlock(out Block? block))
{
if(_logger.IsWarn) _logger.Warn($"Invalid block. Result of {payloadStr}.");
if (_logger.IsWarn) _logger.Warn($"Invalid block. Result of {payloadStr}.");
return BlockValidationResult.Invalid($"Block {payload} coud not be parsed as a block");
}

Expand Down

0 comments on commit cbd73ae

Please sign in to comment.