Skip to content

Commit 1dd6eba

Browse files
committed
More fixes
1 parent fd24b8d commit 1dd6eba

File tree

9 files changed

+27
-16
lines changed

9 files changed

+27
-16
lines changed

src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.V5.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public async Task GetBlobsV2_should_throw_if_more_than_128_requested_blobs([Valu
5959
else
6060
{
6161
result.Result.Should().Be(Result.Success);
62-
result.Data.Should().BeEquivalentTo(ArraySegment<BlobAndProofV2>.Empty);
62+
result.Data.Should().BeNull();
6363
}
6464
}
6565

@@ -118,7 +118,7 @@ public async Task GetBlobsV2_should_return_empty_array_when_blobs_not_found([Val
118118
ResultWrapper<IEnumerable<BlobAndProofV2>?> result = await rpcModule.engine_getBlobsV2(blobTx.BlobVersionedHashes!);
119119

120120
result.Result.Should().Be(Result.Success);
121-
result.Data.Should().BeEquivalentTo(ArraySegment<BlobAndProofV2>.Empty);
121+
result.Data.Should().BeNull();
122122
}
123123

124124
[Test]
@@ -151,7 +151,7 @@ public async Task GetBlobsV2_should_return_empty_array_when_only_some_blobs_foun
151151
if (multiplier > 1)
152152
{
153153
result.Result.Should().Be(Result.Success);
154-
result.Data.Should().BeEquivalentTo(ArraySegment<BlobAndProofV2>.Empty);
154+
result.Data.Should().BeNull();
155155
}
156156
else
157157
{

src/Nethermind/Nethermind.Merge.Plugin/Data/GetPayloadV3Result.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class GetPayloadV3Result<TVersionedExecutionPayload>(Block block, UInt256
1515

1616
public override bool ValidateFork(ISpecProvider specProvider)
1717
{
18-
IReleaseSpec spec = specProvider.GetSpec(new ForkActivation(ExecutionPayload.BlockNumber, ExecutionPayload.Timestamp));
18+
IReleaseSpec spec = specProvider.GetSpec(ExecutionPayload.BlockNumber, ExecutionPayload.Timestamp);
1919
return spec.IsEip4844Enabled && !spec.IsEip7623Enabled;
2020
}
2121

src/Nethermind/Nethermind.Merge.Plugin/Data/GetPayloadV5Result.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ public class GetPayloadV5Result(Block block, UInt256 blockFees, BlobsBundleV2 bl
1313

1414
public override string ToString() =>
1515
$"{{ExecutionPayload: {ExecutionPayload}, Fees: {BlockValue}, BlobsBundle blobs count: {BlobsBundle.Blobs.Length}, ShouldOverrideBuilder {ShouldOverrideBuilder}, ExecutionRequests count : {ExecutionRequests?.Length}}}";
16-
public override bool ValidateFork(ISpecProvider specProvider) => specProvider.GetSpec(new ForkActivation(ExecutionPayload.BlockNumber, ExecutionPayload.Timestamp)).IsEip7594Enabled;
16+
17+
public override bool ValidateFork(ISpecProvider specProvider) => specProvider.GetSpec(ExecutionPayload.BlockNumber, ExecutionPayload.Timestamp).IsEip7594Enabled;
1718
}

src/Nethermind/Nethermind.Merge.Plugin/Handlers/GetBlobsHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class GetBlobsHandler(ITxPool txPool) : IAsyncHandler<byte[][], IEnumerab
3131

3232
foreach (byte[] requestedBlobVersionedHash in request)
3333
{
34-
if (txPool.TryGetBlobAndProof(requestedBlobVersionedHash, out byte[]? blob, out byte[]? proof))
34+
if (txPool.TryGetBlobAndProofV0(requestedBlobVersionedHash, out byte[]? blob, out byte[]? proof))
3535
{
3636
Metrics.NumberOfSentBlobs++;
3737
yield return new BlobAndProofV1(blob, proof);

src/Nethermind/Nethermind.TxPool.Test/TxPoolTests.Blobs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ public void should_handle_indexing_blobs_when_adding_txs_in_parallel([Values(tru
819819

820820
for (int j = 0; j < 100; j++)
821821
{
822-
blobPool.TryGetBlobAndProof(expectedBlobVersionedHash.ToBytes(), out _, out _, ProofVersion.V0, TxPool.SelectProofV0).Should().BeTrue();
822+
blobPool.TryGetBlobAndProofV0(expectedBlobVersionedHash.ToBytes(), out _, out _).Should().BeTrue();
823823
}
824824

825825
// removing 50% of txs

src/Nethermind/Nethermind.TxPool/Collections/BlobTxDistinctSortedPool.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited
22
// SPDX-License-Identifier: LGPL-3.0-only
33

4+
using CkzgLib;
5+
using DotNetty.Common.Utilities;
46
using Nethermind.Core;
7+
using Nethermind.Core.Collections;
58
using Nethermind.Core.Crypto;
69
using Nethermind.Core.Extensions;
710
using Nethermind.Core.Threading;
@@ -24,7 +27,17 @@ public class BlobTxDistinctSortedPool(int capacity, IComparer<Transaction> compa
2427
protected override IComparer<Transaction> GetReplacementComparer(IComparer<Transaction> comparer)
2528
=> comparer.GetBlobReplacementComparer();
2629

27-
public bool TryGetBlobAndProof<TProof>(
30+
public bool TryGetBlobAndProofV0(
31+
byte[] requestedBlobVersionedHash,
32+
[NotNullWhen(true)] out byte[]? blob,
33+
[NotNullWhen(true)] out byte[]? proof) => TryGetBlobAndProof(requestedBlobVersionedHash, out blob, out proof, ProofVersion.V0, (proofs, index) => proofs[index]);
34+
35+
public bool TryGetBlobAndProofV1(
36+
byte[] requestedBlobVersionedHash,
37+
[NotNullWhen(true)] out byte[]? blob,
38+
[NotNullWhen(true)] out byte[][]? proof) => TryGetBlobAndProof<byte[][]>(requestedBlobVersionedHash, out blob, out proof, ProofVersion.V1, (proofs, index) => [.. proofs.Slice(Ckzg.CellsPerExtBlob * index, Ckzg.CellsPerExtBlob)]);
39+
40+
private bool TryGetBlobAndProof<TProof>(
2841
byte[] requestedBlobVersionedHash,
2942
[NotNullWhen(true)] out byte[]? blob,
3043
[NotNullWhen(true)] out TProof? proof,

src/Nethermind/Nethermind.TxPool/ITxPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public interface ITxPool
4545
bool IsKnown(Hash256 hash);
4646
bool TryGetPendingTransaction(Hash256 hash, [NotNullWhen(true)] out Transaction? transaction);
4747
bool TryGetPendingBlobTransaction(Hash256 hash, [NotNullWhen(true)] out Transaction? blobTransaction);
48-
bool TryGetBlobAndProof(byte[] blobVersionedHash,
48+
bool TryGetBlobAndProofV0(byte[] blobVersionedHash,
4949
[NotNullWhen(true)] out byte[]? blob,
5050
[NotNullWhen(true)] out byte[]? proof);
5151
bool TryGetBlobAndProofV1(byte[] blobVersionedHash,

src/Nethermind/Nethermind.TxPool/NullTxPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public bool TryGetPendingBlobTransaction(Hash256 hash, [NotNullWhen(true)] out T
6363
return false;
6464
}
6565

66-
public bool TryGetBlobAndProof(byte[] blobVersionedHash,
66+
public bool TryGetBlobAndProofV0(byte[] blobVersionedHash,
6767
[NotNullWhen(true)] out byte[]? blob,
6868
[NotNullWhen(true)] out byte[]? proof)
6969
{

src/Nethermind/Nethermind.TxPool/TxPool.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,16 @@ public Transaction[] GetPendingTransactionsBySender(Address address) =>
203203
public int GetPendingBlobTransactionsCount() => _blobTransactions.Count;
204204

205205

206-
internal static byte[] SelectProofV0(byte[][] proofs, int index) => proofs[index];
207206

208-
public bool TryGetBlobAndProof(byte[] blobVersionedHash,
207+
public bool TryGetBlobAndProofV0(byte[] blobVersionedHash,
209208
[NotNullWhen(true)] out byte[]? blob,
210209
[NotNullWhen(true)] out byte[]? proof)
211-
=> _blobTransactions.TryGetBlobAndProof(blobVersionedHash, out blob, out proof, ProofVersion.V0, SelectProofV0);
212-
213-
internal static byte[][] SelectProofV1(byte[][] proofs, int index) => [.. proofs.Slice(Ckzg.CellsPerExtBlob * index, Ckzg.CellsPerExtBlob)];
210+
=> _blobTransactions.TryGetBlobAndProofV0(blobVersionedHash, out blob, out proof);
214211

215212
public bool TryGetBlobAndProofV1(byte[] blobVersionedHash,
216213
[NotNullWhen(true)] out byte[]? blob,
217214
[NotNullWhen(true)] out byte[][]? cellProofs)
218-
=> _blobTransactions.TryGetBlobAndProof(blobVersionedHash, out blob, out cellProofs, ProofVersion.V1, SelectProofV1);
215+
=> _blobTransactions.TryGetBlobAndProofV1(blobVersionedHash, out blob, out cellProofs);
219216

220217
public int GetBlobCounts(byte[][] blobVersionedHashes)
221218
=> _blobTransactions.GetBlobCounts(blobVersionedHashes);

0 commit comments

Comments
 (0)