mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-07 16:03:07 +00:00
Logging of entire chain state as seen by rewarder bot
This commit is contained in:
parent
ba9e4b098f
commit
ccc6c815e4
@ -56,6 +56,7 @@ namespace CodexDiscordBotPlugin
|
|||||||
private RunningPod StartRewarderContainer(IStartupWorkflow workflow, RewarderBotStartupConfig config)
|
private RunningPod StartRewarderContainer(IStartupWorkflow workflow, RewarderBotStartupConfig config)
|
||||||
{
|
{
|
||||||
var startupConfig = new StartupConfig();
|
var startupConfig = new StartupConfig();
|
||||||
|
startupConfig.NameOverride = config.Name;
|
||||||
startupConfig.Add(config);
|
startupConfig.Add(config);
|
||||||
return workflow.Start(1, new RewarderBotContainerRecipe(), startupConfig).WaitForOnline();
|
return workflow.Start(1, new RewarderBotContainerRecipe(), startupConfig).WaitForOnline();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,8 +27,9 @@
|
|||||||
|
|
||||||
public class RewarderBotStartupConfig
|
public class RewarderBotStartupConfig
|
||||||
{
|
{
|
||||||
public RewarderBotStartupConfig(string discordBotHost, int discordBotPort, int intervalMinutes, DateTime historyStartUtc, DiscordBotGethInfo gethInfo, string? dataPath)
|
public RewarderBotStartupConfig(string name, string discordBotHost, int discordBotPort, int intervalMinutes, DateTime historyStartUtc, DiscordBotGethInfo gethInfo, string? dataPath)
|
||||||
{
|
{
|
||||||
|
Name = name;
|
||||||
DiscordBotHost = discordBotHost;
|
DiscordBotHost = discordBotHost;
|
||||||
DiscordBotPort = discordBotPort;
|
DiscordBotPort = discordBotPort;
|
||||||
IntervalMinutes = intervalMinutes;
|
IntervalMinutes = intervalMinutes;
|
||||||
@ -37,6 +38,7 @@
|
|||||||
DataPath = dataPath;
|
DataPath = dataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Name { get; }
|
||||||
public string DiscordBotHost { get; }
|
public string DiscordBotHost { get; }
|
||||||
public int DiscordBotPort { get; }
|
public int DiscordBotPort { get; }
|
||||||
public int IntervalMinutes { get; }
|
public int IntervalMinutes { get; }
|
||||||
|
|||||||
@ -121,6 +121,7 @@ namespace CodexTests.UtilityTests
|
|||||||
private void StartRewarderBot(DiscordBotGethInfo gethInfo, RunningContainer botContainer)
|
private void StartRewarderBot(DiscordBotGethInfo gethInfo, RunningContainer botContainer)
|
||||||
{
|
{
|
||||||
Ci.DeployRewarderBot(new RewarderBotStartupConfig(
|
Ci.DeployRewarderBot(new RewarderBotStartupConfig(
|
||||||
|
name: "rewarder-bot",
|
||||||
discordBotHost: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Host,
|
discordBotHost: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Host,
|
||||||
discordBotPort: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Port,
|
discordBotPort: botContainer.GetInternalAddress(DiscordBotContainerRecipe.RewardsPort).Port,
|
||||||
intervalMinutes: Convert.ToInt32(Math.Round(rewarderInterval.TotalMinutes)),
|
intervalMinutes: Convert.ToInt32(Math.Round(rewarderInterval.TotalMinutes)),
|
||||||
@ -145,7 +146,7 @@ namespace CodexTests.UtilityTests
|
|||||||
private RunningContainer StartDiscordBot(DiscordBotGethInfo gethInfo)
|
private RunningContainer StartDiscordBot(DiscordBotGethInfo gethInfo)
|
||||||
{
|
{
|
||||||
var bot = Ci.DeployCodexDiscordBot(new DiscordBotStartupConfig(
|
var bot = Ci.DeployCodexDiscordBot(new DiscordBotStartupConfig(
|
||||||
name: "bot",
|
name: "discord-bot",
|
||||||
token: "aaa",
|
token: "aaa",
|
||||||
serverName: "ThatBen's server",
|
serverName: "ThatBen's server",
|
||||||
adminRoleName: "bottest-admins",
|
adminRoleName: "bottest-admins",
|
||||||
|
|||||||
@ -59,6 +59,17 @@ namespace TestNetRewarder
|
|||||||
public SlotFilledEventDTO[] SlotFilledEvents { get; }
|
public SlotFilledEventDTO[] SlotFilledEvents { get; }
|
||||||
public SlotFreedEventDTO[] SlotFreedEvents { get; }
|
public SlotFreedEventDTO[] SlotFreedEvents { get; }
|
||||||
|
|
||||||
|
public string EntireString()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
$"NewRequests: {JsonConvert.SerializeObject(NewRequests)}" +
|
||||||
|
$"FulfilledE: {JsonConvert.SerializeObject(RequestFulfilledEvents)}" +
|
||||||
|
$"CancelledE: {JsonConvert.SerializeObject(RequestCancelledEvents)}" +
|
||||||
|
$"FilledE: {JsonConvert.SerializeObject(SlotFilledEvents)}" +
|
||||||
|
$"FreedE: {JsonConvert.SerializeObject(SlotFreedEvents)}" +
|
||||||
|
$"Historic: {historicState.EntireString()}";
|
||||||
|
}
|
||||||
|
|
||||||
public string[] GenerateOverview()
|
public string[] GenerateOverview()
|
||||||
{
|
{
|
||||||
var entries = new List<StringBlockNumberPair>();
|
var entries = new List<StringBlockNumberPair>();
|
||||||
|
|||||||
@ -29,6 +29,11 @@ namespace TestNetRewarder
|
|||||||
r.State == RequestState.Failed
|
r.State == RequestState.Failed
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string EntireString()
|
||||||
|
{
|
||||||
|
return JsonConvert.SerializeObject(StorageRequests);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StorageRequest
|
public class StorageRequest
|
||||||
|
|||||||
@ -58,6 +58,8 @@ namespace TestNetRewarder
|
|||||||
|
|
||||||
private async Task ProcessChainState(ChainState chainState)
|
private async Task ProcessChainState(ChainState chainState)
|
||||||
{
|
{
|
||||||
|
log.Log($"Processing chain state: '{chainState.EntireString()}'");
|
||||||
|
|
||||||
var outgoingRewards = new List<RewardUsersCommand>();
|
var outgoingRewards = new List<RewardUsersCommand>();
|
||||||
foreach (var reward in rewardRepo.Rewards)
|
foreach (var reward in rewardRepo.Rewards)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user