Repository navigation
Deployment and Operations
- Introduction
- Project Structure
- Core Components
- Architecture Overview
- Detailed Component Analysis
- Dependency Analysis
- Performance Considerations
- Troubleshooting Guide
- Conclusion
- Appendices
This document is the production deployment and operations guide for Sigvara’s protocol and Oracle service. It covers:
- Testnet versus mainnet deployment strategies, including proxy upgrade procedures and post-upgrade verification.
- Production Oracle deployment using Docker Compose, environment configuration, reverse-proxy exposure, and scaling considerations.
- Monitoring and alerting through health checks, Prometheus metrics, divergence detection, and incident response.
- Maintenance tasks such as contract upgrades, parameter tuning, and emergency procedures.
- Security hardening, backup strategy, disaster recovery, governance processes, and upgrade safety mechanisms.
The repository currently documents a live Arc testnet deployment and an explicit mainnet readiness review; mainnet registries are not yet deployed. The testnet proxies run the contracts as of 4e8c56b: all four were upgraded in place on 26 October 2026, the staking proxy again on 28 October and 2 November, the oracle bond proxy on 2 and 3 November, the reputation proxy on 4 November, the reputation and oracle bond proxies on 5 and 10 November, the reputation proxy on 15 November, the identity and reputation proxies on 16 November (blocks 72491463 and 72491520), and the staking proxy on 24 November, once the slash drill had ended (block 73808194, tag arc-testnet-2026-11-24), so the contract behaviour described below (the guardian pause, admin-ruled disputes, launch floors and ceilings, operator signers) is live there. SigvaraReader was deployed on 4 November at 7e461f4 and replaced on 24 November by one built from 4e8c56b, which reads staking's slashState. The timelocked role grants are the exception: they come from role administrators written when a registry is initialised, and the testnet's were written by the 21 September code. The Oracle service is designed for production with token-gated write endpoints, unauthenticated read paths, rate limiting, persistent state, and checker-mode redundancy. Which commit each service runs is in the runbook's table (operations-runbook.md:19-30).
Section sources
At a high level, production concerns are split between:
- Protocol contracts and deployment/upgrade scripts under
script/. - The off-chain Oracle service under
oracle/, with Docker Compose files indeploy/. - Documentation and runbooks under
docs/andoracle/.
graph TB
subgraph "Protocol"
DEPLOY["Deploy.s.sol"]
UPGRADE["Upgrade.s.sol"]
CONTRACTS["UUPS Proxies<br/>Identity / Reputation / Staking / Bond / Fees"]
end
subgraph "Oracle Service"
ORACLE["oracle/index.js"]
STORE["Persistent State<br/>oracle_state volume"]
METRICS["/metrics"]
HEALTH["/health"]
EVIDENCE["/evidence/:didHash"]
end
subgraph "Compliance & Redundancy"
CHECKER["Checker Operator"]
WATCHER["Divergence Watcher"]
end
subgraph "External"
RPC["Chain RPC"]
PROXY["Reverse Proxy / TLS"]
MONITOR["Prometheus / Alertmanager"]
end
DEPLOY --> CONTRACTS
UPGRADE --> CONTRACTS
ORACLE --> RPC
ORACLE --> STORE
ORACLE --> METRICS
ORACLE --> HEALTH
ORACLE --> EVIDENCE
CHECKER --> RPC
WATCHER --> CHECKER
WATCHER --> RPC
PROXY --> ORACLE
MONITOR --> METRICS
Diagram sources
- Deploy.s.sol:13-60
- Upgrade.s.sol:12-70
- oracle README.md:33-46
- docker-compose.oracle.yml:1-24
- docker-compose.checker.yml:1-31
- docker-compose.watcher.yml:1-40
Section sources
- overview.md:104-158
- docker-compose.oracle.yml:1-24
- docker-compose.checker.yml:1-31
- docker-compose.watcher.yml:1-40
- Sigvara Identity: Agent registration, Ed25519 key management, bond-gated status transitions, and operator transfer.
- Sigvara Reputation: Stores finalized scores, exposes threshold checks, and manages optimistic score proposals with challenge windows.
- Sigvara Staking: Manages agent bonds, slashing lifecycle, suspension, unbonding, and slash distribution.
-
Sigvara Oracle Bond: Bonds oracle operators when enabled; only admitted bonded operators (or, on
main, the signer one has named) may propose scores. - Sigvara Epoch Fees: Optional fee registry for scoring fees. It has never been deployed and is left out of the mainnet launch.
- Oracle Service: Computes six-factor reputation scores, verifies payment-backed attestations, serves evidence, exposes metrics and health, and supports checker mode.
Key operational properties:
- Contracts use UUPS proxies controlled by roles; on mainnet, admin rights target a Safe and upgrade rights a 48 hour timelock.
- The Oracle service persists attestation and flag state to a mounted volume.
- Read endpoints are intentionally unauthenticated and rate-limited; write endpoints require per-integration bearer tokens.
Section sources
- overview.md:144-158
- overview.md:207-232
- overview.md:235-256
- overview.md:260-326
- overview.md:684-710
- oracle README.md:1-14
- oracle README.md:952-1246
The production system consists of on-chain registries and an off-chain Oracle that proposes scores backed by verifiable evidence. A second operator can run in checker mode, and a watcher alerts the slashing committee while proposals remain actionable.
sequenceDiagram
participant Client as "Client / CounterAudit / HoodScan"
participant Oracle as "Oracle Service"
participant Store as "Persistent State"
participant Chain as "Sigvara Contracts"
participant Checker as "Checker Operator"
participant Watcher as "Divergence Watcher"
participant Committee as "Slashing Committee"
Client->>Oracle : POST /attest (payment-backed or legacy)
Oracle->>Store : Record settlement / outcome
Oracle->>Chain : Query identity, feedback, staking
Oracle->>Oracle : Compute 6-factor score + Merkle root
Oracle->>Chain : proposeReputation(didHash, data, root)
Note over Chain : Challenge window open
alt Committee rejects during window
Committee->>Chain : rejectReputation(didHash)
else Window elapses unchallenged
Client->>Chain : finalizeReputation(didHash)
end
Checker->>Chain : Read pending score
Checker->>Checker : Recompute locally
alt Disagreement detected
Checker-->>Watcher : Divergence available
Watcher->>Chain : Re-check proposal status
Watcher-->>Committee : Actionable alert
end
Diagram sources
- overview.md:384-423
- oracle README.md:232-369
- oracle README.md:753-800
- oracle README.md:802-890
- oracle README.md:891-950
-
Testnet: Deployer, oracle, and committee addresses are configurable; role separation is warned but tolerated because testnet assets have no economic value. The script writes chain-specific artifacts to
deployments/{chainId}.json. A broadcast writes the file when forge runs the script locally, before the transactions confirm, so a failed or interrupted broadcast can leave it naming contracts that were never deployed. Do not use--resume; check every proxy against the chain before committing the file. -
Mainnet: Role separation is enforced; deployer must not be oracle or committee, and the two must differ. On
main, a pause guardian (GUARDIAN_ADDRESS) that is none of them is required as well. Admin and upgrade roles should move to a Safe and a timelock before mainnet launch. The SVR token address is supplied (a contract with 18 decimals) rather than deploying the testnet faucet token. The scripts also refuse the testnet default for the minimum stake and the oracle bond amount and anything under the published launch figures (10,000 SVR and 2,500,000 SVR), and a period or window outside the floors and ceilings the contracts enforce, naming the variable, and an unbonding period that is not longer than the challenge period.DeployEpochFees.s.solrefuses to run on chain 5042 at all.
Deployment steps include simulating the script, broadcasting, recording the deploy block (the script writes it to the artifact as deployBlock), verifying parameters and role wiring, checking each proxy against the chain, committing the artifact, and pointing the Oracle service at the new contracts.
On mainnet the post-deploy assertions are in scripts/check-mainnet.sh, which is sourced and then called step by step (check_core, check_bond_and_fees, check_authority, check_timelock, check_treasury, check_treasury_queue, check_safes, check_code, and check_new_implementation before the Safe schedules an upgrade). The addresses it expects come from the environment and not from the artifact, so a wrong artifact cannot vouch for itself, and a read that cannot reach the chain counts as a failure. scripts/check-role-holders.mjs replays every role grant and revocation from the deploy block and fails unless each role is held by exactly the expected addresses. Run it with BEFORE_RENOUNCE=1 after the Safe has removed the deployer's admin and before the last phase of SplitAuthority.s.sol (the deployer is then expected to hold UPGRADER_ROLE beside the timelock), and again without it after the handover. epochFees is checked only when the artifact has an entry for it.
flowchart TD
Start(["Start Deploy"]) --> Env["Export keys and parameters"]
Env --> Simulate["Simulate with forge script"]
Simulate --> CheckRoles{"Role separation OK?"}
CheckRoles --> |No| Warn["Review warnings / adjust roles"]
Warn --> Simulate
CheckRoles --> |Yes| Broadcast["Broadcast deploy"]
Broadcast --> RecordBlock["Record deploy block number"]
RecordBlock --> VerifyParams["Verify minimum stake, challenge periods, maturity rate"]
VerifyParams --> VerifyRoles["Verify STAKING_CORE_ROLE, ORACLE_ROLE, SLASHING_COMMITTEE_ROLE"]
VerifyRoles --> CheckProxies["Check each proxy on chain:<br/>record-implementations.mjs"]
CheckProxies --> CommitArtifact["Commit deployments/{chainId}.json"]
CommitArtifact --> PointOracle["Configure Oracle .env"]
PointOracle --> End(["Ready for Oracle epochs"])
Diagram sources
- deploy-testnet.md:11-47
- deploy-testnet.md:49-112
- deploy-testnet.md:118-159
- Deploy.s.sol:13-60
- Deploy.s.sol:112-213
- Deploy.s.sol:215-233
Section sources
- deploy-testnet.md:1-12
- deploy-testnet.md:29-47
- deploy-testnet.md:49-112
- deploy-testnet.md:118-159
- Deploy.s.sol:13-60
- Deploy.s.sol:112-213
- Deploy.s.sol:215-233
All registries are UUPS proxies. Upgrades are performed via script/Upgrade.s.sol, which:
- Reads the proxy address from the committed deployment artifact or an override.
- Deploys a fresh implementation.
- Calls
upgradeToAndCallwith optional initializer calldata. - Verifies the implementation slot changed.
- Checks dependency ordering to avoid calling functions missing on older dependencies.
- Refuses a
PROXYoverride that is not the kind of contractTARGETnames, since an implementation of one registry installs cleanly on another's proxy and bricks it.
The deployer key must hold UPGRADER_ROLE. After the handover that role belongs to the timelock, which this script cannot act as: it broadcasts with the key it is given and prints no timelock calldata. The upgrade then goes through the timelock. The implementation is deployed from any funded key, the Safe calls schedule(proxy, 0, upgradeToAndCall(impl, data), predecessor, salt, delay), and once the delay has run anyone calls execute. Reinitializers are DEFAULT_ADMIN_ROLE-gated and the timelock is not the admin, so data cannot be one: the upgrade lands with empty data and the Safe calls the reinitializer in a second transaction, which is why a new reinitializer needs an unset state that fails closed.
After an upgrade, record the live implementation addresses so the deployment artifact matches the chain. scripts/record-implementations.mjs reads the Arc testnet artifact by default and CHAIN_ID=5042 selects the mainnet one; it refuses an endpoint that reports a different chain from the artifact's, and --check fails if the file and the chain disagree. Then check that the new code is a build of this repository (node scripts/check-bytecode.mjs), verify it on the Arc explorer with forge verify-contract, set the implementation's reproducedAt in deployments/5042002.json to the commit it was built from, and tag the commit that records it arc-testnet-<date> (docs/arc.md, "Verifying the deployed code"). As of 24 November 2026 every testnet contract is verified there and matches a build of 4e8c56b (tag arc-testnet-2026-11-24, on the commit that records it).
sequenceDiagram
participant Dev as "Operator"
participant Script as "Upgrade.s.sol"
participant Chain as "UUPS Proxy"
participant Impl as "New Implementation"
participant Artifact as "deployments/{chainId}.json"
Dev->>Script : Set TARGET, optional INIT_CALLDATA, PROXY
Script->>Artifact : Read proxy address
Script->>Chain : Read current implementation slot
Script->>Impl : Deploy new implementation
Script->>Chain : upgradeToAndCall(newImpl, initData)
Script->>Chain : Read implementation slot again
Script-->>Dev : Log old/new implementations
Dev->>Dev : Run record-implementations.mjs --check
Diagram sources
Section sources
The Oracle service computes and proposes reputation scores, verifies payment-backed attestations, and exposes public read endpoints plus token-gated write endpoints.
Production deployment essentials:
- Use
docker compose --project-directory . -f deploy/docker-compose.oracle.yml up -dfrom the repo root. - Mount a persistent volume at
/datafor attestation and flag state. - Bind to localhost by default; expose only selected endpoints through a reverse proxy.
- Configure
.envwith RPC URL, private key (orORACLE_PRIVATE_KEY_FILE), contract addresses,EXPECTED_CHAIN_ID, andORACLE_ADMIN_TOKEN; behind a reverse proxy also setTRUSTED_PROXIES. - Enable
PAYMENT_VERIFICATION=requiredand setPAYMENT_ASSETfor mainnet-grade security. - On mainnet use
docker-compose.mainnet.yml: it builds from a pinned commit (SIGVARA_REF), reads the key from a file secret and runs read-only with every capability dropped. - Copy the state volume off the host every night and rehearse a restore once a quarter, as
docs/operations-runbook.mddescribes; the.bakbeside the state file is one save behind and on the same disk.
flowchart TD
Start(["Compose Up"]) --> Build["Build oracle image"]
Build --> Env["Load .env variables"]
Env --> Persist["Mount oracle_state volume"]
Persist --> HTTP["Bind HTTP port (localhost)"]
HTTP --> Health["Serve /health"]
HTTP --> Metrics["Serve /metrics"]
HTTP --> Evidence["Serve /evidence/:didHash"]
HTTP --> Score["Serve /score/:didHash"]
HTTP --> Attest["Accept POST /attest (token policy)"]
Attest --> Verify["Verify payment on chain"]
Verify --> Epoch["Run epoch computation"]
Epoch --> Propose["proposeReputation on chain"]
Diagram sources
Section sources
- oracle README.md:33-46
- oracle README.md:85-190
- oracle README.md:232-369
- oracle README.md:952-1246
- docker-compose.oracle.yml:1-24
Required Oracle configuration includes RPC URL, private key, and contract addresses. Recommended production settings include admin tokens, EXPECTED_CHAIN_ID, persistent state path, attestation cooldown, and payment verification parameters. Numeric settings are checked at startup: a value that is set and unusable stops the process, and a blank value means unset.
Scaling guidance:
- Keep read endpoints rate-limited; they rebuild Merkle trees and perform multiple RPC calls.
- Run a separate checker operator on different hardware and RPC provider.
- Run the divergence watcher on a third host with its own RPC provider.
- Run the slash keepers on two separate hosts, each with its own key and RPC endpoint.
- Avoid sharing state volumes between primary and checker.
- Tune payment scan pacing and confirmations to balance catch-up speed and RPC limits.
graph TB
Primary["Primary Oracle"]
Checker["Checker Operator"]
Watcher["Divergence Watcher"]
RPC1["RPC Provider A"]
RPC2["RPC Provider B"]
RPC3["RPC Provider C"]
Primary --> RPC1
Checker --> RPC2
Watcher --> RPC3
Watcher --> Checker
Diagram sources
- docker-compose.checker.yml:1-31
- docker-compose.watcher.yml:1-40
- oracle README.md:802-890
- oracle README.md:891-950
- oracle README.md:1044-1122
Section sources
Monitoring relies on:
-
/health: Operational signals including epoch freshness (a primary that has never completed an epoch reports 503 once it has been up two epoch intervals), store writability, persistence status, where the state was loaded from (stateSource), the chain the RPC is on, external feed reachability, payment scan progress, the registrations the registry scan holds and how many have bonded (agents), on a checker when the divergence watcher last polled it (watcherSeenMs), and, with a payment chain configured, each chain's mode, cursor and last scan (index.js:3542-3548). -
/metrics: Prometheus-format counters for epochs, proposals, attestations, flags, links, evidence cache hits, checker comparisons, and payment chain scans and the epochs they held (metrics.js:381-394). - Divergence endpoint: Exposes disagreements for checker-mode operators.
- Watcher: Polls checker divergence, re-verifies against chain, and alerts while proposals remain actionable. It also alerts when the checker is unreachable, unreadable, not a checker, or has not completed an epoch within
MAX_SILENCE_MINUTES, and when its own polls fail three times in a row, which includes a poll that could not read a disputed agent's proposal. A checker that reports itself not ok, its/healthanswering 503 included, still has the disputes it lists relayed, each re-read on chain first (watcher.js:159-174, watcher.js:208-212). - Live checks:
scripts/check-live.mjs servicesruns from GitHub Actions on a schedule, from a place that shares no account, host or credential with what it watches. It fails when/healthfails on an operator or the event index, when the index is 80% full or more, when a Pending slash is more than six hours past its deadline unless it is held on purpose, and when one of the wallets indeployments/5042002.jsonis below its floor (live-checks.yml:3-6, check-live.mjs:202-264, check-live.mjs:290-304, check-live.mjs:348-366). It also fails when either operator has completed no epoch for three hours, which includes one that has completed none since it started (timeSinceLastEpochMs: nullon/health) and has been up longer than that. It fails as well when the checker's/healthshows no poll from the divergence watcher for half an hour (watcherSeenMs), or none in the half hour since the checker started: the watcher alerts on changes only, so a stopped one would look like one with nothing to say (check-live.mjs:187-200). The slash check reads every page of the event index'sSlashInitiatedlogs, followingnextfor up to 20 pages, and fails withslashes: could not read thempast that or when a page repeats (check-live.mjs:173-215, check-live.mjs:324-365). - Status page: sigvara.xyz/status reads each service from its public endpoint in the visitor's browser, and holds the operators, the disagreements and the index's
/healthto the same limits. Since 13 November 2026 a second card shows the scores as a whole: how the matured scores of the Active agents spread across six bands, with the spread in bits, how many agents moved band each day, and how often each band was followed within 30 days by an executed slash or a payer's "not delivered" (score-report.js:1-14). It reads slash events only for that table, checks no wallet or certificate, and does not warn before the index is full (status.html:52-54, status.js:2-4).
Alerting recommendations:
- Scrape
/metricswith Prometheus. - Alert on
/healthreturning 503. - Watch failed epochs and rejected attestations due to cooldown.
- Watch
sigvara_oracle_tx_refused_total(a fee cap that trips, or a transaction never seen mined) andstateSourceon/health(anything butfileafter a restart). - Alert on checker silence or inability to see proposals.
- Alert on actionable divergences and final warnings near the challenge window close.
flowchart TD
Scrape["Prometheus scrapes /metrics"] --> Epochs["Epoch success/failure"]
Scrape --> Proposals["Propose/finalize attempts"]
Scrape --> Attests["Attest accept/reject/cooldown"]
Scrape --> Flags["Flags raised/resolved"]
Scrape --> Cache["Evidence cache hit/miss"]
Scrape --> Checker["Checker comparisons"]
HealthCheck["Health check probe"] --> HealthStatus["503 if stale/unwritable/unpersisted"]
Watcher["Divergence watcher"] --> Divergence["GET /divergence"]
Divergence --> Classify["Classify actionable/expired/superseded/closed"]
Classify --> Alert["Send webhook/alert"]
Diagram sources
Section sources
- Contract upgrades: Use
script/Upgrade.s.solwithTARGETand optionalINIT_CALLDATA; verify dependency ordering and implementation slot change; commit live implementations afterward. After the handover the upgrade goes through the timelock instead (see above). - Parameter tuning: Adjust Oracle environment variables such as epoch interval, payment verification thresholds, half-life decay, max-per-payer caps, and scan pacing. A container reads its
env_filewhen it is created, so apply a change withdocker compose up -d; a plainrestartre-runs the start command but keeps the old environment. - Emergency procedures:
- If a score proposal looks wrong, the slashing committee can reject it with
rejectReputationwithin the challenge window. - If an agent key is compromised, suspend the agent, rotate the key, then reinstate.
- If the Oracle service cannot persist state, stop exposing write endpoints until storage is restored.
- On
main, a slash that is wrong can be vetoed by the admin Safe while it is pending or disputed, and a live bug can be contained by the guardian key, which pauses new registrations, stake deposits, score proposals and bond deposits for three days at a time. A pause never covers withdrawals, disputes, rulings, slash execution or finalization, and the admin can lift it or revoke the guardian at once. The Arc testnet contracts have had both since the upgrade of 26 October 2026 (overview.md:74-77).
- If a score proposal looks wrong, the slashing committee can reject it with
flowchart TD
Start(["Maintenance Trigger"]) --> Decide{"Type of maintenance"}
Decide --> |Contract Change| Upgrade["Run Upgrade.s.sol"]
Decide --> |Policy Change| TuneEnv["Update Oracle .env"]
Decide --> |Security Incident| Suspend["Suspend agent / rotate key"]
Decide --> |Service Failure| Recover["Restore state / restart service"]
Upgrade --> VerifyImpl["record-implementations.mjs --check"]
TuneEnv --> Restart["Recreate Oracle container<br/>(docker compose up -d)"]
Suspend --> Reinstate["Reinstate after recovery"]
Recover --> HealthCheck["Validate /health and /metrics"]
Diagram sources
Section sources
Security hardening:
- Do not bind the Oracle service to all interfaces without a reverse proxy. The service refuses a non-loopback bind with no write credential.
- Set
ORACLE_ADMIN_TOKENbefore exposing any write endpoints. - Set
EXPECTED_CHAIN_ID, and keep the signing key in a file secret (ORACLE_PRIVATE_KEY_FILE) rather than in the environment. - Require payment verification on mainnet and configure the correct payment asset.
- Ensure oracle wallet is bonded and admitted (or, on
main, is the named signer of a bonded operator) whenoperatorBondis enabled. - Separate roles: deployer, oracle, committee and guardian should be distinct; mainnet enforces this.
Backup strategy:
- Persist Oracle state to a dedicated volume (
oracle_state). - Back up the state file regularly; attestations not persisted are lost on restart. Copy it off the host: the
<state>.bakthe oracle keeps is one save behind and on the same disk. The Arc testnet operators have run a nightly encrypted copy to the other operator's host since 1 November 2026 (docs/operations-runbook.md, section 1). - Keep deployment artifacts and recorded implementations synchronized with the chain.
Disaster recovery:
- Restore state from backups with the Oracle service stopped, since it rewrites the file from memory at every save, putting the state file and its
.bakback together; then start it. A state file that exists but cannot be read falls back to the.bak, and with no usable backup the process stops rather than start empty. - If the checker becomes unreachable, the watcher alerts; ensure the watcher runs on a separate host.
- If a proposal is missed by the checker, rely on the slashing committee’s reject capability within the challenge window.
Section sources
- oracle README.md:33-46
- oracle README.md:48-83
- oracle README.md:87-190
- oracle README.md:952-1246
- Deploy.s.sol:215-233
- overview.md:684-710
Common operational tasks:
- Deploy to testnet: simulate, broadcast, record block, verify parameters and roles, check every proxy against the chain, commit artifact, point Oracle at contracts.
- Run Oracle locally: copy
.env.example, configure RPC and keys, runnode index.js, validate epochs. - Deploy Oracle via Docker Compose: bring up service, mount state volume, expose through reverse proxy. On mainnet a deploy is a change to
SIGVARA_REFfollowed bydocker compose up -d. - Add a second operator: fund bond, admit operator, grant
ORACLE_ROLE, set checker mode, separate state and RPC. - Monitor divergence: run watcher, configure webhook (
WEBHOOK_URL; without it alerts reach the container log only), watch actionable alerts. - Keep and restore state, follow payer-signed outcomes between the operators, triage a disagreement, and run the event index, the publisher, payment chains and the slash keepers:
docs/operations-runbook.md, which opens with what runs what (operations-runbook.md:19-32).
Section sources
- deploy-testnet.md:49-159
- oracle README.md:16-31
- oracle README.md:33-46
- oracle README.md:802-890
- oracle README.md:891-950
-
/healthreturns 503:- State path not writable or last state write failed.
- No successful epoch in the last two times the epoch interval (counted from process start until the first success).
-
/attestreturns 402 or 409:- Payment did not check out or settlement already credited.
-
/attestreturns 202:- Accepted, but the oracle could not save its state file (
durable: false). Do not resend;/healthis 503 until a save works.
- Accepted, but the oracle could not save its state file (
-
/attestreturns 429:- Cooldown active; wait for remaining seconds.
-
/attestreturns 502:- RPC failure; retry later.
- Checker divergence:
- Review
/divergence, classify whether actionable, expired, superseded, or closed. - Ensure watcher is running on a third host and has a different RPC provider.
- Review
- Evidence audit mismatch:
- Rebuild Merkle root from served evidence and compare with on-chain
evidenceRoots. - Use
verifyEvidenceto validate individual leaves.
- Rebuild Merkle root from served evidence and compare with on-chain
Section sources
- oracle README.md:87-190
- oracle README.md:232-369
- oracle README.md:438-569
- oracle README.md:757-800
- oracle README.md:891-950
The explorer pages on sigvara.xyz read the contracts' history from an event index the team runs at https://index.sigvara.xyz, live since 3 November 2026. It reads every log of identity, reputation, staking and the oracle bond since they were deployed, through Alchemy's Arc testnet RPC, and serves them at /events, filtered by contract, topic and block and paged with a cursor, with /health beside it. It exists because the Arc explorer's per-contract log index stopped at block 70,337,205 on 2 November 2026 and allows ten requests an hour, while the public RPC answers at most 10,000 blocks a call and refuses a batch of four, which makes the history close to 800 calls. By 17 November 2026 the explorer had caught up and held every log after that block, so the pages' fallback, used when the event index does not answer, relies on it again (#338).
- It reads finalized blocks less a 20-block margin, in order, and refuses a batch whose node does not have the batch's last block, so the index has no holes. A span the node refuses for its size, or an answer past 8 MiB, is asked for in pieces, and each piece is added as it arrives (indexer.js:97-100, indexer.js:226-245). The save writes in pieces too (indexer.js:119-132).
- A request never reaches the RPC, and the RPC URL, which carries the provider's key, is never logged or served.
- One answer holds at most 5,000 logs and 4 MiB of them as JSON, though always one log when one matches. A longer history ends with
next, and a reader asks again withafterset to it untilnextis null; only then doestoBlocksay the history is whole (event-index.js:18-25, event-index.js:202-233). The pages follownextfor up to 20 answers (explorer.js:33-34, explorer.js:510-527). The whole testnet history, about 750 logs and 400 KB on 4 November 2026, fits in one answer (event-index.md:50). - Each query's answer is encoded once and kept until the index moves on, at most 64 answers and 32 MiB of them, the oldest dropped first (indexer.js:320-350). Building a new answer is limited to 120 a minute per client, read through
TRUSTED_PROXIES, and past that the client gets 429 withRetry-After: 60. An answer already in the cache does not count (indexer.js:325-328, indexer.js:383-384). - It holds at most
INDEX_MAX_LOGSlogs, 100,000 by default, which fits the container'smem_limitof 256 MB (indexer.js:81-83, docker-compose.indexer.vps.yml:55). At the limit it stops reading on, keeps answering with what it has, and/healthanswers 503 withfull: true. To carry on, raiseINDEX_MAX_LOGSandmem_limittogether, by about 2 MB per thousand logs, and restart (indexer.js:211-224, event-index.md:56). -
docs/event-index.mdlists what else is not bounded, all fine for the testnet history and to be settled before the index serves a much larger one (event-index.md:54-61). - It holds no key that signs. Each log names its transaction, so an added event would not match its transaction, but the pages do not catch a left-out one. An agent's current status, score, stake and evidence roots are still read from the contracts, two or more reads at a time through Multicall3 (explorer.js:356-359).
- When it does not answer, the pages fall back to the Arc explorer and the newest blocks from the chain, and say so.
It runs on archipelago-standby from docker-compose.indexer.vps.yml, pinned to one commit, with the RPC URL as a compose secret. docs/operations-runbook.md, section 4, covers checking, redeploying and recovering it, and scripts/check-live.mjs services watches its /health, how full it is (failing from 80% of maxLogs) and its certificate. /health reports toBlock, head, behind, logs, maxLogs, full, lastError with any URL removed, and commit (indexer.js:285-304).
Section sources
- event-index.md:1-31
- event-index.md:65-78
- indexer.js:3-21
- indexer.js:90-96
- indexer.js:163-193
- docker-compose.indexer.vps.yml:1-21
- explorer.js:497-552
- operations-runbook.md:382-429
- check-live.mjs:217-229
- check-live.mjs:254-261
A payment chain is a chain the oracle only reads payments from (ADR 0009, operations-runbook.md:586). Payment chains are off by default: with PAYMENT_CHAIN_IDS unset no chain is read (payment-chains.js:43-45). Since 7 November 2026 both operators read Base Sepolia (84532) on, so its payments count an hour after they settle, and the checker also reads Elysium testnet (chain 99801) in shadow, which scans beside the epoch, reports what it would credit and credits nothing. A chain in shadow changes no score, proposal or evidence root (0009-payments-on-base.md:253-254, operations-runbook.md:587-589).
-
Adding one in shadow. One operator is enough, and the checker is the one to use: nothing needs the two to agree while a chain counts for nothing, and a bad endpoint then reaches only one of them. Set the chain's lines in the
.envand rundocker compose up -d, since a plain restart does not read.envagain. It also needsPAYMENT_VERIFICATION=required,PAYMENT_SCAN_ENABLED=1andEXPECTED_CHAIN_ID, or the process refuses to start (operations-runbook.md:603-621). -
Checking it.
curl -s https://checker.sigvara.xyz/health | jq .paymentChainsreportsmode,lastBlock,lastBlockTsandlastScan.canary: "unavailable"is what a shadow scan with nothing to credit reports./healthmoves only as each step of at mostMAX_BLOCKSblocks andMAX_READSreads completes, so also check thatlastBlockTsmoves between epochs (operations-runbook.md:623-628, index.js:1421-1436). -
When a scan fails. The log says
payment chain 99801 scan failed, andsigvara_oracle_payment_chain_scan_errors_totalcounts it. In shadow, scoring carries on, and the next epoch resumes from the last block saved. A range the node refuses for its size is halved, so a dense range alone should not stop a scan (operations-runbook.md:630-637). -
Removing one. Delete its lines from the
.envand rundocker compose up -d. Its cursor stays in the state file under99801/shadow, where only a later scan of that chain reads it (operations-runbook.md:639-640). -
Rolling back the code. A shadow cursor leaves the state file at format 1, so a build from before payment chains still loads it and drops the cursor. A chain that has been
onwrites format 2, which such a build refuses. A file holding a payer's "not delivered" is format 3, which a build from before the negative hold refuses rather than count the negative at once, and once pruning has dropped a payment's replay key the file is format 4, which a build from before the age limit on credits refuses rather than credit that payment again (operations-runbook.md:642-645, store.js:220-259). -
Going
on. Both operators need the same values first, and switching on or back has an order (operations-runbook.md:604-605, README.md:1187-1196). A chain that isonis scanned inside the epoch and holds it while its scan is behind (index.js:1601-1604, index.js:1698-1733). Still open before Elysium could goon: a bound on a flood of payments, which Base Sepolia needs too, whether bridged USDC counts, a provider for each operator, and an endless answer from a hostile endpoint, which might exhaust an operator's memory and has not been tested (0009-payments-on-base.md:275-287).
Section sources
The publisher (oracle/publisher.js) posts the spendable score of each agent linked on chain to the ERC-8004 Reputation Registry as Sigvara's own feedback (External Trust Integration). It runs on the primary's host only, never on the checker, from docker-compose.publisher.vps.yml, pinned to one commit like the watcher (docker-compose.publisher.vps.yml:1-12). It holds no key: in live mode it signs through the policy signer (oracle/signer.js) on packrai-vps, run from docker-compose.signer.vps.yml (docker-compose.signer.vps.yml:1-8). The signer listens on its own host's 127.0.0.1:28600, so it opens no port (docker-compose.signer.vps.yml:16-18). The publisher reaches it through a signer-tunnel container, an SSH local forward with its own key and a pinned host key, so requests and the signed transactions they return are encrypted on the way (docker-compose.publisher.vps.yml:74-92). That key works only from the publisher's host, and the account it logs in to may open that one forward and nothing else (operations-runbook.md:462-463, sshd_config.signer-tunnel:10-20). The signer also checks an HMAC on every request (signer.js:165-270). It signs a post only when feedbackHash is the keccak256 of the file in the URI (signer.js:93-96), and SIGNER_HOST defaults to 127.0.0.1 (signer.js:296). The publisher posts through the signer's hash rule every day: on 16 November 2026 it made four posts at 00:04 UTC, each signed there. The signer reads the chain with an 8 second deadline a request, retried by readWithBackoff, and answers chain read failed when it still cannot (signer.js:174-182, signer.js:237-240, signer.js:326-332). For 120 seconds after it starts, twice MAX_SKEW_SECONDS, it signs nothing: its record of requests already used does not survive a restart, and a request's time may be up to 60 seconds either side of its clock. A publisher send in that time fails with starting; signing from 120 s after start, and the agent stays pending for the next run (signer.js:157-175, signer-auth.js:11).
- Shadow mode, the default, reads and logs everything and sends nothing. Each run logs
[publisher] run: N planned, M sent, K skipped, and a failed live gate logsposting blocked: .... A send the registry refuses at the gas estimate for one agent, as EIP-8004 does when that agent's owner has approved the publisher's address, skips that agent, which stays pending and takes nothing from the run's cap; any other failed send ends the run (publisher.js:181-204). A live run with a gate failing records nothing and logs each send it would make aswould send (blocked), so every pending update waits for a run that can send, an unlinked agent's revoke and a slashed agent's 0 included (publisher.js:143-155, publisher.js:185-194, publisher.js:227-232). A send is confirmed by polling for its receipt every 2 seconds, for up to 120. A revert saysrevertedand names the transaction, and no receipt by then sayswas sent, with no receipt after 120 seconds, since it may still land. Either way the run stops there and the agent stays pending for the next one (publisher.js:294-300, publisher.js:376-387). - Its state volume holds the record of which 8004 agent each score went to. That record cannot be rebuilt from the chain, and without it a score left on an agent that is no longer linked is not revoked, so the runbook has the primary's nightly backup copy the volume with the oracle state. The publisher claims its record before a post and when it finds a score already live, so a post that lands late is still cleaned up on unlink (publisher.js:167-173, publisher.js:211-214, publisher.js:278-281).
- Going live is a sequence of steps, each needing a go-ahead: the signer and its keystore, the
agentWalletceremony, then one end-to-end cycle withPUBLISH_ALLOW_AGENT_IDSset to one agent, before the allow list is emptied. On testnet the allow list was emptied on 4 November 2026, a few hours before that cycle's revoke, which ran later that day and read back as expected (operations-runbook.md:550-582).docs/operations-runbook.md, section 5, covers each step, key rotation and what to do if the publisher's host is compromised.
Section sources
- publisher.js:3-20
- docker-compose.publisher.vps.yml:1-8
- docker-compose.signer.vps.yml:1-8
- signer.js:165-270
- sshd_config.signer-tunnel:10-20
- operations-runbook.md:431-582
An undisputed slash settles only when someone calls executeSlash, and from 14 days after its deadline anyone can drop it with expireSlash. oracle/keeper.js makes that call. It runs from docker-compose.keeper.vps.yml, pinned to one commit, with its settings from oracle/.env.keeper.example. Its key holds no role and only a little gas, since executeSlash is open to anyone (keeper.js:6-14, operations-runbook.md:649-658).
- Each run reads
SlashInitiatedto learn who to watch, then each proposal, at chain time. For a Pending proposal past its deadline it simulatesexecuteSlash, so the contract's own rules decide, then sends. It waits 500 ms between log reads and retries a throttled read (keeper.js:65-67, keeper.js:85-100, keeper.js:413-415). - It stops at the lapse though the contract does not: 14 days past a slash's deadline it raises an alert and leaves the decision to a person. It never calls
expireSlashorexpireDispute, since each reinstates an agent, and live mode will not start withoutKEEPER_SKIP_AGENTS, even if only set tonone(keeper.js:16-23, keeper.js:338-343). That list on Arc testnet named agent C of the slash drill, left to lapse on purpose; day 21 expired C on 24 November, so the entry now does nothing and can come off the list (operations-runbook.md:674-678). - Two run on separate hosts, each with its own key: the primary on
archipelago-standbywith no grace, and the backup onpackrai-vpswith an hour (KEEPER_GRACE_SECONDS). If both act, the second simulates, finds nothing Pending and sends nothing (operations-runbook.md:680-682). -
scripts/check-live.mjs serviceswatches the outcome from outside: it fails when a Pending slash is more than six hours past its deadline, unless it is held on purpose, and when a keeper's wallet indeployments/5042002.jsonis below its floor. Each keeper also alerts by webhook (check-live.mjs:345-366, operations-runbook.md:684-698). -
docker psshows a keeper unhealthy when no run has finished for an hour. The healthcheck readslastRunWallMsfrom the state file, the host's clock when the last run finished (lastRunAtis chain time), and falls back to the file's age only for a file written before that field existed, since each run's scan rewrites the file before the run has finished (docker-compose.keeper.vps.yml:42-51, keeper.js:215-218). - Both have been live on Arc testnet since 5 November 2026, funded with 20 USDC each, with alerts on, and on 19 November 2026 the primary keeper executed its first slash, against one of the simulation's ring agents, in this transaction (operations-runbook.md:711-725). Mainnet needs its own pair, funded with their own keys (launch-checklist.md:65-72).
Section sources
- keeper.js:3-30
- docker-compose.keeper.vps.yml:1-18
- .env.keeper.example:1-47
- operations-runbook.md:647-742
The deployment and upgrade scripts depend on OpenZeppelin proxies and the protocol contracts. The Oracle service depends on chain RPCs, contract addresses, and optionally external feeds. The checker and watcher depend on independent RPC providers and separate state.
graph TB
Deploy["Deploy.s.sol"] --> Identity["SigvaraIdentity"]
Deploy --> Reputation["SigvaraReputation"]
Deploy --> Staking["SigvaraStaking"]
Deploy --> Token["SVRToken"]
Upgrade["Upgrade.s.sol"] --> Identity
Upgrade --> Reputation
Upgrade --> Staking
Upgrade --> Bond["SigvaraOracleBond"]
Upgrade --> Fees["SigvaraEpochFees"]
Oracle["Oracle Service"] --> Reputation
Oracle --> Identity
Oracle --> RPC["Chain RPC"]
Checker["Checker"] --> RPC
Watcher["Watcher"] --> RPC
Diagram sources
- Deploy.s.sol:4-10
- Deploy.s.sol:112-213
- Upgrade.s.sol:4-10
- Upgrade.s.sol:82-108
- oracle README.md:952-1246
Section sources
- Deploy.s.sol:4-10
- Deploy.s.sol:112-213
- Upgrade.s.sol:4-10
- Upgrade.s.sol:82-108
- oracle README.md:952-1246
- Oracle epoch cadence should be shorter than half the reputation challenge window so the checker can observe proposals before they expire.
- Payment scanning pace must respect RPC rate limits; default pacing avoids bucket exhaustion during long catch-ups.
- Evidence cache reduces expensive Merkle tree rebuilds; monitor hit rates.
- Badge endpoint caches results to reduce repeated RPC calls.
- Rate-limit read endpoints to prevent enumeration and expensive recomputation.
See the detailed troubleshooting section above for common error codes, divergence classification, and evidence auditing steps.
Section sources
- oracle README.md:87-190
- oracle README.md:232-369
- oracle README.md:438-569
- oracle README.md:757-800
- oracle README.md:891-950
Sigvara’s production model combines UUPS-upgradeable contracts with a robust Oracle service, checker-mode redundancy, and divergence alerting. Testnet deployment is straightforward, while mainnet requires strict role separation, governance controls, and payment-verified attestations. Operators should treat upgrades as high-risk operations, back up Oracle state, monitor health and metrics closely, and maintain independent RPC providers across primary, checker, and watcher components. Governance and upgrade safety are central: only authorized roles can upgrade, and the slashing committee retains the ability to reject bad proposals within the challenge window.
- Roles:
-
UPGRADER_ROLEauthorizes upgrades and, onmain, the wiring of the stake view, reputation's operator bond registry and the slash beneficiary (on the Arc testnet proxies the admin does that); on mainnet it belongs to a 48 hour timelock. Onmainit also administers itself and the roles that move funds or change an agent's standing (the slasher, committee and staking core roles), so granting one takes the delay. -
DEFAULT_ADMIN_ROLEis the admin Safe on mainnet. Onmainit sets parameters within their floors and ceilings, grantsORACLE_ROLEandGUARDIAN_ROLE, revokes any role exceptUPGRADER_ROLE, rules on disputed slashes and can veto a pending or disputed one. -
STAKING_CORE_ROLEallows staking actions on identity and reputation. -
ORACLE_ROLEpermits proposing scores; whenoperatorBondis set, the oracle must also be admitted and bonded, or be the signer an admitted operator has named. -
SLASHING_COMMITTEE_ROLEinitiates and cancels slashes and rejects bad scores within the challenge window. Onmainit does not rule on disputes. -
GUARDIAN_ROLEpauses new inflows for three days at a time, and nothing else. - The Arc testnet proxies have run this code since 26 October 2026, but their role administrators were written by the September code, so the admin also grants the slasher, committee and staking core roles there.
-
- Upgrade safety:
-
Upgrade.s.solvalidates dependency ordering and implementation slot changes, and refuses a proxy that is not the kind its target names. - Post-upgrade, record live implementations and verify with
scripts/record-implementations.mjs --check, then compare the deployed code with a build (scripts/check-bytecode.mjs) and verify the source on the Arc explorer.
-
- Mainnet readiness:
- Move admin rights to a Safe and upgrade rights to a timelock with
script/SplitAuthority.s.sol(rehearsed on a fork of the testnet, not yet run on a live deployment). Its renounce step refuses to run without a fresh passing report fromscripts/check-before-renounce.mjs. - The documented end-to-end testnet slash is done (executed 3 October 2026). The external audit is not.
-
docs/roadmap.mdis the one list of what comes next and what starts each step (roadmap). -
docs/launch-checklist.mdopens with "Where this stands", the public list of what is open (launch-checklist.md:5-34).
- Move admin rights to a Safe and upgrade rights to a timelock with
Section sources
- Agent Registration and Lifecycle
- Contract Overview and Architecture
- Economic Security Model and Incentives
- Evidence Verification and Merkle Proofs
- Key Management and Rotation
- Maturity Mechanism and Score Release
- Proposal Workflow and Challenge System
- Score Storage and Data Model
- SigvaraIdentity Contract
- SigvaraOracleBond Contract
- SigvaraReputation Contract
- SigvaraStaking Contract
- Slashing Lifecycle and Dispute Resolution
- Stake Management Functions
- Status Management and Control
- Token and Fee Contracts
- Unbonding Period and Withdrawal Security
- Anti-Manipulation and Security Measures
- Community Flag Processing
- Evidence Sources and Verification
- External Trust Integration
- Merkle Proof System
- Oracle Score Computation
- Payment-Backed Attestations
- Scoring Model and Formulas
- Agent Creation and Key Management
- Agent Operations
- Agent Registration Workflow
- Challenge-Response Authentication
- Gate Access Control
- Integration Patterns and Examples
- SDK Overview and Setup
- Verifier Functions