|
23 | 23 | import org.hyperledger.besu.consensus.common.BftValidatorOverrides;
|
24 | 24 | import org.hyperledger.besu.consensus.common.EpochManager;
|
25 | 25 | import org.hyperledger.besu.consensus.common.ForksSchedule;
|
| 26 | +import org.hyperledger.besu.consensus.common.bft.BftBlockHashing; |
26 | 27 | import org.hyperledger.besu.consensus.common.bft.BftBlockInterface;
|
27 | 28 | import org.hyperledger.besu.consensus.common.bft.BftContext;
|
28 | 29 | import org.hyperledger.besu.consensus.common.bft.BftEventQueue;
|
|
46 | 47 | import org.hyperledger.besu.consensus.qbft.QbftExtraDataCodec;
|
47 | 48 | import org.hyperledger.besu.consensus.qbft.QbftForksSchedulesFactory;
|
48 | 49 | import org.hyperledger.besu.consensus.qbft.QbftProtocolScheduleBuilder;
|
| 50 | +import org.hyperledger.besu.consensus.qbft.adaptor.BftEventHandlerAdaptor; |
49 | 51 | import org.hyperledger.besu.consensus.qbft.adaptor.BlockUtil;
|
50 | 52 | import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockCodecAdaptor;
|
51 | 53 | import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockCreatorFactoryAdaptor;
|
| 54 | +import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockHashingAdaptor; |
52 | 55 | import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockInterfaceAdaptor;
|
| 56 | +import org.hyperledger.besu.consensus.qbft.adaptor.QbftBlockchainAdaptor; |
53 | 57 | import org.hyperledger.besu.consensus.qbft.adaptor.QbftExtraDataProviderAdaptor;
|
54 | 58 | import org.hyperledger.besu.consensus.qbft.adaptor.QbftFinalStateImpl;
|
55 | 59 | import org.hyperledger.besu.consensus.qbft.adaptor.QbftProtocolScheduleAdaptor;
|
| 60 | +import org.hyperledger.besu.consensus.qbft.adaptor.QbftValidatorModeTransitionLoggerAdaptor; |
| 61 | +import org.hyperledger.besu.consensus.qbft.adaptor.QbftValidatorProviderAdaptor; |
56 | 62 | import org.hyperledger.besu.consensus.qbft.blockcreation.QbftBlockCreatorFactory;
|
57 | 63 | import org.hyperledger.besu.consensus.qbft.core.network.QbftGossip;
|
58 | 64 | import org.hyperledger.besu.consensus.qbft.core.payload.MessageFactory;
|
|
62 | 68 | import org.hyperledger.besu.consensus.qbft.core.types.QbftBlockCodec;
|
63 | 69 | import org.hyperledger.besu.consensus.qbft.core.types.QbftBlockInterface;
|
64 | 70 | import org.hyperledger.besu.consensus.qbft.core.types.QbftContext;
|
| 71 | +import org.hyperledger.besu.consensus.qbft.core.types.QbftEventHandler; |
65 | 72 | import org.hyperledger.besu.consensus.qbft.core.types.QbftFinalState;
|
66 | 73 | import org.hyperledger.besu.consensus.qbft.core.types.QbftMinedBlockObserver;
|
67 | 74 | import org.hyperledger.besu.consensus.qbft.core.types.QbftProtocolSchedule;
|
| 75 | +import org.hyperledger.besu.consensus.qbft.core.types.QbftValidatorProvider; |
68 | 76 | import org.hyperledger.besu.consensus.qbft.core.validation.MessageValidatorFactory;
|
69 |
| -import org.hyperledger.besu.consensus.qbft.core.validator.ValidatorModeTransitionLogger; |
70 | 77 | import org.hyperledger.besu.consensus.qbft.jsonrpc.QbftJsonRpcMethods;
|
71 | 78 | import org.hyperledger.besu.consensus.qbft.protocol.Istanbul100SubProtocol;
|
72 | 79 | import org.hyperledger.besu.consensus.qbft.validator.ForkingValidatorProvider;
|
73 | 80 | import org.hyperledger.besu.consensus.qbft.validator.TransactionValidatorProvider;
|
74 | 81 | import org.hyperledger.besu.consensus.qbft.validator.ValidatorContractController;
|
| 82 | +import org.hyperledger.besu.consensus.qbft.validator.ValidatorModeTransitionLogger; |
75 | 83 | import org.hyperledger.besu.datatypes.Address;
|
76 | 84 | import org.hyperledger.besu.ethereum.ProtocolContext;
|
77 | 85 | import org.hyperledger.besu.ethereum.api.jsonrpc.methods.JsonRpcMethods;
|
@@ -209,9 +217,11 @@ protected MiningCoordinator createMiningCoordinator(
|
209 | 217 |
|
210 | 218 | final ValidatorProvider validatorProvider =
|
211 | 219 | protocolContext.getConsensusContext(BftContext.class).getValidatorProvider();
|
| 220 | + final QbftValidatorProvider qbftValidatorProvider = |
| 221 | + new QbftValidatorProviderAdaptor(validatorProvider); |
212 | 222 |
|
213 | 223 | final QbftBlockInterface qbftBlockInterface = new QbftBlockInterfaceAdaptor(bftBlockInterface);
|
214 |
| - final QbftContext qbftContext = new QbftContext(validatorProvider, qbftBlockInterface); |
| 224 | + final QbftContext qbftContext = new QbftContext(qbftValidatorProvider, qbftBlockInterface); |
215 | 225 | final ProtocolContext qbftProtocolContext =
|
216 | 226 | new ProtocolContext(
|
217 | 227 | blockchain,
|
@@ -267,42 +277,47 @@ protected MiningCoordinator createMiningCoordinator(
|
267 | 277 |
|
268 | 278 | final MessageFactory messageFactory = new MessageFactory(nodeKey, blockEncoder);
|
269 | 279 |
|
| 280 | + QbftRoundFactory qbftRoundFactory = |
| 281 | + new QbftRoundFactory( |
| 282 | + finalState, |
| 283 | + qbftProtocolContext, |
| 284 | + qbftProtocolSchedule, |
| 285 | + minedBlockObservers, |
| 286 | + messageValidatorFactory, |
| 287 | + messageFactory, |
| 288 | + qbftExtraDataCodec, |
| 289 | + new QbftExtraDataProviderAdaptor(qbftExtraDataCodec), |
| 290 | + new QbftBlockHashingAdaptor(new BftBlockHashing(qbftExtraDataCodec))); |
270 | 291 | QbftBlockHeightManagerFactory qbftBlockHeightManagerFactory =
|
271 | 292 | new QbftBlockHeightManagerFactory(
|
272 | 293 | finalState,
|
273 |
| - new QbftRoundFactory( |
274 |
| - finalState, |
275 |
| - qbftProtocolContext, |
276 |
| - qbftProtocolSchedule, |
277 |
| - minedBlockObservers, |
278 |
| - messageValidatorFactory, |
279 |
| - messageFactory, |
280 |
| - qbftExtraDataCodec, |
281 |
| - new QbftExtraDataProviderAdaptor(qbftExtraDataCodec)), |
| 294 | + qbftRoundFactory, |
282 | 295 | messageValidatorFactory,
|
283 | 296 | messageFactory,
|
284 |
| - new ValidatorModeTransitionLogger(qbftForksSchedule)); |
| 297 | + new QbftValidatorModeTransitionLoggerAdaptor( |
| 298 | + new ValidatorModeTransitionLogger(qbftForksSchedule))); |
285 | 299 |
|
286 | 300 | qbftBlockHeightManagerFactory.isEarlyRoundChangeEnabled(isEarlyRoundChangeEnabled);
|
287 | 301 |
|
288 |
| - final BftEventHandler qbftController = |
| 302 | + final QbftEventHandler qbftController = |
289 | 303 | new QbftController(
|
290 |
| - blockchain, |
| 304 | + new QbftBlockchainAdaptor(blockchain), |
291 | 305 | finalState,
|
292 | 306 | qbftBlockHeightManagerFactory,
|
293 | 307 | gossiper,
|
294 | 308 | duplicateMessageTracker,
|
295 | 309 | futureMessageBuffer,
|
296 | 310 | new EthSynchronizerUpdater(ethProtocolManager.ethContext().getEthPeers()),
|
297 | 311 | blockEncoder);
|
| 312 | + final BftEventHandler bftEventHandler = new BftEventHandlerAdaptor(qbftController); |
298 | 313 |
|
299 |
| - final EventMultiplexer eventMultiplexer = new EventMultiplexer(qbftController); |
| 314 | + final EventMultiplexer eventMultiplexer = new EventMultiplexer(bftEventHandler); |
300 | 315 | final BftProcessor bftProcessor = new BftProcessor(bftEventQueue, eventMultiplexer);
|
301 | 316 |
|
302 | 317 | final MiningCoordinator miningCoordinator =
|
303 | 318 | new BftMiningCoordinator(
|
304 | 319 | bftExecutors,
|
305 |
| - qbftController, |
| 320 | + bftEventHandler, |
306 | 321 | bftProcessor,
|
307 | 322 | blockCreatorFactory,
|
308 | 323 | blockchain,
|
|
0 commit comments