samscrack commited on
Commit
0a284dd
·
verified ·
1 Parent(s): 8310032

Add dataset card with schema, provenance, B2/B3 mitigations

Browse files
Files changed (1) hide show
  1. README.md +95 -73
README.md CHANGED
@@ -1,76 +1,98 @@
1
  ---
2
- dataset_info:
3
- - config_name: full
4
- features:
5
- - name: task_id
6
- dtype: large_string
7
- - name: domain
8
- dtype: large_string
9
- - name: contract_name
10
- dtype: large_string
11
- - name: contract_address
12
- dtype: large_string
13
- - name: pragma
14
- dtype: large_string
15
- - name: pragma_major_minor
16
- dtype: large_string
17
- - name: resolved_solc_version
18
- dtype: large_string
19
- - name: target_function_signature
20
- dtype: large_string
21
- - name: prompt_context
22
- dtype: large_string
23
- - name: workspace_tar
24
- dtype: large_string
25
- - name: scoring_tar
26
- dtype: large_string
27
- - name: canary_substrings
28
- list: string
29
- splits:
30
- - name: train
31
- num_bytes: 134949194
32
- num_examples: 3044
33
- download_size: 104615982
34
- dataset_size: 134949194
35
- - config_name: lite
36
- features:
37
- - name: task_id
38
- dtype: large_string
39
- - name: domain
40
- dtype: large_string
41
- - name: contract_name
42
- dtype: large_string
43
- - name: contract_address
44
- dtype: large_string
45
- - name: pragma
46
- dtype: large_string
47
- - name: pragma_major_minor
48
- dtype: large_string
49
- - name: resolved_solc_version
50
- dtype: large_string
51
- - name: target_function_signature
52
- dtype: large_string
53
- - name: prompt_context
54
- dtype: large_string
55
- - name: workspace_tar
56
- dtype: large_string
57
- - name: scoring_tar
58
- dtype: large_string
59
- - name: canary_substrings
60
- list: string
61
- splits:
62
- - name: train
63
- num_bytes: 9132818
64
- num_examples: 200
65
- download_size: 7186378
66
- dataset_size: 9132818
67
  configs:
68
- - config_name: full
69
- data_files:
70
- - split: train
71
- path: full/train-*
72
- - config_name: lite
73
- data_files:
74
- - split: train
75
- path: lite/train-*
 
76
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
+ task_categories:
4
+ - text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - solidity
9
+ - smart-contracts
10
+ - code-generation
11
+ - agentic-eval
12
+ - foundry
13
+ - differential-fuzzing
14
+ size_categories:
15
+ - 1K<n<10K
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  configs:
17
+ - config_name: lite
18
+ data_files:
19
+ - split: train
20
+ path: lite/train-*
21
+ - config_name: full
22
+ data_files:
23
+ - split: train
24
+ path: full/train-*
25
+ default: true
26
  ---
27
+
28
+ # Solidity Eval (2026)
29
+
30
+ Agentic Solidity benchmark. Each task hands the agent a Foundry workspace where one function body in a real Etherscan-verified contract has been replaced with `revert("TODO");`. The agent edits, builds (`forge build`), and tests (`forge test`) inside a sandbox until it returns. Reward is the differential-fuzz pass rate (Diffusc + Echidna) of the model's body against the ground-truth body.
31
+
32
+ This dataset is intended for use with the [hermes-agent](https://github.com/NousResearch/hermes-agent) Solidity Eval environment, but the `workspace_tar` / `scoring_tar` shape is harness-agnostic — any agent harness that can stage a tarball into `/work` and run a scorer over `/scoring` can use it.
33
+
34
+ ## Configs
35
+
36
+ | Config | Rows | Selection |
37
+ | --- | --- | --- |
38
+ | `lite` | 200 | Stratified by pragma major.minor over the full cohort (seed=0). Use this for cost-bounded eval runs. |
39
+ | `full` | 3044 | Every row from the SolBench RACR-4k corpus that (a) has a parseable Solidity pragma, (b) satisfies the 0.5.0–0.8.34 compiler range installed in the reference image, and (c) parses cleanly through the function-stubbing step. |
40
+
41
+ ## Schema
42
+
43
+ | Field | Type | Description |
44
+ | --- | --- | --- |
45
+ | `task_id` | str | `<contract_name>_<idx>`, unique within the dataset. |
46
+ | `domain` | str | `"unknown"` for every row — the source corpus has no domain mapping. |
47
+ | `contract_name` | str | Solidity contract name (target of the deletion). |
48
+ | `contract_address` | str | Etherscan address the source was scraped from. |
49
+ | `pragma` | str | Raw pragma string from the source (`^0.8.10`, `>=0.6.0 <0.8.0`, etc.). |
50
+ | `pragma_major_minor` | str | `"0.5"` / `"0.6"` / `"0.7"` / `"0.8"` — used for stratification. |
51
+ | `resolved_solc_version` | str | Highest installed solc satisfying the pragma. The reference image installs every patch version of 0.5.x–0.8.x. |
52
+ | `target_function_signature` | str | First line of the deleted function header (for the prompt). |
53
+ | `prompt_context` | str | Surrounding code shown to the model (`sc_ba[0]` from the source corpus). |
54
+ | `workspace_tar` | str | Base64-encoded `.tar.gz` containing `foundry.toml` + `src/<contract_name>.sol` (with the target function body replaced by `{ revert("TODO"); }`). Stage this into `/work` before the agent runs. |
55
+ | `scoring_tar` | str | Base64-encoded `.tar.gz` containing `manifest.json` + `origin/<contract_name>.sol`. Stage into `/scoring` *only at scoring time* — never during the agent loop. |
56
+ | `canary_substrings` | list[str] | Tokens / fragments unique to the deleted function body. The scorer fails the run with `b3_violation` if any of these appear in `/work` after the agent finishes. |
57
+
58
+ ## Reward semantics
59
+
60
+ The in-image scorer (`/opt/scoring/run_diffusc.py` in the reference image) follows SolBench's `echidna()` rule:
61
+
62
+ ```
63
+ reward = 1.0 if Diffusc compiles + Echidna passes (or vacuous "no diff" pass)
64
+ reward = 0.0 on diffusc compile failure, echidna failure, timeout,
65
+ B3 canary violation, or stub-residue (revert("TODO"); left in)
66
+ ```
67
+
68
+ Three pass routes are tagged in `pass_route.txt` for auditability: `exit_0`, `vacuous_no_diff`, `fail`. Runs with disproportionate vacuous passes can be flagged.
69
+
70
+ ## B2 / B3 reward-hack mitigations
71
+
72
+ - **B2 (no exfiltration via web tools).** The verified contracts are public on Etherscan, so any agent with web access can fetch the answer with one query. Runners must disable web/browser/messaging tools; for non-Hermes agents this means setting agent-specific flags or running the sandbox container without network egress.
73
+ - **B3 (no ground-truth in the workspace).** `scoring_tar` (containing `origin/`) is staged only after the agent loop ends. The scorer additionally greps the candidate for `canary_substrings` and zeroes the reward if any match.
74
+ - **Stub residue.** If the agent leaves `revert("TODO");` in the candidate, the scorer flags it (`pass_route=stub_residue`) and zeros the reward — otherwise an empty implementation would coast through the vacuous-pass route.
75
+
76
+ ### B3 caveats
77
+
78
+ - 168 of the 3044 rows have an empty `canary_substrings` list (the deleted body uses only identifiers that already appear elsewhere in the contract — common for ERC20-style getters). For these rows B3 enforcement degrades to best-effort; the canary-grep is a no-op and only the stub-residue + diff-fuzz checks remain. Auditors who want strict B3 enforcement should filter to rows with non-empty canaries.
79
+
80
+ ## Provenance
81
+
82
+ - Source corpus: SolBench (https://github.com/ZaoyuChen/SolBench, MIT, FSE 2026), specifically the RACR-4k LCS subset.
83
+ - Function-stubbing + tarball construction: this dataset's builder (`environments/benchmarks/solidity_eval/dataset/build_modern_subset.py` in the eval repo).
84
+ - Reference scorer + sandbox image: `samscrack/solidity-eval-sandbox:dev` (Foundry 1.6.0-nightly, Echidna 2.2.3 from the SolBench fork, Diffusc + Slither 0.9.3 from `webthethird/slither.git@dev-diffusc-testing`, solc-select 0.5.0–0.8.34).
85
+
86
+ ## Skipped rows from the source corpus (164 of 3208)
87
+
88
+ | Reason | Count |
89
+ | --- | --- |
90
+ | `cannot-stub-funit` | 143 |
91
+ | `unsupported-pragma-0.4` | 8 |
92
+ | `no-pragma` | 13 |
93
+
94
+ `cannot-stub-funit` covers constructors, modifiers, receive/fallback declarations, and abstract function shapes the regex-based stubber can't safely rewrite. Future builder iterations could handle these explicitly.
95
+
96
+ ## License
97
+
98
+ MIT, inherited from SolBench. The contract sources are public on Etherscan.