Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
291 commits
Select commit Hold shift + click to select a range
e3cc8e1
Add test with removed stake.
shamil-gadelshin Sep 19, 2025
dd44dd8
Fix existing tests
shamil-gadelshin Sep 19, 2025
0b13d2e
Update tests
shamil-gadelshin Sep 22, 2025
e03b730
Do not run epoch if keys have duplicate hotkeys
gztensor Sep 22, 2025
73f3a35
Spec version bump
gztensor Sep 22, 2025
265076e
Fix error output
gztensor Sep 22, 2025
8537ccc
Fix clippy
gztensor Sep 22, 2025
8d1140d
Fix swap claim root
shamil-gadelshin Sep 22, 2025
12788fc
fix(runtime): remove create_pure from proxy call filter
silva-fj Sep 24, 2025
65bb4f0
Add basic run_coinbase test
shamil-gadelshin Sep 24, 2025
1accdfa
Fix block indices to claim
shamil-gadelshin Sep 25, 2025
dae1677
Update tests in swap pallet
ales-otf Sep 23, 2025
6e667c5
Minimal log analysing tests
gztensor Sep 25, 2025
c09bcb3
Optimize RootClaimable
shamil-gadelshin Sep 26, 2025
0ffa456
Add more log watching tests
gztensor Sep 26, 2025
bb83235
Add epoch tests for multiple mechanisms
gztensor Sep 26, 2025
0485b69
Add multi-mechanism test for network dissolve
gztensor Sep 26, 2025
800f82e
multiple pulse Txs per block
JohnReedV Sep 28, 2025
2b25f8a
clippy
JohnReedV Sep 28, 2025
c7bfbad
update test
JohnReedV Sep 28, 2025
395d6a1
Merge upstream/devnet-ready into feature/add-pallet-contracts
silva-fj Sep 29, 2025
70c381d
Resolve git conflicts
ales-otf Sep 29, 2025
fc161b3
Update benchmarks
shamil-gadelshin Sep 29, 2025
b39d51c
Add coldkey to the new map.
shamil-gadelshin Sep 30, 2025
57bcae3
Add root staking maps migration.
shamil-gadelshin Sep 30, 2025
dbc6f66
Refactor SwapHandler
ales-otf Oct 1, 2025
24b2d1e
Merge branch 'devnet-ready' into feat/type-safe-swap
ales-otf Oct 1, 2025
cb4ba55
Update swap api in subtensor module
ales-otf Oct 1, 2025
cc7a1df
Add run_coinbase test for root claim.
shamil-gadelshin Oct 2, 2025
78e45af
Refactor root claim code.
shamil-gadelshin Oct 3, 2025
dcaa3f7
Merge branch 'devnet-ready' into root-claim2
shamil-gadelshin Oct 3, 2025
d0b2dac
Fix merge issues
shamil-gadelshin Oct 3, 2025
0f82356
Remove obsolete code
shamil-gadelshin Oct 3, 2025
239df82
Fix typo
shamil-gadelshin Oct 3, 2025
3da7e9c
Fix new swap's API integration issues
ales-otf Oct 3, 2025
69e222b
Add sudo_set_num_root_claims extrinsic
shamil-gadelshin Oct 3, 2025
a99e497
auto-update benchmark weights
github-actions[bot] Oct 3, 2025
8b62e98
Address Loris' comments
ales-otf Oct 6, 2025
6ead71a
Resolve git conflicts
ales-otf Oct 6, 2025
c5d9f31
Update claim_root benchmark.
shamil-gadelshin Oct 6, 2025
7639869
Remove swap pallet error shadowing in max_amount staking calculators
ales-otf Oct 7, 2025
6d3ab3a
Merge pull request #2011 from opentensor/feat/type-safe-swap
sam0x17 Oct 7, 2025
8693c7c
Merge remote-tracking branch 'upstream/devnet-ready' into feature/add…
silva-fj Oct 8, 2025
2fec8d7
remove duplicate sudo_set_subnet_owner_hotkey
JohnReedV Oct 8, 2025
13ddea7
bump spec
JohnReedV Oct 8, 2025
e4d802f
make crowdloan finalizable when cap is reached but before end
l0r1s Oct 8, 2025
cef1fcc
make crowdloan refund before the end possible
l0r1s Oct 8, 2025
0736b0b
fix comment
l0r1s Oct 8, 2025
7ccea37
bump spec version
l0r1s Oct 8, 2025
01f2000
auto-update benchmark weights
github-actions[bot] Oct 8, 2025
51671de
Refactor childkeys/parentkeys, add migration to clean state
gztensor Oct 8, 2025
21b9671
Move and document set_childkeys and set_parentkeys
gztensor Oct 8, 2025
41d2207
Unignore errors in load_child_parent_relations
gztensor Oct 8, 2025
765808d
Extend test_set_child_keys_empty_vector_clears_storage to parent keys
gztensor Oct 8, 2025
522d744
Merge branch 'devnet-ready' into fix/child-parent-setting
gztensor Oct 8, 2025
f949590
Merge branch 'devnet-ready' into test/epoch-with-logs
gztensor Oct 8, 2025
d0214db
Remove .expect from set_children.rs
gztensor Oct 8, 2025
d6d2f1a
Fix epoch log analyzing test
gztensor Oct 8, 2025
183211c
Merge branch 'devnet-ready' into fix/no-epoch-on-inconsistent-data
gztensor Oct 8, 2025
9cf797f
auto-update benchmark weights
github-actions[bot] Oct 8, 2025
ad398f7
set all precompile transaction payable
open-junius Oct 9, 2025
118be96
bump version
open-junius Oct 9, 2025
cd2d306
Merge pull request #2115 from opentensor/crowdloan-finalize-refund-be…
sam0x17 Oct 9, 2025
6aa04cd
fix conflict
open-junius Oct 9, 2025
92f4b99
fix utility::force_batch weight mismatch
l0r1s Oct 9, 2025
de04830
Merge branch 'devnet-ready' into Remove-Duplicate-Setter-snownerhotkey
JohnReedV Oct 9, 2025
fdca1c1
Merge branch 'devnet-ready' into fix/child-parent-setting
gztensor Oct 9, 2025
1b9eb7d
Address code review comments
gztensor Oct 9, 2025
2ac1687
Merge branch 'devnet-ready' into test/epoch-with-logs
gztensor Oct 9, 2025
c33b328
Merge branch 'devnet-ready' into fix/no-epoch-on-inconsistent-data
gztensor Oct 9, 2025
f553326
chore: empty commit to trigger CI
gztensor Oct 9, 2025
b61806f
chore: empty commit to trigger CI
gztensor Oct 9, 2025
be43bed
Merge pull request #2118 from opentensor/precompile-payable
sam0x17 Oct 9, 2025
aa72439
re-enable sudo_set_subnet_owner_hotkey
JohnReedV Oct 9, 2025
8b14a60
Add linter rule to flag expect. Remove expects/allow exceptions.
gztensor Oct 9, 2025
d511dad
Remove unneeded comment
gztensor Oct 9, 2025
593ad2e
Fix clippy and tests for all featrues
gztensor Oct 9, 2025
cf157c5
Merge pull request #2116 from opentensor/fix/child-parent-setting
sam0x17 Oct 9, 2025
96dd8b4
Merge pull request #2081 from opentensor/test/epoch-with-logs
sam0x17 Oct 9, 2025
2c51598
Merge pull request #2122 from opentensor/fix/ban-expect
sam0x17 Oct 9, 2025
b892a2d
chore: empty commit to trigger CI
gztensor Oct 9, 2025
3a91f29
Add protocol fees to protocol LP proportionally to the price
gztensor Oct 9, 2025
ca6aad7
auto-update benchmark weights
github-actions[bot] Oct 10, 2025
99345b1
Refactor code
shamil-gadelshin Oct 10, 2025
cc324ec
Add migration
shamil-gadelshin Oct 10, 2025
14542fd
Merge branch 'devnet-ready' into fix-utility-weight-mismatch
l0r1s Oct 10, 2025
c44138d
Update pallets/swap/src/pallet/impls.rs
gztensor Oct 10, 2025
6084f49
Update pallets/swap/src/pallet/tests.rs
gztensor Oct 10, 2025
3b31892
Add a test with price > 1 and alpha limiting
gztensor Oct 10, 2025
e6af8a9
Merge pull request #2123 from opentensor/fix/protocol-lp-fees-on-inje…
sam0x17 Oct 10, 2025
4a67e16
Merge pull request #2075 from opentensor/fix/no-epoch-on-inconsistent…
sam0x17 Oct 10, 2025
60ee6e6
tweak template to mention fix_rust.sh
sam0x17 Oct 10, 2025
f1e3051
add copilot instructions
sam0x17 Oct 10, 2025
33b0083
Add DoNotBreakSmartContracts trait for contract API stability
silva-fj Oct 13, 2025
4c0109b
Merge remote-tracking branch 'upstream/devnet-ready' into feature/add…
silva-fj Oct 13, 2025
2610ac1
docs(contracts): remove Proxy::create_pure from allowed calls
silva-fj Oct 13, 2025
a490159
refactor(runtime): rename DoNotBreakSmartContracts trait
silva-fj Oct 13, 2025
0f2668c
auto-update benchmark weights
github-actions[bot] Oct 13, 2025
8d63857
Merge branch 'devnet-ready' into root-claim2
shamil-gadelshin Oct 14, 2025
1f1c7e7
Fix merge conflicts
shamil-gadelshin Oct 14, 2025
3d3ef0d
Update pallets/subtensor/src/staking/claim_root.rs
shamil-gadelshin Oct 14, 2025
ab5a274
Handle case for stake mismatch.
shamil-gadelshin Oct 14, 2025
6474efc
Merge pull request #2119 from opentensor/fix-utility-weight-mismatch
sam0x17 Oct 14, 2025
56d6d63
bump psdk with txpool log set to debug + pin tracing-subscriber to fi…
l0r1s Oct 14, 2025
640b751
auto-update benchmark weights
github-actions[bot] Oct 14, 2025
f5e1147
remove governance deadcode
l0r1s Oct 14, 2025
514b354
cargo fmt
l0r1s Oct 14, 2025
98c500b
Merge pull request #2127 from opentensor/bump-polkadot-sdk-logs-patch
sam0x17 Oct 15, 2025
287f625
Merge branch 'devnet-ready' into remove-gov-deadcode
l0r1s Oct 15, 2025
db3a0f0
Add proxy type.
shamil-gadelshin Oct 15, 2025
7da8c81
add srtool scripts
camfairchild Oct 15, 2025
fd23a59
use diff env var
camfairchild Oct 15, 2025
cf70929
refactor(runtime): remove DoNotBreakSmartContractsV1 trait
silva-fj Oct 15, 2025
cf30094
build: add chain-extensions workspace member
silva-fj Oct 15, 2025
da84eed
feat(chain-extensions): add chain extensions crate
silva-fj Oct 15, 2025
7e7c364
feat(chain-extensions): add FunctionId and Outcome types
silva-fj Oct 15, 2025
bab0039
feat(chain-extensions): implement staking chain extensions
silva-fj Oct 15, 2025
3724e33
refactor(chain-ext): rename Outcome to Output
silva-fj Oct 15, 2025
87e3449
auto-update benchmark weights
github-actions[bot] Oct 15, 2025
71b106f
fix type nonfungibile
open-junius Oct 16, 2025
c26d988
bump version
open-junius Oct 16, 2025
62e433a
Merge pull request #2126 from opentensor/remove-gov-deadcode
l0r1s Oct 16, 2025
31a7b90
burn alpha precompile
open-junius Oct 16, 2025
c6547fd
build(chain-ext): add test dependencies
silva-fj Oct 16, 2025
2279c43
refactor(chain-ext): introduce testable extension environment trait
silva-fj Oct 16, 2025
dab4c46
test(chain-ext): add test infrastructure and test suite
silva-fj Oct 16, 2025
8e55f84
refactor(runtime): replace chain extension with subtensor-chain-exten…
silva-fj Oct 16, 2025
c9d8d59
only allow refund for crowdloan creator
l0r1s Oct 16, 2025
8dd3c5c
refactor(contracts): remove SubtensorModule calls from whitelist
silva-fj Oct 16, 2025
4e7e913
docs(contracts): document all chain extension functions and error codes
silva-fj Oct 16, 2025
20cfeb3
Merge upstream/devnet-ready into feature/add-pallet-contracts
silva-fj Oct 16, 2025
c213dd0
Add swap_coldkey support for root claim
shamil-gadelshin Oct 16, 2025
8c7d14b
fix conflict
open-junius Oct 16, 2025
d6203c0
Add swap_hotkey support for root claim
shamil-gadelshin Oct 16, 2025
2a21410
use loris's modifications
sam0x17 Oct 16, 2025
d3d9c56
Merge remote-tracking branch 'origin/devnet-ready' into copilot-reviews
sam0x17 Oct 16, 2025
0b7ff00
Merge pull request #2125 from opentensor/copilot-reviews
sam0x17 Oct 16, 2025
2652464
auto-update benchmark weights
github-actions[bot] Oct 16, 2025
bf92ee4
Merge pull request #2134 from opentensor/fix-typo-nonfungibile
open-junius Oct 16, 2025
dd3688e
make kappa root only
JohnReedV Oct 16, 2025
919121b
fix comment
l0r1s Oct 16, 2025
81667e1
fix tests
JohnReedV Oct 16, 2025
4b5be6c
Merge pull request #2138 from opentensor/fix-crowdloan-refund
sam0x17 Oct 16, 2025
ba6899b
Merge branch 'devnet-ready' into Remove-Duplicate-Setter-snownerhotkey
JohnReedV Oct 16, 2025
fcdc3ab
auto-update benchmark weights
github-actions[bot] Oct 16, 2025
e6e7b8a
Merge branch 'devnet-ready' into kappa-sudo-only
JohnReedV Oct 16, 2025
be7c2d4
remove max weight limit => u16::MAX
sam0x17 Oct 16, 2025
2b53f39
fix
sam0x17 Oct 16, 2025
23e1bf9
keep the old storage entry for compatibility
sam0x17 Oct 16, 2025
ee0c50d
fix e2e test
open-junius Oct 17, 2025
68b89f8
fix(chain-extensions): make types module public
silva-fj Oct 17, 2025
61219e7
fix(chain-extensions): return correct success code
silva-fj Oct 17, 2025
673d8c4
refactor(mock): clean up unused imports
silva-fj Oct 17, 2025
7a2ebae
Remove PendingRootDivs map
shamil-gadelshin Oct 17, 2025
e542ed5
chore(chain-extensions): add no_std support
silva-fj Oct 17, 2025
b0e346e
Claim all during network deregistration.
shamil-gadelshin Oct 17, 2025
d68d3aa
Modify default claim root key number
shamil-gadelshin Oct 17, 2025
2934dba
set transaction payable
open-junius Oct 17, 2025
d03be2e
bump version
open-junius Oct 17, 2025
0fd04bf
refactor(chain-extensions): remove unused mock utilities
silva-fj Oct 17, 2025
249fa62
Merge pull request #2141 from opentensor/disable-max-weight-limit
sam0x17 Oct 17, 2025
9211c19
Refactor subnet emissions
gztensor Oct 17, 2025
4a01966
Merge pull request #2142 from opentensor/chore/refactor-subnet-emissions
sam0x17 Oct 17, 2025
6a60750
feat(chain-extensions): add AddProxyV1 function ID and error codes
silva-fj Oct 18, 2025
2d975b7
build(chain-extensions): add pallet-subtensor-proxy dependency
silva-fj Oct 18, 2025
ea31d42
feat(chain-extensions): implement AddProxyV1 chain extension
silva-fj Oct 18, 2025
7e89630
test(chain-extensions): add proxy pallet to test runtime
silva-fj Oct 18, 2025
0724349
test(chain-extensions): add test for AddProxyV1
silva-fj Oct 18, 2025
00dc850
docs: add AddProxyV1 to chain extension documentation
silva-fj Oct 18, 2025
61b5541
refactor(runtime): remove add_proxy from contract call filter
silva-fj Oct 18, 2025
24e87c6
chore: update Cargo.lock
silva-fj Oct 18, 2025
73e9387
feat(chain-extensions): add RemoveProxyV1 function ID and error code
silva-fj Oct 18, 2025
f919287
feat(chain-extensions): implement RemoveProxyV1 chain extension
silva-fj Oct 18, 2025
0a362f2
test(chain-extensions): add test for RemoveProxyV1
silva-fj Oct 18, 2025
49b07bd
docs: add RemoveProxyV1 to chain extension documentation
silva-fj Oct 18, 2025
29e99d7
Introduce root claim threshold for subnets.
shamil-gadelshin Oct 20, 2025
05550de
fix: add num_enum/std feature propagation
silva-fj Oct 20, 2025
fc7eeff
Merge remote-tracking branch 'upstream/devnet-ready' into feature/add…
silva-fj Oct 20, 2025
142842d
fix: remove InitialMaxWeightsLimit from chain-extensions mock
silva-fj Oct 20, 2025
fe70e19
Merge branch 'devnet-ready' into kappa-sudo-only
JohnReedV Oct 20, 2025
17d0d48
migrate kappa to default
JohnReedV Oct 20, 2025
bf4ed6a
Merge branch 'devnet-ready' into Remove-Duplicate-Setter-snownerhotkey
JohnReedV Oct 20, 2025
feb736e
fix test
JohnReedV Oct 20, 2025
6ca4b24
clippy
JohnReedV Oct 20, 2025
712d459
Add migration for RateLimitKey
ales-otf Oct 17, 2025
5477ccb
Fix lints
ales-otf Oct 20, 2025
974e0e0
Merge pull request #2114 from opentensor/Remove-Duplicate-Setter-snow…
JohnReedV Oct 20, 2025
fc0f611
Merge pull request #2139 from opentensor/kappa-sudo-only
sam0x17 Oct 20, 2025
4b83813
Merge pull request #2147 from opentensor/fix/rate-limit-key
sam0x17 Oct 20, 2025
99a542b
Merge pull request #2137 from opentensor/burn-alpha-precompile
open-junius Oct 20, 2025
08be1e5
disable set kappa test
open-junius Oct 22, 2025
045ae84
bump version
open-junius Oct 22, 2025
0143105
Merge branch 'devnet-ready' into root-claim2
shamil-gadelshin Oct 22, 2025
fb17282
Fix benchmarks
shamil-gadelshin Oct 23, 2025
534e578
Fix incorrect extrinsic class.
shamil-gadelshin Oct 23, 2025
1426ed1
Merge pull request #2152 from opentensor/unstake-all-class
sam0x17 Oct 23, 2025
2beefc1
fix clippy issue
silva-fj Oct 23, 2025
55f30b2
auto-update benchmark weights
github-actions[bot] Oct 23, 2025
1b392d5
Implement emissions based on tao flow
gztensor Oct 23, 2025
9cd2b14
Fix typo in hooks.rs
gztensor Oct 23, 2025
32982b7
Change type of flow cutoff to I64F64, add tests for negative cutoff, …
gztensor Oct 23, 2025
1ab5d4d
set root owner for fast time
open-junius Oct 24, 2025
649a6d7
bump version
open-junius Oct 24, 2025
3e478e8
Merge pull request #2151 from opentensor/fix-set-kappa-test
open-junius Oct 24, 2025
a2d2cb8
Merge branch 'devnet-ready' into set-root-owner-fast-runtime
open-junius Oct 24, 2025
c6c61e0
docs(contracts): rename and clarify WASM contract support
silva-fj Oct 24, 2025
aaa8b37
Merge branch 'devnet-ready' into feat/flow-emissions
gztensor Oct 24, 2025
558f908
Apply review suggestions
shamil-gadelshin Oct 24, 2025
28deede
Merge branch 'devnet-ready' into root-claim2
shamil-gadelshin Oct 24, 2025
318fb58
Set pays yes for sudo extrinsics.
shamil-gadelshin Oct 27, 2025
346986b
Merge pull request #2132 from opentensor/feat/add-srtool-scripts
sam0x17 Oct 27, 2025
efbe782
auto-update benchmark weights
github-actions[bot] Oct 27, 2025
4a1ba93
auto-update benchmark weights
github-actions[bot] Oct 27, 2025
da9a2dc
Merge branch 'devnet-ready' into multiple-pulse-txs-per-block
JohnReedV Oct 27, 2025
f08ef46
Enable zero as sudo_set_num_root_claims param value.
shamil-gadelshin Oct 28, 2025
91e5776
Add subnets to claim_root extrinsic.
shamil-gadelshin Oct 28, 2025
5025669
Merge pull request #2155 from opentensor/set-sudo-extrinsics-pays-yes
sam0x17 Oct 28, 2025
c1dde79
Set set_coldkey_auto_stake_hotkey to Pays::Yes
shamil-gadelshin Oct 28, 2025
8fb0324
add root owner hotkey
open-junius Oct 28, 2025
b710d30
Merge pull request #2153 from opentensor/set-root-owner-fast-runtime
sam0x17 Oct 28, 2025
acdc77f
Merge pull request #2059 from silva-fj/feature/add-pallet-contracts
sam0x17 Oct 29, 2025
39a8cf4
add missing reads
JohnReedV Oct 29, 2025
f190dca
Merge pull request #2053 from opentensor/root-claim2
sam0x17 Oct 29, 2025
3a475f3
Merge branch 'devnet-ready' into feat/flow-emissions
gztensor Oct 29, 2025
507df12
Merge branch 'devnet-ready' into add-missing-reads-to-admin-utils-dis…
JohnReedV Oct 29, 2025
31578b0
Merge pull request #2160 from opentensor/feat/flow-emissions
sam0x17 Oct 29, 2025
9a66571
Merge pull request #2084 from opentensor/multiple-pulse-txs-per-block
sam0x17 Oct 29, 2025
733f8b3
Fix ema flow
gztensor Oct 29, 2025
b2a894f
Merge pull request #2162 from opentensor/feat/flow-emissions
sam0x17 Oct 29, 2025
2fdbe92
bump spec version
sam0x17 Oct 29, 2025
ab5d88b
Fix DefaultFlowEmaSmoothingFactor (should be i64 normalized)
gztensor Oct 29, 2025
d7eec7a
Spec bump
gztensor Oct 29, 2025
b14c8d6
Resove conflicts
gztensor Oct 29, 2025
5f7514a
Merge pull request #2163 from opentensor/feat/flow-emissions
sam0x17 Oct 29, 2025
7aae75f
auto-update benchmark weights
github-actions[bot] Oct 30, 2025
acb0868
add note about ink v6 support
camfairchild Oct 30, 2025
0cef978
use new line and warning
camfairchild Oct 30, 2025
40e9df6
Merge pull request #2159 from opentensor/add-missing-reads-to-admin-u…
sam0x17 Oct 30, 2025
34a774f
Merge pull request #2167 from opentensor/ink/docs/note-ink-v6-support
sam0x17 Oct 30, 2025
742c4aa
Disable root claim fees.
shamil-gadelshin Oct 31, 2025
b5cfad3
Merge pull request #2157 from opentensor/set-pays-yes-extrinsic
sam0x17 Nov 1, 2025
989944b
Remove claim root on network deregistration
shamil-gadelshin Oct 31, 2025
e4da052
Bump chain spec version.
shamil-gadelshin Nov 3, 2025
c6cfaeb
auto-update benchmark weights
github-actions[bot] Nov 3, 2025
c5e0161
Merge pull request #2168 from opentensor/disable-root-claim-fees
sam0x17 Nov 3, 2025
3b64fb8
Merge remote-tracking branch 'origin/devnet-ready' into network-disso…
sam0x17 Nov 3, 2025
0d66053
Init flows instead of transition, set temperature = 1.0
gztensor Nov 3, 2025
9f84b02
Remove init_factor
gztensor Nov 3, 2025
d3211b7
Merge pull request #2171 from opentensor/feat/flow-emissions
sam0x17 Nov 3, 2025
e846eba
Merge pull request #2170 from opentensor/network-dissolution-optimiza…
sam0x17 Nov 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Bittensor PR Review Guidelines

You are reviewing code for a Substrate-based blockchain with a $4B market cap. Lives and livelihoods depend on the security and correctness of this code. Be thorough, precise, and uncompromising on safety.

## Branch Strategy
* Unless this is a hotfix or deployment PR (`devnet-ready` => `devnet`, `devnet` => `testnet`, or `testnet` => `main`), all PRs must target `devnet-ready`
* Flag PRs targeting `main` directly unless they are hotfixes
* `devnet` and `testnet` branches must only receive merges from their respective `-ready` branches

## CRITICAL: Runtime Safety (Chain-Bricking Prevention)
The runtime CANNOT panic under any circumstances. A single panic can brick the entire chain.

**Panic Sources to Flag:**
* Direct indexing: `vec[i]`, `arr[3]` → Must use `.get()` returning `Option`
* `.unwrap()`, `.expect()` → Must handle `Result`/`Option` properly
* `.unwrap_or()` is acceptable only with safe defaults
* Unchecked arithmetic: `a + b`, `a - b`, `a * b`, `a / b` → Must use `checked_*` or `saturating_*`
* Division without zero checks
* Type conversions: `.try_into()` without handling, casting that could truncate
* Iterator operations that assume non-empty collections: `.first().unwrap()`, `.last().unwrap()`
* String operations: slicing without bounds checking
* `unsafe` blocks (absolutely prohibited in runtime)

## Substrate-Specific Vulnerabilities

### Storage Safety
* Unbounded storage iterations (DoS vector) - check for loops over storage maps without limits
* Missing storage deposits/bonds for user-created entries (state bloat attack)
* Storage migrations without proper version checks or error handling
* Direct storage manipulation without proper weight accounting
* `kill_storage()` or storage removals without cleanup of dependent data

### Weight & Resource Exhaustion
* Missing or incorrect `#[pallet::weight]` annotations
* Computational complexity not reflected in weight calculations
* Database reads/writes not accounted for in weights
* Potential for weight exhaustion attacks through parameter manipulation
* Loops with user-controlled bounds in extrinsics

### Origin & Permission Checks
* Missing `ensure_signed`, `ensure_root`, or `ensure_none` checks
* Origin checks that can be bypassed
* Privilege escalation paths
* Missing checks before state-modifying operations
* Incorrect origin forwarding in cross-pallet calls

### Economic & Cryptoeconomic Exploits
* Integer overflow/underflow in token/balance calculations
* Rounding errors that can be exploited (especially in repeated operations)
* MEV/front-running vulnerabilities in auction/pricing mechanisms
* Flash loan-style attacks or single-block exploits
* Reward calculation errors or manipulation vectors
* Slashing logic vulnerabilities
* Economic denial of service (forcing expensive operations on others)

### Migration Safety
* Migrations without try-state checks or validation
* Missing version guards (checking current vs new version)
* Unbounded migrations that could time out
* Data loss risks during migration
* Missing rollback handling for failed migrations

### Consensus & Chain State
* Anything that could cause non-deterministic behavior (randomness sources, timestamps without validation)
* Fork-causing conditions due to different execution paths
* Block production or finalization blockers
*Validator set manipulation vulnerabilities

### Cross-Pallet Interactions
* Reentrancy-like patterns when calling other pallets
* Circular dependencies between pallets
* Assumptions about other pallet state that could be violated
* Missing error handling from pallet calls

## Supply Chain & Dependency Security

**Flag any PR that:**
* Adds new dependencies (require justification and thorough vetting)
* Updates cryptographic or core dependencies
* Uses dependencies with known vulnerabilities (check advisories)
* Depends on unmaintained or obscure crates
* Introduces git dependencies or path dependencies pointing outside the repo
* Uses pre-release versions of critical dependencies
* Includes large dependency version jumps without explanation

**For dependency changes, verify:**
* Changelog review for security fixes or breaking changes
* Maintainer reputation and project activity
* Number of reverse dependencies (more = more scrutiny)
* Whether it introduces new transitive dependencies

## Code Quality & Maintainability

* Code duplication that could lead to inconsistent bug fixes
* Overly complex logic that obscures security issues
* Missing error messages or unclear panic contexts in tests
* Insufficient test coverage for new extrinsics or storage operations
* Missing or inadequate documentation for complex algorithms
* Magic numbers without explanation
* TODO/FIXME comments introducing technical debt in critical paths

## External Contributor Scrutiny
For contributors without "Nucleus" role, apply **maximum scrutiny**:
* Verify the PR solves a real, documented issue
* Check for hidden backdoors or logic bombs
* Review commit history for suspicious patterns
* Validate that changes match the stated purpose
* Question any unusual patterns or overcomplicated solutions
* Require clear explanations for non-obvious changes

## Build & Tooling
* If lints fail (clippy, rustfmt, cargo check), suggest running `./scripts/fix_rust.sh`
* Uncommitted `Cargo.lock` changes should be included in commits
* Ensure CI passes before deep review

## Review Style
* Be **concise** - report only legitimate issues, no nitpicks
* Provide **specific line numbers** and **concrete examples**
* Suggest **fixes** when possible, not just problems
* **Severity levels**: Use [CRITICAL], [HIGH], [MEDIUM], [LOW] tags
* Block PRs on [CRITICAL] and [HIGH] issues
* For security issues, consider discussing privately before commenting publicly

## Final Check
Before approving, ask yourself:
1. Could this brick the chain? (panic, consensus break)
2. Could this lose or steal funds? (arithmetic, logic errors)
3. Could this DOS the network? (unbounded operations, weight issues)
4. Could this introduce a backdoor? (especially for external contributors)
5. Is this change necessary and minimal?

**Remember: $4B market cap. Err on the side of caution. When in doubt, escalate.**
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Please ensure the following tasks are completed before requesting a review:

- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have run `cargo fmt` and `cargo clippy` to ensure my code is formatted and linted correctly
- [ ] 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
Expand Down
Loading
Loading