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:
Validator::start_benchmarking which explicitly initialises a validator for testing/benchmarking that is being used from the codebase
Validator::start_production which explicitly initialises a validator which is using the SimpleBlockHandler and should be used for the production purposes
Validator::start where another custom BlockHandler can be passed in
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
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 methodValidator::start_benchmarking
to initialise a Validator with theBenchmarkFastPathBlockHandler
block handler.The whole complexity did arise from the fact that to initialise
BenchmarkFastPathBlockHandler
a few components that gets initialised during thestart
method should be passed in, which complicate things.I've ended up introducing three public methods:
Validator::start_benchmarking
which explicitly initialises a validator for testing/benchmarking that is being used from the codebaseValidator::start_production
which explicitly initialises a validator which is using theSimpleBlockHandler
and should be used for the production purposesValidator::start
where another customBlockHandler
can be passed inUltimately 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