2025-08-15 12:02:33 +02:00
|
|
|
|
using Logging;
|
|
|
|
|
|
using Utils;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CodexContractsPlugin.ChainMonitor
|
|
|
|
|
|
{
|
|
|
|
|
|
public class PeriodReport
|
|
|
|
|
|
{
|
|
|
|
|
|
public PeriodReport(ProofPeriod period, PeriodRequiredProof[] required, FunctionCallReport[] functionCalls)
|
|
|
|
|
|
{
|
|
|
|
|
|
Period = period;
|
|
|
|
|
|
Required = required;
|
|
|
|
|
|
FunctionCalls = functionCalls;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ProofPeriod Period { get; }
|
|
|
|
|
|
public PeriodRequiredProof[] Required { get; }
|
|
|
|
|
|
public FunctionCallReport[] FunctionCalls { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public void Log(ILog log)
|
|
|
|
|
|
{
|
|
|
|
|
|
log.Log($"Period report: {Period}");
|
|
|
|
|
|
foreach (var r in Required)
|
|
|
|
|
|
{
|
|
|
|
|
|
log.Log($" Required: {r.Describe()}");
|
|
|
|
|
|
}
|
2025-08-21 09:54:46 +02:00
|
|
|
|
log.Log($" - Calls: {FunctionCalls.Length}");
|
2025-08-15 12:02:33 +02:00
|
|
|
|
foreach (var f in FunctionCalls)
|
|
|
|
|
|
{
|
|
|
|
|
|
log.Log($" - {f.Describe()}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class FunctionCallReport
|
|
|
|
|
|
{
|
2025-08-21 09:54:46 +02:00
|
|
|
|
public FunctionCallReport(DateTime utc, ulong blockNumber, string name, string payload)
|
2025-08-15 12:02:33 +02:00
|
|
|
|
{
|
|
|
|
|
|
Utc = utc;
|
2025-08-21 09:54:46 +02:00
|
|
|
|
BlockNumber = blockNumber;
|
2025-08-15 12:02:33 +02:00
|
|
|
|
Name = name;
|
|
|
|
|
|
Payload = payload;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DateTime Utc { get; }
|
2025-08-21 09:54:46 +02:00
|
|
|
|
public ulong BlockNumber { get; }
|
2025-08-15 12:02:33 +02:00
|
|
|
|
public string Name { get; }
|
|
|
|
|
|
public string Payload { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public string Describe()
|
|
|
|
|
|
{
|
2025-08-21 09:54:46 +02:00
|
|
|
|
return $"[{Time.FormatTimestamp(Utc)}][{BlockNumber}] {Name} = \"{Payload}\"";
|
2025-08-15 12:02:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|