From 01ff583759db0195510a649c5cb7de277108d4db Mon Sep 17 00:00:00 2001 From: Jason Frame Date: Wed, 22 Jan 2025 17:27:04 +1000 Subject: [PATCH] cleanup warnings Signed-off-by: Jason Frame --- .../common/bft/statemachine/BftFinalState.java | 3 +-- .../core/validation/ProposalPayloadValidatorTest.java | 11 ----------- .../validation/RoundChangeMessageValidatorTest.java | 11 ----------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/statemachine/BftFinalState.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/statemachine/BftFinalState.java index a814ce8b8b0..8aaa6c8898e 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/statemachine/BftFinalState.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/statemachine/BftFinalState.java @@ -127,8 +127,7 @@ public boolean isLocalNodeProposerForRound(final ConsensusRoundIdentifier roundI * @return true if the local node is a validator, false otherwise */ public boolean isLocalNodeValidator() { - final boolean isValidator = getValidators().contains(localAddress); - return isValidator; + return getValidators().contains(localAddress); } /** diff --git a/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/ProposalPayloadValidatorTest.java b/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/ProposalPayloadValidatorTest.java index 43f7a575c9f..2ff44d75ef1 100644 --- a/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/ProposalPayloadValidatorTest.java +++ b/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/ProposalPayloadValidatorTest.java @@ -16,12 +16,10 @@ import static java.util.Collections.emptyList; import static org.assertj.core.api.Assertions.assertThat; -import static org.hyperledger.besu.consensus.common.bft.BftContextBuilder.setupContextWithBftExtraDataEncoder; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import org.hyperledger.besu.consensus.common.bft.BftContext; import org.hyperledger.besu.consensus.common.bft.BftExtraDataCodec; import org.hyperledger.besu.consensus.common.bft.ConsensusRoundHelpers; import org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier; @@ -34,8 +32,6 @@ import org.hyperledger.besu.cryptoservices.NodeKey; import org.hyperledger.besu.cryptoservices.NodeKeyUtils; import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.ethereum.ProtocolContext; -import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; @@ -58,7 +54,6 @@ public class ProposalPayloadValidatorTest { @Mock private WorldStateArchive worldStateArchive; @Mock private BftExtraDataCodec bftExtraDataCodec; @Mock private QbftBlockCodec blockEncoder; - private ProtocolContext protocolContext; private static final int CHAIN_HEIGHT = 3; private final ConsensusRoundIdentifier targetRound = @@ -72,12 +67,6 @@ public class ProposalPayloadValidatorTest { @BeforeEach public void setup() { - protocolContext = - new ProtocolContext( - blockChain, - worldStateArchive, - setupContextWithBftExtraDataEncoder(BftContext.class, emptyList(), bftExtraDataCodec), - new BadBlockManager()); messageFactory = new MessageFactory(nodeKey, blockEncoder); } diff --git a/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/RoundChangeMessageValidatorTest.java b/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/RoundChangeMessageValidatorTest.java index 62c3a95aee3..6533fd88209 100644 --- a/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/RoundChangeMessageValidatorTest.java +++ b/consensus/qbft-core/src/test/java/org/hyperledger/besu/consensus/qbft/core/validation/RoundChangeMessageValidatorTest.java @@ -17,14 +17,12 @@ import static com.google.common.collect.Iterables.toArray; import static java.util.Collections.emptyList; import static org.assertj.core.api.Assertions.assertThat; -import static org.hyperledger.besu.consensus.common.bft.BftContextBuilder.setupContextWithBftExtraDataEncoder; import static org.hyperledger.besu.consensus.qbft.core.validation.ValidationTestHelpers.createPreparePayloads; import static org.hyperledger.besu.consensus.qbft.core.validation.ValidationTestHelpers.createPreparedCertificate; import static org.mockito.Mockito.any; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.when; -import org.hyperledger.besu.consensus.common.bft.BftContext; import org.hyperledger.besu.consensus.common.bft.BftExtraDataCodec; import org.hyperledger.besu.consensus.common.bft.BftHelpers; import org.hyperledger.besu.consensus.common.bft.ConsensusRoundHelpers; @@ -43,8 +41,6 @@ import org.hyperledger.besu.consensus.qbft.core.types.QbftProtocolSpec; import org.hyperledger.besu.crypto.SECPSignature; import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.ethereum.ProtocolContext; -import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; @@ -70,7 +66,6 @@ public class RoundChangeMessageValidatorTest { @Mock private QbftProtocolSpec protocolSpec; @Mock private BftExtraDataCodec bftExtraDataCodec; @Mock private QbftBlockCodec blockEncoder; - private ProtocolContext protocolContext; private RoundChangeMessageValidator messageValidator; private QbftNodeList validators; @@ -83,12 +78,6 @@ public class RoundChangeMessageValidatorTest { @BeforeEach public void setup() { - protocolContext = - new ProtocolContext( - blockChain, - worldStateArchive, - setupContextWithBftExtraDataEncoder(BftContext.class, emptyList(), bftExtraDataCodec), - new BadBlockManager()); validators = QbftNodeList.createNodes(VALIDATOR_COUNT, blockEncoder); lenient().when(protocolSchedule.getByBlockHeader(any())).thenReturn(protocolSpec);