Skip to content

feat(precompiles): add NeuronRegistrationCost precompile for burn que…#2387

Open
pablo-reef wants to merge 3 commits intoopentensor:devnet-readyfrom
bittensor-church:devnet-ready
Open

feat(precompiles): add NeuronRegistrationCost precompile for burn que…#2387
pablo-reef wants to merge 3 commits intoopentensor:devnet-readyfrom
bittensor-church:devnet-ready

Conversation

@pablo-reef
Copy link

Description

This PR adds a new EVM precompile NeuronRegistrationCost that allows smart contracts to query the current burn cost required to register a neuron on a subnet.

Features:

  • getBurn(uint16 netuid) - Returns the current burn cost in RAO for neuron registration
  • getMinBurn(uint16 netuid) - Returns the minimum burn cost for a subnet
  • getMaxBurn(uint16 netuid) - Returns the maximum burn cost for a subnet
  • isRegistrationAllowed(uint16 netuid) - Checks if registration is currently allowed on a subnet

Precompile Address: 0x0000000000000000000000000000000000000806 (index 2062)

Files Added/Modified:

  • precompiles/src/neuron_registration_cost.rs - New precompile implementation
  • precompiles/src/solidity/neuronRegistrationCost.sol - Solidity interface
  • precompiles/src/lib.rs - Registered new precompile
  • pallets/admin-utils/src/lib.rs - Added NeuronRegistrationCost variant to PrecompileEnum

Related Issue(s)

  • Closes #[issue number]

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Breaking Change

N/A - This is a new feature that adds functionality without affecting existing code.

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 ./scripts/fix_rust.sh to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

N/A

Additional Notes

This precompile enables smart contracts to dynamically check registration costs before attempting to register neurons, improving gas efficiency and user experience for DeFi applications built on top of Bittensor.

@pablo-reef pablo-reef marked this pull request as ready for review February 2, 2026 15:46
@ppolewicz ppolewicz added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Feb 2, 2026
@open-junius
Copy link
Contributor

For these data querying, you can consider use the storage_query precompile to get, instead of adding the interface for each storage.

@open-junius
Copy link
Contributor

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.

4 participants