make it more extremely hard Gasworks asks the age...
تم الإنشاء في: ٦ ديسمبر ٢٠٢٦
تمت الإجابة باستخدام GPT-6.2 Thinking بواسطة Chat01
تم الإنشاء في: ٦ ديسمبر ٢٠٢٦
تمت الإجابة باستخدام GPT-6.2 Thinking بواسطة Chat01
make it more extremely hard
Gasworks asks the agent to write an optimizer for smart-contract bytecode: a program that takes a system of EVM-style contracts and returns bytecode that behaves identically but uses less gas.
What the agent gets
A Python starter project with the virtual machine (which is the specification), a small assembler, and an optimizer that returns its input unchanged.
A few sample systems.
A task statement that defines "behaves identically": after any sequence of transactions, both versions must agree on success, output, logs, calls to outside addresses, storage and balances.
What makes it hard
Outside addresses are adversarial. A call to one can call back into any contract of the system, any number of times, before it returns. Every saving the optimizer makes around a call (keeping a storage value in memory, delaying a write, dropping a repeated read) is therefore only safe if it can prove what a call-back could or could not see or change.
The difficulty comes in three levels:
General rewriting: constant folding, removing redundant work, cheaper dispatch. The models do this well.
Reasoning about locks: a contract with a re-entrancy lock cannot be re-entered mid-call, so its storage can be cached across calls. The optimizer has to prove the lock holds on every path, and notice when a setter or a second contract breaks it.
Whole-system reasoning: which contracts can reach which, which values are fixed constants and which can be changed by a later transaction.
How it is graded
The verifier runs the agent's optimizer on 40 hidden systems, then replays 400 seeded transaction sequences against both versions with hostile re-entrant outside addresses.
Any difference in behaviour fails that system and earns 0 for its checks.
For equivalent systems, the score is the share of my reference optimizer's gas saving that the agent achieved.
For the 24 hard checks (80 points), only savings beyond a "cautious rewrite" count. That baseline is my reference with call-back reasoning switched off.
General rewriting alone is worth about 20 points; the rest needs the lock and whole-system reasoning.
Area Points
Basic contracts 9
Ledger behind its lock 10
Ledger with setters that open the lock 20
Pool with fixed constants 16
Pool with changeable parameters 25
Scale (six-contract systems, time limit) 10
Unusual code shapes 10
RL Gym Task Authoring and Self-Check
A basic pre-submission validation. It covers only what the task requirements state directly and helps candidates catch issues before submitting. It is not the final review, and the final review may identify additional issues. It reports what looks good, what is not passing yet, and what has no proof. It does not suggest redesigns.
Repository context
Use this guidance when authoring or reviewing a task. Run the self-check workflow below when validating a submission; its scratch-copy and no-edit rules apply to validation, not to an explicitly requested authoring change.
Read README.md for the index and the selected task's detailed guide: brownfield/README.md or greenfield/README.md.
Each task root contains task.toml, instruction.md, app/config.toml, environment/Dockerfile, reference-solution/, verifier/, and proof-of-work/.
Only app/ and instruction.md are candidate-visible. Keep reference solutions, verifiers, mutants, proof-of-work, and authoring guidance private.
Keep instructions, setup/run commands, reference behavior, and verification aligned. Keep verifier/scoring.yml synchronized with the verifier's TESTS declarations, which currently award points.
Brownfield has zero-point existing-feature gates in verifier/hidden-tests/. These must pass before scored tests run and are reported separately in reward.json.
Generate solutions using the latest qualifying frontier model versions available at generation time. Outdated models are not allowed. Use medium reasoning effort and include at least two proof-of-solution runs from different qualifying frontier models per task.
Store runs in proof-of-work/model-reasoning-timestamp/, omitting the provider prefix. Include solution/, generation metadata.json and trajectory.jsonl, and verifications/<run-number>/reward.json. Nondeterministic verification also requires metadata and trajectory files in each numbered verification folder.
Keep the root README short and task details in the task READMEs. Update this file when shared authoring guidance changes. Exclude generated dependencies, build output, local databases, and secrets from submissions.
How to run
Task Progress:
From the selected task root (brownfield/ or greenfield/), read instruction.md, task.toml, verifier/tests/, verifier/scoring.yml, and any verifier/hidden-tests/.
Prepare a fresh scratch copy of reference-solution/ using its setup commands. For Taskboard, use the task's app/config.toml for setup/run commands; GoRedis's reference has its own config.toml. Use the task environment for installed dependencies. Run the verifier twice, using a fresh reference workspace and separate output directory for each run. Keep both scores and logs.
Run each patch in verifier/mutants/ independently against a fresh reference copy, after an unmutated control. Compare the score with the targeted weight and the mutant README's expected score. This repository does not define check:reference or check:mutants npm scripts.
Grade a fresh app/ copy and confirm 0/100. For brownfield, also confirm all existing-feature gates pass.
Open the reference and model run records. Note each run's score, model name/version, reasoning effort, and the instruction and verifier version it was generated against.
After running the workspace's configured setup, invoke the verifier from the task root with absolute paths:
WORKSPACE=/absolute/path/to/prepared-workspace
TASK_DIR="$PWD"
OUT_DIR=/absolute/path/to/results
python3 verifier/tests/run_tests.py
The verifier starts the configured app; leave its port free. Save each run's reward.json and verifier.log. GoRedis also uses OUT_DIR/setup.log to detect setup failure, so preserve setup output there. Scores in this repository use 0–100: the reference target of 1.0 below means 100/100.
What to check
Instruction
Check Passing looks like
Realistic A genuine use case with a practical application. Not an arbitrary puzzle with many invented constraints.
No verifier or test leakage It does not name test files, test cases, check names, weights or how the score is computed.
No evaluation framing It does not say or imply the task is for RLVR, benchmarking, training or evaluating models.
Verifier
Check Passing looks like
Deterministic The reference scores exactly 1.0, and gives the same score on a repeat run. A saved run record showing this exists. If there is no such proof, treat it as "not shown yet".
Genuine (black-box) It checks behaviour and output, not how the solution is written. It does not require specific function names, attributes, internal values, file names or message text, unless the instruction states them. Many valid implementations should be able to pass.
Real partial credit It does not rely on all-or-nothing components. A component worth 30% or 40% of the total that gives nothing on a single failure is flagged, because it cannot tell partly correct from fully wrong.
Functionality weights No single functionality carries more than 25% of the total score. Each major functionality has several granular sub-checks.
Sub-check weights No single sub-check carries more than 5% of the total score.
Non-functional share Non-functional requirements (for example performance, limits, robustness) total no more than 20% of the score.
If the weights break any of these limits, say so and ask the candidate to review the weight allocation.
Mutants
Check Passing looks like
Count and mix 7 to 8 mutants on core functional behaviour, plus 1 to 2 on non-functional behaviour.
Each mutant breaks only its own feature Take the weight of the feature a mutant targets (for example 7%). With that mutant applied, the reference should score about 100% minus that weight (93%). A difference of more than 2 percentage points either way is flagged.
Caught for the right reason Mutants fail on behaviour, not because the build fails. Run an unmutated control first, and confirm it still scores 1.0.
Reference solution
Check Passing looks like
Exists There is a reference solution that builds and runs.
Scores 1.0 Run against the verifier, it scores exactly 1.0, with the same score on every run.
Below 1.0 Flag it and ask the candidate to check it. The cause may be the verifier or the reference.
Not hacky The reference does not hard-code expected values or detect the test inputs to reach 1.0. It solves the task the way the instruction describes.
Proof-of-work
Check Passing looks like
Qualifying model runs At least two distinct qualifying models have completed single-pass runs, with records and scores. Use the model anchors and release-date rule below; do not require an exact name match. A missing or unverified run is "not shown yet".
Difficulty target Each qualifying model must score below 30% in a single pass on the final version, using medium reasoning effort. A score of 30% or higher is flagged for review.
Repeated zero scores If multiple independent qualifying model runs score 0%, gently ask the author to review whether the instruction and verifier are clear and aligned. Consistent zero scores may indicate a task or verifier issue, rather than only high difficulty.
Latest version Every run was generated against the latest instruction and the latest verifier. If the instruction or verifier changed after a run was recorded, the proof is not valid until the solution is regenerated and the run completed again on the latest versions.
Use these as provider and release-date anchors, not as a static exact-name allowlist: GPT-5 Sol / GPT-6 Astra, Claude Opus 5 / Claude Fable 5, Gemini Argon 4 / Gemini 3.8 Flash, Grok 4.7, Muse Wonder, Kimi K3, Qwen 3.8 Max, MiMo V2.6 Pro, Mistral Large 4, GLM 5.3, MiniMax M3, and Nemotron 3.5 Lightning. Normalize case, punctuation, separators, and common provider/model aliases before comparing names. Identify the publishing company for both the candidate model and the matching anchor; use an official model catalog or release announcement to confirm publisher and release chronology when needed. A candidate model qualifies when it is from the same company as an anchor and was released on or after that company's anchor model. Accept newer generations and naming variants, including GPT-6 Sol, GPT-6.1, and GPT-5.1-Sol as later OpenAI models than GPT-5 Sol; do not reject them because their names differ from an anchor. Do not compare version numbers across companies or infer release order from name alone. If the publisher or release chronology cannot be confirmed, treat the run as outside the qualifying set. Runs from companies not represented by these anchors do not count toward candidate-provided proof-of-work. Require at least two distinct qualifying models, each run with medium reasoning effort and scoring below 30% in a single pass on the final task version.
If multiple independent qualifying model runs score 0%, gently ask the author to review whether the task instruction and verifier are clear and aligned. Present this as a possible issue to investigate, not as a conclusion that either is defective.
If proof runs use other models, including free-tier models, acknowledge them as useful early evidence. Explain gently that they may not predict the final assessment: after submission, the task may be evaluated with two leading frontier models selected from examples such as GPT-6 Sol, Claude Opus 5.5, and GPT-6 Astra, using high reasoning effort. The expected score in that assessment is below 40%. Free-tier proof alone may not be sufficient if the task does not meet the final evaluation criteria. Use wording such as: "If your proof runs use other or free-tier models, they can still help you assess the task before submission. For a consistent final assessment, we may also run it after submission with two leading frontier models (for example, GPT-6 Sol, Claude Opus 5.5, or GPT-6 Astra) at high reasoning effort; the task is expected to score below 40%. Free-tier results may differ from that assessment, so final acceptance will depend on the task meeting the evaluation criteria."
To check the last row, compare the instruction and verifier version recorded in each run (a commit, hash or timestamp) with the current files. If the run record has no version, say that the freshness of the proof cannot be confirmed.
How to word the report
Report every miss as a check that is not passing yet. Do not say the work is bad or wrong, and do not accuse.
For checks that meet the stated criteria, use "Looks good" instead of "Passing".
Use plain, calm wording: "This check is not passing yet:", "This is not shown yet:", "Please review:".
Give the evidence: the score, the weight, the count, or the file. Say what you ran and what you read.
Do not propose designs or rewrites. State what failed and what would show it passing.
If a check could not be run, say so once and say why.
Report template
<Numbered list of every check that is not passing yet or not shown yet, in the order above. Include the gentle post-submission assessment note when the submitted runs do not meet the provider/release-date rule. Write "None" if everything passes.>
Always end the report with: This is a basic pre-submission validation, not the final review. The final review may identify additional issues.
If the list contains any items, put this reminder after that note so it is the final line: Please resolve the feedback above before you submit the task. Omit the reminder when the list is "None".
Self-check before sending
Every number in the report came from a run or a file read in this check.
Every miss is worded as "not passing yet" or "not shown yet", with the evidence.
No fixes or redesigns are proposed.
The scratch copy was used, and the candidate's repo was not changed.
To make Gasworks extremely hard, I would elevate it from a re-entrancy-aware bytecode optimizer into a whole-system, adversarial, path-sensitive program optimizer.
The key change: the agent must reason not only about whether a storage value can change during a call, but whether it can change through an arbitrarily deep chain of callbacks, indirect calls, cross-contract lock interactions, and future transactions.
Here is the significantly harder version.
:::writing{variant="document" id="83172"}
Build a high-performance optimizer for EVM-style smart-contract bytecode.
The optimizer receives an entire interconnected system of contracts and produces a new version of that system that consumes less gas while preserving its exact observable behavior.
This is not a conventional peephole optimizer. The optimizer must perform bytecode-level analysis, path-sensitive reasoning, interprocedural analysis, cross-contract dependency analysis, and adversarial re-entrancy reasoning.
The central challenge is proving when an optimization remains valid despite arbitrary interactions between contracts and hostile external addresses.
Correctness is absolute. An optimization that saves gas but changes even one observable behavior is invalid.
The supplied Python virtual machine defines the authoritative execution semantics.
For every finite sequence of transactions and every permitted behavior of external addresses, the original and optimized systems must agree on:
The optimizer must preserve behavior across transaction boundaries, not merely for one isolated execution.
External addresses are fully adversarial. They may:
No external call may be assumed pure, harmless, deterministic, or non-reentrant.
The optimizer must discover and apply safe transformations across the entire contract system.
Implement:
The optimizer must work with noncanonical bytecode, including unusual stack layouts, shared code regions, indirect jumps, overlapping control-flow structures, and equivalent but differently encoded instruction sequences.
It must not depend on clean source-level function boundaries.
The optimizer must understand that an external call is a potential execution of the entire reachable contract system.
For every external call, it must determine:
This analysis must be transitive.
If Contract A calls an external address, which calls Contract B, which calls Contract C, which modifies a storage location subsequently read by A, the optimizer must recognize the dependency.
A direct-call-only analysis is insufficient.
The optimizer must identify and reason about re-entrancy locks even when they are not implemented as conventional boolean variables.
Locks may be represented through:
The optimizer must prove whether a lock is held on every relevant execution path.
It must account for:
A lock is not considered protective merely because a storage variable is set before an external call.
The optimizer must establish that the lock remains effective throughout every possible callback path.
The optimizer must reason about lock relationships across the complete system.
For example:
Contract A holds lock X and calls Contract B.
Contract B holds lock Y and calls an external address.
The external address re-enters Contract A through a different entry point.
The optimizer must determine whether X and Y jointly prevent relevant state modifications, whether another entry point bypasses either lock, and whether the callback can modify state that A assumes remains unchanged.
It must also identify cases where:
Lock proofs must be based on actual reachable execution paths, not contract names, function names, or superficial patterns.
The optimizer must distinguish between values that are:
It must discover invariants across contracts.
For example, a pool may read a configuration value from a ledger. The ledger may expose a setter that appears unrelated to the pool's execution path.
The optimizer must establish whether that setter is actually reachable, whether it can be invoked through an adversarial callback, and whether the configuration value can change between transactions.
Only proven invariants may justify replacing storage operations with constants or cached values.
The optimizer must construct conservative summaries of functions and their transitive effects.
These summaries must capture:
Summaries must account for indirect calls and recursive call graphs.
When a function's effects cannot be established, the optimizer must conservatively invalidate affected assumptions.
The optimizer must reason about how contract state evolves across an arbitrary number of transactions.
It must not assume that:
It must identify which optimizations are valid permanently and which are valid only within specific execution contexts.
The optimizer must analyze the system as a connected graph rather than optimizing contracts independently.
It must handle:
The analysis must remain sound when the system contains six or more interconnected contracts.
It must not rely on a fixed contract ordering or assume that the contract being optimized is isolated.
The optimizer must remain correct under combinations of difficult execution conditions.
Examples include:
Scenario 1: Indirect re-entrancy
A calls an external address, which calls B, which calls C, which re-enters A through a different entry point.
Scenario 2: Lock invalidation
A holds a lock, but a callback reaches a setter in B that changes the condition under which A's lock is considered valid.
Scenario 3: Cross-contract storage mutation
A caches a storage value, calls B, and B indirectly modifies that value through another contract.
Scenario 4: Conditional protection
A lock is held on most paths but is released on an uncommon branch before an external call.
Scenario 5: Temporal invalidation
A configuration value is constant during one transaction but can be changed by a later transaction through an otherwise unrelated entry point.
Scenario 6: Multiple-lock interaction
A relies on two locks in different contracts. A callback can modify one lock without touching the other.
Scenario 7: Recursive callback chains
An external address repeatedly invokes different system contracts, producing a call graph containing cycles and multiple possible return paths.
Scenario 8: State-dependent dispatch
A callback changes a storage value that affects the destination of a later indirect call.
Scenario 9: Revert-sensitive execution
A lock is acquired, an external call occurs, and different nested failure paths determine whether state changes are retained or reverted.
Scenario 10: Cross-contract invariant failure
Two contracts independently satisfy an invariant, but their combined execution allows a callback to violate the assumption used by an optimization.
These conditions may occur together rather than independently.
The optimizer must:
Conservative optimization is preferable to an unsound transformation.
The optimizer may decline an optimization when it cannot establish the necessary invariant. However, it should still pursue independent optimizations that remain provably safe.
The final program must implement a general-purpose optimizer that combines:
The ultimate challenge is to discover gas savings that are impossible to justify through local instruction rewriting alone.
A successful optimizer must understand not just what a contract executes, but what every other reachable contract could do while that execution is suspended.
The governing principle: Every optimization must remain correct under every execution path that the virtual machine permits, including paths created by hostile re-entrant behavior. :::
| Dimension | Original challenge | New challenge |
|---|---|---|
| Re-entrancy | Direct callbacks | Arbitrarily nested transitive callbacks |
| Locks | Boolean-style lock reasoning | Multi-lock, cross-contract lock proofs |
| Storage | Identify mutable values | Temporal and transitive invariant analysis |
| Call graph | Contract reachability | Dynamic, cyclic, context-sensitive reachability |
| Optimization | Local and interprocedural | Whole-system path-sensitive optimization |
| Transactions | Basic sequence testing | Arbitrary transaction-history dependencies |
| Failure handling | Basic success/failure | Nested revert and state-invalidation reasoning |
| Bytecode | Conventional instruction sequences | Unusual control-flow and stack structures |
To make this genuinely frontier-model difficult, I would enforce three particularly demanding requirements:
One important distinction: this is a harder candidate-facing task specification, not proof that the benchmark itself is harder. The verifier must also exercise these combined scenarios, and the reference optimizer must demonstrate that the requested optimizations are achievable.