Skip to content

Improve Benchmarking#2798

Open
JohnReedV wants to merge 54 commits into
devnet-readyfrom
apply-benchmark-to-only-bad-benches
Open

Improve Benchmarking#2798
JohnReedV wants to merge 54 commits into
devnet-readyfrom
apply-benchmark-to-only-bad-benches

Conversation

@JohnReedV

@JohnReedV JohnReedV commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

This PR

  • Modifies the benchmark flow so that only extrinsics that have drifted passed the threshold or have incorrect read/writes are updated rather than replacing the entire file and creating conflicts everywhere.

  • Adds a lint to check for extrinsics with missing benchmarks. This can be hidden with
    #[allow(unknown_lints, benchmarked_weight_not_plugged)]

  • Adds 48 missing benchmarks

  • Fixes a bug where benchmarks could fail on noisy internal component drift even when the actual benchmark-level weight was still within the configured threshold.

  • Adds block_step to the benchmark flow so the on_initialize weight is generated instead of hardcoded. The benchmark simulates the current worst case with 2 epochs in a block.

  • Updates the drift check to include proof size and to compare the actual benchmark-level weight instead of failing on noisy internal component drift.

@JohnReedV JohnReedV added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jun 25, 2026
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

Baseline-to-medium scrutiny: established @opentensor-associated contributor with substantial subtensor history; cached repo permission is read; later commits include UnArbosSix; branch apply-benchmark-to-only-bad-benches -> devnet-ready.

The PR does not modify .github/ai-review/* or .github/copilot-instructions.md. The manifest edits only enable features on existing workspace dependencies, and I did not see a Cargo.lock change or new external dependency. The build.rs addition invokes an in-repo source lint that reads Rust files and emits Cargo warnings; I did not find command execution, network access, or secret-handling logic in that path.

The prior register_limit underweight concern remains addressed: the current benchmark uses setup_full_subnet_registration_benchmark, fills the subnet to DefaultMaxAllowedUids, seeds existing neurons, and asserts the subnet is full before measuring the dispatch path.

Findings

No findings.

Prior-comment reconciliation

  • 7af6c073: addressed — The benchmark now uses setup_full_subnet_registration_benchmark, which fills the subnet to DefaultMaxAllowedUids and asserts the subnet is full before invoking register_limit; this covers the prune/replacement path raised in the prior finding.

Conclusion

No malicious behavior or security vulnerability found in the current diff. The previously reported benchmark coverage issue is resolved, so the Skeptic verdict is SAFE.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor UNKNOWN; author is an established opentensor/subtensor contributor with substantial recent PR history, cached repo permission is read.

PR body is substantive and matches the benchmark/tooling scope, so I would leave it unchanged.

Prior register_limit blocker remains addressed: the benchmark now uses setup_full_subnet_registration_benchmark, fills the subnet, and dispatches against the replacement path rather than the cheap append path.

Duplicate-work check found overlapping PRs only through broad shared files such as weights/runtime-adjacent code; none appear to be alternate implementations of this benchmark-flow change.

Validation performed: bash -n scripts/benchmark_action.sh, bash -n scripts/discover_pallets.sh, and git diff --check passed. Targeted cargo test -p subtensor-linting require_extrinsic_benchmarks -- --nocapture could not start because rustup tried to create a temp file under read-only /home/runner/.rustup/tmp. Spec-version auto-fix was not performed because this sandbox could not resolve dev.chain.opentensor.ai; local spec_version is 424, and the diff does not modify runtime/src/lib.rs.

Findings

No findings.

Prior-comment reconciliation

  • 2caec2f2: addressedregister_limit now benchmarks through setup_full_subnet_registration_benchmark, filling the subnet before dispatch so the measured path reaches replacement rather than append.

Conclusion

The prior benchmark coverage issue is fixed, and I did not find a remaining domain issue that should block merge. CI should still perform the normal live spec-version and test checks that this sandbox could not complete.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@JohnReedV JohnReedV changed the title Apply Benchmark patch only where its needed Improve Benchmarking Jun 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/benchmarks.rs Outdated
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/benchmarks.rs Outdated
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/benchmarks.rs Outdated
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/benchmarks.rs Outdated
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@UnArbosSix UnArbosSix force-pushed the apply-benchmark-to-only-bad-benches branch from ea42319 to b1ab08e Compare July 3, 2026 12:47

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/benchmarks.rs Outdated
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/benchmarks/benchmarks.rs
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-cargo-audit This PR fails cargo audit but needs to be merged anyway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants