diff --git a/src/Nethermind/Nethermind.Facade/Eth/BlockForRpc.cs b/src/Nethermind/Nethermind.Facade/Eth/BlockForRpc.cs index 6bafdd3d1667..9180c47237ff 100644 --- a/src/Nethermind/Nethermind.Facade/Eth/BlockForRpc.cs +++ b/src/Nethermind/Nethermind.Facade/Eth/BlockForRpc.cs @@ -18,14 +18,13 @@ namespace Nethermind.Facade.Eth; public class BlockForRpc { private static readonly BlockDecoder _blockDecoder = new(); - private readonly bool _isAuRaBlock; public BlockForRpc() { } [SkipLocalsInit] public BlockForRpc(Block block, bool includeFullTransactionData, ISpecProvider specProvider, bool skipTxs = false) { - _isAuRaBlock = block.Header.AuRaSignature is not null; + bool isAuRaBlock = block.Header.AuRaSignature is not null; Difficulty = block.Difficulty; ExtraData = block.ExtraData; GasLimit = block.GasLimit; @@ -33,7 +32,7 @@ public BlockForRpc(Block block, bool includeFullTransactionData, ISpecProvider s Hash = block.Hash; LogsBloom = block.Bloom; Miner = block.Beneficiary; - if (!_isAuRaBlock) + if (!isAuRaBlock) { MixHash = block.MixHash; Nonce = new byte[8]; @@ -106,29 +105,23 @@ public BlockForRpc(Block block, bool includeFullTransactionData, ISpecProvider s [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public Bloom LogsBloom { get; set; } public Address Miner { get; set; } - public Hash256 MixHash { get; set; } - - public bool ShouldSerializeMixHash() => !_isAuRaBlock && MixHash is not null; + public Hash256? MixHash { get; set; } [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public byte[] Nonce { get; set; } - - public bool ShouldSerializeNonce() => !_isAuRaBlock; + public byte[]? Nonce { get; set; } [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public long? Number { get; set; } public Hash256 ParentHash { get; set; } public Hash256 ReceiptsRoot { get; set; } public Hash256 Sha3Uncles { get; set; } - public byte[] Signature { get; set; } - public bool ShouldSerializeSignature() => _isAuRaBlock; + public byte[]? Signature { get; set; } public long Size { get; set; } public Hash256 StateRoot { get; set; } [JsonConverter(typeof(NullableRawLongConverter))] public long? Step { get; set; } [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public UInt256? TotalDifficulty { get; set; } - public bool ShouldSerializeStep() => _isAuRaBlock; public UInt256 Timestamp { get; set; } public UInt256? BaseFeePerGas { get; set; } diff --git a/src/Nethermind/Nethermind.Optimism/CL/L2Api.cs b/src/Nethermind/Nethermind.Optimism/CL/L2Api.cs index 41951eeec669..8affb3fc6d2a 100644 --- a/src/Nethermind/Nethermind.Optimism/CL/L2Api.cs +++ b/src/Nethermind/Nethermind.Optimism/CL/L2Api.cs @@ -52,7 +52,7 @@ private PayloadAttributesRef PayloadAttributesFromBlockForRpc(BlockForRpc? block EIP1559Params = block.ExtraData.Length == 0 ? null : block.ExtraData[1..], GasLimit = block.GasLimit, ParentBeaconBlockRoot = block.ParentBeaconBlockRoot, - PrevRandao = block.MixHash, + PrevRandao = block.MixHash!, SuggestedFeeRecipient = block.Miner, Timestamp = block.Timestamp.ToUInt64(null), Withdrawals = block.Withdrawals?.ToArray()