From e0755a11015eb47aae2e6ac29954acb1ca462513 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 4 Nov 2024 12:21:39 +0100 Subject: [PATCH] Updates to 0.1.8. Fixes issue in blockchain monitor --- Framework/Utils/BlockInterval.cs | 3 ++- ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs | 3 ++- ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Framework/Utils/BlockInterval.cs b/Framework/Utils/BlockInterval.cs index 64430488..4a5b2ee9 100644 --- a/Framework/Utils/BlockInterval.cs +++ b/Framework/Utils/BlockInterval.cs @@ -15,12 +15,13 @@ To = from; } TimeRange = timeRange; + NumberOfBlocks = (To - From) + 1; } public ulong From { get; } public ulong To { get; } public TimeRange TimeRange { get; } - public ulong NumberOfBlocks => To - From; + public ulong NumberOfBlocks { get; } public override string ToString() { diff --git a/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs b/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs index 30756c4c..a5f73c85 100644 --- a/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs +++ b/ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs @@ -75,11 +75,12 @@ namespace CodexContractsPlugin.ChainMonitor throw new Exception(msg); } - log.Log($"ChainState updating: {events.BlockInterval}"); + log.Log($"ChainState updating: {events.BlockInterval} = {events.All.Length} events."); // Run through each block and apply the events to the state in order. var span = events.BlockInterval.TimeRange.Duration; var numBlocks = events.BlockInterval.NumberOfBlocks; + if (numBlocks == 0) return; var spanPerBlock = span / numBlocks; var eventUtc = events.BlockInterval.TimeRange.From; diff --git a/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs b/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs index 9dfcf2cf..be6329c1 100644 --- a/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs +++ b/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs @@ -7,7 +7,7 @@ namespace CodexPlugin { public class CodexContainerRecipe : ContainerRecipeFactory { - private const string DefaultDockerImage = "codexstorage/nim-codex:latest-dist-tests"; + private const string DefaultDockerImage = "codexstorage/nim-codex:0.1.8-dist-tests"; public const string ApiPortTag = "codex_api_port"; public const string ListenPortTag = "codex_listen_port"; public const string MetricsPortTag = "codex_metrics_port";