-
Notifications
You must be signed in to change notification settings - Fork 244
Add pallet-contracts integration with Subtensor chain extension #2059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devnet-ready
Are you sure you want to change the base?
Add pallet-contracts integration with Subtensor chain extension #2059
Conversation
This proposal is groundbreaking, it open lot of native doors integration. |
runtime/src/lib.rs
Outdated
pub const ContractDepositPerItem: Balance = deposit(1, 0); | ||
pub const ContractDepositPerByte: Balance = deposit(0, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is using the proxy/multisig deposit formula
So around 0.001 TAO
per byte and 0.02 TAO
per storage item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the deposit format to mirror the substrate example reference:
15% of the existential deposit per key, 6% per byte.
Implement custom deposit calculation for contract storage with 15% of existential deposit per key and 6% per byte
I saw something in the docs saying the APIs for the extrinsics we allow has to remain stable. We solve this in the frontier (EVM) pallet by using precompiles with stable APIs but the underlying extrinsics can change. Possibly we should do the same because I'm not sure if we can guarantee the stability of any of the extrinsics at-present |
Also, @silva-fj let's actually remove the |
Yes that's correct, the whitelisted dispatchables should remain stable. This is not exactly as critical as on EVM contracts because ink contracts can be upgradable (just like the runtime). But ideally a stable API should be provided. This can be accomplished with chain extensions, by exposing an API that remains stable while the underlying dispatchables could be changed |
EVM contracts use an upgradeable pattern as well.
Possibly we can also just agree that the API is not stable and any contracts implementing the calls can check the runtime version to see if it has changed/if their current contract version (self-imposed) supports it. i.e. like a guard clause |
Summary
This PR integrates the
pallet-contracts
module into the Subtensor runtime, enabling wasm smart contract functionality with a custom chain extension for accessing Subtensor-specific features.Key Features
Custom Chain Extension (Function ID: 1001)
get_stake_info_for_hotkey_coldkey_netuid
)Restricted Call Filter
SubtensorModule::add_stake
SubtensorModule::remove_stake
SubtensorModule::unstake_all
SubtensorModule::unstake_all_alpha
SubtensorModule::move_stake
SubtensorModule::transfer_stake
SubtensorModule::swap_stake
SubtensorModule::add_stake_limit
SubtensorModule::remove_stake_limit
SubtensorModule::swap_stake_limit
SubtensorModule::remove_stake_full_limit
SubtensorModule::set_coldkey_auto_stake_hotkey
Proxy::proxy
Proxy::add_proxy
Proxy::create_pure
Conservative Configuration
Breaking Changes
None - This is an additive change that doesn't affect existing functionality.