Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better cache initialization #30

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dkg-common
2 changes: 1 addition & 1 deletion dkgNodeLibrary/Services/DkgNodeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public async Task<StatusResponse> ReportStatus(HttpClient httpClient, string[]?
var statusResponse = new StatusResponse(roundId, Failed);
string r = $"[status '{NodeStatusConstants.GetNodeStatusById(Status).Name}', round '{(Round == null ? 0: Round)}']";

var report = new StatusReport(Config.PublicKey!, Name, Round ?? 0, Status);
var report = new StatusReport(Config.Address, Name, Round ?? 0, Status);
if (data != null)
{
report.Data = data;
Expand Down
16 changes: 8 additions & 8 deletions dkgNodesTests/NodeComparer.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public void Compare_FirstNodeNull_ReturnsOne()

var history1 = new NodesRoundHistory { NodeId = 100181, RoundId = 1, NodeRandom = 5 };
var history2 = new NodesRoundHistory { NodeId = 100182, RoundId = 1, NodeRandom = 3 };
nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history2);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history2);

var result = comparer.Compare(null, node);
Assert.That(result, Is.EqualTo(1));
Expand All @@ -76,8 +76,8 @@ public void Compare_BothNodesHaveSameNodeRandom_ReturnsZero()
var history1 = new NodesRoundHistory { NodeId = 1001811, RoundId = 1, NodeRandom = 5 };
var history2 = new NodesRoundHistory { NodeId = 1001812, RoundId = 1, NodeRandom = 5 };

nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history2);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history2);

var result = comparer.Compare(node1, node2);
Assert.That(result, Is.EqualTo(0));
Expand All @@ -93,8 +93,8 @@ public void Compare_FirstNodeHasSmallerNodeRandom_ReturnsMinusOne()
var history1 = new NodesRoundHistory { NodeId = 1001821, RoundId = 1, NodeRandom = 3 };
var history2 = new NodesRoundHistory { NodeId = 1001822, RoundId = 1, NodeRandom = 5 };

nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history2);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history2);

var result = comparer.Compare(node1, node2);
Assert.That(result, Is.EqualTo(-1));
Expand All @@ -110,8 +110,8 @@ public void Compare_SecondNodeHasSmallerNodeRandom_ReturnsOne()
var history1 = new NodesRoundHistory { NodeId = 1001831, RoundId = 1, NodeRandom = 5 };
var history2 = new NodesRoundHistory { NodeId = 1001832, RoundId = 1, NodeRandom = 3 };

nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.LoadNodesRoundHistoryToCache(history2);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history1);
nodesRoundHistoryCache.SaveNodesRoundHistoryToCache(history2);

var result = comparer.Compare(node1, node2);
Assert.That(result, Is.EqualTo(1));
Expand Down
159 changes: 0 additions & 159 deletions dkgNodesTests/NodesCache.Tests.cs

This file was deleted.

119 changes: 0 additions & 119 deletions dkgNodesTests/NodesRoundHistoryCache.Tests.cs

This file was deleted.

Loading