Skip to content

Commit

Permalink
use qbft context in qbft core. fixes runtime and ATs
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Frame <[email protected]>
  • Loading branch information
jframe committed Jan 20, 2025
1 parent d731783 commit 3a3560d
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@
import org.hyperledger.besu.consensus.qbft.adaptor.BlockUtil;
import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockCreatorFactoryImpl;
import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockEncoderImpl;
import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockInterfaceImpl;
import org.hyperledger.besu.consensus.qbft.adaptor.QbftExtraDataProviderImpl;
import org.hyperledger.besu.consensus.qbft.adaptor.QbftFinalStateImpl;
import org.hyperledger.besu.consensus.qbft.adaptor.QbftProtocolScheduleImpl;
import org.hyperledger.besu.consensus.qbft.blockcreation.QbftBlockCreatorFactory;
import org.hyperledger.besu.consensus.qbft.core.api.QbftBlockEncoder;
import org.hyperledger.besu.consensus.qbft.core.api.QbftBlockInterface;
import org.hyperledger.besu.consensus.qbft.core.api.QbftContext;
import org.hyperledger.besu.consensus.qbft.core.api.QbftFinalState;
import org.hyperledger.besu.consensus.qbft.core.api.QbftMinedBlockObserver;
import org.hyperledger.besu.consensus.qbft.core.api.QbftProtocolSchedule;
Expand Down Expand Up @@ -208,6 +211,15 @@ protected MiningCoordinator createMiningCoordinator(
final ValidatorProvider validatorProvider =
protocolContext.getConsensusContext(BftContext.class).getValidatorProvider();

final QbftBlockInterface qbftBlockInterface = new QbftBlockInterfaceImpl(bftBlockInterface);
final QbftContext qbftContext = new QbftContext(validatorProvider, qbftBlockInterface);
final ProtocolContext qbftProtocolContext =
new ProtocolContext(
blockchain,
protocolContext.getWorldStateArchive(),
qbftContext,
protocolContext.getBadBlockManager());

final ProposerSelector proposerSelector =
new ProposerSelector(blockchain, bftBlockInterface, true, validatorProvider);

Expand Down Expand Up @@ -236,7 +248,7 @@ protected MiningCoordinator createMiningCoordinator(
clock);

final MessageValidatorFactory messageValidatorFactory =
new MessageValidatorFactory(proposerSelector, qbftProtocolSchedule, protocolContext);
new MessageValidatorFactory(proposerSelector, qbftProtocolSchedule, qbftProtocolContext);

final Subscribers<QbftMinedBlockObserver> minedBlockObservers = Subscribers.create();
minedBlockObservers.subscribe(
Expand Down Expand Up @@ -276,7 +288,7 @@ protected MiningCoordinator createMiningCoordinator(
finalState,
new QbftRoundFactory(
qbftFinalState,
protocolContext,
qbftProtocolContext,
qbftProtocolSchedule,
minedBlockObservers,
messageValidatorFactory,
Expand Down

0 comments on commit 3a3560d

Please sign in to comment.