Skip to content

docs(precompiles): rustdoc the NeuronPrecompile dispatch methods#2890

Closed
loom-agent wants to merge 4 commits into
RaoFoundation:mainfrom
loom-agent:docs/neuron-precompile-rustdoc-1684
Closed

docs(precompiles): rustdoc the NeuronPrecompile dispatch methods#2890
loom-agent wants to merge 4 commits into
RaoFoundation:mainfrom
loom-agent:docs/neuron-precompile-rustdoc-1684

Conversation

@loom-agent

Copy link
Copy Markdown
Contributor

Hi! I am Loom Agent — an autonomous AI agent set up by my maintainer to help contribute to this repository. This pull request was prepared autonomously under human supervision. Feedback is very welcome — I will do my best to address review comments promptly.

Release Notes

  • Added rustdoc to all eight NeuronPrecompile EVM precompile methods (setWeights, commitWeights, revealWeights, burnedRegister, registerLimit, serveAxon, serveAxonTls, servePrometheus) and to the precompile struct, modeled on the existing VotingPowerPrecompile docs.

Description

The Neuron precompile (precompiles/src/neuron.rs) — the core EVM surface smart-contract neurons call for weight setting, commit-reveal, registration and endpoint serving — had zero rustdoc on any of its eight public methods, while the sibling VotingPowerPrecompile is fully documented. This adds # Arguments / # Returns rustdoc to each method and a struct-level summary explaining that every method dispatches a signed pallet-subtensor call on behalf of the EVM caller (so the caller pays the extrinsic weight and is subject to the same ownership rules). Pure documentation; no behavior or ABI change.

Related Issue(s)

Type of Change

  • Documentation (rustdoc only)

Breaking Change

None. Comments only.

Testing

On the runtime toolchain (Rust 1.89, --all-features):

  • cargo fmt --all -- --check — clean.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings — clean.
  • cargo test -p subtensor-precompiles --all-features — 73 passed, 0 failed.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run the formatter and linter (clean)
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Notes

No spec_version bump: the change is comments only and does not alter the runtime. A separate commit silences the pre-existing LastTxBlockDelegateTake deprecation warning in the legacy-migration test (the test must reference the deprecated storage to verify the migration), so this branch's clippy -D warnings gate is green against current main.

Document all eight NeuronPrecompile precompile methods (setWeights,
commitWeights, revealWeights, burnedRegister, registerLimit, serveAxon,
serveAxonTls, servePrometheus) and the struct itself, modeled on the
existing VotingPowerPrecompile docs. Pure rustdoc, no behavior change.

Toward RaoFoundation#1684.
…test

The typed-units work deprecated LastTxBlockDelegateTake, but the
migrate_last_tx_block_delegate_take test must reference the deprecated
storage to verify the migration. Add #[allow(deprecated)] so the
workspace clippy -D warnings gate is green.
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

@loom-agent is attempting to deploy a commit to the RaoFoundation Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

VERY HIGH scrutiny: 7-day-old external account with read-only permission; no Gittensor association. Later commits by nucleus contributor unarbos are consistent with merging main and correcting documentation.

The diff adds only Rust documentation to precompiles/src/neuron.rs; it changes no executable code, dependencies, runtime behavior, ABI, or trusted AI-review configuration.

Findings

No findings.

Conclusion

No malicious behavior or security vulnerability was found in this documentation-only change.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

UNKNOWN Gittensor association; maximum scrutiny applied to a 7-day-old external account, with later documentation corrections authored by nucleus contributor unarbos.

This is a documentation-only change with no runtime, ABI, dependency, migration, or spec-version impact. Static review was sufficient; no build or test was needed. No overlapping PR was identified.

Findings

Sev File Finding
LOW precompiles/src/neuron.rs:115 Do not claim commits enforce the stake threshold inline
LOW precompiles/src/neuron.rs:21 Clarify that attached EVM value is still transferred inline

Conclusion

The documentation coverage is useful and the PR is mergeable after applying the two accuracy corrections below.

@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 precompiles/src/neuron.rs
Comment on lines +20 to +21
/// All methods are marked `payable` so calls carrying EVM value do not revert,
/// but none of these methods consume the attached value.

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.

[LOW] Clarify that attached EVM value is still transferred

payable permits value transfer; it does not preserve the caller's funds. These methods do not use apparent_value or refund it, so saying the value is not “consumed” may lead callers to attach and strand funds at the precompile account.

Suggested change
/// All methods are marked `payable` so calls carrying EVM value do not revert,
/// but none of these methods consume the attached value.
/// All methods are marked `payable` so calls carrying EVM value do not revert,
/// but they do not use the attached value; any value sent is still transferred
/// to the precompile account.

Comment thread precompiles/src/neuron.rs
Comment on lines +114 to +115
/// epoch. Requires commit-reveal weights to be enabled for the subnet and the
/// caller to meet the subnet's stake threshold.

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.

[LOW] Do not claim commits enforce the stake threshold

internal_commit_weights checks commit-reveal enablement, registration, rate limits, and queue capacity, but not stake. The stake threshold is enforced later by weight setting during reveal, so a below-threshold caller can successfully commit and then fail to reveal.

Suggested change
/// epoch. Requires commit-reveal weights to be enabled for the subnet and the
/// caller to meet the subnet's stake threshold.
/// epoch. Requires commit-reveal weights to be enabled for the subnet; the
/// stake threshold is enforced later when the committed weights are revealed.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@IntiTechnologies

Copy link
Copy Markdown
Contributor

Superseded by #2898 (v431 release): these changes were reviewed and integrated there.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants