Skip to content

Add liquid alpha consensus mode controls to precompiles - #3102

Draft
UnArbosFour wants to merge 6 commits into
mainfrom
feat/liquidalphaconsensusmode-precompile
Draft

Add liquid alpha consensus mode controls to precompiles#3102
UnArbosFour wants to merge 6 commits into
mainfrom
feat/liquidalphaconsensusmode-precompile

Conversation

@UnArbosFour

Copy link
Copy Markdown
Contributor

Summary

Adds typed EVM access to LiquidAlphaConsensusMode through the existing Subnet precompile at 0x0803.

New functions:

function getLiquidAlphaConsensusMode(uint16 netuid)
    external
    view
    returns (uint8);

function setLiquidAlphaConsensusMode(uint16 netuid, uint8 mode)
    external
    payable;

Mode encoding:

  • 0Current
  • 1Previous
  • 2Auto
  • Other values revert

Implementation

  • Reads LiquidAlphaConsensusMode directly with one charged database read.
  • Dispatches AdminUtils.sudo_set_liquid_alpha_consensus_mode using the mapped EVM caller.
  • Preserves subnet-owner authorization, admin-window enforcement, and hyperparameter rate limiting.
  • Adds selector locks and collision validation.
  • Updates the Solidity interface, canonical ABI, Python SDK ABI, and EVM documentation.

This is an additive ABI change; existing addresses, selectors, and behavior remain unchanged.

Testing

  • cargo test -p subtensor-precompiles — 128 passed
  • SKIP_WASM_BUILD=1 cargo clippy -p subtensor-precompiles --all-targets --all-features -- -D warnings
  • cargo fmt --all --check
  • Python EVM/ABI tests — 40 passed
  • Canonical and SDK ABI synchronization verified
  • New tests cover:
    • All three mode encodings
    • Default Auto behavior
    • Invalid-mode rejection
    • Non-owner rejection
    • Static-call rejection for the setter
    • Getter database-read charging

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subtensor Ready Ready Preview Aug 21, 2026 5:01pm

Request Review

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

VERY HIGH scrutiny due to the account being under 90 days old with one public repository; repository write access, substantive merged PR history, matching authorship, and no known Gittensor association reduce practical concern. Branch: feat/liquidalphaconsensusmode-precompile → release-449.

Findings

No findings.

Conclusion

The additive precompile methods preserve mapped-caller authentication and the existing subnet-owner, admin-window, and rate-limit checks, while validating enum inputs and charging the getter's database read. No malicious behavior or security vulnerability was found.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor association: UNKNOWN. Newer account with repository write access and several merged subtensor contributions; reviewed with elevated external-contributor scrutiny.

The implementation consistently exposes the existing runtime setting through the Subnet precompile: stable enum encoding, mapped signed caller dispatch, runtime authorization, O(1) storage access with one charged read, synchronized Solidity/Python ABIs, selector locks, documentation, and focused tests.

PR #3018 overlaps two files but is a much broader precompile overhaul. This PR is the better candidate. Recommend closing #3018 in favor of this independently scoped change.

No spec_version bump is required for the release-449 base. git diff --check passed and the worktree remains clean. cargo fmt --check --all could not run because rustup cannot write to its read-only environment; Python formatting, ABI-sync, and generated-doc checks were skipped because the existing environment has no uv.

Findings

No findings.

Conclusion

The additive ABI change correctly preserves runtime authorization and rate limiting while providing consistent typed EVM access. No blocking domain issues found.

@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: 👍

@UnArbosFour
UnArbosFour marked this pull request as draft August 28, 2026 20:14
@UnArbosFour
UnArbosFour changed the base branch from release-449 to main August 28, 2026 20:14
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.

1 participant