common: keystore and jd client support, use keystore and jd in verifier standalone mode#643
Open
common: keystore and jd client support, use keystore and jd in verifier standalone mode#643
Conversation
makramkd
commented
Feb 6, 2026
makramkd
commented
Feb 6, 2026
|
Code coverage report:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apologies in advance for the big PR: open to suggestions on breaking this up into smaller pieces.
This PR:
Reasoning:
Note that this is not expected to be the end-game for JD usage - the aim is to serve as a starting point in order to iterate on. Since standalone mode is currently not being used in production, we should be able to move fast on this.
Control Flow
Can put this somewhere in the repo, I suspect all JD-driven services will have the same flow. We tried to implement the minimum required flow in order to support the following things:
sequenceDiagram participant V as Verifier participant DB as PostgreSQL participant HTTP as HTTP Server participant JD as Job Distributor participant LM as Lifecycle Manager participant DE as DevEnv Note over V: Phase 1: INIT V->>DB: Run migrations V->>DB: Generate/load signing key (ECDSA_S256) V->>DB: Generate/load CSA key (Ed25519) Note over V: Phase 2: READY V->>HTTP: Start HTTP server (background) HTTP-->>HTTP: GET /info, /health available V->>LM: Create Manager with JobRunner Note over LM: Lifecycle Manager Startup LM->>DB: Check for cached job alt Cached job exists LM->>LM: State = Running LM->>V: StartJob(cachedSpec) V->>V: Start coordinator else No cached job LM->>LM: State = WaitingForJob end LM->>JD: Connect via WSRPC (background) LM-->>LM: Listen for proposals/deletions Note over DE: DevEnv Flow DE->>HTTP: GET /info (get signing addr + CSA pubkey) DE->>JD: RegisterNode(name, csaPubKey) DE->>DE: Deploy contracts with signing address DE->>JD: ProposeJob(nodeId, tomlConfig) Note over LM: Handle Job Proposal JD->>LM: ProposeJob(id, version, spec) alt Already running a job LM->>V: StopJob() V->>V: Stop coordinator end LM->>V: StartJob(spec) V->>V: Parse TOML, start coordinator LM->>DB: SaveJob(id, version, spec) LM->>JD: ApproveJob(id, version) LM->>LM: State = Running Note over LM: Handle Delete Job JD->>LM: DeleteJob(id) alt Job ID matches current LM->>V: StopJob() V->>V: Stop coordinator LM->>DB: DeleteJob() LM->>LM: State = WaitingForJob LM-->>LM: Wait for new proposal end Note over LM: Handle Revoke (ignored) JD->>LM: RevokeJob(id) LM->>LM: Auto-approve, ignore Note over V: Shutdown V->>LM: Context cancelled / SIGTERM LM->>LM: Shutdown() alt Running a job LM->>V: StopJob() V->>V: Stop coordinator end LM->>JD: Close WSRPC connection V->>HTTP: Graceful shutdown