forked from NSPG13/agent-bounties
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-render-blueprint.py
More file actions
555 lines (506 loc) · 24.2 KB
/
Copy pathcheck-render-blueprint.py
File metadata and controls
555 lines (506 loc) · 24.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
from __future__ import annotations
import json
import re
import sys
from pathlib import Path
from render_deploy_recovery import OPEN_COMPETITION_WORKER_ENVIRONMENT
SERVICE_NAMES = [
"agent-bounties-api",
"agent-bounties-mcp",
"agent-bounties-base-indexer",
"agent-bounties-open-competition-v1-indexer",
]
RECOVERY_RESERVED_BOUNTY_CONTRACTS = (
"0x680030abf3ffffbc8d0a550b6355a8713c54d3c8,"
"0x3137e6c0f44b940580ea7efc5f8cc6c6c0bda3f1,"
"0xb35b94e1225b66e50644a331feccdab0439e63d7,"
"0xfffecb0fcd36477c5f6ecec808f6f0cf53819562,"
"0xbe17ef2d154265ebe3142d7bda5e99610d571455,"
"0x43d42cb227d76588ab16693f14efd6cff851fa7a,"
"0xe8c1d3f046f3e4690bef59ba4abd5d02d2a6984b"
)
HOSTED_BASE_MAINNET_RPC_URL = "https://base.drpc.org"
MAINNET_LEADERBOARD_REWARD_CONTRACT = "0xb2637dd1dcf4ac9e22b42e9612e907ac44c52c69"
SEPOLIA_LEADERBOARD_REWARD_CONTRACT = "0x2e84ef6708d5fff0e9909e80481a00b7ac47293e"
def fail(message: str) -> None:
raise SystemExit(message)
def section(text: str, heading: str) -> str:
marker = f"\n{heading}:\n"
start = f"{text}\n".find(marker)
if start == -1:
if text.startswith(f"{heading}:\n"):
start = -1
else:
fail(f"render.yaml missing {heading}: section")
start += len(marker)
next_top_level = re.search(r"\n[A-Za-z][A-Za-z0-9_-]*:\n", text[start:])
if next_top_level:
return text[start : start + next_top_level.start()]
return text[start:]
def named_block(text: str, name: str) -> str:
for match in re.finditer(r"(?ms)^ - type: .+?(?=^ - type: |\Z)", text):
block = match.group(0)
if f"name: {name}" in block:
return block
fail(f"render.yaml missing service block for {name}")
def domain_lines(block: str) -> list[str]:
match = re.search(r"(?ms)^ domains:\n(?P<body>.*?)(?=^ \S)", block)
if not match:
fail("Render web service missing domains block")
return [line.strip() for line in match.group("body").splitlines() if line.strip()]
def env_entry(block: str, key: str) -> str:
match = re.search(
rf"(?ms)^ - key: {re.escape(key)}\n(?P<body>(?: .+\n?)+)",
block,
)
if not match:
fail(f"service block missing env var {key}")
body = match.group("body")
next_key = re.search(r"^ - ", body, re.MULTILINE)
return body[: next_key.start()] if next_key else body
def require_env_value(block: str, key: str, value: str) -> None:
body = env_entry(block, key)
if not re.search(rf"^\s+value: {re.escape(value)}\s*$", body, re.MULTILINE):
fail(f"{key} must have value {value}")
def require_env_sync_false(block: str, key: str) -> None:
body = env_entry(block, key)
if not re.search(r"^\s+sync: false\s*$", body, re.MULTILINE):
fail(f"{key} must be Dashboard-provided with sync: false")
def require_env_json(block: str, key: str, expected: object) -> None:
body = env_entry(block, key)
match = re.search(r"^\s+value: '(.*)'\s*$", body, re.MULTILINE)
if not match:
fail(f"{key} must be a single-quoted JSON value")
try:
actual = json.loads(match.group(1))
except json.JSONDecodeError as error:
fail(f"{key} contains invalid JSON: {error}")
if actual != expected:
fail(f"{key} must exactly match the published mainnet release manifest")
def require_database_ref(block: str) -> None:
body = env_entry(block, "DATABASE_URL")
required = [
"fromDatabase:",
"name: agent-bounties-postgres",
"property: connectionString",
]
for item in required:
if item not in body:
fail(f"DATABASE_URL must use Render database reference {item}")
def env_group_block(text: str, name: str) -> str:
groups = section(text, "envVarGroups")
start = groups.find(f" - name: {name}\n")
if start == -1:
fail(f"missing env var group {name}")
end_match = re.search(r"^ - name: ", groups[start + 1 :], re.MULTILINE)
return groups[start : start + 1 + end_match.start()] if end_match else groups[start:]
def require_group(text: str, name: str, keys: list[str]) -> str:
group = env_group_block(text, name)
for key in keys:
if f"key: {key}" not in group:
fail(f"env var group {name} missing {key}")
if "STRIPE_SECRET_KEY" in keys and "sync: false" not in group:
fail("Stripe secrets must be Dashboard-provided")
if "OPERATOR_API_TOKEN" in keys and "generateValue: true" not in group:
fail("OPERATOR_API_TOKEN must be generated by Render")
if "ANALYTICS_EXCLUSION_TOKEN" in keys and "generateValue: true" not in group:
fail("ANALYTICS_EXCLUSION_TOKEN must be generated by Render")
if "DISCOVERY_WEBHOOK_SIGNING_KEY" in keys and "generateValue: true" not in group:
fail("DISCOVERY_WEBHOOK_SIGNING_KEY must be generated by Render")
return group
def require_address(value: object, label: str) -> str:
if not isinstance(value, str) or not re.fullmatch(r"0x[0-9a-fA-F]{40}", value):
fail(f"deployment manifest {label} must be an EVM address")
return value
def require_docker_compile_time_assets(repo_root: Path) -> None:
dockerfile_path = repo_root / "Dockerfile"
if not dockerfile_path.exists():
fail("missing Dockerfile")
dockerfile = dockerfile_path.read_text(encoding="utf-8")
copied_roots: set[str] = set()
for line in dockerfile.splitlines():
if "--from=" in line:
continue
match = re.match(r"^\s*COPY\s+(?:--\S+\s+)*(?P<sources>.+?)\s+\S+\s*$", line)
if not match:
continue
for source in match.group("sources").split():
if source.startswith("/"):
continue
copied_roots.add(source.rstrip("/").split("/", 1)[0])
include_pattern = re.compile(r'include_(?:str|bytes)!\(\s*"([^"]+)"\s*\)')
for rust_source in repo_root.glob("crates/**/*.rs"):
contents = rust_source.read_text(encoding="utf-8")
production_contents = contents.split("#[cfg(test)]", 1)[0]
for relative_asset in include_pattern.findall(production_contents):
resolved_asset = (rust_source.parent / relative_asset).resolve()
try:
repository_asset = resolved_asset.relative_to(repo_root.resolve())
except ValueError:
fail(
f"{rust_source.relative_to(repo_root)} includes an asset outside the repository: "
f"{relative_asset}"
)
if not resolved_asset.is_file():
fail(
f"{rust_source.relative_to(repo_root)} includes missing asset "
f"{repository_asset.as_posix()}"
)
root = repository_asset.parts[0]
if root not in copied_roots:
fail(
f"Dockerfile must copy {root}/ because {rust_source.relative_to(repo_root)} "
f"compiles {repository_asset.as_posix()} into a production binary"
)
workflow = (repo_root / ".github" / "workflows" / "containers.yml").read_text(
encoding="utf-8"
)
for root in sorted(copied_roots):
if root == "." or not (repo_root / root).is_dir():
continue
path_filter = f'- "{root}/**"'
if workflow.count(path_filter) != 2:
fail(
f"containers workflow must monitor {root}/** for pull_request and main push builds"
)
def load_mainnet_deployment(repo_root: Path) -> dict[str, object]:
path = repo_root / "deployments" / "base-mainnet.json"
if not path.exists():
fail("missing deployments/base-mainnet.json")
try:
deployment = json.loads(path.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError) as error:
fail(f"invalid Base mainnet deployment manifest: {error}")
if deployment.get("schema_version") != 2:
fail("Base mainnet deployment schema_version must be 2")
if deployment.get("protocol_version") != "agent-bounties/autonomous-v1":
fail("Base mainnet deployment must use autonomous-v1")
if deployment.get("network") != "base-mainnet" or deployment.get("chain_id") != 8453:
fail("Base mainnet deployment must target chain 8453")
if deployment.get("rpc_url") != "https://mainnet.base.org":
fail("Base mainnet deployment must use the official bootstrap RPC URL")
require_address(deployment.get("native_usdc"), "native_usdc")
status = deployment.get("status")
if status not in {"pending_external_review_and_deployment", "active"}:
fail("Base mainnet autonomous deployment status is invalid")
factory = deployment.get("factory")
if not isinstance(factory, dict):
fail("Base mainnet deployment must contain factory metadata")
if factory.get("source") != "contracts/base-escrow/src/AgentBountyFactory.sol:AgentBountyFactory":
fail("deployment factory source does not identify the autonomous factory")
constructor_args = factory.get("constructor_args")
if not isinstance(constructor_args, dict) or constructor_args.get("settlement_token") != deployment.get("native_usdc"):
fail("autonomous factory constructor must use Base native USDC")
if status == "active":
require_address(factory.get("contract"), "factory.contract")
require_address(factory.get("implementation"), "factory.implementation")
require_address(factory.get("deployer"), "factory.deployer")
transaction = factory.get("deployment_transaction")
if not isinstance(transaction, str) or not re.fullmatch(r"0x[0-9a-fA-F]{64}", transaction):
fail("factory deployment_transaction must be a transaction hash")
for key in ("runtime_code_hash", "implementation_runtime_code_hash"):
value = factory.get(key)
if not isinstance(value, str) or not re.fullmatch(r"0x[0-9a-fA-F]{64}", value):
fail(f"factory.{key} must be a bytes32 hash")
if not isinstance(factory.get("deployment_block"), int) or factory["deployment_block"] <= 0:
fail("factory.deployment_block must be positive")
policy = deployment.get("policy")
if not isinstance(policy, dict):
fail("deployment manifest must contain autonomous policy metadata")
if policy.get("operator_settlement_signer") is not False:
fail("autonomous protocol cannot configure an operator settlement signer")
if policy.get("hosted_paid_state_requires_confirmed_bounty_settled_event") is not True:
fail("hosted paid state must require confirmed BountySettled evidence")
return deployment
def load_open_competition_mainnet_release(repo_root: Path) -> dict[str, object]:
path = repo_root / "deployments" / "open-competition-v1-base-mainnet.json"
if not path.exists():
fail("missing deployments/open-competition-v1-base-mainnet.json")
try:
release = json.loads(path.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError) as error:
fail(f"invalid Open Competition V1 mainnet release manifest: {error}")
if release.get("schema_version") != "agent-bounties/open-competition-v1-base-mainnet-release-v1":
fail("Open Competition V1 release schema is invalid")
if release.get("protocol_version") != "agent-bounties/open-competition-v1":
fail("Open Competition V1 protocol version is invalid")
if release.get("network") != "base-mainnet" or release.get("chain_id") != 8453:
fail("Open Competition V1 release must target Base mainnet")
deployment_state = release.get("deployment_state")
active = deployment_state == "active_ready_to_earn"
if deployment_state not in {
"mainnet_canary_not_ready_to_earn",
"active_ready_to_earn",
}:
fail("Open Competition V1 hosted release state is invalid")
hosted = release.get("hosted_activation")
if not isinstance(hosted, dict):
fail("Open Competition V1 hosted activation evidence is missing")
if hosted.get("monitoring_gate_configured") is not True:
fail("Open Competition V1 monitoring gate must be configured")
for field in (
"public_creation_enabled",
"public_commitments_enabled",
"public_inventory_eligible",
"relay_support_available",
"gas_sponsorship_available",
"r4_release_evidence_complete",
):
if hosted.get(field) is not active:
fail(f"Open Competition V1 hosted gate {field} must match release state")
if hosted.get("monitoring_active") is not False:
fail("Open Competition V1 runtime monitoring cannot be pre-attested")
if not isinstance(release.get("release_manifest"), dict):
fail("Open Competition V1 release_manifest is missing")
catalog = release.get("verifier_catalog")
if not isinstance(catalog, dict):
fail("Open Competition V1 verifier_catalog is missing")
profiles = catalog.get("profiles")
if not isinstance(profiles, list) or len(profiles) != 1 or not isinstance(profiles[0], dict):
fail("Open Competition V1 catalog must contain one exact verifier profile")
hidden_canary = release.get("hidden_canary")
if not isinstance(hidden_canary, dict) or not isinstance(hidden_canary.get("verifier_profile"), dict):
fail("Open Competition V1 hidden canary must pin its verifier profile commitments")
canary_profile = hidden_canary["verifier_profile"]
catalog_profile = profiles[0]
if (
catalog_profile.get("deployment_state") != deployment_state
or catalog_profile.get("public_inventory_eligible") is not active
):
fail("Open Competition V1 catalog profile must match the hosted release state")
for field in ("profile_id", "benchmark_hash", "evidence_schema_hash"):
if canary_profile.get(field) != catalog_profile.get(field):
fail(f"Open Competition V1 hidden canary {field} must match the verifier catalog")
frozen_commitments = {
"benchmark": (
"leading-zero-work-v1/difficulty-16/canary-benchmark-v1",
"0x8f5dc601eaff77e6102aab44f16a9b176df7ce0a998078782fb5d4b9e0c0ebf2",
),
"evidence_schema": (
"agent-bounties/leading-zero-work-evidence-v1",
"0xea961c63fb67f86823003426b04a928406e44e9c8acc3dcb298189e9558083da",
),
}
for name, (preimage, commitment_hash) in frozen_commitments.items():
if canary_profile.get(f"{name}_preimage") != preimage or canary_profile.get(f"{name}_hash") != commitment_hash:
fail(f"Open Competition V1 hidden canary {name} commitment is not frozen")
if catalog_profile.get("evidence_schema") != canary_profile.get("evidence_schema_preimage"):
fail("Open Competition V1 evidence schema identifier must match its frozen preimage")
release_manifest = release.get("release_manifest")
if not isinstance(release_manifest, dict) or release_manifest.get("deployment_state") != deployment_state:
fail("Open Competition V1 nested release state must match the hosted release state")
public_activation_block = hosted.get("public_activation_block")
if active:
evidence = release.get("release_evidence")
review = evidence.get("independent_review") if isinstance(evidence, dict) else None
if (
not isinstance(review, dict)
or review.get("status") != "passed"
or review.get("reviewed_source_commit") != release.get("source_commit")
or review.get("factory_runtime_code_hash")
!= release_manifest.get("factory_runtime_code_hash")
or review.get("implementation_runtime_code_hash")
!= release_manifest.get("implementation_runtime_code_hash")
):
fail("Open Competition V1 active release requires exact independent-review evidence")
if (
not isinstance(public_activation_block, int)
or public_activation_block < release_manifest.get("deployment_block", 0)
):
fail("Open Competition V1 active release requires a public activation block")
elif public_activation_block is not None:
fail("Open Competition V1 hidden canary cannot declare a public activation block")
return release
def main() -> int:
repo_root = Path(__file__).resolve().parents[1]
require_docker_compile_time_assets(repo_root)
deployment = load_mainnet_deployment(repo_root)
open_competition_release = load_open_competition_mainnet_release(repo_root)
rpc_url = str(deployment["rpc_url"])
factory = deployment["factory"]
assert isinstance(factory, dict)
active = deployment["status"] == "active"
blueprint = repo_root / "render.yaml"
if not blueprint.exists():
fail("missing render.yaml")
text = blueprint.read_text(encoding="utf-8")
if "\t" in text:
fail("render.yaml must not contain tabs")
for secret_marker in ("sk_live_", "sk_test_", "whsec_", "PRIVATE KEY"):
if secret_marker in text:
fail(f"render.yaml must not contain secret marker {secret_marker}")
require_group(
text,
"agent-bounties-operator",
["OPERATOR_API_TOKEN", "ANALYTICS_EXCLUSION_TOKEN"],
)
require_group(
text,
"agent-bounties-discovery",
["DISCOVERY_WEBHOOK_SIGNING_KEY"],
)
require_group(
text,
"agent-bounties-stripe",
[
"STRIPE_SECRET_KEY",
"STRIPE_WEBHOOK_SECRET",
"STRIPE_PAYMENT_METHOD_CONFIGURATION",
],
)
base_group = require_group(
text,
"agent-bounties-base",
[
"BASE_SEPOLIA_RPC_URL",
"BASE_MAINNET_RPC_URL",
"BASE_SEPOLIA_USDC_TOKEN",
"BASE_MAINNET_USDC_TOKEN",
"BASE_SEPOLIA_BOUNTY_FACTORY",
"BASE_SEPOLIA_BOUNTY_IMPLEMENTATION",
"BASE_MAINNET_BOUNTY_FACTORY",
"BASE_MAINNET_BOUNTY_IMPLEMENTATION",
"BASE_MAINNET_LEADERBOARD_REWARD_CONTRACT",
"BASE_SEPOLIA_LEADERBOARD_REWARD_CONTRACT",
"BASE_RECOVERY_RESERVED_BOUNTY_CONTRACTS",
"BASE_MAINNET_OPEN_COMPETITION_V1_RELEASE_MANIFEST_JSON",
"BASE_MAINNET_OPEN_COMPETITION_V1_VERIFIER_CATALOG_JSON",
"BASE_MAINNET_OPEN_COMPETITION_V1_ENTRANT_WALLET_RELEASE_MANIFEST_JSON",
"BASE_MAINNET_OPEN_COMPETITION_V1_GAS_SPONSORSHIP_AVAILABLE",
"BASE_MAINNET_OPEN_COMPETITION_V1_RELAY_SUPPORT_AVAILABLE",
"BASE_MAINNET_OPEN_COMPETITION_V1_ENTRANT_RELAY_CANARY_ENABLED",
"BASE_MAINNET_OPEN_COMPETITION_V1_ENTRANT_RECOVERY_RELAY_ENABLED",
"BASE_MAINNET_OPEN_COMPETITION_V1_R4_EVIDENCE_COMPLETE",
"BASE_MAINNET_OPEN_COMPETITION_V1_MONITORING_ACTIVE",
"BASE_MAINNET_OPEN_COMPETITION_V1_CREATION_ENABLED",
"BASE_MAINNET_OPEN_COMPETITION_V1_COMMITMENTS_ENABLED",
"BASE_MAINNET_OPEN_COMPETITION_V1_PUBLIC_ACTIVATION_BLOCK",
],
)
require_env_sync_false(base_group, "BASE_SEPOLIA_RPC_URL")
require_env_sync_false(base_group, "BASE_SEPOLIA_BOUNTY_FACTORY")
require_env_sync_false(base_group, "BASE_SEPOLIA_BOUNTY_IMPLEMENTATION")
require_env_value(
base_group, "BASE_MAINNET_RPC_URL", HOSTED_BASE_MAINNET_RPC_URL
)
require_env_value(base_group, "BASE_MAINNET_USDC_TOKEN", str(deployment["native_usdc"]))
require_env_value(
base_group,
"BASE_MAINNET_LEADERBOARD_REWARD_CONTRACT",
f'"{MAINNET_LEADERBOARD_REWARD_CONTRACT}"',
)
require_env_value(
base_group,
"BASE_SEPOLIA_LEADERBOARD_REWARD_CONTRACT",
f'"{SEPOLIA_LEADERBOARD_REWARD_CONTRACT}"',
)
require_env_value(
base_group,
"BASE_RECOVERY_RESERVED_BOUNTY_CONTRACTS",
f'"{RECOVERY_RESERVED_BOUNTY_CONTRACTS}"',
)
require_env_json(
base_group,
"BASE_MAINNET_OPEN_COMPETITION_V1_RELEASE_MANIFEST_JSON",
open_competition_release["release_manifest"],
)
require_env_json(
base_group,
"BASE_MAINNET_OPEN_COMPETITION_V1_VERIFIER_CATALOG_JSON",
open_competition_release["verifier_catalog"],
)
require_env_sync_false(
base_group,
"BASE_MAINNET_OPEN_COMPETITION_V1_ENTRANT_WALLET_RELEASE_MANIFEST_JSON",
)
open_competition_active = (
open_competition_release["deployment_state"] == "active_ready_to_earn"
)
for key in (
"BASE_MAINNET_OPEN_COMPETITION_V1_GAS_SPONSORSHIP_AVAILABLE",
"BASE_MAINNET_OPEN_COMPETITION_V1_RELAY_SUPPORT_AVAILABLE",
"BASE_MAINNET_OPEN_COMPETITION_V1_R4_EVIDENCE_COMPLETE",
"BASE_MAINNET_OPEN_COMPETITION_V1_CREATION_ENABLED",
"BASE_MAINNET_OPEN_COMPETITION_V1_COMMITMENTS_ENABLED",
):
require_env_value(
base_group, key, '"true"' if open_competition_active else '"false"'
)
for key in (
"BASE_MAINNET_OPEN_COMPETITION_V1_ENTRANT_RELAY_CANARY_ENABLED",
"BASE_MAINNET_OPEN_COMPETITION_V1_ENTRANT_RECOVERY_RELAY_ENABLED",
):
require_env_value(base_group, key, '"false"')
activation_block = (
open_competition_release["hosted_activation"]["public_activation_block"]
if open_competition_active
else 0
)
require_env_value(
base_group,
"BASE_MAINNET_OPEN_COMPETITION_V1_PUBLIC_ACTIVATION_BLOCK",
f'"{activation_block}"',
)
require_env_value(
base_group, "BASE_MAINNET_OPEN_COMPETITION_V1_MONITORING_ACTIVE", '"true"'
)
relayer_group = require_group(
text,
"agent-bounties-x402-relayer",
["X402_RELAYER_PRIVATE_KEY"],
)
require_env_sync_false(relayer_group, "X402_RELAYER_PRIVATE_KEY")
if "agent-bounties-cloud-agent" in section(text, "envVarGroups"):
fail("CLOUD_AGENT_API_KEY cannot use sync: false inside an environment group")
if active:
require_env_value(base_group, "BASE_MAINNET_BOUNTY_FACTORY", str(factory["contract"]))
require_env_value(base_group, "BASE_MAINNET_BOUNTY_IMPLEMENTATION", str(factory["implementation"]))
else:
require_env_sync_false(base_group, "BASE_MAINNET_BOUNTY_FACTORY")
require_env_sync_false(base_group, "BASE_MAINNET_BOUNTY_IMPLEMENTATION")
services = section(text, "services")
for service in SERVICE_NAMES:
block = named_block(services, service)
require_database_ref(block)
require_env_value(block, "PUBLIC_BASE_URL", "https://api.agentbounties.app")
if "autoDeployTrigger: off" not in block:
fail(f"{service} must disable Render auto-deploys")
if "branch: main" not in block:
fail(f"{service} must deploy from main")
if "runtime: docker" not in block:
fail(f"{service} must use the Docker runtime")
if service in {"agent-bounties-api", "agent-bounties-mcp"}:
if "maxShutdownDelaySeconds: 60" not in block:
fail(f"{service} must allow graceful shutdown")
domains = domain_lines(block)
expected_domain = (
"- api.agentbounties.app"
if service == "agent-bounties-api"
else "- mcp.agentbounties.app"
)
if domains != [expected_domain]:
fail(f"{service} custom domain must be exactly {expected_domain}")
if service == "agent-bounties-base-indexer":
require_env_value(block, "BASE_INDEXER_NETWORK", "base-mainnet")
require_env_value(block, "BASE_INDEXER_PROTOCOL", "autonomous-v1")
require_env_value(block, "BASE_INDEXER_RPC_URL", rpc_url)
if active:
require_env_value(block, "BASE_INDEXER_FACTORY_CONTRACT", str(factory["contract"]))
if service == "agent-bounties-open-competition-v1-indexer":
for key, value in OPEN_COMPETITION_WORKER_ENVIRONMENT.items():
rendered_value = f'"{value}"' if value.isdecimal() else value
require_env_value(block, key, rendered_value)
database = section(text, "databases")
for required in (
"name: agent-bounties-postgres",
"databaseName: agent_bounties",
"user: agent_bounties",
"postgresMajorVersion: \"16\"",
"ipAllowList: []",
):
if required not in database:
fail(f"Render database configuration missing {required}")
print("render blueprint ok")
return 0
if __name__ == "__main__":
sys.exit(main())