Skip to content

Remove statics from tproxy and jdc#432

Open
Shourya742 wants to merge 4 commits intostratum-mining:mainfrom
Shourya742:2026-04-15-remove-statics-from-tproxy-and-jdc
Open

Remove statics from tproxy and jdc#432
Shourya742 wants to merge 4 commits intostratum-mining:mainfrom
Shourya742:2026-04-15-remove-statics-from-tproxy-and-jdc

Conversation

@Shourya742
Copy link
Copy Markdown
Collaborator

This PR removes the use of static variables that were previously used to specify the operating mode (in JDC: FullTemplate / CoinbaseOnly / SoloMining, and in Tproxy: Aggregated / NonAggregated). While static approach works fine in production where a single binary simulates the process, it does not work well in integration tests (IT), where these components are used as libraries. In such cases, the test harness is built once, and static global variables are placed in the binary’s data section, remaining valid for the entire runtime. However, for testing, we need the ability to change this value dynamically in accordance to start method invocation. Although it is technically possible to mutate these values (as done in JDC), doing so can introduce non-deterministic behavior. When multiple such tasks run in parallel, they may modify the shared state concurrently without proper coordination, leading to unpredictable results.

This PR updates both Tproxy and JDC to eliminate statics and instead initialize the mode locally within the start method.

closes: #430

@Shourya742 Shourya742 force-pushed the 2026-04-15-remove-statics-from-tproxy-and-jdc branch from 8dfe1b6 to 27c48c0 Compare April 15, 2026 14:59
@Shourya742 Shourya742 requested a review from plebhash April 16, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TranslatorSv2::start() panics on second call due to process-wide OnceLock statics (breaks sequential integration tests)

1 participant