Trying to log slot reservation calls

This commit is contained in:
ThatBen 2025-05-07 15:20:24 +02:00
parent 69cf4283fa
commit b3d35933a8
No known key found for this signature in database
GPG Key ID: E020A7DDCD52E1AB
5 changed files with 7 additions and 40 deletions

View File

@ -10,7 +10,7 @@ namespace CodexPlugin
public class ApiChecker
{
// <INSERT-OPENAPI-YAML-HASH>
private const string OpenApiYamlHash = "FD-C8-0F-19-5E-14-09-C9-05-93-17-4A-97-50-1D-7E-37-50-B2-30-B2-E6-66-37-23-FA-35-F5-AB-A0-C6-BD";
private const string OpenApiYamlHash = "06-B9-41-E8-C8-6C-DE-01-86-83-F3-9A-E4-AC-E7-30-D9-E6-64-60-E0-21-81-9E-4E-C5-93-77-2C-71-79-14";
private const string OpenApiFilePath = "/codex/openapi.yaml";
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";

View File

@ -31,8 +31,7 @@ namespace GethPlugin
List<EventLog<TEvent>> GetEvents<TEvent>(string address, TimeRange timeRange) where TEvent : IEventDTO, new();
BlockInterval ConvertTimeRangeToBlockRange(TimeRange timeRange);
BlockTimeEntry GetBlockForNumber(ulong number);
void IterateFunctionCalls<TFunc>(BlockInterval blockInterval, Action<TFunc> onCall) where TFunc : FunctionMessage;
void IterateFunctionCalls<TFunc>(BlockInterval blockInterval, Action<TFunc> onCall) where TFunc : FunctionMessage, new();
}
public class DeploymentGethNode : BaseGethNode, IGethNode
@ -199,8 +198,11 @@ namespace GethPlugin
foreach (var t in blk.Transactions)
{
var func = t.DecodeTransactionToFunctionMessage<TFunc>();
if (func != null) onCall(func);
if (t.IsTransactionForFunctionMessage<TFunc>())
{
var func = t.DecodeTransactionToFunctionMessage<TFunc>();
if (func != null) onCall(func);
}
}
}
}

View File

@ -39,7 +39,6 @@ namespace CodexReleaseTests.MarketTests
request.WaitForStorageContractSubmitted();
AssertContractIsOnChain(request);
WaitUntilSlotReservationsFull(request);
WaitForContractStarted(request);
AssertContractSlotsAreFilledByHosts(request, hosts);

View File

@ -345,39 +345,6 @@ namespace CodexReleaseTests.MarketTests
}, nameof(AssertContractIsOnChain));
}
protected void WaitUntilSlotReservationsFull(IStoragePurchaseContract contract)
{
var requestId = contract.PurchaseId.ToLowerInvariant();
var slots = contract.Purchase.MinRequiredNumberOfNodes;
var timeout = TimeSpan.FromMinutes(1.0);
var start = DateTime.UtcNow;
var fullIndices = new List<ulong>();
while (DateTime.UtcNow - start < timeout)
{
Thread.Sleep(TimeSpan.FromSeconds(3.0));
var fullEvents = GetContracts().GetEvents(GetTestRunTimeRange()).GetSlotReservationsFullEvents();
foreach (var e in fullEvents)
{
if (e.RequestId.ToHex().ToLowerInvariant() == requestId)
{
if (!fullIndices.Contains(e.SlotIndex))
{
fullIndices.Add(e.SlotIndex);
if (fullIndices.Count == slots) return;
}
}
}
}
Assert.Fail(
$"Slot reservations were not full after {Time.FormatDuration(timeout)}." +
$" Slots: {slots} Filled: {string.Join(",", fullIndices.Select(i => i.ToString()))}"
);
}
protected void AssertOnChainEvents(Action<ICodexContractsEvents> onEvents, string description)
{
Time.Retry(() =>

View File

@ -57,7 +57,6 @@ namespace CodexReleaseTests.MarketTests
AssertContractIsOnChain(r);
});
All(requests, WaitUntilSlotReservationsFull);
All(requests, WaitForContractStarted);
// for the time being, we're only interested in whether these contracts start.