make it more extremely difficult Gasworks asks th...
作成日: 2026年12月5日
使用モデル GPT-6.2 Thinking by Chat01
作成日: 2026年12月5日
使用モデル GPT-6.2 Thinking by Chat01
make it more extremely difficult
Gasworks asks the model to write a program that rewrites smart-contract bytecode so it does exactly the same thing but costs less gas to run.
What the model is given
A small virtual machine (evm.py): a Python implementation of an Ethereum-style machine with a fixed gas price for every operation. This file is the specification; whatever it does is the rule.
An assembler and five sample systems: a token, a vault and combinations of them, in two bytecode styles.
A one-page instruction and an empty optimizer that returns its input unchanged.
What the model must build
A command that reads a system (one or more contracts plus their starting storage) and prints replacement bytecode for each contract. It has 60 seconds and 2 CPUs per system, and each contract must stay under 24,576 bytes.
The rule it must not break
The new contracts must behave identically to the originals after every transaction:
same success or failure, and same returned data
same logs, in the same order
same calls to outside addresses, with the same arguments
same storage and balances
Gas used and memory contents are allowed to differ. That is the whole point: anything not observable can be changed.
How it is checked
The checker replays thousands of random transaction sequences against the original and the rewritten system and compares them step by step. It also plays the outside addresses itself and behaves badly on purpose: returning junk, failing, or calling back into the contract mid-call. An optimization that is only safe when the outside world is polite gets caught.
A single behavioural difference means that system earns nothing. If the system stays equivalent, the score comes from how much gas was saved.
Where the difficulty was meant to come from
Open-ended objective: there is no correct answer to copy from a spec, only "save more". Tidepool failed because it was fully specified.
Risk against reward: aggressive rewrites save more but are more likely to break equivalence, which costs everything on that system.
Hidden systems: the model sees token and vault, but is also graded on staking and auction contracts it never saw.
Packed bytecode: a second style with a jump-table dispatcher, shared subroutines and constants stored in code, meant to defeat simple analysis.
L 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.
The current Gasworks is difficult, but a strong frontier model could potentially achieve a respectable score using peephole optimization, constant folding, dead-code elimination, and basic control-flow analysis.
To make it extremely difficult, turn it from a local bytecode optimization problem into a whole-system optimizing compiler problem, where meaningful gas savings require reasoning about dynamically dispatched execution, persistent state, memory aliasing, indirect jumps, and adversarial interactions between contracts.
The difficulty should come from genuine semantic complexity, rather than insufficient documentation, unrealistic time limits, or arbitrary requirements.
| Area | Current Gasworks | Extreme Gasworks |
|---|---|---|
| Control flow | Jump tables and dispatchers | Computed jumps, shared continuations, recursive internal subroutines |
| System size | Small contract combinations | Interdependent systems of 3–12 contracts |
| Storage | Basic persistent state | Symbolic storage keys, dynamic mappings, packed fields and aliasing |
| Memory | Ordinary memory operations | Overlapping regions, dynamic offsets and conditional aliasing |
| External calls | Adversarial responses | Nested reentrancy, callbacks into different contracts and failures |
| Bytecode | Two compilation styles | Multiple independently generated compilation styles and mixed styles |
| Optimization | Local gas savings | Interprocedural analysis and safe global transformations |
| Transactions | Random sequences | Stateful, adaptive and boundary-value sequences |
| Hidden systems | Unseen contract types | Unseen combinations of business logic, control flow and bytecode generation techniques |
1. Interprocedural control-flow reconstruction
Contracts contain dynamically computed jump destinations, shared subroutines, multiple return sites and code-embedded constants. Changing instruction offsets requires correctly relocating every affected reference.
2. Symbolic storage alias analysis
Repeated storage operations use keys calculated through different arithmetic expressions. The optimizer must determine whether two accesses are equivalent, independent or potentially overlapping.
3. Reentrancy-aware optimization
External calls can invalidate previously established facts about storage, balances and control flow by reentering any reachable contract in the system.
4. Memory alias analysis
Contracts repeatedly copy, overwrite and read partially overlapping memory regions. Removing an apparently redundant write can silently corrupt later return data, logs or call arguments.
5. Path-sensitive symbolic execution
An expression may be redundant on one execution path but essential on another. Useful optimizations require propagating constraints across branches and loop iterations.
6. Cross-contract specialization
Contracts repeatedly interact through predictable interfaces. The optimizer can exploit provable relationships between contracts, but cannot assume that initial state, caller identities or outside responses remain constant.
7. Bit-vector arithmetic simplification
Algebraic transformations must preserve the VM's exact word width, overflow, signedness, shifts and exceptional arithmetic behavior.
8. Optimization under a code-size budget
Inlining, loop unrolling and specialization can reduce execution costs while increasing bytecode size. The optimizer must select profitable transformations without exceeding the deployment limit.
For example, consider this execution:
An apparently redundant storage read becomes essential after an adversarial callback.
A naive optimizer caches the first storage read and removes the second. A conservative optimizer preserves both. An advanced optimizer must establish when caching is actually safe.
Build similar situations into memory operations, arithmetic, indirect jumps and cross-contract interactions. Include both safe and unsafe variants so that simply disabling aggressive optimizations sacrifices meaningful gas savings.
Do not rely exclusively on token, vault, staking and auction contracts.
| Hidden system | Primary challenge |
|---|---|
| Automated market maker | Arithmetic invariants and storage dependencies |
| Lending protocol | Cross-contract state and callbacks |
| Governance system | Dynamic dispatch and complex state transitions |
| Escrow network | Failure propagation and conditional transfers |
| Order-matching exchange | Loops, memory aliasing and dynamic data |
| Multisignature wallet | Variable-length inputs and indirect execution |
| Reward distribution system | Nested mappings and arithmetic boundaries |
| Composable financial protocol | Combined optimization hazards |
| Contract router | Computed jumps and runtime dispatch |
| Settlement system | Partial failures and complex inter-contract dependencies |
Generate multiple equivalent bytecode variants of each system using deterministic transformations. Vary instruction layout, stack ordering, arithmetic expressions, dispatch mechanisms and subroutine sharing.
This makes recognizing a particular compiler pattern much less useful.
The intended progression should look something like this:
Proposed difficulty calibration — illustrative targets, not measured results
Design workloads where the largest savings come from reasoning across basic blocks, subroutines and contracts, rather than replacing short instruction sequences.
Calibrate those workloads against actual baseline optimizers and the reference implementation.
Avoid making the entire task all-or-nothing. Instead, independently score small systems and workloads.
| Functionality | Sub-checks | Weight |
|---|---|---|
| Control-flow and bytecode transformation | 4 | 20% |
| Stack, arithmetic and memory optimization | 4 | 20% |
| Persistent storage optimization | 4 | 20% |
| Cross-contract and adversarial optimization | 4 | 20% |
| Gas efficiency on mixed workloads | 4 | 20% |
| Total | 20 | 100% |
Each sub-check is worth at most 5%. A behavioral difference invalidates that system, not the entire submission. Correct optimizations receive granular credit according to their gas savings.
The unchanged optimizer must earn zero.
This allocation treats the first four groups as functional optimizer capabilities and the last group as non-functional efficiency. Confirm that interpretation against the authoring rules, because gas reduction is itself the primary functionality of Gasworks.
The private verifier should include deterministic transaction sequences, arithmetic boundary values, malformed inputs, deep callbacks, rollback scenarios, equivalent bytecode variants and adaptive outside behavior driven by observable contract interactions.
Also explicitly resolve gas observability, gas-limited execution and code introspection according to evm.py. Otherwise, some seemingly reasonable equivalence requirements could make optimization impossible.
:::writing{variant="document" id="83921"}
Build an optimizing bytecode rewriter for interconnected smart-contract systems.
Existing contracts execute correctly but consume unnecessary gas. Your goal is to reduce their execution costs without changing their observable behavior.
Each system contains deployed contract bytecode, initial persistent storage, addresses and initial balances.
The supplied virtual machine defines the execution semantics. Contracts may use indirect control flow, shared subroutines, dynamic storage addressing, overlapping memory regions and interactions with other contracts.
The supplied examples demonstrate several valid bytecode layouts. Your optimizer must not depend on a particular layout, contract implementation or transaction sequence.
Implement the supplied optimizer command so that it produces replacement bytecode for every contract in the input system.
Your implementation must support previously unseen contracts and systems without manual configuration.
For every valid transaction sequence under the supplied virtual machine, the rewritten system must preserve:
Outside addresses are not trusted. They may return arbitrary data, fail, or call back into any accessible contract.
The optimizer must not assume that initial storage values remain constant, that memory regions are independent, or that external interactions leave system state unchanged.
Gas consumption and unobservable intermediate execution state may differ.
Reduce unnecessary gas consumption across the complete contract system.
The optimizer may restructure control flow, simplify calculations, eliminate redundant operations, specialize execution paths and perform other semantics-preserving transformations.
The implementation must operate using the supplied bytecode and system information alone.
The replacement system must remain executable by the supplied virtual machine without modifications.
The behavior implemented in evm.py is authoritative.
:::
Use eight core functional mutants and two non-functional mutants.
| Mutant | Deliberately broken behavior |
|---|---|
| M1 | Incorrect relocation of computed jump destinations |
| M2 | Unsound storage alias assumptions |
| M3 | Reuse of storage values after reentrant calls |
| M4 | Incorrect elimination of overlapping memory writes |
| M5 | Arithmetic simplification that ignores overflow |
| M6 | Invalid propagation of facts across conditional branches |
| M7 | Incorrect cross-contract specialization |
| M8 | Incorrect handling of failed calls and rollback |
| M9 | Exceeding the bytecode size constraint |
| M10 | Exceeding the optimization runtime budget |
Each mutant should remain executable and fail for its intended reason. Verify that its score reduction matches its targeted weight within the permitted tolerance.
The biggest improvement is that the model can no longer solve individual optimization opportunities independently.
One possible architecture for a high-performing solution, rather than a prescribed implementation.
A sophisticated solution may require substantial components of a production optimizing compiler, including abstract interpretation, symbolic execution, alias analysis, interprocedural effect analysis and bytecode generation.
That makes Gasworks substantially more open-ended than a conventional fully specified software engineering task.
Difficulty target: both qualifying frontier models below 30% at medium reasoning effort, while the reference solution consistently earns 100%.
This is a proposed redesign, not an experimentally validated difficulty result. I have retained the original runtime, CPU and bytecode limits rather than making the task harder through artificial resource restrictions. The repository, reference implementation and model proof runs were not supplied, so the proposed scoring distribution and difficulty still require empirical validation.