Find bug in blocktime finder

This commit is contained in:
benbierens 2024-04-01 13:21:21 +02:00
parent a6b0b16909
commit be268ace42
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
2 changed files with 35 additions and 4 deletions

View File

@ -71,8 +71,6 @@ namespace CodexTests.BasicTests
.AsStorageNode() .AsStorageNode()
.AsValidator())); .AsValidator()));
AssertBalance(contracts, seller, Is.EqualTo(sellerInitialBalance));
var availability = new StorageAvailability( var availability = new StorageAvailability(
totalSpace: 10.GB(), totalSpace: 10.GB(),
maxDuration: TimeSpan.FromMinutes(30), maxDuration: TimeSpan.FromMinutes(30),
@ -90,8 +88,6 @@ namespace CodexTests.BasicTests
.WithAccount(myAccount) .WithAccount(myAccount)
.WithInitial(10.Eth(), buyerInitialBalance))); .WithInitial(10.Eth(), buyerInitialBalance)));
AssertBalance(contracts, buyer, Is.EqualTo(buyerInitialBalance));
var contentId = buyer.UploadFile(testFile); var contentId = buyer.UploadFile(testFile);
var purchase = new StoragePurchaseRequest(contentId) var purchase = new StoragePurchaseRequest(contentId)

View File

@ -117,6 +117,41 @@ namespace FrameworkTests.NethereumWorkflow
Assert.That(notFound, Is.Null); Assert.That(notFound, Is.Null);
} }
[Test]
public void FailsToFindBlockBeforeFrontOfChain_history()
{
var first = blocks.First().Value;
var notFound = finder.GetHighestBlockNumberBefore(first.JustBefore);
Assert.That(notFound, Is.Null);
}
[Test]
public void FailsToFindBlockAfterTailOfChain_future()
{
var last = blocks.Last().Value;
var notFound = finder.GetLowestBlockNumberAfter(last.JustAfter);
Assert.That(notFound, Is.Null);
}
[Test]
public void RunThrough()
{
foreach (var pair in blocks)
{
finder.GetHighestBlockNumberBefore(pair.Value.JustBefore);
finder.GetHighestBlockNumberBefore(pair.Value.Time);
finder.GetHighestBlockNumberBefore(pair.Value.JustAfter);
finder.GetLowestBlockNumberAfter(pair.Value.JustBefore);
finder.GetLowestBlockNumberAfter(pair.Value.Time);
finder.GetLowestBlockNumberAfter(pair.Value.JustAfter);
}
}
} }
public class Block public class Block