From 2610dcd684e0d9dbec592eb2682c74a1bd9b5188 Mon Sep 17 00:00:00 2001 From: Say Cheong Date: Wed, 7 Feb 2024 01:50:20 +0900 Subject: [PATCH] Build fix due to package downgrade --- .../Consensus/ConsensusContextTest.cs | 12 ++++++------ Libplanet.Net.Tests/Consensus/ContextProposerTest.cs | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Libplanet.Net.Tests/Consensus/ConsensusContextTest.cs b/Libplanet.Net.Tests/Consensus/ConsensusContextTest.cs index 97bc84ff827..6068a2703cc 100644 --- a/Libplanet.Net.Tests/Consensus/ConsensusContextTest.cs +++ b/Libplanet.Net.Tests/Consensus/ConsensusContextTest.cs @@ -89,14 +89,14 @@ public async void NewHeightIncreasing() Assert.Throws(() => consensusContext.NewHeight(3)); await proposalMessageSent.WaitAsync(); - Assert.NotNull(proposal?.BlockHash); + BlockHash proposedblockHash = Assert.IsType(proposal?.BlockHash); consensusContext.HandleMessage(new ConsensusPreCommitMsg(TestUtils.CreateVote( - TestUtils.PrivateKeys[0], 3, hash: proposal.BlockHash, flag: VoteFlag.PreCommit))); + TestUtils.PrivateKeys[0], 3, hash: proposedblockHash, flag: VoteFlag.PreCommit))); consensusContext.HandleMessage(new ConsensusPreCommitMsg(TestUtils.CreateVote( - TestUtils.PrivateKeys[1], 3, hash: proposal.BlockHash, flag: VoteFlag.PreCommit))); + TestUtils.PrivateKeys[1], 3, hash: proposedblockHash, flag: VoteFlag.PreCommit))); consensusContext.HandleMessage(new ConsensusPreCommitMsg(TestUtils.CreateVote( - TestUtils.PrivateKeys[2], 3, hash: proposal.BlockHash, flag: VoteFlag.PreCommit))); + TestUtils.PrivateKeys[2], 3, hash: proposedblockHash, flag: VoteFlag.PreCommit))); // Waiting for commit. await heightThreeStepChangedToEndCommit.WaitAsync(); @@ -224,7 +224,7 @@ public async void VoteSetGetOnlyProposeCommitHash() consensusContext.NewHeight(blockChain.Tip.Index + 1); await heightOneProposalSent.WaitAsync(); - Assert.NotNull(proposal?.BlockHash); + BlockHash proposedblockHash = Assert.IsType(proposal?.BlockHash); votes.Add(TestUtils.CreateVote( TestUtils.PrivateKeys[0], @@ -236,7 +236,7 @@ public async void VoteSetGetOnlyProposeCommitHash() TestUtils.PrivateKeys[x], 1, 0, - proposal.BlockHash, + proposedblockHash, VoteFlag.PreCommit))); foreach (var vote in votes) diff --git a/Libplanet.Net.Tests/Consensus/ContextProposerTest.cs b/Libplanet.Net.Tests/Consensus/ContextProposerTest.cs index 43a733e047f..84057b46f6c 100644 --- a/Libplanet.Net.Tests/Consensus/ContextProposerTest.cs +++ b/Libplanet.Net.Tests/Consensus/ContextProposerTest.cs @@ -106,29 +106,29 @@ public async void EnterPreCommitBlock() // Wait for propose to process. await proposalSent.WaitAsync(); - Assert.NotNull(proposal?.BlockHash); + BlockHash proposedblockHash = Assert.IsType(proposal?.BlockHash); context.ProduceMessage( new ConsensusPreVoteMsg(TestUtils.CreateVote( TestUtils.PrivateKeys[0], 1, - hash: proposal.BlockHash, + hash: proposedblockHash, flag: VoteFlag.PreVote))); context.ProduceMessage( new ConsensusPreVoteMsg(TestUtils.CreateVote( TestUtils.PrivateKeys[2], 1, - hash: proposal.BlockHash, + hash: proposedblockHash, flag: VoteFlag.PreVote))); context.ProduceMessage( new ConsensusPreVoteMsg(TestUtils.CreateVote( TestUtils.PrivateKeys[3], 1, - hash: proposal.BlockHash, + hash: proposedblockHash, flag: VoteFlag.PreVote))); await Task.WhenAll(preCommitSent.WaitAsync(), stepChangedToPreCommit.WaitAsync()); - Assert.Equal(proposal?.BlockHash, preCommit?.BlockHash); + Assert.Equal(proposedblockHash, preCommit?.BlockHash); Assert.Equal(1, context.Height); Assert.Equal(0, context.Round); Assert.Equal(ConsensusStep.PreCommit, context.Step);