fix: bootstrap-light.sh lacks Push3 candidate injection (#999)

Add CANDIDATE env var support to bootstrap-light.sh. When set to a
.push3 file path, the script:
1. Invokes push3-transpiler to regenerate OptimizerV3Push3.sol
2. Extracts the function body into OptimizerV3Push3Lib.sol
3. Deploys contracts normally via DeployLocal.sol
4. Deploys OptimizerV3 and upgrades the UUPS proxy via upgradeTo()

Also updates formulas/run-red-team.toml to reflect the implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
johba 2026-03-22 13:19:48 +00:00
parent 29b8f7d426
commit 349bd2c2c6
2 changed files with 134 additions and 17 deletions

View file

@ -55,9 +55,9 @@ description = "Timeout in seconds for the adversarial agent run (maps to CLAUDE_
# → promote-attacks (if floor broken) → deliver → teardown.
#
# CANDIDATE_NAME and OPTIMIZER_PROFILE label the evidence record and attack
# filenames; they do not select which optimizer is deployed — bootstrap-light
# always deploys via DeployLocal.sol. Per-candidate Push3 injection is planned
# but not yet wired (see notes.candidate_injection).
# filenames. To deploy a specific Push3 candidate, set the CANDIDATE env var
# (path to a .push3 file) — bootstrap-light.sh will transpile, recompile, and
# upgrade the Optimizer proxy to OptimizerV3 (see notes.candidate_injection).
[execution]
script = "scripts/harb-evaluator/red-team.sh"
@ -81,9 +81,9 @@ scripts/harb-evaluator/bootstrap-light.sh:
liquidity into positions establishing a realistic baseline.
- Verifies Anvil responds and all contract addresses are present in
onchain/deployments-local.json before proceeding.
Note: the deployed optimizer is always the default from DeployLocal.sol.
Per-candidate Push3 transpilation is not yet implemented here; see
notes.candidate_injection.
When the CANDIDATE env var is set (path to a .push3 file), bootstrap-light.sh
transpiles the candidate and upgrades the Optimizer proxy to OptimizerV3.
See notes.candidate_injection for details.
"""
[[steps]]
@ -242,13 +242,14 @@ rediscoveries are silently dropped and the step exits 0.
"""
candidate_injection = """
Push3 candidate injection is not yet implemented: bootstrap-light.sh always
deploys the default optimizer via DeployLocal.sol and does not read the
CANDIDATE env var. The candidate_name and optimizer_profile inputs are used
only for labelling (evidence records, attack filenames, PR titles); they do not
affect which optimizer is deployed.
Wiring CANDIDATE push3-transpiler forge compile bootstrap-light is
tracked as a follow-up issue.
Push3 candidate injection is supported via the CANDIDATE env var in
bootstrap-light.sh. When CANDIDATE points to a .push3 file the script:
1. Invokes push3-transpiler to regenerate OptimizerV3Push3.sol.
2. Extracts the function body into OptimizerV3Push3Lib.sol (shared library).
3. Deploys contracts normally via DeployLocal.sol (Optimizer v1 behind UUPS proxy).
4. Deploys a fresh OptimizerV3 implementation and upgrades the proxy via upgradeTo().
The candidate_name and optimizer_profile inputs remain metadata-only (evidence
records, attack filenames, PR titles).
"""
run_attack_suite_gap = """