Adds will-be-required to log

This commit is contained in:
Ben 2025-08-25 11:15:00 +02:00
parent e03f5982d3
commit 74dbdfba17
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
2 changed files with 23 additions and 2 deletions

View File

@ -32,6 +32,7 @@ namespace CodexContractsPlugin
TimeRange GetPeriodTimeRange(ulong periodNumber);
void WaitUntilNextPeriod();
bool IsProofRequired(byte[] requestId, decimal slotIndex);
bool WillProofBeRequired(byte[] requestId, decimal slotIndex);
byte[] GetSlotId(byte[] requestId, decimal slotIndex);
ICodexContracts WithDifferentGeth(IGethNode node);
@ -172,6 +173,12 @@ namespace CodexContractsPlugin
return IsProofRequired(slotId);
}
public bool WillProofBeRequired(byte[] requestId, decimal slotIndex)
{
var slotId = GetSlotId(requestId, slotIndex);
return WillProofBeRequired(slotId);
}
public ICodexContracts WithDifferentGeth(IGethNode node)
{
return new CodexContractsAccess(log, node, Deployment);
@ -198,6 +205,16 @@ namespace CodexContractsPlugin
return result.ReturnValue1;
}
private bool WillProofBeRequired(byte[] slotId)
{
var func = new WillProofBeRequiredFunction
{
Id = slotId
};
var result = gethNode.Call<WillProofBeRequiredFunction, WillProofBeRequiredOutputDTO>(Deployment.MarketplaceAddress, func);
return result.ReturnValue1;
}
private ContractInteractions StartInteraction()
{
return new ContractInteractions(log, gethNode);

View File

@ -51,16 +51,20 @@ namespace CodexReleaseTests.MarketTests
{
Thread.Sleep(TimeSpan.FromSeconds(1));
var requiredSlotIndices = new List<int>();
var willRequireSlotIndices = new List<int>();
for (var i = 0; i < numSlots; i++)
{
if (GetContracts().IsProofRequired(requestId, i)) requiredSlotIndices.Add(i);
if (GetContracts().WillProofBeRequired(requestId, i)) willRequireSlotIndices.Add(i);
}
var periodNumber = GetContracts().GetPeriodNumber(DateTime.UtcNow);
var blockNumber = GetGeth().GetSyncedBlockNumber();
Log($"[{blockNumber?.ToString().PadLeft(4, '0')}]" +
$"{periodNumber.ToString().PadLeft(12, '0')} => " +
$"{string.Join(",", requiredSlotIndices.Select(i => i.ToString()))}");
$"{periodNumber.ToString().PadLeft(12, '0')} => Required now: " +
$"[{string.Join(",", requiredSlotIndices.Select(i => i.ToString()))}] " +
$"Will be required: " +
$"[{string.Join(",", willRequireSlotIndices.Select(i => i.ToString()))}]");
//var num = currentPeriod.PeriodNumber;
//if (!map.ContainsKey(num))