stratum-mining / stratum

stratum
https://stratumprotocol.org
Other
222 stars 127 forks source link

Need to fix fragmented patterns on Integration Test starter APIs #1234

Open plebhash opened 2 weeks ago

plebhash commented 2 weeks ago

Role starter APIs on Integration Test framework is starting to slip into some fragmented patterns, which is resulting in a suboptimal user experience while writing tests.

I noticed this while doing the experimentation described here: https://github.com/stratum-mining/stratum/pull/1226#issuecomment-2438910821

Given that #1226 hasn't yet been merged, I believe it can be used to address start_jdc and start_jds.

But start_sniffer, start_pool and start_template_provider probably deserve a separate PR (ideally in sync with #1226).

Here's a detailed description of each fragmented pattern:

arg types

All starter functions take parameters with Socket Address information. However, each role is following a different standard:

assumptions on roles socket addresses

Not all starter functions are taking Socket Address information for the actual role.

To be honest, I feel it makes more sense to always call common::get_available_address() inside the function bodies and simply abstract that away from the user (potentially even making common::get_available_address() into a private function under common).

In other words, I think the direction start_jdc and start_jds are taking is better than the other starters.

return types

Starter functions are returning types under different patterns:

jbesraa commented 2 weeks ago

Totally agree with the stance here. I was about to address this after completing #1226 as it made it more clear how we should approach this.