MystenLabs / mysticeti

Mysticeti: Low-Latency DAG Consensus with Fast Commit Path
Apache License 2.0
55 stars 28 forks source link

Initialise validator for production with SimpleBlockHandler, SimpleCommitObserver & wire consumer properties #45

Closed akichidis closed 1 year ago

akichidis commented 1 year ago

After a few iterations I found the most straightforward way to inject a BlockHandler to the Validator::start method - as a trait should be accepted - to now have a method Validator::start_benchmarking to initialise a Validator with the BenchmarkFastPathBlockHandler block handler.

The whole complexity did arise from the fact that to initialise BenchmarkFastPathBlockHandler a few components that gets initialised during the start method should be passed in, which complicate things.

I've ended up introducing three public methods:

Ultimately in SUI we should just use the Validator::start_production which should be straightforward . The PR is also moving the SimpleBlockHandler from SUI to Mysticeti . Although I also believed that it would be a good fit in SUI, it turns out that things are simpler if it just lives for now in Mysticeti.

Note: similarly we'll be able to inject the consensus handler to the validator