NFTBench 1.0.1 (part 2)
Browse files- data_card.md +2 -2
- pyproject.toml +1 -1
- src/tests/test_evaluate.py +6 -0
- src/tests/test_lenient.py +3 -0
- src/tests/test_rc_select.py +2 -0
- src/tests/test_real_code_tasks.py +16 -2
- src/tests/test_rules.py +1 -0
data_card.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
# NFTBench Dataset Card (Version 1.0.
|
| 2 |
|
| 3 |
## Overview
|
| 4 |
|
| 5 |
NFTBench is a deterministic benchmark for evaluating AI agent execution and decision-making on smart contract semantics and multi-standard interactions.
|
| 6 |
|
| 7 |
-
This release is version 1.0.
|
| 8 |
|
| 9 |
Version 0.9.2 adds M25 to real_code: its attached destination signatures are computed at build time. It also adds a signing task group and an optional local wallet endpoint.
|
| 10 |
|
|
|
|
| 1 |
+
# NFTBench Dataset Card (Version 1.0.1)
|
| 2 |
|
| 3 |
## Overview
|
| 4 |
|
| 5 |
NFTBench is a deterministic benchmark for evaluating AI agent execution and decision-making on smart contract semantics and multi-standard interactions.
|
| 6 |
|
| 7 |
+
This release is version 1.0.1.
|
| 8 |
|
| 9 |
Version 0.9.2 adds M25 to real_code: its attached destination signatures are computed at build time. It also adds a signing task group and an optional local wallet endpoint.
|
| 10 |
|
pyproject.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
[project]
|
| 2 |
name = "nftbench"
|
| 3 |
-
version = "1.0.
|
| 4 |
requires-python = ">=3.13"
|
| 5 |
dependencies = [
|
| 6 |
"eth-account>=0.14.0",
|
|
|
|
| 1 |
[project]
|
| 2 |
name = "nftbench"
|
| 3 |
+
version = "1.0.1"
|
| 4 |
requires-python = ">=3.13"
|
| 5 |
dependencies = [
|
| 6 |
"eth-account>=0.14.0",
|
src/tests/test_evaluate.py
CHANGED
|
@@ -705,6 +705,12 @@ def test_run_json_records_code_revision_and_resume_appends_a_new_one(tmp_path, m
|
|
| 705 |
|
| 706 |
|
| 707 |
def test_code_revision_from_git_then_env_then_null(monkeypatch):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 708 |
rev, dirty = evaluate.code_revision()
|
| 709 |
assert len(rev) == 40 and int(rev, 16) >= 0 and isinstance(dirty, bool)
|
| 710 |
|
|
|
|
| 705 |
|
| 706 |
|
| 707 |
def test_code_revision_from_git_then_env_then_null(monkeypatch):
|
| 708 |
+
root = Path(evaluate.__file__).resolve().parents[2]
|
| 709 |
+
if shutil.which("git") is None:
|
| 710 |
+
pytest.skip("git checkout required: git executable not found")
|
| 711 |
+
probe = subprocess.run(["git", "-C", str(root), "rev-parse", "--is-inside-work-tree"], capture_output=True, text=True)
|
| 712 |
+
if probe.returncode != 0 or probe.stdout.strip() != "true":
|
| 713 |
+
pytest.skip(f"git checkout required: {root} is not inside a git work tree")
|
| 714 |
rev, dirty = evaluate.code_revision()
|
| 715 |
assert len(rev) == 40 and int(rev, 16) >= 0 and isinstance(dirty, bool)
|
| 716 |
|
src/tests/test_lenient.py
CHANGED
|
@@ -446,7 +446,10 @@ def test_relative_path_resolution_against_different_runs_dir(tmp_path):
|
|
| 446 |
def test_pbs_validity_sidecar_behavior(tmp_path):
|
| 447 |
"""Finding 5: PBS validity sidecar checks requested lenient episodes, marking INVALID on missing run.json or EVAL_RC != 0."""
|
| 448 |
from nftbench.evaluate import get_task_root, load_manifest_records
|
|
|
|
| 449 |
|
|
|
|
|
|
|
| 450 |
out_dir = tmp_path / "run_out"
|
| 451 |
out_dir.mkdir(parents=True)
|
| 452 |
|
|
|
|
| 446 |
def test_pbs_validity_sidecar_behavior(tmp_path):
|
| 447 |
"""Finding 5: PBS validity sidecar checks requested lenient episodes, marking INVALID on missing run.json or EVAL_RC != 0."""
|
| 448 |
from nftbench.evaluate import get_task_root, load_manifest_records
|
| 449 |
+
from nftbench.lenient_resume import DEFAULT_SELECTION_PATH
|
| 450 |
|
| 451 |
+
if not DEFAULT_SELECTION_PATH.exists():
|
| 452 |
+
pytest.skip(f"lenient selection not shipped: {DEFAULT_SELECTION_PATH} missing")
|
| 453 |
out_dir = tmp_path / "run_out"
|
| 454 |
out_dir.mkdir(parents=True)
|
| 455 |
|
src/tests/test_rc_select.py
CHANGED
|
@@ -236,6 +236,7 @@ def test_planted_funnel_row_with_locked_false_and_transfer_revert_fails_g5():
|
|
| 236 |
assert strat_sb == "soulbound"
|
| 237 |
|
| 238 |
|
|
|
|
| 239 |
def test_planted_recipe_step_that_reverts_fails_contract(shared_anvil, proxy_bc, tmp_path):
|
| 240 |
"""A planted recipe step that reverts fails the contract replay (reverts are never swallowed)."""
|
| 241 |
selection_csv = REAL_CODE_DIR / "selection.csv"
|
|
@@ -268,6 +269,7 @@ def test_planted_recipe_step_that_reverts_fails_contract(shared_anvil, proxy_bc,
|
|
| 268 |
assert "reverted" in str(exc_info.value).lower()
|
| 269 |
|
| 270 |
|
|
|
|
| 271 |
def test_replay_passes_for_every_selected_contract_with_real_anvil(shared_anvil, proxy_bc):
|
| 272 |
"""Replay passes for every selected contract on real Anvil and facts match stratum requirements."""
|
| 273 |
selection_csv = REAL_CODE_DIR / "selection.csv"
|
|
|
|
| 236 |
assert strat_sb == "soulbound"
|
| 237 |
|
| 238 |
|
| 239 |
+
@pytest.mark.skipif(not RECIPES_DIR.is_dir(), reason=f"replay recipes not shipped: {RECIPES_DIR} missing")
|
| 240 |
def test_planted_recipe_step_that_reverts_fails_contract(shared_anvil, proxy_bc, tmp_path):
|
| 241 |
"""A planted recipe step that reverts fails the contract replay (reverts are never swallowed)."""
|
| 242 |
selection_csv = REAL_CODE_DIR / "selection.csv"
|
|
|
|
| 269 |
assert "reverted" in str(exc_info.value).lower()
|
| 270 |
|
| 271 |
|
| 272 |
+
@pytest.mark.skipif(not RECIPES_DIR.is_dir(), reason=f"replay recipes not shipped: {RECIPES_DIR} missing")
|
| 273 |
def test_replay_passes_for_every_selected_contract_with_real_anvil(shared_anvil, proxy_bc):
|
| 274 |
"""Replay passes for every selected contract on real Anvil and facts match stratum requirements."""
|
| 275 |
selection_csv = REAL_CODE_DIR / "selection.csv"
|
src/tests/test_real_code_tasks.py
CHANGED
|
@@ -568,8 +568,10 @@ def test_m12_locked_cancellation_then_infeasible_fails():
|
|
| 568 |
|
| 569 |
@pytest.fixture(scope="module")
|
| 570 |
def gate_tasks(tmp_path_factory):
|
| 571 |
-
from scripts.rc_build_tasks import build_tasks, load_task_specs
|
| 572 |
|
|
|
|
|
|
|
| 573 |
root = tmp_path_factory.mktemp("real_code_gate")
|
| 574 |
build_tasks([s for s in load_task_specs() if s["instance_id"] in {
|
| 575 |
"M12_rc01_locked", "M19_rc11_owner_minter",
|
|
@@ -920,6 +922,8 @@ def m20_root(tmp_path_factory):
|
|
| 920 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m20", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 921 |
module = importlib.util.module_from_spec(spec)
|
| 922 |
spec.loader.exec_module(module)
|
|
|
|
|
|
|
| 923 |
|
| 924 |
root = tmp_path_factory.mktemp("real_code_m20")
|
| 925 |
module.build_tasks(out_dir=root)
|
|
@@ -1036,6 +1040,8 @@ def m21_root(tmp_path_factory):
|
|
| 1036 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m21", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1037 |
module = importlib.util.module_from_spec(spec)
|
| 1038 |
spec.loader.exec_module(module)
|
|
|
|
|
|
|
| 1039 |
|
| 1040 |
root = tmp_path_factory.mktemp("real_code_m21")
|
| 1041 |
module.build_tasks(out_dir=root)
|
|
@@ -1263,6 +1269,8 @@ def m22_root(tmp_path_factory):
|
|
| 1263 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m22", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1264 |
module = importlib.util.module_from_spec(spec)
|
| 1265 |
spec.loader.exec_module(module)
|
|
|
|
|
|
|
| 1266 |
root = tmp_path_factory.mktemp("real_code_m22")
|
| 1267 |
module.build_tasks(specs=[s for s in module.load_task_specs() if s["template"] == "M22"], out_dir=root)
|
| 1268 |
return root
|
|
@@ -1353,8 +1361,10 @@ def test_m22_first_part_then_declaration_fails(m22_root):
|
|
| 1353 |
|
| 1354 |
@pytest.fixture
|
| 1355 |
def m23_tasks(tmp_path):
|
| 1356 |
-
from scripts.rc_build_tasks import build_tasks, load_task_specs
|
| 1357 |
|
|
|
|
|
|
|
| 1358 |
build_tasks([s for s in load_task_specs() if s.get("template") == "M23"], tmp_path)
|
| 1359 |
return tmp_path
|
| 1360 |
|
|
@@ -1454,6 +1464,8 @@ def m24_root(tmp_path_factory):
|
|
| 1454 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m24", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1455 |
module = importlib.util.module_from_spec(spec)
|
| 1456 |
spec.loader.exec_module(module)
|
|
|
|
|
|
|
| 1457 |
root = tmp_path_factory.mktemp("real_code_m24")
|
| 1458 |
module.build_tasks(out_dir=root)
|
| 1459 |
return root
|
|
@@ -1570,6 +1582,8 @@ def m25_root(tmp_path_factory):
|
|
| 1570 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m25", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1571 |
module = importlib.util.module_from_spec(spec)
|
| 1572 |
spec.loader.exec_module(module)
|
|
|
|
|
|
|
| 1573 |
root = tmp_path_factory.mktemp("real_code_m25")
|
| 1574 |
module.build_tasks(out_dir=root)
|
| 1575 |
return root
|
|
|
|
| 568 |
|
| 569 |
@pytest.fixture(scope="module")
|
| 570 |
def gate_tasks(tmp_path_factory):
|
| 571 |
+
from scripts.rc_build_tasks import TASK_SPECS_PATH, build_tasks, load_task_specs
|
| 572 |
|
| 573 |
+
if not TASK_SPECS_PATH.exists():
|
| 574 |
+
pytest.skip(f"task specs not shipped: {TASK_SPECS_PATH} missing")
|
| 575 |
root = tmp_path_factory.mktemp("real_code_gate")
|
| 576 |
build_tasks([s for s in load_task_specs() if s["instance_id"] in {
|
| 577 |
"M12_rc01_locked", "M19_rc11_owner_minter",
|
|
|
|
| 922 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m20", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 923 |
module = importlib.util.module_from_spec(spec)
|
| 924 |
spec.loader.exec_module(module)
|
| 925 |
+
if not module.TASK_SPECS_PATH.exists():
|
| 926 |
+
pytest.skip(f"task specs not shipped: {module.TASK_SPECS_PATH} missing")
|
| 927 |
|
| 928 |
root = tmp_path_factory.mktemp("real_code_m20")
|
| 929 |
module.build_tasks(out_dir=root)
|
|
|
|
| 1040 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m21", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1041 |
module = importlib.util.module_from_spec(spec)
|
| 1042 |
spec.loader.exec_module(module)
|
| 1043 |
+
if not module.TASK_SPECS_PATH.exists():
|
| 1044 |
+
pytest.skip(f"task specs not shipped: {module.TASK_SPECS_PATH} missing")
|
| 1045 |
|
| 1046 |
root = tmp_path_factory.mktemp("real_code_m21")
|
| 1047 |
module.build_tasks(out_dir=root)
|
|
|
|
| 1269 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m22", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1270 |
module = importlib.util.module_from_spec(spec)
|
| 1271 |
spec.loader.exec_module(module)
|
| 1272 |
+
if not module.TASK_SPECS_PATH.exists():
|
| 1273 |
+
pytest.skip(f"task specs not shipped: {module.TASK_SPECS_PATH} missing")
|
| 1274 |
root = tmp_path_factory.mktemp("real_code_m22")
|
| 1275 |
module.build_tasks(specs=[s for s in module.load_task_specs() if s["template"] == "M22"], out_dir=root)
|
| 1276 |
return root
|
|
|
|
| 1361 |
|
| 1362 |
@pytest.fixture
|
| 1363 |
def m23_tasks(tmp_path):
|
| 1364 |
+
from scripts.rc_build_tasks import TASK_SPECS_PATH, build_tasks, load_task_specs
|
| 1365 |
|
| 1366 |
+
if not TASK_SPECS_PATH.exists():
|
| 1367 |
+
pytest.skip(f"task specs not shipped: {TASK_SPECS_PATH} missing")
|
| 1368 |
build_tasks([s for s in load_task_specs() if s.get("template") == "M23"], tmp_path)
|
| 1369 |
return tmp_path
|
| 1370 |
|
|
|
|
| 1464 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m24", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1465 |
module = importlib.util.module_from_spec(spec)
|
| 1466 |
spec.loader.exec_module(module)
|
| 1467 |
+
if not module.TASK_SPECS_PATH.exists():
|
| 1468 |
+
pytest.skip(f"task specs not shipped: {module.TASK_SPECS_PATH} missing")
|
| 1469 |
root = tmp_path_factory.mktemp("real_code_m24")
|
| 1470 |
module.build_tasks(out_dir=root)
|
| 1471 |
return root
|
|
|
|
| 1582 |
spec = importlib.util.spec_from_file_location("rc_build_tasks_m25", REPO_ROOT / "scripts" / "rc_build_tasks.py")
|
| 1583 |
module = importlib.util.module_from_spec(spec)
|
| 1584 |
spec.loader.exec_module(module)
|
| 1585 |
+
if not module.TASK_SPECS_PATH.exists():
|
| 1586 |
+
pytest.skip(f"task specs not shipped: {module.TASK_SPECS_PATH} missing")
|
| 1587 |
root = tmp_path_factory.mktemp("real_code_m25")
|
| 1588 |
module.build_tasks(out_dir=root)
|
| 1589 |
return root
|
src/tests/test_rules.py
CHANGED
|
@@ -641,6 +641,7 @@ def test_fingerprint_covers_the_union(envs):
|
|
| 641 |
|
| 642 |
# Canonical registry.
|
| 643 |
@pytest.mark.parametrize("instance", ["A1", "A2", "A3", "A4"])
|
|
|
|
| 644 |
def test_registry_is_canonical_and_matches_the_recorded_mainnet_hash(envs, instance):
|
| 645 |
env = envs[instance]
|
| 646 |
assert env.symbols["registry"] == REGISTRY
|
|
|
|
| 641 |
|
| 642 |
# Canonical registry.
|
| 643 |
@pytest.mark.parametrize("instance", ["A1", "A2", "A3", "A4"])
|
| 644 |
+
@pytest.mark.skipif(not (CONTRACTS_DIR / "deps.lock").exists(), reason=f"dependency lock not shipped: {CONTRACTS_DIR / 'deps.lock'} missing")
|
| 645 |
def test_registry_is_canonical_and_matches_the_recorded_mainnet_hash(envs, instance):
|
| 646 |
env = envs[instance]
|
| 647 |
assert env.symbols["registry"] == REGISTRY
|