You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the bundle producer, there are a few test-only variables used to control the bundle producer logic in the test, which is quite invasive to the production code:
implBundleProducerfor struct TestBundleProducer{fnproduce_bundle(..) -> sp_blockchain::Result<Option<DomainProposal<Block,CBlock>>>{// Test logic
inner.produce_bundle(..)?;// Test logic }}
It's not quite this simple, because the skip_empty_bundle_production check depends on the extrinsics (and consensus_chain_best_hash) which are only available (and consistent) inside DomainBundleProducer::produce_bundle().
So we'll either need a DomainBundleProducer::produce_bundle_inner() method which takes a closure to determine whether to skip empty bundle production, or a BundleProducerTesting trait with a skip_empty_bundle_production() method. Edit: or splitting the DomainBundleProducer::produce_bundle() method.
Splitting the method is likely to be more performant, and the code is slightly less complex that way, so I'll go with that alternative.
Since there's a big refactor involved, it seems easier to do this in two PRs.
In the bundle producer, there are a few test-only variables used to control the bundle producer logic in the test, which is quite invasive to the production code:
subspace/domains/client/domain-operator/src/domain_bundle_producer.rs
Lines 65 to 71 in eb24a91
To get rid of them, we can abstract the bundle producer to introduce a trait:
For the production code, we can use the current implementation with the test-only logic removed:
subspace/domains/client/domain-operator/src/domain_bundle_producer.rs
Line 173 in eb24a91
For the test, we can introduce a
TestBundleProducer
that is a wrapper of the production bundle producer and having the test-only logic in the wrapper:cc @teor2345
The text was updated successfully, but these errors were encountered: