docs(precompiles): rustdoc the NeuronPrecompile dispatch methods#2890
docs(precompiles): rustdoc the NeuronPrecompile dispatch methods#2890loom-agent wants to merge 4 commits into
Conversation
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.
|
@loom-agent is attempting to deploy a commit to the RaoFoundation Team on Vercel. A member of the Team first needs to authorize it. |
🛡️ 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 FindingsNo findings. ConclusionNo 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
ConclusionThe documentation coverage is useful and the PR is mergeable after applying the two accuracy corrections below. |
| /// All methods are marked `payable` so calls carrying EVM value do not revert, | ||
| /// but none of these methods consume the attached value. |
There was a problem hiding this comment.
[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.
| /// 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. |
| /// epoch. Requires commit-reveal weights to be enabled for the subnet and the | ||
| /// caller to meet the subnet's stake threshold. |
There was a problem hiding this comment.
[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.
| /// 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. |
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👍 |
|
Superseded by #2898 (v431 release): these changes were reviewed and integrated there. |
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
NeuronPrecompileEVM precompile methods (setWeights,commitWeights,revealWeights,burnedRegister,registerLimit,serveAxon,serveAxonTls,servePrometheus) and to the precompile struct, modeled on the existingVotingPowerPrecompiledocs.Description
The
Neuronprecompile (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 siblingVotingPowerPrecompileis fully documented. This adds# Arguments/# Returnsrustdoc to each method and a struct-level summary explaining that every method dispatches a signedpallet-subtensorcall 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)
Neuronslice)Type of Change
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
Notes
No
spec_versionbump: the change is comments only and does not alter the runtime. A separate commit silences the pre-existingLastTxBlockDelegateTakedeprecation warning in the legacy-migration test (the test must reference the deprecated storage to verify the migration), so this branch'sclippy -D warningsgate is green against currentmain.