diff --git a/Cargo.lock b/Cargo.lock index 4a7d47eb0f78..9972285780f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -896,7 +896,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -1026,7 +1025,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -1062,7 +1060,6 @@ dependencies = [ "parity-scale-codec", "sp-io", "sp-runtime", - "sp-std 14.0.0", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", @@ -1085,7 +1082,6 @@ dependencies = [ "scale-info", "sp-api", "sp-runtime", - "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -2036,7 +2032,6 @@ dependencies = [ "snowbridge-core", "sp-core", "sp-runtime", - "sp-std 14.0.0", "staging-xcm", ] @@ -2216,7 +2211,6 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", @@ -2616,7 +2610,6 @@ dependencies = [ "sp-genesis-builder", "sp-keyring", "sp-runtime", - "sp-std 14.0.0", "staging-chain-spec-builder", "substrate-wasm-builder", ] @@ -2966,7 +2959,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -3223,7 +3215,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -3321,7 +3312,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -3386,7 +3376,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -3910,7 +3899,6 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-trie", "tracing", @@ -4002,7 +3990,6 @@ dependencies = [ "sp-application-crypto", "sp-consensus-aura", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -4019,7 +4006,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "staging-xcm", ] @@ -4093,7 +4079,6 @@ dependencies = [ "pallet-session", "parity-scale-codec", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -4108,7 +4093,6 @@ dependencies = [ "polkadot-primitives", "scale-info", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -4122,7 +4106,6 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", "staging-xcm", ] @@ -4147,7 +4130,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -4164,7 +4146,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", "staging-xcm", ] @@ -4178,7 +4159,6 @@ dependencies = [ "sp-api", "sp-consensus-aura", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -4192,7 +4172,6 @@ dependencies = [ "scale-info", "sp-api", "sp-runtime", - "sp-std 14.0.0", "sp-trie", "staging-xcm", ] @@ -4209,7 +4188,6 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0", "sp-trie", ] @@ -4240,7 +4218,6 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-trie", ] @@ -4252,7 +4229,6 @@ dependencies = [ "futures", "parity-scale-codec", "sp-inherents", - "sp-std 14.0.0", "sp-timestamp", ] @@ -4269,7 +4245,6 @@ dependencies = [ "polkadot-runtime-parachains", "sp-io", "sp-runtime", - "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -4439,7 +4414,6 @@ dependencies = [ "polkadot-primitives", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0", "sp-trie", ] @@ -4478,7 +4452,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-transaction-pool", "sp-version", "staging-parachain-info", @@ -5729,7 +5702,6 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-runtime-interface 24.0.0", - "sp-std 14.0.0", "sp-storage 19.0.0", "static_assertions", ] @@ -5794,7 +5766,6 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -5828,7 +5799,6 @@ dependencies = [ "sp-io", "sp-npos-elections", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -5866,7 +5836,6 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "sp-version", ] @@ -6046,7 +6015,6 @@ dependencies = [ "sp-metadata-ir", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0", "sp-version", "static_assertions", "trybuild", @@ -6121,7 +6089,6 @@ dependencies = [ "sp-externalities 0.25.0", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-version", ] @@ -6142,7 +6109,6 @@ dependencies = [ "parity-scale-codec", "sp-api", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -6480,7 +6446,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -9665,7 +9630,6 @@ dependencies = [ "sp-crypto-hashing", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9686,7 +9650,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9707,7 +9670,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9725,7 +9687,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-storage 19.0.0", ] @@ -9742,7 +9703,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9763,7 +9723,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-storage 19.0.0", ] @@ -9814,7 +9773,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9832,7 +9790,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9849,7 +9806,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9864,7 +9820,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9892,7 +9847,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -9912,7 +9866,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", ] @@ -9960,7 +9913,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -9988,7 +9940,6 @@ dependencies = [ "sp-session", "sp-staking", "sp-state-machine", - "sp-std 14.0.0", ] [[package]] @@ -10013,7 +9964,6 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std 14.0.0", ] [[package]] @@ -10031,7 +9981,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10161,7 +10110,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", ] @@ -10181,7 +10129,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10205,7 +10152,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 14.0.0", "sp-tracing 16.0.0", ] @@ -10222,7 +10168,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10237,7 +10182,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10330,7 +10274,6 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", @@ -10374,7 +10317,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10392,7 +10334,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10406,7 +10347,6 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10427,7 +10367,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 14.0.0", "sp-tracing 16.0.0", "substrate-test-utils", ] @@ -10449,7 +10388,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10465,7 +10403,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10515,7 +10452,6 @@ dependencies = [ "sp-io", "sp-npos-elections", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "strum 0.26.2", ] @@ -10530,7 +10466,6 @@ dependencies = [ "parity-scale-codec", "sp-npos-elections", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10549,7 +10484,6 @@ dependencies = [ "sp-npos-elections", "sp-runtime", "sp-staking", - "sp-std 14.0.0", "sp-tracing 16.0.0", "substrate-test-utils", ] @@ -10568,7 +10502,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10594,7 +10527,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10625,7 +10557,6 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10644,7 +10575,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-version", ] @@ -10660,7 +10590,6 @@ dependencies = [ "scale-info", "sp-core", "sp-io", - "sp-std 14.0.0", ] [[package]] @@ -10676,7 +10605,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10714,7 +10642,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 14.0.0", "sp-tracing 16.0.0", "substrate-test-utils", ] @@ -10735,7 +10662,6 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10765,7 +10691,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -10784,7 +10709,6 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10804,7 +10728,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -10821,7 +10744,6 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10836,7 +10758,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10853,7 +10774,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10869,7 +10789,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10891,7 +10810,6 @@ dependencies = [ "sp-crypto-hashing", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "sp-weights", ] @@ -10915,7 +10833,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "sp-version", ] @@ -10945,7 +10862,6 @@ dependencies = [ "sp-io", "sp-mixnet", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10965,7 +10881,6 @@ dependencies = [ "sp-io", "sp-mmr-primitives", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -10981,7 +10896,6 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11019,7 +10933,6 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11029,7 +10942,6 @@ dependencies = [ "pallet-nfts", "parity-scale-codec", "sp-api", - "sp-std 14.0.0", ] [[package]] @@ -11046,7 +10958,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11061,7 +10972,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11078,7 +10988,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 14.0.0", "sp-tracing 16.0.0", ] @@ -11104,7 +11013,6 @@ dependencies = [ "sp-runtime", "sp-runtime-interface 24.0.0", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -11129,7 +11037,6 @@ dependencies = [ "pallet-nomination-pools", "parity-scale-codec", "sp-api", - "sp-std 14.0.0", ] [[package]] @@ -11196,7 +11103,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -11223,7 +11129,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -11240,7 +11145,6 @@ dependencies = [ "sp-io", "sp-metadata-ir", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11285,7 +11189,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11302,7 +11205,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11319,7 +11221,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11337,7 +11238,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11353,7 +11253,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11375,7 +11274,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11391,7 +11289,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11426,7 +11323,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11446,7 +11342,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11464,7 +11359,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11483,7 +11377,6 @@ dependencies = [ "sp-crypto-hashing", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11501,7 +11394,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-weights", "substrate-test-utils", ] @@ -11518,7 +11410,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11538,7 +11429,6 @@ dependencies = [ "sp-session", "sp-staking", "sp-state-machine", - "sp-std 14.0.0", "sp-trie", ] @@ -11562,7 +11452,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-session", - "sp-std 14.0.0", ] [[package]] @@ -11574,7 +11463,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11595,7 +11483,6 @@ dependencies = [ "sp-crypto-hashing", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11623,7 +11510,6 @@ dependencies = [ "sp-npos-elections", "sp-runtime", "sp-staking", - "sp-std 14.0.0", "sp-tracing 16.0.0", "substrate-test-utils", ] @@ -11673,7 +11559,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "substrate-state-trie-migration-rpc", "thousands", @@ -11696,7 +11581,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-statement-store", - "sp-std 14.0.0", ] [[package]] @@ -11712,7 +11596,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11744,7 +11627,6 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-timestamp", ] @@ -11765,7 +11647,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-storage 19.0.0", ] @@ -11783,7 +11664,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11829,7 +11709,6 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-transaction-storage-proof", ] @@ -11850,7 +11729,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11869,7 +11747,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11905,7 +11782,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11922,7 +11798,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11940,7 +11815,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -11962,7 +11836,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -11986,7 +11859,6 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-builder", @@ -12179,7 +12051,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "staging-parachain-info", "staging-xcm", "staging-xcm-executor", @@ -12224,7 +12095,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-tracing 16.0.0", "staging-parachain-info", "staging-xcm", @@ -12498,7 +12368,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -12596,7 +12465,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -12694,7 +12562,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -13075,7 +12942,6 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -13970,7 +13836,6 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 14.0.0", "sp-weights", ] @@ -13997,7 +13862,6 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -14095,7 +13959,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -14110,7 +13973,6 @@ dependencies = [ "frame-benchmarking", "parity-scale-codec", "polkadot-primitives", - "sp-std 14.0.0", "sp-tracing 16.0.0", ] @@ -14165,7 +14027,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", "sp-tracing 16.0.0", "staging-xcm", "staging-xcm-executor", @@ -14671,7 +14532,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-transaction-pool", "sp-version", @@ -15031,7 +14891,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", "sp-transaction-pool", "sp-trie", "sp-version", @@ -16457,7 +16316,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-transaction-pool", "sp-version", "staging-parachain-info", @@ -16559,7 +16417,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-tracing 16.0.0", "sp-transaction-pool", @@ -18198,7 +18055,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-runtime-interface 24.0.0", - "sp-std 14.0.0", "substrate-wasm-builder", ] @@ -18788,7 +18644,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-transaction-pool", "sp-version", "staging-parachain-info", @@ -19112,7 +18967,6 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 14.0.0", "sp-transaction-pool", "sp-version", "staging-parachain-info", @@ -19219,7 +19073,6 @@ dependencies = [ "parity-scale-codec", "paste", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -19853,7 +19706,6 @@ dependencies = [ "sp-runtime", "sp-runtime-interface 24.0.0", "sp-state-machine", - "sp-std 14.0.0", "sp-test-primitives", "sp-trie", "sp-version", @@ -19906,7 +19758,6 @@ dependencies = [ "serde", "sp-core", "sp-io", - "sp-std 14.0.0", ] [[package]] @@ -19934,7 +19785,6 @@ dependencies = [ "scale-info", "serde", "sp-crypto-hashing", - "sp-std 14.0.0", "static_assertions", ] @@ -20350,7 +20200,6 @@ dependencies = [ "sp-keystore", "sp-runtime-interface 24.0.0", "sp-state-machine", - "sp-std 14.0.0", "sp-tracing 16.0.0", "sp-trie", "tracing", @@ -20596,7 +20445,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime-interface 24.0.0", - "sp-std 14.0.0", "substrate-wasm-builder", ] @@ -21024,7 +20872,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -21076,7 +20923,6 @@ dependencies = [ "sp-arithmetic", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-weights", "staging-xcm", "staging-xcm-executor", @@ -21096,7 +20942,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0", "sp-weights", "staging-xcm", "tracing", @@ -21893,7 +21738,6 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives", "sp-io", - "sp-std 14.0.0", "substrate-wasm-builder", "tiny-keccak", ] @@ -21941,7 +21785,6 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives", "sp-io", - "sp-std 14.0.0", "substrate-wasm-builder", "tiny-keccak", ] @@ -23640,7 +23483,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0", "sp-storage 19.0.0", "sp-tracing 16.0.0", "sp-transaction-pool", @@ -24195,7 +24037,6 @@ dependencies = [ "scale-info", "sp-api", "sp-io", - "sp-std 14.0.0", "sp-weights", "staging-xcm", "staging-xcm-builder", diff --git a/cumulus/client/parachain-inherent/Cargo.toml b/cumulus/client/parachain-inherent/Cargo.toml index d81f727b41b9..0d82cf648743 100644 --- a/cumulus/client/parachain-inherent/Cargo.toml +++ b/cumulus/client/parachain-inherent/Cargo.toml @@ -18,7 +18,6 @@ sp-crypto-hashing = { workspace = true, default-features = true } sp-inherents = { workspace = true, default-features = true } sp-runtime = { workspace = true, default-features = true } sp-state-machine = { workspace = true, default-features = true } -sp-std = { workspace = true, default-features = true } sp-storage = { workspace = true, default-features = true } sp-trie = { workspace = true, default-features = true } diff --git a/cumulus/client/relay-chain-inprocess-interface/src/lib.rs b/cumulus/client/relay-chain-inprocess-interface/src/lib.rs index 8f8d666bd143..38ba84748c1e 100644 --- a/cumulus/client/relay-chain-inprocess-interface/src/lib.rs +++ b/cumulus/client/relay-chain-inprocess-interface/src/lib.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -use std::{pin::Pin, sync::Arc, time::Duration}; +use std::{collections::btree_map::BTreeMap, pin::Pin, sync::Arc, time::Duration}; use async_trait::async_trait; use cumulus_primitives_core::{ @@ -38,7 +38,7 @@ use sc_client_api::{ use sc_telemetry::TelemetryWorkerHandle; use sp_api::ProvideRuntimeApi; use sp_consensus::SyncOracle; -use sp_core::{sp_std::collections::btree_map::BTreeMap, Pair}; +use sp_core::Pair; use sp_state_machine::{Backend as StateBackend, StorageValue}; /// The timeout in seconds after that the waiting for a block should be aborted. diff --git a/cumulus/client/relay-chain-rpc-interface/src/lib.rs b/cumulus/client/relay-chain-rpc-interface/src/lib.rs index 692a1fb537a8..e32ec6a41a4b 100644 --- a/cumulus/client/relay-chain-rpc-interface/src/lib.rs +++ b/cumulus/client/relay-chain-rpc-interface/src/lib.rs @@ -30,11 +30,10 @@ use futures::{FutureExt, Stream, StreamExt}; use polkadot_overseer::Handle; use sc_client_api::StorageProof; -use sp_core::sp_std::collections::btree_map::BTreeMap; use sp_state_machine::StorageValue; use sp_storage::StorageKey; use sp_version::RuntimeVersion; -use std::pin::Pin; +use std::{collections::btree_map::BTreeMap, pin::Pin}; use cumulus_primitives_core::relay_chain::BlockId; pub use url::Url; diff --git a/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs b/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs index a5d7c22a2ec8..c7eaa45958b0 100644 --- a/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs +++ b/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs @@ -24,7 +24,7 @@ use jsonrpsee::{ }; use serde::de::DeserializeOwned; use serde_json::Value as JsonValue; -use std::collections::VecDeque; +use std::collections::{btree_map::BTreeMap, VecDeque}; use tokio::sync::mpsc::Sender as TokioSender; use codec::{Decode, Encode}; @@ -47,7 +47,6 @@ use sc_client_api::StorageData; use sc_rpc_api::{state::ReadProof, system::Health}; use sc_service::TaskManager; use sp_consensus_babe::Epoch; -use sp_core::sp_std::collections::btree_map::BTreeMap; use sp_storage::StorageKey; use sp_version::RuntimeVersion; diff --git a/cumulus/pallets/aura-ext/Cargo.toml b/cumulus/pallets/aura-ext/Cargo.toml index 1b6ac4cf07df..c08148928b7c 100644 --- a/cumulus/pallets/aura-ext/Cargo.toml +++ b/cumulus/pallets/aura-ext/Cargo.toml @@ -21,7 +21,6 @@ pallet-timestamp = { workspace = true } sp-application-crypto = { workspace = true } sp-consensus-aura = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # Cumulus cumulus-pallet-parachain-system = { workspace = true } @@ -44,7 +43,6 @@ std = [ "sp-application-crypto/std", "sp-consensus-aura/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", diff --git a/cumulus/pallets/aura-ext/src/consensus_hook.rs b/cumulus/pallets/aura-ext/src/consensus_hook.rs index 560d477b2a85..c1a8568bdd83 100644 --- a/cumulus/pallets/aura-ext/src/consensus_hook.rs +++ b/cumulus/pallets/aura-ext/src/consensus_hook.rs @@ -20,6 +20,7 @@ //! The velocity `V` refers to the rate of block processing by the relay chain. use super::{pallet, Aura}; +use core::{marker::PhantomData, num::NonZeroU32}; use cumulus_pallet_parachain_system::{ self as parachain_system, consensus_hook::{ConsensusHook, UnincludedSegmentCapacity}, @@ -27,7 +28,6 @@ use cumulus_pallet_parachain_system::{ }; use frame_support::pallet_prelude::*; use sp_consensus_aura::{Slot, SlotDuration}; -use sp_std::{marker::PhantomData, num::NonZeroU32}; /// A consensus hook for a fixed block processing velocity and unincluded segment capacity. /// @@ -84,7 +84,7 @@ where ( weight, - NonZeroU32::new(sp_std::cmp::max(C, 1)) + NonZeroU32::new(core::cmp::max(C, 1)) .expect("1 is the minimum value and non-zero; qed") .into(), ) diff --git a/cumulus/pallets/aura-ext/src/lib.rs b/cumulus/pallets/aura-ext/src/lib.rs index 4605dd325bee..4c9e61458a87 100644 --- a/cumulus/pallets/aura-ext/src/lib.rs +++ b/cumulus/pallets/aura-ext/src/lib.rs @@ -109,7 +109,7 @@ pub mod pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -125,7 +125,7 @@ pub mod pallet { /// /// When executing the block it will verify the block seal to ensure that the correct author created /// the block. -pub struct BlockExecutor(sp_std::marker::PhantomData<(T, I)>); +pub struct BlockExecutor(core::marker::PhantomData<(T, I)>); impl ExecuteBlock for BlockExecutor where diff --git a/cumulus/pallets/collator-selection/Cargo.toml b/cumulus/pallets/collator-selection/Cargo.toml index 206700b7d606..b3512dc2ae6c 100644 --- a/cumulus/pallets/collator-selection/Cargo.toml +++ b/cumulus/pallets/collator-selection/Cargo.toml @@ -21,7 +21,6 @@ codec = { features = ["derive"], workspace = true } rand = { features = ["std_rng"], workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } sp-staking = { workspace = true } frame-support = { workspace = true } @@ -65,7 +64,6 @@ std = [ "scale-info/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] try-runtime = [ diff --git a/cumulus/pallets/collator-selection/src/benchmarking.rs b/cumulus/pallets/collator-selection/src/benchmarking.rs index c6b600445282..24823661383b 100644 --- a/cumulus/pallets/collator-selection/src/benchmarking.rs +++ b/cumulus/pallets/collator-selection/src/benchmarking.rs @@ -21,13 +21,14 @@ use super::*; #[allow(unused)] use crate::Pallet as CollatorSelection; +use alloc::vec::Vec; use codec::Decode; +use core::cmp; use frame_benchmarking::{account, v2::*, whitelisted_caller, BenchmarkError}; use frame_support::traits::{Currency, EnsureOrigin, Get, ReservableCurrency}; use frame_system::{pallet_prelude::BlockNumberFor, EventRecord, RawOrigin}; use pallet_authorship::EventHandler; use pallet_session::{self as session, SessionManager}; -use sp_std::{cmp, prelude::*}; pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; diff --git a/cumulus/pallets/collator-selection/src/lib.rs b/cumulus/pallets/collator-selection/src/lib.rs index 2fa384367528..17dc1a552c2d 100644 --- a/cumulus/pallets/collator-selection/src/lib.rs +++ b/cumulus/pallets/collator-selection/src/lib.rs @@ -81,6 +81,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use core::marker::PhantomData; use frame_support::traits::TypedGet; pub use pallet::*; @@ -101,6 +103,7 @@ const LOG_TARGET: &str = "runtime::collator-selection"; #[frame_support::pallet] pub mod pallet { pub use crate::weights::WeightInfo; + use alloc::vec::Vec; use core::ops::Div; use frame_support::{ dispatch::{DispatchClass, DispatchResultWithPostInfo}, @@ -118,7 +121,6 @@ pub mod pallet { RuntimeDebug, }; use sp_staking::SessionIndex; - use sp_std::vec::Vec; /// The in-code storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); @@ -244,7 +246,7 @@ pub mod pallet { let duplicate_invulnerables = self .invulnerables .iter() - .collect::>(); + .collect::>(); assert!( duplicate_invulnerables.len() == self.invulnerables.len(), "duplicate invulnerables in genesis." diff --git a/cumulus/pallets/collator-selection/src/migration.rs b/cumulus/pallets/collator-selection/src/migration.rs index 425acdd8bfb5..c52016948069 100644 --- a/cumulus/pallets/collator-selection/src/migration.rs +++ b/cumulus/pallets/collator-selection/src/migration.rs @@ -17,6 +17,8 @@ //! A module that is responsible for migration of storage for Collator Selection. use super::*; +#[cfg(feature = "try-runtime")] +use alloc::vec::Vec; use frame_support::traits::{OnRuntimeUpgrade, UncheckedOnRuntimeUpgrade}; use log; @@ -29,8 +31,6 @@ pub mod v2 { traits::{Currency, ReservableCurrency}, }; use sp_runtime::traits::{Saturating, Zero}; - #[cfg(feature = "try-runtime")] - use sp_std::vec::Vec; /// [`UncheckedMigrationToV2`] wrapped in a /// [`VersionedMigration`](frame_support::migrations::VersionedMigration), ensuring the @@ -51,7 +51,7 @@ pub mod v2 { >; /// Migrate to V2. - pub struct UncheckedMigrationToV2(sp_std::marker::PhantomData); + pub struct UncheckedMigrationToV2(PhantomData); impl UncheckedOnRuntimeUpgrade for UncheckedMigrationToV2 { fn on_runtime_upgrade() -> Weight { let mut weight = Weight::zero(); @@ -123,10 +123,8 @@ pub mod v2 { pub mod v1 { use super::*; use frame_support::pallet_prelude::*; - #[cfg(feature = "try-runtime")] - use sp_std::prelude::*; - pub struct MigrateToV1(sp_std::marker::PhantomData); + pub struct MigrateToV1(PhantomData); impl OnRuntimeUpgrade for MigrateToV1 { fn on_runtime_upgrade() -> Weight { let on_chain_version = Pallet::::on_chain_storage_version(); diff --git a/cumulus/pallets/collator-selection/src/weights.rs b/cumulus/pallets/collator-selection/src/weights.rs index 1c01ad6cd6fe..12e6b755e976 100644 --- a/cumulus/pallets/collator-selection/src/weights.rs +++ b/cumulus/pallets/collator-selection/src/weights.rs @@ -18,11 +18,11 @@ #![allow(unused_parens)] #![allow(unused_imports)] +use core::marker::PhantomData; use frame_support::{ traits::Get, weights::{constants::RocksDbWeight, Weight}, }; -use sp_std::marker::PhantomData; // The weight info trait for `pallet_collator_selection`. pub trait WeightInfo { diff --git a/cumulus/pallets/dmp-queue/Cargo.toml b/cumulus/pallets/dmp-queue/Cargo.toml index 052a2547e788..936526290d93 100644 --- a/cumulus/pallets/dmp-queue/Cargo.toml +++ b/cumulus/pallets/dmp-queue/Cargo.toml @@ -21,7 +21,6 @@ scale-info = { features = ["derive"], workspace = true } frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } sp-io = { workspace = true } @@ -48,7 +47,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm/std", ] diff --git a/cumulus/pallets/dmp-queue/src/benchmarking.rs b/cumulus/pallets/dmp-queue/src/benchmarking.rs index 91d1e0eab7e4..432d6f3bc7ae 100644 --- a/cumulus/pallets/dmp-queue/src/benchmarking.rs +++ b/cumulus/pallets/dmp-queue/src/benchmarking.rs @@ -19,9 +19,9 @@ use crate::*; +use alloc::vec; use frame_benchmarking::v2::*; use frame_support::{pallet_prelude::*, traits::Hooks}; -use sp_std::vec; #[benchmarks] mod benchmarks { diff --git a/cumulus/pallets/dmp-queue/src/lib.rs b/cumulus/pallets/dmp-queue/src/lib.rs index 9b3ec684feba..cedca6f3fb97 100644 --- a/cumulus/pallets/dmp-queue/src/lib.rs +++ b/cumulus/pallets/dmp-queue/src/lib.rs @@ -23,6 +23,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(deprecated)] // The pallet itself is deprecated. +extern crate alloc; + use migration::*; pub use pallet::*; diff --git a/cumulus/pallets/dmp-queue/src/migration.rs b/cumulus/pallets/dmp-queue/src/migration.rs index 349635cce547..b1945e8eb37b 100644 --- a/cumulus/pallets/dmp-queue/src/migration.rs +++ b/cumulus/pallets/dmp-queue/src/migration.rs @@ -17,9 +17,9 @@ //! Migrates the storage from the previously deleted DMP pallet. use crate::*; +use alloc::vec::Vec; use cumulus_primitives_core::relay_chain::BlockNumber as RelayBlockNumber; use frame_support::{pallet_prelude::*, storage_alias, traits::HandleMessage}; -use sp_std::vec::Vec; pub(crate) const LOG: &str = "runtime::dmp-queue-export-xcms"; diff --git a/cumulus/pallets/parachain-system/proc-macro/src/lib.rs b/cumulus/pallets/parachain-system/proc-macro/src/lib.rs index 8ab5d81efdcf..f284fbdc64c6 100644 --- a/cumulus/pallets/parachain-system/proc-macro/src/lib.rs +++ b/cumulus/pallets/parachain-system/proc-macro/src/lib.rs @@ -122,8 +122,8 @@ pub fn register_validate_block(input: proc_macro::TokenStream) -> proc_macro::To #[no_mangle] unsafe fn validate_block(arguments: *mut u8, arguments_len: usize) -> u64 { // We convert the `arguments` into a boxed slice and then into `Bytes`. - let args = #crate_::validate_block::sp_std::boxed::Box::from_raw( - #crate_::validate_block::sp_std::slice::from_raw_parts_mut( + let args = #crate_::validate_block::Box::from_raw( + #crate_::validate_block::slice::from_raw_parts_mut( arguments, arguments_len, ) diff --git a/cumulus/pallets/parachain-system/src/consensus_hook.rs b/cumulus/pallets/parachain-system/src/consensus_hook.rs index 91353fc7bbda..3062396a4e78 100644 --- a/cumulus/pallets/parachain-system/src/consensus_hook.rs +++ b/cumulus/pallets/parachain-system/src/consensus_hook.rs @@ -18,8 +18,8 @@ //! of parachain blocks ready to submit to the relay chain, as well as some basic implementations. use super::relay_state_snapshot::RelayChainStateProof; +use core::num::NonZeroU32; use frame_support::weights::Weight; -use sp_std::num::NonZeroU32; /// The possible capacity of the unincluded segment. #[derive(Clone)] @@ -95,7 +95,7 @@ impl ConsensusHook for FixedCapacityUnincludedSegment { fn on_state_proof(_state_proof: &RelayChainStateProof) -> (Weight, UnincludedSegmentCapacity) { ( Weight::zero(), - NonZeroU32::new(sp_std::cmp::max(N, 1)) + NonZeroU32::new(core::cmp::max(N, 1)) .expect("1 is the minimum value and non-zero; qed") .into(), ) diff --git a/cumulus/pallets/parachain-system/src/lib.rs b/cumulus/pallets/parachain-system/src/lib.rs index bbb74a1b0538..9e0a68d09a14 100644 --- a/cumulus/pallets/parachain-system/src/lib.rs +++ b/cumulus/pallets/parachain-system/src/lib.rs @@ -27,7 +27,11 @@ //! //! Users must ensure that they register this pallet as an inherent provider. +extern crate alloc; + +use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; use codec::{Decode, Encode}; +use core::cmp; use cumulus_primitives_core::{ relay_chain, AbridgedHostConfiguration, ChannelInfo, ChannelStatus, CollationInfo, GetChannelInfo, InboundDownwardMessage, InboundHrmpMessage, ListChannelInfos, MessageSendError, @@ -54,7 +58,6 @@ use sp_runtime::{ }, BoundedSlice, FixedU128, RuntimeDebug, Saturating, }; -use sp_std::{cmp, collections::btree_map::BTreeMap, prelude::*}; use xcm::{latest::XcmHash, VersionedLocation, VersionedXcm}; use xcm_builder::InspectMessageQueues; @@ -938,7 +941,7 @@ pub mod pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -1530,7 +1533,7 @@ impl Pallet { } /// Type that implements `SetCode`. -pub struct ParachainSetCode(sp_std::marker::PhantomData); +pub struct ParachainSetCode(core::marker::PhantomData); impl frame_system::SetCode for ParachainSetCode { fn set_code(code: Vec) -> DispatchResult { Pallet::::schedule_code_upgrade(code) @@ -1645,7 +1648,7 @@ pub trait CheckInherents { /// Struct that always returns `Ok` on inherents check, needed for backwards-compatibility. #[doc(hidden)] -pub struct DummyCheckInherents(sp_std::marker::PhantomData); +pub struct DummyCheckInherents(core::marker::PhantomData); #[allow(deprecated)] impl CheckInherents for DummyCheckInherents { @@ -1718,7 +1721,7 @@ pub type RelaychainBlockNumberProvider = RelaychainDataProvider; /// of [`RelayChainState`]. /// - [`current_block_number`](Self::current_block_number): Will return /// [`Pallet::last_relay_block_number()`]. -pub struct RelaychainDataProvider(sp_std::marker::PhantomData); +pub struct RelaychainDataProvider(core::marker::PhantomData); impl BlockNumberProvider for RelaychainDataProvider { type BlockNumber = relay_chain::BlockNumber; diff --git a/cumulus/pallets/parachain-system/src/mock.rs b/cumulus/pallets/parachain-system/src/mock.rs index da904c0079a0..7bea72224b8b 100644 --- a/cumulus/pallets/parachain-system/src/mock.rs +++ b/cumulus/pallets/parachain-system/src/mock.rs @@ -20,7 +20,9 @@ use super::*; +use alloc::collections::vec_deque::VecDeque; use codec::Encode; +use core::num::NonZeroU32; use cumulus_primitives_core::{ relay_chain::BlockNumber as RelayBlockNumber, AggregateMessageOrigin, InboundDownwardMessage, InboundHrmpMessage, PersistedValidationData, @@ -37,7 +39,6 @@ use frame_support::{ }; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use sp_runtime::{traits::BlakeTwo256, BuildStorage}; -use sp_std::{collections::vec_deque::VecDeque, num::NonZeroU32}; use sp_version::RuntimeVersion; use std::cell::RefCell; diff --git a/cumulus/pallets/parachain-system/src/relay_state_snapshot.rs b/cumulus/pallets/parachain-system/src/relay_state_snapshot.rs index 60eccfb072f4..323aaf650380 100644 --- a/cumulus/pallets/parachain-system/src/relay_state_snapshot.rs +++ b/cumulus/pallets/parachain-system/src/relay_state_snapshot.rs @@ -16,6 +16,7 @@ //! Relay chain state proof provides means for accessing part of relay chain storage for reads. +use alloc::vec::Vec; use codec::{Decode, Encode}; use cumulus_primitives_core::{ relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId, @@ -23,7 +24,6 @@ use cumulus_primitives_core::{ use scale_info::TypeInfo; use sp_runtime::traits::HashingFor; use sp_state_machine::{Backend, TrieBackend, TrieBackendBuilder}; -use sp_std::vec::Vec; use sp_trie::{HashDBT, MemoryDB, StorageProof, EMPTY_PREFIX}; /// The capacity of the upward message queue of a parachain on the relay chain. diff --git a/cumulus/pallets/parachain-system/src/tests.rs b/cumulus/pallets/parachain-system/src/tests.rs index 5ff15036fb6e..51c6e83c1131 100755 --- a/cumulus/pallets/parachain-system/src/tests.rs +++ b/cumulus/pallets/parachain-system/src/tests.rs @@ -19,6 +19,7 @@ use super::*; use crate::mock::*; +use core::num::NonZeroU32; use cumulus_primitives_core::{AbridgedHrmpChannel, InboundDownwardMessage, InboundHrmpMessage}; use frame_support::{assert_ok, parameter_types, weights::Weight}; use frame_system::RawOrigin; @@ -26,7 +27,6 @@ use hex_literal::hex; use rand::Rng; use relay_chain::HrmpChannelId; use sp_core::H256; -use sp_std::num::NonZeroU32; #[test] #[should_panic] diff --git a/cumulus/pallets/parachain-system/src/unincluded_segment.rs b/cumulus/pallets/parachain-system/src/unincluded_segment.rs index 1e83a945c4ee..814bb83aa1ac 100644 --- a/cumulus/pallets/parachain-system/src/unincluded_segment.rs +++ b/cumulus/pallets/parachain-system/src/unincluded_segment.rs @@ -21,11 +21,12 @@ //! sent to relay chain. use super::relay_state_snapshot::{MessagingStateSnapshot, RelayDispatchQueueRemainingCapacity}; +use alloc::collections::btree_map::BTreeMap; use codec::{Decode, Encode}; +use core::marker::PhantomData; use cumulus_primitives_core::{relay_chain, ParaId}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; -use sp_std::{collections::btree_map::BTreeMap, marker::PhantomData}; /// Constraints on outbound HRMP channel. #[derive(Clone, RuntimeDebug)] @@ -398,6 +399,7 @@ pub(crate) fn size_after_included(included_hash: H, segment: &[Anc #[cfg(test)] mod tests { use super::*; + use alloc::{vec, vec::Vec}; use assert_matches::assert_matches; #[test] diff --git a/cumulus/pallets/parachain-system/src/validate_block/implementation.rs b/cumulus/pallets/parachain-system/src/validate_block/implementation.rs index 956962fce157..42311ca9d834 100644 --- a/cumulus/pallets/parachain-system/src/validate_block/implementation.rs +++ b/cumulus/pallets/parachain-system/src/validate_block/implementation.rs @@ -26,6 +26,7 @@ use polkadot_parachain_primitives::primitives::{ HeadData, RelayChainBlockNumber, ValidationResult, }; +use alloc::vec::Vec; use codec::Encode; use frame_support::traits::{ExecuteBlock, ExtrinsicCall, Get, IsSubType}; @@ -33,7 +34,6 @@ use sp_core::storage::{ChildInfo, StateVersion}; use sp_externalities::{set_and_run_with_externalities, Externalities}; use sp_io::KillStorageResult; use sp_runtime::traits::{Block as BlockT, Extrinsic, HashingFor, Header as HeaderT}; -use sp_std::prelude::*; use sp_trie::{MemoryDB, ProofSizeProvider}; use trie_recorder::SizeOnlyRecorderProvider; @@ -124,7 +124,7 @@ where Err(_) => panic!("Compact proof decoding failure."), }; - sp_std::mem::drop(storage_proof); + core::mem::drop(storage_proof); let mut recorder = SizeOnlyRecorderProvider::new(); let cache_provider = trie_cache::CacheProvider::new(); @@ -294,7 +294,7 @@ fn host_storage_read(key: &[u8], value_out: &mut [u8], value_offset: u32) -> Opt Some(value) => { let value_offset = value_offset as usize; let data = &value[value_offset.min(value.len())..]; - let written = sp_std::cmp::min(data.len(), value_out.len()); + let written = core::cmp::min(data.len(), value_out.len()); value_out[..written].copy_from_slice(&data[..written]); Some(value.len() as u32) }, @@ -368,7 +368,7 @@ fn host_default_child_storage_read( Some(value) => { let value_offset = value_offset as usize; let data = &value[value_offset.min(value.len())..]; - let written = sp_std::cmp::min(data.len(), value_out.len()); + let written = core::cmp::min(data.len(), value_out.len()); value_out[..written].copy_from_slice(&data[..written]); Some(value.len() as u32) }, diff --git a/cumulus/pallets/parachain-system/src/validate_block/mod.rs b/cumulus/pallets/parachain-system/src/validate_block/mod.rs index 763a4cffd77f..3a00d4d352a6 100644 --- a/cumulus/pallets/parachain-system/src/validate_block/mod.rs +++ b/cumulus/pallets/parachain-system/src/validate_block/mod.rs @@ -30,6 +30,9 @@ mod trie_cache; #[doc(hidden)] mod trie_recorder; +#[cfg(not(feature = "std"))] +#[doc(hidden)] +pub use alloc::{boxed::Box, slice}; #[cfg(not(feature = "std"))] #[doc(hidden)] pub use bytes; diff --git a/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs b/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs index 5d785910fbe0..5999b3ce87f9 100644 --- a/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs +++ b/cumulus/pallets/parachain-system/src/validate_block/trie_cache.rs @@ -15,12 +15,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use sp_state_machine::TrieCacheProvider; -use sp_std::{ +use alloc::{ boxed::Box, - cell::{RefCell, RefMut}, collections::btree_map::{BTreeMap, Entry}, }; +use core::cell::{RefCell, RefMut}; +use sp_state_machine::TrieCacheProvider; use sp_trie::NodeCodec; use trie_db::{node::NodeOwned, Hasher}; diff --git a/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs b/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs index 48310670c074..198013407195 100644 --- a/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs +++ b/cumulus/pallets/parachain-system/src/validate_block/trie_recorder.rs @@ -22,11 +22,11 @@ use codec::Encode; -use sp_std::{ - cell::{RefCell, RefMut}, +use alloc::{ collections::{btree_map::BTreeMap, btree_set::BTreeSet}, rc::Rc, }; +use core::cell::{RefCell, RefMut}; use sp_trie::{NodeCodec, ProofSizeProvider, StorageProof}; use trie_db::{Hasher, RecordedForKey, TrieAccess}; diff --git a/cumulus/pallets/parachain-system/src/weights.rs b/cumulus/pallets/parachain-system/src/weights.rs index da7f64237e9b..5c61879b4d36 100644 --- a/cumulus/pallets/parachain-system/src/weights.rs +++ b/cumulus/pallets/parachain-system/src/weights.rs @@ -50,7 +50,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions needed for cumulus_pallet_parachain_system. pub trait WeightInfo { diff --git a/cumulus/pallets/session-benchmarking/Cargo.toml b/cumulus/pallets/session-benchmarking/Cargo.toml index df671566cdc2..e182ac45edeb 100644 --- a/cumulus/pallets/session-benchmarking/Cargo.toml +++ b/cumulus/pallets/session-benchmarking/Cargo.toml @@ -17,7 +17,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } @@ -39,5 +38,4 @@ std = [ "frame-system/std", "pallet-session/std", "sp-runtime/std", - "sp-std/std", ] diff --git a/cumulus/pallets/session-benchmarking/src/inner.rs b/cumulus/pallets/session-benchmarking/src/inner.rs index 36411d3d71af..8d5954304878 100644 --- a/cumulus/pallets/session-benchmarking/src/inner.rs +++ b/cumulus/pallets/session-benchmarking/src/inner.rs @@ -15,7 +15,7 @@ //! Benchmarking setup for pallet-session. -use sp_std::{prelude::*, vec}; +use alloc::{vec, vec::Vec}; use codec::Decode; use frame_benchmarking::{benchmarks, whitelisted_caller}; diff --git a/cumulus/pallets/session-benchmarking/src/lib.rs b/cumulus/pallets/session-benchmarking/src/lib.rs index a95d6fb7d591..f5bfef006169 100644 --- a/cumulus/pallets/session-benchmarking/src/lib.rs +++ b/cumulus/pallets/session-benchmarking/src/lib.rs @@ -20,6 +20,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] pub mod inner; diff --git a/cumulus/pallets/solo-to-para/Cargo.toml b/cumulus/pallets/solo-to-para/Cargo.toml index ced1b24f1d2b..5fd1939e93a0 100644 --- a/cumulus/pallets/solo-to-para/Cargo.toml +++ b/cumulus/pallets/solo-to-para/Cargo.toml @@ -18,7 +18,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } pallet-sudo = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # Polkadot polkadot-primitives = { workspace = true } @@ -37,7 +36,6 @@ std = [ "polkadot-primitives/std", "scale-info/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "cumulus-pallet-parachain-system/try-runtime", diff --git a/cumulus/pallets/solo-to-para/src/lib.rs b/cumulus/pallets/solo-to-para/src/lib.rs index da948615d4e9..b42cc74f1cf3 100644 --- a/cumulus/pallets/solo-to-para/src/lib.rs +++ b/cumulus/pallets/solo-to-para/src/lib.rs @@ -16,12 +16,14 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use cumulus_pallet_parachain_system as parachain_system; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; pub use pallet::*; use polkadot_primitives::PersistedValidationData; -use sp_std::vec::Vec; #[frame_support::pallet] pub mod pallet { diff --git a/cumulus/pallets/xcm/Cargo.toml b/cumulus/pallets/xcm/Cargo.toml index 1f0cef70e3a7..35d7a083b061 100644 --- a/cumulus/pallets/xcm/Cargo.toml +++ b/cumulus/pallets/xcm/Cargo.toml @@ -13,7 +13,6 @@ workspace = true codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } frame-support = { workspace = true } @@ -33,7 +32,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm/std", ] try-runtime = [ diff --git a/cumulus/pallets/xcm/src/lib.rs b/cumulus/pallets/xcm/src/lib.rs index 90a0ec76defe..e31df8471c26 100644 --- a/cumulus/pallets/xcm/src/lib.rs +++ b/cumulus/pallets/xcm/src/lib.rs @@ -25,7 +25,6 @@ use cumulus_primitives_core::ParaId; pub use pallet::*; use scale_info::TypeInfo; use sp_runtime::{traits::BadOrigin, RuntimeDebug}; -use sp_std::prelude::*; use xcm::latest::{ExecuteXcm, Outcome}; #[frame_support::pallet] diff --git a/cumulus/pallets/xcmp-queue/Cargo.toml b/cumulus/pallets/xcmp-queue/Cargo.toml index c542fa373b5e..9c7470eda6da 100644 --- a/cumulus/pallets/xcmp-queue/Cargo.toml +++ b/cumulus/pallets/xcmp-queue/Cargo.toml @@ -20,7 +20,6 @@ frame-system = { workspace = true } sp-io = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } pallet-message-queue = { workspace = true } # Polkadot @@ -68,7 +67,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", "xcm/std", diff --git a/cumulus/pallets/xcmp-queue/src/benchmarking.rs b/cumulus/pallets/xcmp-queue/src/benchmarking.rs index 49e2cc836734..9cb1301addfe 100644 --- a/cumulus/pallets/xcmp-queue/src/benchmarking.rs +++ b/cumulus/pallets/xcmp-queue/src/benchmarking.rs @@ -17,6 +17,7 @@ use crate::*; +use alloc::vec; use codec::DecodeAll; use frame_benchmarking::v2::*; use frame_support::traits::Hooks; diff --git a/cumulus/pallets/xcmp-queue/src/bridging.rs b/cumulus/pallets/xcmp-queue/src/bridging.rs index 9db4b6e74c39..eff4a37b0cef 100644 --- a/cumulus/pallets/xcmp-queue/src/bridging.rs +++ b/cumulus/pallets/xcmp-queue/src/bridging.rs @@ -21,7 +21,7 @@ use frame_support::pallet_prelude::Get; /// both `OutboundXcmpStatus` and `InboundXcmpStatus` for defined `ParaId` if any of those is /// suspended. pub struct InAndOutXcmpChannelStatusProvider( - sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, + core::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, ); impl, Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider @@ -45,7 +45,7 @@ impl, Runtime: crate::Config> /// Adapter implementation for `bp_xcm_bridge_hub_router::XcmChannelStatusProvider` which checks /// only `OutboundXcmpStatus` for defined `SiblingParaId` if is suspended. pub struct OutXcmpChannelStatusProvider( - sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, + core::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, ); impl, Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider diff --git a/cumulus/pallets/xcmp-queue/src/lib.rs b/cumulus/pallets/xcmp-queue/src/lib.rs index 45126a9425d4..8c4446a925d4 100644 --- a/cumulus/pallets/xcmp-queue/src/lib.rs +++ b/cumulus/pallets/xcmp-queue/src/lib.rs @@ -50,6 +50,9 @@ pub mod bridging; pub mod weights; pub use weights::WeightInfo; +extern crate alloc; + +use alloc::vec::Vec; use bounded_collections::BoundedBTreeSet; use codec::{Decode, DecodeLimit, Encode, MaxEncodedLen}; use cumulus_primitives_core::{ @@ -69,7 +72,6 @@ use polkadot_runtime_parachains::FeeTracker; use scale_info::TypeInfo; use sp_core::MAX_POSSIBLE_ALLOCATION; use sp_runtime::{FixedU128, RuntimeDebug, Saturating, WeakBoundedVec}; -use sp_std::prelude::*; use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm, WrapVersion, MAX_XCM_DECODE_DEPTH}; use xcm_builder::InspectMessageQueues; use xcm_executor::traits::ConvertOrigin; diff --git a/cumulus/pallets/xcmp-queue/src/migration.rs b/cumulus/pallets/xcmp-queue/src/migration.rs index b64982a89302..d0657aaea9fd 100644 --- a/cumulus/pallets/xcmp-queue/src/migration.rs +++ b/cumulus/pallets/xcmp-queue/src/migration.rs @@ -19,6 +19,7 @@ pub mod v5; use crate::{Config, OverweightIndex, Pallet, QueueConfig, QueueConfigData, DEFAULT_POV_SIZE}; +use alloc::vec::Vec; use cumulus_primitives_core::XcmpMessageFormat; use frame_support::{ pallet_prelude::*, diff --git a/cumulus/pallets/xcmp-queue/src/migration/v5.rs b/cumulus/pallets/xcmp-queue/src/migration/v5.rs index 247adab7108f..818365f36f60 100644 --- a/cumulus/pallets/xcmp-queue/src/migration/v5.rs +++ b/cumulus/pallets/xcmp-queue/src/migration/v5.rs @@ -17,6 +17,7 @@ //! Migrates the storage to version 5. use crate::*; +use alloc::vec::Vec; use cumulus_primitives_core::ListChannelInfos; use frame_support::{pallet_prelude::*, traits::UncheckedOnRuntimeUpgrade}; diff --git a/cumulus/parachains/common/Cargo.toml b/cumulus/parachains/common/Cargo.toml index 6eac9a096726..6d436bdf799a 100644 --- a/cumulus/parachains/common/Cargo.toml +++ b/cumulus/parachains/common/Cargo.toml @@ -29,7 +29,6 @@ sp-consensus-aura = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # Polkadot pallet-xcm = { workspace = true } @@ -73,7 +72,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-executor/std", "xcm/std", ] diff --git a/cumulus/parachains/common/src/impls.rs b/cumulus/parachains/common/src/impls.rs index 16cda1a4ed83..42ea50c75a8d 100644 --- a/cumulus/parachains/common/src/impls.rs +++ b/cumulus/parachains/common/src/impls.rs @@ -16,6 +16,8 @@ //! Auxiliary struct/enums for parachain runtimes. //! Taken from polkadot/runtime/common (at a21cd64) and adapted for parachains. +use alloc::boxed::Box; +use core::marker::PhantomData; use frame_support::traits::{ fungible, fungibles, tokens::imbalance::ResolveTo, Contains, ContainsPair, Currency, Defensive, Get, Imbalance, OnUnbalanced, OriginTrait, @@ -23,7 +25,6 @@ use frame_support::traits::{ use pallet_asset_tx_payment::HandleCredit; use pallet_collator_selection::StakingPotAccountId; use sp_runtime::traits::Zero; -use sp_std::{marker::PhantomData, prelude::*}; use xcm::latest::{ Asset, AssetId, Fungibility, Fungibility::Fungible, Junction, Junctions::Here, Location, Parent, WeightLimit, diff --git a/cumulus/parachains/common/src/lib.rs b/cumulus/parachains/common/src/lib.rs index b01d623d2b93..3cffb69daac3 100644 --- a/cumulus/parachains/common/src/lib.rs +++ b/cumulus/parachains/common/src/lib.rs @@ -15,6 +15,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub mod impls; pub mod message_queue; pub mod xcm_config; diff --git a/cumulus/parachains/common/src/message_queue.rs b/cumulus/parachains/common/src/message_queue.rs index 0c9f4b840c91..511d6243cb8c 100644 --- a/cumulus/parachains/common/src/message_queue.rs +++ b/cumulus/parachains/common/src/message_queue.rs @@ -16,10 +16,10 @@ //! Helpers to deal with configuring the message queue in the runtime. +use core::marker::PhantomData; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::traits::{QueueFootprint, QueuePausedQuery}; use pallet_message_queue::OnQueueChanged; -use sp_std::marker::PhantomData; /// Narrow the scope of the `Inner` query from `AggregateMessageOrigin` to `ParaId`. /// diff --git a/cumulus/parachains/common/src/xcm_config.rs b/cumulus/parachains/common/src/xcm_config.rs index a9756af7aed2..7c58a2b2405c 100644 --- a/cumulus/parachains/common/src/xcm_config.rs +++ b/cumulus/parachains/common/src/xcm_config.rs @@ -14,13 +14,13 @@ // limitations under the License. use crate::impls::AccountIdOf; +use core::marker::PhantomData; use cumulus_primitives_core::{IsSystem, ParaId}; use frame_support::{ traits::{fungibles::Inspect, tokens::ConversionToAssetBalance, Contains, ContainsPair}, weights::Weight, }; use sp_runtime::traits::Get; -use sp_std::marker::PhantomData; use xcm::latest::prelude::*; /// A `ChargeFeeInFungibles` implementation that converts the output of diff --git a/cumulus/parachains/pallets/collective-content/Cargo.toml b/cumulus/parachains/pallets/collective-content/Cargo.toml index 61cbe7850090..c52021f67e36 100644 --- a/cumulus/parachains/pallets/collective-content/Cargo.toml +++ b/cumulus/parachains/pallets/collective-content/Cargo.toml @@ -19,7 +19,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-io = { workspace = true } @@ -48,5 +47,4 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] diff --git a/cumulus/parachains/pallets/collective-content/src/lib.rs b/cumulus/parachains/pallets/collective-content/src/lib.rs index b1c960ad6a0d..7ea3c2d79fa7 100644 --- a/cumulus/parachains/pallets/collective-content/src/lib.rs +++ b/cumulus/parachains/pallets/collective-content/src/lib.rs @@ -46,7 +46,6 @@ pub use weights::WeightInfo; use frame_support::{traits::schedule::DispatchTime, BoundedVec}; use sp_core::ConstU32; -use sp_std::prelude::*; /// IPFS compatible CID. // Worst case 2 bytes base and codec, 2 bytes hash type and size, 64 bytes hash digest. diff --git a/cumulus/parachains/pallets/parachain-info/Cargo.toml b/cumulus/parachains/pallets/parachain-info/Cargo.toml index 7369c3a2c157..e0bed23c4f8c 100644 --- a/cumulus/parachains/pallets/parachain-info/Cargo.toml +++ b/cumulus/parachains/pallets/parachain-info/Cargo.toml @@ -17,7 +17,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } cumulus-primitives-core = { workspace = true } @@ -30,7 +29,6 @@ std = [ "frame-system/std", "scale-info/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/cumulus/parachains/pallets/parachain-info/src/lib.rs b/cumulus/parachains/pallets/parachain-info/src/lib.rs index a4ef448a6b6b..0aaa7adaa51c 100644 --- a/cumulus/parachains/pallets/parachain-info/src/lib.rs +++ b/cumulus/parachains/pallets/parachain-info/src/lib.rs @@ -41,7 +41,7 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, pub parachain_id: ParaId, } diff --git a/cumulus/parachains/pallets/ping/Cargo.toml b/cumulus/parachains/pallets/ping/Cargo.toml index f74328207b84..51fc384a4f14 100644 --- a/cumulus/parachains/pallets/ping/Cargo.toml +++ b/cumulus/parachains/pallets/ping/Cargo.toml @@ -13,7 +13,6 @@ workspace = true codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } @@ -33,7 +32,6 @@ std = [ "frame-system/std", "scale-info/std", "sp-runtime/std", - "sp-std/std", "xcm/std", ] diff --git a/cumulus/parachains/pallets/ping/src/lib.rs b/cumulus/parachains/pallets/ping/src/lib.rs index a738c05e0366..729494cbd251 100644 --- a/cumulus/parachains/pallets/ping/src/lib.rs +++ b/cumulus/parachains/pallets/ping/src/lib.rs @@ -18,12 +18,14 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_xcm::{ensure_sibling_para, Origin as CumulusOrigin}; use cumulus_primitives_core::ParaId; use frame_support::{parameter_types, BoundedVec}; use frame_system::Config as SystemConfig; use sp_runtime::traits::Saturating; -use sp_std::prelude::*; use xcm::latest::prelude::*; pub use pallet::*; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml index 9ef0aa0072c9..98df41090a40 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/Cargo.toml @@ -53,7 +53,6 @@ sp-genesis-builder = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -241,7 +240,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index e8772c0b4830..f09647854cd0 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -27,6 +27,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use assets_common::{ foreign_creators::ForeignCreators, local_and_foreign_assets::{LocalFromLeft, TargetFromLeft}, @@ -45,7 +48,6 @@ use sp_runtime::{ }; use testnet_parachains_constants::rococo::snowbridge::EthereumNetwork; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -1161,7 +1163,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -1445,7 +1447,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -1515,7 +1517,7 @@ impl_runtime_apis! { } fn set_up_complex_asset_transfer( - ) -> Option<(XcmAssets, u32, Location, Box)> { + ) -> Option<(XcmAssets, u32, Location, alloc::boxed::Box)> { // Transfer to Relay some local AH asset (local-reserve-transfer) while paying // fees using teleported native token. // (We don't care that Relay doesn't accept incoming unknown AH local asset) @@ -1550,7 +1552,7 @@ impl_runtime_apis! { let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 }; // verify transferred successfully - let verify = Box::new(move || { + let verify = alloc::boxed::Box::new(move || { // verify native balance after transfer, decreased by transferred fee amount // (plus transport fees) assert!(Balances::free_balance(&who) <= balance - fee_amount); @@ -1584,7 +1586,7 @@ impl_runtime_apis! { let bridged_asset_hub = xcm_config::bridging::to_westend::AssetHubWestend::get(); let _ = PolkadotXcm::force_xcm_version( RuntimeOrigin::root(), - Box::new(bridged_asset_hub.clone()), + alloc::boxed::Box::new(bridged_asset_hub.clone()), XCM_VERSION, ).map_err(|e| { log::error!( diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs index c1e5c6a74293..fc63a0814d0a 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs @@ -47,7 +47,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_message_queue.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_message_queue.rs index 45531ccfa797..cd72703104ad 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_message_queue.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_message_queue.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/mod.rs index 8e675ad0cf8e..8c52ecd9f1b1 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/mod.rs @@ -18,10 +18,10 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 7fab35842509..03d3785dccbd 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 4454494badcb..bee6bcdf21cf 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index 03de2c971b7f..c736d3ee4420 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -511,8 +511,8 @@ impl pallet_assets::BenchmarkHelper for XcmBenchmarkHelper { /// All configuration related to bridging pub mod bridging { use super::*; + use alloc::collections::btree_set::BTreeSet; use assets_common::matching; - use sp_std::collections::btree_set::BTreeSet; // common/shared parameters parameter_types! { @@ -541,13 +541,13 @@ pub mod bridging { /// (`AssetId` has to be aligned with `BridgeTable`) pub XcmBridgeHubRouterFeeAssetId: AssetId = TokenLocation::get().into(); - pub BridgeTable: sp_std::vec::Vec = - sp_std::vec::Vec::new().into_iter() + pub BridgeTable: alloc::vec::Vec = + alloc::vec::Vec::new().into_iter() .chain(to_westend::BridgeTable::get()) .collect(); - pub EthereumBridgeTable: sp_std::vec::Vec = - sp_std::vec::Vec::new().into_iter() + pub EthereumBridgeTable: alloc::vec::Vec = + alloc::vec::Vec::new().into_iter() .chain(to_ethereum::BridgeTable::get()) .collect(); } @@ -578,10 +578,10 @@ pub mod bridging { /// Set up exporters configuration. /// `Option` represents static "base fee" which is used for total delivery fee calculation. - pub BridgeTable: sp_std::vec::Vec = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec = alloc::vec![ NetworkExportTableItem::new( WestendNetwork::get(), - Some(sp_std::vec![ + Some(alloc::vec![ AssetHubWestend::get().interior.split_global().expect("invalid configuration for AssetHubWestend").1, ]), SiblingBridgeHub::get(), @@ -595,7 +595,7 @@ pub mod bridging { /// Universal aliases pub UniversalAliases: BTreeSet<(Location, Junction)> = BTreeSet::from_iter( - sp_std::vec![ + alloc::vec![ (SiblingBridgeHubWithBridgeHubWestendInstance::get(), GlobalConsensus(WestendNetwork::get())) ] ); @@ -643,10 +643,10 @@ pub mod bridging { /// Set up exporters configuration. /// `Option` represents static "base fee" which is used for total delivery fee calculation. - pub BridgeTable: sp_std::vec::Vec = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec = alloc::vec![ NetworkExportTableItem::new( EthereumNetwork::get(), - Some(sp_std::vec![Junctions::Here]), + Some(alloc::vec![Junctions::Here]), SiblingBridgeHub::get(), Some(( XcmBridgeHubRouterFeeAssetId::get(), @@ -657,7 +657,7 @@ pub mod bridging { /// Universal aliases pub UniversalAliases: BTreeSet<(Location, Junction)> = BTreeSet::from_iter( - sp_std::vec![ + alloc::vec![ (SiblingBridgeHubWithEthereumInboundQueueInstance::get(), GlobalConsensus(EthereumNetwork::get())), ] ); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs index f670c5f424ef..ee1461b7f9c8 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs @@ -34,6 +34,7 @@ use asset_test_utils::{ ExtBuilder, SlotDurations, }; use codec::{Decode, Encode}; +use core::ops::Mul; use cumulus_primitives_utility::ChargeWeightInFungibles; use frame_support::{ assert_noop, assert_ok, @@ -48,7 +49,6 @@ use frame_support::{ use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance}; use sp_consensus_aura::SlotDuration; use sp_runtime::traits::MaybeEquivalence; -use sp_std::ops::Mul; use std::convert::Into; use testnet_parachains_constants::rococo::{consensus::*, currency::UNITS, fee::WeightToFee}; use xcm::latest::prelude::{Assets as XcmAssets, *}; @@ -1277,7 +1277,7 @@ mod asset_hub_rococo_tests { collator_session_keys(), bridging_to_asset_hub_westend, || { - sp_std::vec![ + vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, @@ -1287,16 +1287,16 @@ mod asset_hub_rococo_tests { bp_asset_hub_rococo::XcmBridgeHubRouterCall::report_bridge_status { bridge_id: Default::default(), is_congested: true, - } + }, ) .encode() .into(), - } + }, ] .into() }, || { - sp_std::vec![ + vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, @@ -1306,11 +1306,11 @@ mod asset_hub_rococo_tests { bp_asset_hub_rococo::XcmBridgeHubRouterCall::report_bridge_status { bridge_id: Default::default(), is_congested: false, - } + }, ) .encode() .into(), - } + }, ] .into() }, diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml index 7e618d950b19..6b1bf769ace3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml @@ -53,7 +53,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -240,7 +239,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 55c8a9f0b265..178b886fc3e8 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -27,6 +27,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use assets_common::{ local_and_foreign_assets::{LocalFromLeft, TargetFromLeft}, AssetIdForTrustBackedAssetsConvert, @@ -68,7 +71,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Perbill, Permill, RuntimeDebug, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -1206,7 +1208,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -1536,7 +1538,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -1601,7 +1603,7 @@ impl_runtime_apis! { } fn set_up_complex_asset_transfer( - ) -> Option<(XcmAssets, u32, Location, Box)> { + ) -> Option<(XcmAssets, u32, Location, alloc::boxed::Box)> { // Transfer to Relay some local AH asset (local-reserve-transfer) while paying // fees using teleported native token. // (We don't care that Relay doesn't accept incoming unknown AH local asset) @@ -1636,7 +1638,7 @@ impl_runtime_apis! { let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 }; // verify transferred successfully - let verify = Box::new(move || { + let verify = alloc::boxed::Box::new(move || { // verify native balance after transfer, decreased by transferred fee amount // (plus transport fees) assert!(Balances::free_balance(&who) <= balance - fee_amount); @@ -1675,7 +1677,7 @@ impl_runtime_apis! { let bridged_asset_hub = xcm_config::bridging::to_rococo::AssetHubRococo::get(); let _ = PolkadotXcm::force_xcm_version( RuntimeOrigin::root(), - Box::new(bridged_asset_hub.clone()), + alloc::boxed::Box::new(bridged_asset_hub.clone()), XCM_VERSION, ).map_err(|e| { log::error!( diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_parachain_system.rs index c1e5c6a74293..fc63a0814d0a 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_parachain_system.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/cumulus_pallet_parachain_system.rs @@ -47,7 +47,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_message_queue.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_message_queue.rs index 45531ccfa797..cd72703104ad 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_message_queue.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_message_queue.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs index 8c77774da2dd..d39052c5c03b 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs @@ -17,10 +17,10 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index eaf07aac52ce..fe8d18613925 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -42,7 +42,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index fc196abea0f5..127bc173c103 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -42,7 +42,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index fc2e68c599fd..2deeb73eb127 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -519,8 +519,8 @@ impl pallet_assets::BenchmarkHelper for XcmBenchmarkHelper { /// All configuration related to bridging pub mod bridging { use super::*; + use alloc::collections::btree_set::BTreeSet; use assets_common::matching; - use sp_std::collections::btree_set::BTreeSet; parameter_types! { /// Base price of every byte of the Westend -> Rococo message. Can be adjusted via @@ -548,8 +548,8 @@ pub mod bridging { /// (`AssetId` has to be aligned with `BridgeTable`) pub XcmBridgeHubRouterFeeAssetId: AssetId = WestendLocation::get().into(); - pub BridgeTable: sp_std::vec::Vec = - sp_std::vec::Vec::new().into_iter() + pub BridgeTable: alloc::vec::Vec = + alloc::vec::Vec::new().into_iter() .chain(to_rococo::BridgeTable::get()) .collect(); } @@ -580,10 +580,10 @@ pub mod bridging { /// Set up exporters configuration. /// `Option` represents static "base fee" which is used for total delivery fee calculation. - pub BridgeTable: sp_std::vec::Vec = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec = alloc::vec![ NetworkExportTableItem::new( RococoNetwork::get(), - Some(sp_std::vec![ + Some(alloc::vec![ AssetHubRococo::get().interior.split_global().expect("invalid configuration for AssetHubRococo").1, ]), SiblingBridgeHub::get(), @@ -597,7 +597,7 @@ pub mod bridging { /// Universal aliases pub UniversalAliases: BTreeSet<(Location, Junction)> = BTreeSet::from_iter( - sp_std::vec![ + alloc::vec![ (SiblingBridgeHubWithBridgeHubRococoInstance::get(), GlobalConsensus(RococoNetwork::get())) ] ); diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index b5957dd5df92..48e6c11d268c 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -1258,7 +1258,7 @@ fn report_bridge_status_from_xcm_bridge_router_for_rococo_works() { collator_session_keys(), bridging_to_asset_hub_rococo, || { - sp_std::vec![ + vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, @@ -1268,16 +1268,16 @@ fn report_bridge_status_from_xcm_bridge_router_for_rococo_works() { bp_asset_hub_westend::XcmBridgeHubRouterCall::report_bridge_status { bridge_id: Default::default(), is_congested: true, - } + }, ) .encode() .into(), - } + }, ] .into() }, || { - sp_std::vec![ + vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, @@ -1287,11 +1287,11 @@ fn report_bridge_status_from_xcm_bridge_router_for_rococo_works() { bp_asset_hub_westend::XcmBridgeHubRouterCall::report_bridge_status { bridge_id: Default::default(), is_congested: false, - } + }, ) .encode() .into(), - } + }, ] .into() }, diff --git a/cumulus/parachains/runtimes/assets/common/Cargo.toml b/cumulus/parachains/runtimes/assets/common/Cargo.toml index 94612506f510..c6740269339d 100644 --- a/cumulus/parachains/runtimes/assets/common/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/common/Cargo.toml @@ -18,7 +18,6 @@ impl-trait-for-tuples = { workspace = true } # Substrate frame-support = { workspace = true } sp-api = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } pallet-asset-conversion = { workspace = true } @@ -48,7 +47,6 @@ std = [ "scale-info/std", "sp-api/std", "sp-runtime/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", "xcm/std", diff --git a/cumulus/parachains/runtimes/assets/common/src/benchmarks.rs b/cumulus/parachains/runtimes/assets/common/src/benchmarks.rs index 44bda1eb3709..d59fddc4e8f0 100644 --- a/cumulus/parachains/runtimes/assets/common/src/benchmarks.rs +++ b/cumulus/parachains/runtimes/assets/common/src/benchmarks.rs @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use core::marker::PhantomData; use cumulus_primitives_core::ParaId; use sp_runtime::traits::Get; -use sp_std::marker::PhantomData; use xcm::latest::prelude::*; /// Creates asset pairs for liquidity pools with `Target` always being the first asset. diff --git a/cumulus/parachains/runtimes/assets/common/src/foreign_creators.rs b/cumulus/parachains/runtimes/assets/common/src/foreign_creators.rs index a9fd79bf939f..95edb31da06e 100644 --- a/cumulus/parachains/runtimes/assets/common/src/foreign_creators.rs +++ b/cumulus/parachains/runtimes/assets/common/src/foreign_creators.rs @@ -23,7 +23,7 @@ use xcm_executor::traits::ConvertLocation; /// `EnsureOriginWithArg` impl for `CreateOrigin` that allows only XCM origins that are locations /// containing the class location. pub struct ForeignCreators( - sp_std::marker::PhantomData<(IsForeign, AccountOf, AccountId, L)>, + core::marker::PhantomData<(IsForeign, AccountOf, AccountId, L)>, ); impl< IsForeign: ContainsPair, @@ -41,7 +41,7 @@ where fn try_origin( origin: RuntimeOrigin, asset_location: &L, - ) -> sp_std::result::Result { + ) -> core::result::Result { let origin_location = EnsureXcm::::try_origin(origin.clone())?; if !IsForeign::contains(asset_location, &origin_location) { return Err(origin) diff --git a/cumulus/parachains/runtimes/assets/common/src/fungible_conversion.rs b/cumulus/parachains/runtimes/assets/common/src/fungible_conversion.rs index e21203485a76..27ee2d6b5653 100644 --- a/cumulus/parachains/runtimes/assets/common/src/fungible_conversion.rs +++ b/cumulus/parachains/runtimes/assets/common/src/fungible_conversion.rs @@ -16,9 +16,10 @@ //! Runtime API definition for assets. use crate::runtime_api::FungiblesAccessError; +use alloc::vec::Vec; +use core::borrow::Borrow; use frame_support::traits::Contains; use sp_runtime::traits::MaybeEquivalence; -use sp_std::{borrow::Borrow, vec::Vec}; use xcm::latest::{Asset, Location}; use xcm_builder::{ConvertedConcreteId, MatchedConvertedConcreteId}; use xcm_executor::traits::MatchesFungibles; diff --git a/cumulus/parachains/runtimes/assets/common/src/lib.rs b/cumulus/parachains/runtimes/assets/common/src/lib.rs index 431b5766147a..4bb593f98929 100644 --- a/cumulus/parachains/runtimes/assets/common/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/common/src/lib.rs @@ -23,6 +23,8 @@ pub mod local_and_foreign_assets; pub mod matching; pub mod runtime_api; +extern crate alloc; + use crate::matching::{LocalLocationPattern, ParentLocation}; use frame_support::traits::{Equals, EverythingBut}; use parachains_common::{AssetIdForTrustBackedAssets, CollectionId, ItemId}; diff --git a/cumulus/parachains/runtimes/assets/common/src/local_and_foreign_assets.rs b/cumulus/parachains/runtimes/assets/common/src/local_and_foreign_assets.rs index 58f5d2d57a76..8a89089c7187 100644 --- a/cumulus/parachains/runtimes/assets/common/src/local_and_foreign_assets.rs +++ b/cumulus/parachains/runtimes/assets/common/src/local_and_foreign_assets.rs @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use core::marker::PhantomData; use frame_support::traits::Get; use sp_runtime::{ traits::{Convert, MaybeEquivalence}, Either, Either::{Left, Right}, }; -use sp_std::marker::PhantomData; use xcm::latest::Location; /// Converts a given [`Location`] to [`Either::Left`] when equal to `Target`, or diff --git a/cumulus/parachains/runtimes/assets/common/src/matching.rs b/cumulus/parachains/runtimes/assets/common/src/matching.rs index f356cb541315..9bb35d0c5328 100644 --- a/cumulus/parachains/runtimes/assets/common/src/matching.rs +++ b/cumulus/parachains/runtimes/assets/common/src/matching.rs @@ -28,7 +28,7 @@ frame_support::parameter_types! { } /// Accepts an asset if it is from the origin. -pub struct IsForeignConcreteAsset(sp_std::marker::PhantomData); +pub struct IsForeignConcreteAsset(core::marker::PhantomData); impl> ContainsPair for IsForeignConcreteAsset { @@ -41,7 +41,7 @@ impl> ContainsPair /// Checks if `a` is from sibling location `b`. Checks that `Location-a` starts with /// `Location-b`, and that the `ParaId` of `b` is not equal to `a`. pub struct FromSiblingParachain( - sp_std::marker::PhantomData<(SelfParaId, L)>, + core::marker::PhantomData<(SelfParaId, L)>, ); impl, L: TryFrom + TryInto + Clone> ContainsPair for FromSiblingParachain @@ -65,7 +65,7 @@ impl, L: TryFrom + TryInto + Clone> /// Checks if `a` is from the expected global consensus network. Checks that `Location-a` /// starts with `Location-b`, and that network is a foreign consensus system. pub struct FromNetwork( - sp_std::marker::PhantomData<(UniversalLocation, ExpectedNetworkId, L)>, + core::marker::PhantomData<(UniversalLocation, ExpectedNetworkId, L)>, ); impl< UniversalLocation: Get, @@ -100,7 +100,7 @@ impl< /// Accept an asset if it is native to `AssetsAllowedNetworks` and it is coming from /// `OriginLocation`. pub struct RemoteAssetFromLocation( - sp_std::marker::PhantomData<(AssetsAllowedNetworks, OriginLocation)>, + core::marker::PhantomData<(AssetsAllowedNetworks, OriginLocation)>, ); impl, OriginLocation: Get> ContainsPair for RemoteAssetFromLocation diff --git a/cumulus/parachains/runtimes/assets/common/src/runtime_api.rs b/cumulus/parachains/runtimes/assets/common/src/runtime_api.rs index 19977cbedab0..799b2f45b4df 100644 --- a/cumulus/parachains/runtimes/assets/common/src/runtime_api.rs +++ b/cumulus/parachains/runtimes/assets/common/src/runtime_api.rs @@ -18,7 +18,7 @@ use codec::{Codec, Decode, Encode}; use sp_runtime::RuntimeDebug; #[cfg(feature = "std")] -use {sp_std::vec::Vec, xcm::latest::Asset}; +use {alloc::vec::Vec, xcm::latest::Asset}; /// The possible errors that can happen querying the storage of assets. #[derive(Eq, PartialEq, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] diff --git a/cumulus/parachains/runtimes/assets/test-utils/Cargo.toml b/cumulus/parachains/runtimes/assets/test-utils/Cargo.toml index a7aad361e84e..529d6460fc4e 100644 --- a/cumulus/parachains/runtimes/assets/test-utils/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/test-utils/Cargo.toml @@ -21,7 +21,6 @@ pallet-timestamp = { workspace = true } pallet-session = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # Cumulus cumulus-pallet-parachain-system = { workspace = true } @@ -68,7 +67,6 @@ std = [ "parachains-runtimes-test-utils/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", "xcm/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs index 39ea63692552..d97e6a1d88e1 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_bulletin_config.rs @@ -87,7 +87,7 @@ parameter_types! { XCM_LANE_FOR_ROCOCO_PEOPLE_TO_ROCOCO_BULLETIN, ); /// All active routes and their destinations. - pub ActiveLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = sp_std::vec![ + pub ActiveLanes: alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = alloc::vec![ ( FromRococoPeopleToRococoBulletinRoute::get(), (RococoBulletinGlobalConsensusNetwork::get(), Here) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs index 07bb718bd13d..fe854e20c244 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_westend_config.rs @@ -71,7 +71,7 @@ parameter_types! { ParentThen([Parachain(AssetHubRococoParaId::get().into())].into()).into(), XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND, ); - pub ActiveLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = sp_std::vec![ + pub ActiveLanes: alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = alloc::vec![ ( FromAssetHubRococoToAssetHubWestendRoute::get(), (WestendGlobalConsensusNetwork::get(), [Parachain(AssetHubWestendParaId::get().into())].into()) @@ -91,8 +91,8 @@ parameter_types! { } pub const XCM_LANE_FOR_ASSET_HUB_ROCOCO_TO_ASSET_HUB_WESTEND: LaneId = LaneId([0, 0, 0, 2]); -fn build_congestion_message(is_congested: bool) -> sp_std::vec::Vec> { - sp_std::vec![ +fn build_congestion_message(is_congested: bool) -> alloc::vec::Vec> { + alloc::vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 8ca5898d1a10..512c1199f439 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -35,6 +35,9 @@ pub mod bridge_to_westend_config; mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use bridge_runtime_common::extensions::{ check_obsolete_extension::{ CheckAndBoostBridgeGrandpaTransactions, CheckAndBoostBridgeParachainsTransactions, @@ -58,7 +61,6 @@ use sp_runtime::{ ApplyExtrinsicResult, FixedU128, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -110,6 +112,8 @@ use parachains_common::{ AVERAGE_ON_INITIALIZE_RATIO, NORMAL_DISPATCH_RATIO, }; +#[cfg(feature = "runtime-benchmarks")] +use alloc::boxed::Box; #[cfg(feature = "runtime-benchmarks")] use benchmark_helpers::DoNothingRouter; @@ -862,7 +866,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -1197,7 +1201,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs index dc480c391636..8fcd7b10d931 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/cumulus_pallet_parachain_system.rs @@ -47,7 +47,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_message_queue.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_message_queue.rs index 2fcd573ceb27..b6fee47d1435 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_message_queue.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_message_queue.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs index 4f5bae0fe597..b40cbfeeb8f2 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs @@ -17,11 +17,11 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use codec::Encode; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index d7e8c41ff8ac..057dc4313510 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index bafc973bdac4..9c58072d402c 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index a0d2e91dffd2..5ec545ee0590 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -22,6 +22,7 @@ use super::{ use bp_messages::LaneId; use bp_relayers::{PayRewardFromAccount, RewardsAccountOwner, RewardsAccountParams}; use bp_runtime::ChainId; +use core::marker::PhantomData; use frame_support::{ parameter_types, traits::{tokens::imbalance::ResolveTo, ConstU32, Contains, Equals, Everything, Nothing}, @@ -41,7 +42,6 @@ use polkadot_runtime_common::xcm_sender::ExponentialPrice; use snowbridge_runtime_common::XcmExportFeeToSibling; use sp_core::Get; use sp_runtime::traits::AccountIdConversion; -use sp_std::marker::PhantomData; use testnet_parachains_constants::rococo::snowbridge::EthereumNetwork; use xcm::latest::prelude::*; use xcm_builder::{ diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs index 09d55f4323ab..42d5ef3eebdb 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_rococo_config.rs @@ -78,7 +78,7 @@ parameter_types! { ParentThen([Parachain(AssetHubWestendParaId::get().into())].into()).into(), XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO, ); - pub ActiveLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = sp_std::vec![ + pub ActiveLanes: alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = alloc::vec![ ( FromAssetHubWestendToAssetHubRococoRoute::get(), (RococoGlobalConsensusNetwork::get(), [Parachain(AssetHubRococoParaId::get().into())].into()) @@ -98,8 +98,8 @@ parameter_types! { } pub const XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 2]); -fn build_congestion_message(is_congested: bool) -> sp_std::vec::Vec> { - sp_std::vec![ +fn build_congestion_message(is_congested: bool) -> alloc::vec::Vec> { + alloc::vec![ UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 993f60432458..5d4c35d6610a 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -32,6 +32,9 @@ pub mod bridge_to_rococo_config; mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use bridge_runtime_common::extensions::{ check_obsolete_extension::{ CheckAndBoostBridgeGrandpaTransactions, CheckAndBoostBridgeParachainsTransactions, @@ -49,7 +52,6 @@ use sp_runtime::{ ApplyExtrinsicResult, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -612,7 +614,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -886,7 +888,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -928,7 +930,7 @@ impl_runtime_apis! { } fn set_up_complex_asset_transfer( - ) -> Option<(Assets, u32, Location, Box)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box)> { // BH only supports teleports to system parachain. // Relay/native token can be teleported between BH and Relay. let native_location = Parent.into(); @@ -1051,7 +1053,7 @@ impl_runtime_apis! { // save XCM version for remote bridge hub let _ = PolkadotXcm::force_xcm_version( RuntimeOrigin::root(), - Box::new(bridge_to_rococo_config::BridgeHubRococoLocation::get()), + alloc::boxed::Box::new(bridge_to_rococo_config::BridgeHubRococoLocation::get()), XCM_VERSION, ).map_err(|e| { log::error!( diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_parachain_system.rs index dc480c391636..8fcd7b10d931 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_parachain_system.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/cumulus_pallet_parachain_system.rs @@ -47,7 +47,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_message_queue.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_message_queue.rs index 2fcd573ceb27..b6fee47d1435 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_message_queue.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/pallet_message_queue.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/mod.rs index e8950678b40f..3961cc6d5cdd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/mod.rs @@ -18,11 +18,11 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use codec::Encode; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 295abd481d7d..4310b2456475 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 73bea66bf710..ba434ff29629 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/bridge-hubs/common/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/common/Cargo.toml index fd0eed1c05a1..3ae43075000b 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/common/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/common/Cargo.toml @@ -10,7 +10,6 @@ license = "Apache-2.0" codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } frame-support = { workspace = true } -sp-std = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } cumulus-primitives-core = { workspace = true } @@ -29,7 +28,6 @@ std = [ "snowbridge-core/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", "xcm/std", ] diff --git a/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs b/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs index c1bba65b0abc..5f91897262f4 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/common/src/message_queue.rs @@ -14,6 +14,7 @@ // limitations under the License. //! Runtime configuration for MessageQueue pallet use codec::{Decode, Encode, MaxEncodedLen}; +use core::marker::PhantomData; use cumulus_primitives_core::{AggregateMessageOrigin as CumulusAggregateMessageOrigin, ParaId}; use frame_support::{ traits::{ProcessMessage, ProcessMessageError, QueueFootprint, QueuePausedQuery}, @@ -22,7 +23,6 @@ use frame_support::{ use pallet_message_queue::OnQueueChanged; use scale_info::TypeInfo; use snowbridge_core::ChannelId; -use sp_std::{marker::PhantomData, prelude::*}; use xcm::v4::{Junction, Location}; /// The aggregate origin of an inbound message. diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml index fb96d29a497a..44a8646142d6 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml @@ -21,7 +21,6 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-keyring = { workspace = true, default-features = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-tracing = { workspace = true, default-features = true } pallet-balances = { workspace = true } pallet-utility = { workspace = true } @@ -81,7 +80,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", "xcm/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs index 1874f38de2df..0b3463f0df97 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs @@ -19,6 +19,8 @@ pub mod test_cases; pub mod test_data; +extern crate alloc; + pub use bp_test_utils::test_header; pub use parachains_runtimes_test_utils::*; use sp_runtime::Perbill; diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs index 8f3c7de61f84..d6dfa93731a7 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_grandpa_chain.rs @@ -22,6 +22,7 @@ use crate::{ test_data, }; +use alloc::{boxed::Box, vec}; use bp_header_chain::ChainWithGrandpa; use bp_messages::{LaneId, UnrewardedRelayersState}; use bp_relayers::{RewardsAccountOwner, RewardsAccountParams}; @@ -61,7 +62,7 @@ pub trait WithRemoteGrandpaChainHelper { /// Adapter struct that implements [`WithRemoteGrandpaChainHelper`]. pub struct WithRemoteGrandpaChainHelperAdapter( - sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, MPI)>, + core::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, MPI)>, ); impl WithRemoteGrandpaChainHelper diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs index 6580648e6606..728b4e76b105 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/from_parachain.rs @@ -22,6 +22,7 @@ use crate::{ test_data, }; +use alloc::{boxed::Box, vec}; use bp_header_chain::ChainWithGrandpa; use bp_messages::{LaneId, UnrewardedRelayersState}; use bp_polkadot_core::parachains::ParaHash; @@ -66,7 +67,7 @@ pub trait WithRemoteParachainHelper { /// Adapter struct that implements `WithRemoteParachainHelper`. pub struct WithRemoteParachainHelperAdapter( - sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI)>, + core::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI)>, ); impl WithRemoteParachainHelper diff --git a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs index c990c6e5307c..78b8a170f0d4 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/test-utils/src/test_cases/helpers.rs @@ -23,6 +23,7 @@ use bp_messages::{LaneId, MessageNonce}; use bp_polkadot_core::parachains::{ParaHash, ParaId}; use bp_relayers::RewardsAccountParams; use codec::Decode; +use core::marker::PhantomData; use frame_support::{ assert_ok, traits::{OnFinalize, OnInitialize, PalletInfoAccess}, @@ -37,7 +38,6 @@ use parachains_runtimes_test_utils::{ use sp_core::Get; use sp_keyring::AccountKeyring::*; use sp_runtime::{traits::TrailingZeroInput, AccountId32}; -use sp_std::marker::PhantomData; use xcm::latest::prelude::*; /// Verify that the transaction has succeeded. @@ -290,7 +290,7 @@ pub fn relayed_incoming_message_works( // value here is tricky - there are several transaction payment pallets and we don't // want to introduce additional bounds and traits here just for that, so let's just // select some presumably large value - sp_std::cmp::max::(Runtime::ExistentialDeposit::get(), 1u32.into()) * + core::cmp::max::(Runtime::ExistentialDeposit::get(), 1u32.into()) * 100_000_000u32.into(), )], || { diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml index 87cf42ba87d8..43fc9083937c 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/Cargo.toml @@ -54,7 +54,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -229,7 +228,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/impls.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/impls.rs index e5b176fc7787..ed5d4870e4a6 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/impls.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/impls.rs @@ -14,6 +14,8 @@ // limitations under the License. use crate::OriginCaller; +use alloc::boxed::Box; +use core::{cmp::Ordering, marker::PhantomData}; use frame_support::{ dispatch::DispatchResultWithPostInfo, traits::{Currency, PrivilegeCmp}, @@ -21,7 +23,6 @@ use frame_support::{ }; use pallet_alliance::{ProposalIndex, ProposalProvider}; use sp_runtime::DispatchError; -use sp_std::{cmp::Ordering, marker::PhantomData, prelude::*}; type AccountIdOf = ::AccountId; diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index f37af88c2843..d843d6f6f776 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs @@ -42,8 +42,12 @@ mod weights; pub mod xcm_config; // Fellowship configurations. pub mod fellowship; + +extern crate alloc; + pub use ambassador::pallet_ambassador_origins; +use alloc::{vec, vec::Vec}; use ambassador::AmbassadorCoreInstance; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use fellowship::{pallet_fellowship_origins, Fellows, FellowshipCoreInstance}; @@ -57,7 +61,6 @@ use sp_runtime::{ ApplyExtrinsicResult, Perbill, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -837,7 +840,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -1047,7 +1050,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -1096,7 +1099,7 @@ impl_runtime_apis! { } fn set_up_complex_asset_transfer( - ) -> Option<(Assets, u32, Location, Box)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box)> { // Collectives only supports teleports to system parachain. // Relay/native token can be teleported between Collectives and Relay. let native_location = Parent.into(); diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_parachain_system.rs index 0b7a2fc21cde..92c8c88b5154 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_parachain_system.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/cumulus_pallet_parachain_system.rs @@ -47,7 +47,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_message_queue.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_message_queue.rs index 4bd71c4e7d49..0bb6d3d0f1c4 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_message_queue.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/pallet_message_queue.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index 4fb4bcde0235..1fcebb3f16a9 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -31,7 +31,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -133,7 +132,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index d2fe0689f515..47ce6f3628ec 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -29,6 +29,9 @@ mod contracts; mod weights; mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::AggregateMessageOrigin; use sp_api::impl_runtime_apis; @@ -40,7 +43,6 @@ use sp_runtime::{ ApplyExtrinsicResult, Perbill, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -487,7 +489,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -765,7 +767,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -815,7 +817,7 @@ impl_runtime_apis! { } fn set_up_complex_asset_transfer( - ) -> Option<(Assets, u32, Location, Box)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box)> { // Contracts-System-Para only supports teleports to system parachain. // Relay/native token can be teleported between Contracts-System-Para and Relay. let native_location = Parent.into(); diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml index 57a0782b1ef6..2920bc428d90 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml @@ -49,7 +49,6 @@ sp-genesis-builder = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -133,7 +132,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs index 6e36539c7bf7..9fd0093840d3 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/lib.rs @@ -33,6 +33,9 @@ mod coretime; mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ @@ -66,7 +69,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, DispatchError, MultiAddress, Perbill, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -552,7 +554,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -774,7 +776,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/mod.rs index 9f79cea831ae..b8db473f1066 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/mod.rs @@ -18,10 +18,10 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 7ff1cce2e072..73a719805307 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 16412eb49a52..676048f92ad9 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml index d3bf6b43a7ed..07a4332800d7 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml @@ -48,7 +48,6 @@ sp-genesis-builder = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -131,7 +130,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs index 74fdd971f5ce..7907f252cf8e 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/lib.rs @@ -33,6 +33,9 @@ mod coretime; mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ @@ -66,7 +69,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, DispatchError, MultiAddress, Perbill, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -543,7 +545,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -765,7 +767,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/mod.rs index 99af88812da2..f35f7bfc188d 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/mod.rs @@ -17,10 +17,10 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 8e1461c4a99e..ddfc599fa579 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 9657fa55c1f2..7390f35e3974 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -43,7 +43,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml index c201c8375be0..d20b62a557b9 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml @@ -35,7 +35,6 @@ pallet-message-queue = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -109,7 +108,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs index a204bb7276cf..1b505ad3acbf 100644 --- a/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/glutton/glutton-westend/src/lib.rs @@ -47,6 +47,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use sp_api::impl_runtime_apis; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -57,7 +60,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -345,7 +347,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -455,7 +457,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml index 890de672e0b5..a732bec2352d 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-rococo/Cargo.toml @@ -45,7 +45,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -128,7 +127,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs index ff31aba8a277..4f007c3fc39d 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/lib.rs @@ -22,6 +22,9 @@ pub mod people; mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ @@ -59,7 +62,6 @@ use sp_runtime::{ ApplyExtrinsicResult, }; pub use sp_runtime::{MultiAddress, Perbill, Permill}; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -521,7 +523,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -737,7 +739,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/people.rs b/cumulus/parachains/runtimes/people/people-rococo/src/people.rs index 88a89711019d..8211447d68c8 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/people.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/people.rs @@ -28,7 +28,6 @@ use sp_runtime::{ traits::{AccountIdConversion, Verify}, RuntimeDebug, }; -use sp_std::prelude::*; parameter_types! { // 27 | Min encoded size of `Registration` @@ -94,8 +93,8 @@ pub enum IdentityField { )] #[codec(mel_bound())] pub struct IdentityInfo { - /// A reasonable display name for the controller of the account. This should be whatever the - /// account is typically known as and should not be confusable with other entities, given + /// A reasonable display name for the controller of the account. This should be whatever the + /// account is typically known as and should not be confusable with other entities, given /// reasonable context. /// /// Stored as UTF-8. @@ -151,7 +150,7 @@ impl IdentityInformationProvider for IdentityInfo { #[cfg(feature = "runtime-benchmarks")] fn create_identity_info() -> Self { - let data = Data::Raw(vec![0; 32].try_into().unwrap()); + let data = Data::Raw(alloc::vec![0; 32].try_into().unwrap()); IdentityInfo { display: data.clone(), diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_parachain_system.rs index fcea5fd1bf67..5715d56c2186 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_parachain_system.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/cumulus_pallet_parachain_system.rs @@ -20,7 +20,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_message_queue.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_message_queue.rs index fe1911b77a72..47c679014073 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_message_queue.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_message_queue.rs @@ -20,7 +20,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/mod.rs index 4afd65bdcfea..11c1bad9aa17 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/mod.rs @@ -17,10 +17,10 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index b279399e7a96..2364798596d5 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -42,7 +42,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index e2be324ee2d4..a50c8860c48f 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -42,7 +42,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml index 83068e489d2e..20c7e691ebc8 100644 --- a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml @@ -45,7 +45,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -127,7 +126,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs index 6adaa4b4e502..1378324ce7b0 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/lib.rs @@ -22,6 +22,9 @@ pub mod people; mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ @@ -59,7 +62,6 @@ use sp_runtime::{ ApplyExtrinsicResult, }; pub use sp_runtime::{MultiAddress, Perbill, Permill}; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -521,7 +523,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -737,7 +739,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/cumulus/parachains/runtimes/people/people-westend/src/people.rs b/cumulus/parachains/runtimes/people/people-westend/src/people.rs index a5c0e66a3f88..0255fd074b11 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/people.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/people.rs @@ -28,7 +28,6 @@ use sp_runtime::{ traits::{AccountIdConversion, Verify}, RuntimeDebug, }; -use sp_std::prelude::*; parameter_types! { // 27 | Min encoded size of `Registration` @@ -151,7 +150,7 @@ impl IdentityInformationProvider for IdentityInfo { #[cfg(feature = "runtime-benchmarks")] fn create_identity_info() -> Self { - let data = Data::Raw(vec![0; 32].try_into().unwrap()); + let data = Data::Raw(alloc::vec![0; 32].try_into().unwrap()); IdentityInfo { display: data.clone(), diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_parachain_system.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_parachain_system.rs index fcea5fd1bf67..5715d56c2186 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_parachain_system.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/cumulus_pallet_parachain_system.rs @@ -20,7 +20,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_message_queue.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_message_queue.rs index fe1911b77a72..47c679014073 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_message_queue.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_message_queue.rs @@ -20,7 +20,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/mod.rs index b2579230c9ed..b1fc7ad8ed83 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/mod.rs @@ -17,10 +17,10 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use alloc::vec::Vec; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighAssets { diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index efffd3188171..92d08a246180 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -42,7 +42,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::fungible`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index d7b10f95c792..861f03819959 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -42,7 +42,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_benchmarks::generic`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/parachains/runtimes/starters/seedling/Cargo.toml b/cumulus/parachains/runtimes/starters/seedling/Cargo.toml index 8a7c5922362e..c76c09a31234 100644 --- a/cumulus/parachains/runtimes/starters/seedling/Cargo.toml +++ b/cumulus/parachains/runtimes/starters/seedling/Cargo.toml @@ -30,7 +30,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -74,7 +73,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", diff --git a/cumulus/parachains/runtimes/starters/seedling/src/lib.rs b/cumulus/parachains/runtimes/starters/seedling/src/lib.rs index 461133f6cfc0..1fe72604d373 100644 --- a/cumulus/parachains/runtimes/starters/seedling/src/lib.rs +++ b/cumulus/parachains/runtimes/starters/seedling/src/lib.rs @@ -27,6 +27,9 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use sp_api::impl_runtime_apis; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -37,7 +40,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -310,7 +312,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } diff --git a/cumulus/parachains/runtimes/starters/shell/Cargo.toml b/cumulus/parachains/runtimes/starters/shell/Cargo.toml index 4a1271ca6584..8f3b2204cfe3 100644 --- a/cumulus/parachains/runtimes/starters/shell/Cargo.toml +++ b/cumulus/parachains/runtimes/starters/shell/Cargo.toml @@ -29,7 +29,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } pallet-message-queue = { workspace = true } @@ -77,7 +76,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", diff --git a/cumulus/parachains/runtimes/starters/shell/src/lib.rs b/cumulus/parachains/runtimes/starters/shell/src/lib.rs index 7422b580cc3e..1dfbe2b6c41c 100644 --- a/cumulus/parachains/runtimes/starters/shell/src/lib.rs +++ b/cumulus/parachains/runtimes/starters/shell/src/lib.rs @@ -31,6 +31,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::AggregateMessageOrigin; @@ -45,7 +48,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -280,7 +282,7 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned { type Pre = (); fn additional_signed( &self, - ) -> sp_std::result::Result<(), sp_runtime::transaction_validity::TransactionValidityError> { + ) -> core::result::Result<(), sp_runtime::transaction_validity::TransactionValidityError> { Ok(()) } fn pre_dispatch( @@ -368,7 +370,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } diff --git a/cumulus/parachains/runtimes/test-utils/Cargo.toml b/cumulus/parachains/runtimes/test-utils/Cargo.toml index 5e895271ab17..01d7fcc2b5c8 100644 --- a/cumulus/parachains/runtimes/test-utils/Cargo.toml +++ b/cumulus/parachains/runtimes/test-utils/Cargo.toml @@ -21,7 +21,6 @@ pallet-timestamp = { workspace = true } sp-consensus-aura = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-tracing = { workspace = true, default-features = true } sp-core = { workspace = true } @@ -68,7 +67,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-executor/std", "xcm/std", ] diff --git a/cumulus/parachains/runtimes/test-utils/src/lib.rs b/cumulus/parachains/runtimes/test-utils/src/lib.rs index 3c84243306fb..3fc3822a63eb 100644 --- a/cumulus/parachains/runtimes/test-utils/src/lib.rs +++ b/cumulus/parachains/runtimes/test-utils/src/lib.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use sp_std::marker::PhantomData; +use core::marker::PhantomData; use codec::{Decode, DecodeLimit}; use cumulus_primitives_core::{ diff --git a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml index bdd0dfac6065..1a2737f3aa22 100644 --- a/cumulus/parachains/runtimes/testing/penpal/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/penpal/Cargo.toml @@ -51,7 +51,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -128,7 +127,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool/std", "sp-version/std", diff --git a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs index 8d03f8332764..bf39c02a3f59 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/lib.rs @@ -32,6 +32,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod weights; pub mod xcm_config; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::Encode; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; @@ -69,7 +72,6 @@ use sp_runtime::{ ApplyExtrinsicResult, }; pub use sp_runtime::{traits::ConvertInto, MultiAddress, Perbill, Permill}; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -737,7 +739,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml index 7cbb614babe7..a0ad248bb704 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -35,7 +35,6 @@ sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -106,7 +105,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 40f2b78ffd6d..dff7046f1972 100644 --- a/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -22,6 +22,9 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +extern crate alloc; + +use alloc::{vec, vec::Vec}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; use sp_api::impl_runtime_apis; @@ -32,7 +35,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -711,7 +713,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } diff --git a/cumulus/polkadot-parachain/src/fake_runtime_api/asset_hub_polkadot_aura.rs b/cumulus/polkadot-parachain/src/fake_runtime_api/asset_hub_polkadot_aura.rs index 0b79d338c168..7d54e9b4be04 100644 --- a/cumulus/polkadot-parachain/src/fake_runtime_api/asset_hub_polkadot_aura.rs +++ b/cumulus/polkadot-parachain/src/fake_runtime_api/asset_hub_polkadot_aura.rs @@ -53,7 +53,7 @@ sp_api::impl_runtime_apis! { unimplemented!() } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> Vec { unimplemented!() } } diff --git a/cumulus/polkadot-parachain/src/fake_runtime_api/aura.rs b/cumulus/polkadot-parachain/src/fake_runtime_api/aura.rs index 823eb9ab584a..ca5fc8bdf119 100644 --- a/cumulus/polkadot-parachain/src/fake_runtime_api/aura.rs +++ b/cumulus/polkadot-parachain/src/fake_runtime_api/aura.rs @@ -53,7 +53,7 @@ sp_api::impl_runtime_apis! { unimplemented!() } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> Vec { unimplemented!() } } diff --git a/cumulus/primitives/aura/Cargo.toml b/cumulus/primitives/aura/Cargo.toml index f17c2035edd6..062b9ce736e7 100644 --- a/cumulus/primitives/aura/Cargo.toml +++ b/cumulus/primitives/aura/Cargo.toml @@ -16,7 +16,6 @@ codec = { features = ["derive"], workspace = true } sp-api = { workspace = true } sp-consensus-aura = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # Polkadot polkadot-core-primitives = { workspace = true } @@ -31,5 +30,4 @@ std = [ "sp-api/std", "sp-consensus-aura/std", "sp-runtime/std", - "sp-std/std", ] diff --git a/cumulus/primitives/core/Cargo.toml b/cumulus/primitives/core/Cargo.toml index f41213e9485e..533d368d3b00 100644 --- a/cumulus/primitives/core/Cargo.toml +++ b/cumulus/primitives/core/Cargo.toml @@ -16,7 +16,6 @@ scale-info = { features = ["derive"], workspace = true } # Substrate sp-api = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-trie = { workspace = true } # Polkadot @@ -35,7 +34,6 @@ std = [ "scale-info/std", "sp-api/std", "sp-runtime/std", - "sp-std/std", "sp-trie/std", "xcm/std", ] diff --git a/cumulus/primitives/core/src/lib.rs b/cumulus/primitives/core/src/lib.rs index 29216d513465..6eafecfc3ff5 100644 --- a/cumulus/primitives/core/src/lib.rs +++ b/cumulus/primitives/core/src/lib.rs @@ -18,11 +18,13 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use polkadot_parachain_primitives::primitives::HeadData; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; -use sp_std::prelude::*; pub use polkadot_core_primitives::InboundDownwardMessage; pub use polkadot_parachain_primitives::primitives::{ @@ -202,7 +204,7 @@ pub struct ParachainBlockData { /// The header of the parachain block. header: B::Header, /// The extrinsics of the parachain block. - extrinsics: sp_std::vec::Vec, + extrinsics: alloc::vec::Vec, /// The data that is required to emulate the storage accesses executed by all extrinsics. storage_proof: sp_trie::CompactProof, } @@ -211,7 +213,7 @@ impl ParachainBlockData { /// Creates a new instance of `Self`. pub fn new( header: ::Header, - extrinsics: sp_std::vec::Vec<::Extrinsic>, + extrinsics: alloc::vec::Vec<::Extrinsic>, storage_proof: sp_trie::CompactProof, ) -> Self { Self { header, extrinsics, storage_proof } @@ -243,7 +245,7 @@ impl ParachainBlockData { } /// Deconstruct into the inner parts. - pub fn deconstruct(self) -> (B::Header, sp_std::vec::Vec, sp_trie::CompactProof) { + pub fn deconstruct(self) -> (B::Header, alloc::vec::Vec, sp_trie::CompactProof) { (self.header, self.extrinsics, self.storage_proof) } } diff --git a/cumulus/primitives/parachain-inherent/Cargo.toml b/cumulus/primitives/parachain-inherent/Cargo.toml index c07fe0754561..172af4b9ec63 100644 --- a/cumulus/primitives/parachain-inherent/Cargo.toml +++ b/cumulus/primitives/parachain-inherent/Cargo.toml @@ -19,7 +19,6 @@ sp-core = { workspace = true } sp-inherents = { workspace = true } sp-runtime = { optional = true, workspace = true } sp-state-machine = { optional = true, workspace = true } -sp-std = { workspace = true } sp-trie = { workspace = true } # Cumulus @@ -36,6 +35,5 @@ std = [ "sp-inherents/std", "sp-runtime?/std", "sp-state-machine?/std", - "sp-std/std", "sp-trie/std", ] diff --git a/cumulus/primitives/parachain-inherent/src/lib.rs b/cumulus/primitives/parachain-inherent/src/lib.rs index 75a56693958e..ad4b39b547c5 100644 --- a/cumulus/primitives/parachain-inherent/src/lib.rs +++ b/cumulus/primitives/parachain-inherent/src/lib.rs @@ -27,14 +27,16 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use cumulus_primitives_core::{ relay_chain::{BlakeTwo256, Hash as RelayHash, HashT as _}, InboundDownwardMessage, InboundHrmpMessage, ParaId, PersistedValidationData, }; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use scale_info::TypeInfo; use sp_inherents::InherentIdentifier; -use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; /// The identifier for the parachain inherent. pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"sysi1337"; diff --git a/cumulus/primitives/storage-weight-reclaim/Cargo.toml b/cumulus/primitives/storage-weight-reclaim/Cargo.toml index af32fb68d8bb..3a98fdd017ae 100644 --- a/cumulus/primitives/storage-weight-reclaim/Cargo.toml +++ b/cumulus/primitives/storage-weight-reclaim/Cargo.toml @@ -18,7 +18,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-proof-size-hostfunction = { workspace = true } @@ -41,6 +40,5 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-trie/std", ] diff --git a/cumulus/primitives/storage-weight-reclaim/src/lib.rs b/cumulus/primitives/storage-weight-reclaim/src/lib.rs index 35fa334f51c6..f48dd927ee96 100644 --- a/cumulus/primitives/storage-weight-reclaim/src/lib.rs +++ b/cumulus/primitives/storage-weight-reclaim/src/lib.rs @@ -18,6 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; +use core::marker::PhantomData; use cumulus_primitives_core::Weight; use cumulus_primitives_proof_size_hostfunction::{ storage_proof_size::storage_proof_size, PROOF_RECORDING_DISABLED, @@ -33,7 +34,6 @@ use sp_runtime::{ transaction_validity::TransactionValidityError, DispatchResult, }; -use sp_std::marker::PhantomData; const LOG_TARGET: &'static str = "runtime::storage_reclaim"; @@ -199,6 +199,7 @@ where #[cfg(test)] mod tests { use super::*; + use core::marker::PhantomData; use frame_support::{ assert_ok, dispatch::{DispatchClass, PerDispatchClass}, @@ -206,7 +207,6 @@ mod tests { }; use frame_system::{BlockWeight, CheckWeight}; use sp_runtime::{AccountId32, BuildStorage}; - use sp_std::marker::PhantomData; use sp_trie::proof_size_extension::ProofSizeExt; type Test = cumulus_test_runtime::Runtime; diff --git a/cumulus/primitives/timestamp/Cargo.toml b/cumulus/primitives/timestamp/Cargo.toml index f7bf53a9d7d7..a50011bc3f0e 100644 --- a/cumulus/primitives/timestamp/Cargo.toml +++ b/cumulus/primitives/timestamp/Cargo.toml @@ -15,7 +15,6 @@ futures = { workspace = true } # Substrate sp-inherents = { workspace = true } -sp-std = { workspace = true } sp-timestamp = { workspace = true } # Cumulus @@ -27,6 +26,5 @@ std = [ "codec/std", "cumulus-primitives-core/std", "sp-inherents/std", - "sp-std/std", "sp-timestamp/std", ] diff --git a/cumulus/primitives/timestamp/src/lib.rs b/cumulus/primitives/timestamp/src/lib.rs index e6aba6d0bb74..5365f83efdf1 100644 --- a/cumulus/primitives/timestamp/src/lib.rs +++ b/cumulus/primitives/timestamp/src/lib.rs @@ -27,9 +27,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +use core::time::Duration; use cumulus_primitives_core::relay_chain::Slot; use sp_inherents::{Error, InherentData}; -use sp_std::time::Duration; pub use sp_timestamp::{InherentType, INHERENT_IDENTIFIER}; diff --git a/cumulus/primitives/utility/Cargo.toml b/cumulus/primitives/utility/Cargo.toml index a2fa2dd9806d..82d18c8c0aac 100644 --- a/cumulus/primitives/utility/Cargo.toml +++ b/cumulus/primitives/utility/Cargo.toml @@ -17,7 +17,6 @@ log = { workspace = true } frame-support = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } pallet-asset-conversion = { workspace = true } # Polkadot @@ -42,7 +41,6 @@ std = [ "polkadot-runtime-parachains/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", "xcm/std", diff --git a/cumulus/primitives/utility/src/lib.rs b/cumulus/primitives/utility/src/lib.rs index 64784eb36f84..9d5bf4e231eb 100644 --- a/cumulus/primitives/utility/src/lib.rs +++ b/cumulus/primitives/utility/src/lib.rs @@ -19,7 +19,11 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::Encode; +use core::marker::PhantomData; use cumulus_primitives_core::{MessageSendError, UpwardMessageSender}; use frame_support::{ defensive, @@ -33,7 +37,6 @@ use sp_runtime::{ traits::{Saturating, Zero}, SaturatedConversion, }; -use sp_std::{marker::PhantomData, prelude::*}; use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm, WrapVersion}; use xcm_builder::{InspectMessageQueues, TakeRevenue}; use xcm_executor::{ @@ -803,7 +806,7 @@ mod test_trader { /// needed. #[cfg(feature = "runtime-benchmarks")] pub struct ToParentDeliveryHelper( - sp_std::marker::PhantomData<(XcmConfig, ExistentialDeposit, PriceForDelivery)>, + core::marker::PhantomData<(XcmConfig, ExistentialDeposit, PriceForDelivery)>, ); #[cfg(feature = "runtime-benchmarks")] diff --git a/cumulus/templates/xcm-bench-template.hbs b/cumulus/templates/xcm-bench-template.hbs index 5d0ded403f63..119924bca2ee 100644 --- a/cumulus/templates/xcm-bench-template.hbs +++ b/cumulus/templates/xcm-bench-template.hbs @@ -17,7 +17,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `{{pallet}}`. pub struct WeightInfo(PhantomData); diff --git a/cumulus/test/relay-sproof-builder/Cargo.toml b/cumulus/test/relay-sproof-builder/Cargo.toml index 454266c90ba7..e266b5807081 100644 --- a/cumulus/test/relay-sproof-builder/Cargo.toml +++ b/cumulus/test/relay-sproof-builder/Cargo.toml @@ -16,7 +16,6 @@ codec = { features = ["derive"], workspace = true } sp-runtime = { workspace = true } sp-state-machine = { workspace = true } sp-trie = { workspace = true } -sp-std = { workspace = true } # Polkadot polkadot-primitives = { workspace = true } @@ -32,6 +31,5 @@ std = [ "polkadot-primitives/std", "sp-runtime/std", "sp-state-machine/std", - "sp-std/std", "sp-trie/std", ] diff --git a/cumulus/test/relay-sproof-builder/src/lib.rs b/cumulus/test/relay-sproof-builder/src/lib.rs index fbd2692a36b4..d1016085c807 100644 --- a/cumulus/test/relay-sproof-builder/src/lib.rs +++ b/cumulus/test/relay-sproof-builder/src/lib.rs @@ -14,12 +14,14 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . +extern crate alloc; + +use alloc::collections::btree_map::BTreeMap; use cumulus_primitives_core::{ relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId, }; use polkadot_primitives::UpgradeGoAhead; use sp_runtime::traits::HashingFor; -use sp_std::collections::btree_map::BTreeMap; use sp_trie::PrefixedMemoryDB; /// Builds a sproof (portmanteau of 'spoof' and 'proof') of the relay chain state. diff --git a/cumulus/test/runtime/Cargo.toml b/cumulus/test/runtime/Cargo.toml index d5582f2d2a23..54b83e2dfeda 100644 --- a/cumulus/test/runtime/Cargo.toml +++ b/cumulus/test/runtime/Cargo.toml @@ -36,7 +36,6 @@ sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } sp-consensus-aura = { workspace = true } -sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } @@ -87,7 +86,6 @@ std = [ "sp-offchain/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", diff --git a/cumulus/test/runtime/src/lib.rs b/cumulus/test/runtime/src/lib.rs index 97cb02ab779e..274f16ab630d 100644 --- a/cumulus/test/runtime/src/lib.rs +++ b/cumulus/test/runtime/src/lib.rs @@ -33,6 +33,10 @@ pub mod elastic_scaling { } mod test_pallet; + +extern crate alloc; + +use alloc::{vec, vec::Vec}; use frame_support::{derive_impl, traits::OnRuntimeUpgrade, PalletId}; use sp_api::{decl_runtime_apis, impl_runtime_apis}; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -44,7 +48,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, MultiSignature, }; -use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -454,7 +457,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> Vec { Runtime::metadata_versions() } } diff --git a/cumulus/test/runtime/src/test_pallet.rs b/cumulus/test/runtime/src/test_pallet.rs index 7f43f713fadc..61195386ae79 100644 --- a/cumulus/test/runtime/src/test_pallet.rs +++ b/cumulus/test/runtime/src/test_pallet.rs @@ -42,7 +42,7 @@ pub mod pallet { #[pallet::weight(0)] pub fn set_custom_validation_head_data( _: OriginFor, - custom_header: sp_std::vec::Vec, + custom_header: alloc::vec::Vec, ) -> DispatchResult { cumulus_pallet_parachain_system::Pallet::::set_custom_validation_head_data( custom_header, @@ -79,7 +79,7 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] diff --git a/cumulus/xcm/xcm-emulator/src/lib.rs b/cumulus/xcm/xcm-emulator/src/lib.rs index 1a3f3930cb34..8de3660c2236 100644 --- a/cumulus/xcm/xcm-emulator/src/lib.rs +++ b/cumulus/xcm/xcm-emulator/src/lib.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +extern crate alloc; + pub use codec::{Decode, Encode, EncodeLike, MaxEncodedLen}; pub use lazy_static::lazy_static; pub use log; @@ -24,6 +26,8 @@ pub use std::{ }; // Substrate +pub use alloc::collections::vec_deque::VecDeque; +pub use core::{cell::RefCell, fmt::Debug}; pub use cumulus_primitives_core::AggregateMessageOrigin as CumulusAggregateMessageOrigin; pub use frame_support::{ assert_ok, @@ -44,7 +48,6 @@ pub use sp_core::{parameter_types, sr25519, storage::Storage, Pair}; pub use sp_crypto_hashing::blake2_256; pub use sp_io::TestExternalities; pub use sp_runtime::BoundedSlice; -pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, fmt::Debug}; pub use sp_tracing; // Cumulus diff --git a/docs/sdk/src/reference_docs/chain_spec_runtime/Cargo.toml b/docs/sdk/src/reference_docs/chain_spec_runtime/Cargo.toml index 9cf921a492a5..028495712032 100644 --- a/docs/sdk/src/reference_docs/chain_spec_runtime/Cargo.toml +++ b/docs/sdk/src/reference_docs/chain_spec_runtime/Cargo.toml @@ -33,7 +33,6 @@ pallet-transaction-payment-rpc-runtime-api = { workspace = true } sp-genesis-builder = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-core = { workspace = true } -sp-std = { workspace = true } sp-keyring = { workspace = true } sp-application-crypto = { features = ["serde"], workspace = true } @@ -63,7 +62,6 @@ std = [ "sp-genesis-builder/std", "sp-keyring/std", "sp-runtime/std", - "sp-std/std", "serde/std", "serde_json/std", diff --git a/docs/sdk/src/reference_docs/chain_spec_runtime/src/lib.rs b/docs/sdk/src/reference_docs/chain_spec_runtime/src/lib.rs index 4606104fb968..e7effce1bd66 100644 --- a/docs/sdk/src/reference_docs/chain_spec_runtime/src/lib.rs +++ b/docs/sdk/src/reference_docs/chain_spec_runtime/src/lib.rs @@ -19,6 +19,8 @@ //! A minimal runtime that shows runtime genesis state. +extern crate alloc; + pub mod pallets; pub mod presets; pub mod runtime; diff --git a/docs/sdk/src/reference_docs/chain_spec_runtime/src/pallets.rs b/docs/sdk/src/reference_docs/chain_spec_runtime/src/pallets.rs index be4455aa2197..2ff2d9539e2d 100644 --- a/docs/sdk/src/reference_docs/chain_spec_runtime/src/pallets.rs +++ b/docs/sdk/src/reference_docs/chain_spec_runtime/src/pallets.rs @@ -17,6 +17,7 @@ //! Pallets for the chain-spec demo runtime. +use alloc::vec::Vec; use frame::prelude::*; #[docify::export] diff --git a/docs/sdk/src/reference_docs/chain_spec_runtime/src/presets.rs b/docs/sdk/src/reference_docs/chain_spec_runtime/src/presets.rs index c51947f6cc7c..02c2d90f7c82 100644 --- a/docs/sdk/src/reference_docs/chain_spec_runtime/src/presets.rs +++ b/docs/sdk/src/reference_docs/chain_spec_runtime/src/presets.rs @@ -18,10 +18,10 @@ //! Presets for the chain-spec demo runtime. use crate::pallets::{FooEnum, SomeFooData1, SomeFooData2}; +use alloc::vec; use serde_json::{json, to_string, Value}; use sp_application_crypto::Ss58Codec; use sp_keyring::AccountKeyring; -use sp_std::vec; /// A demo preset with strings only. pub const PRESET_1: &str = "preset_1"; @@ -122,7 +122,7 @@ fn preset_invalid() -> Value { /// /// If no preset with given `id` exits `None` is returned. #[docify::export] -pub fn get_builtin_preset(id: &sp_genesis_builder::PresetId) -> Option> { +pub fn get_builtin_preset(id: &sp_genesis_builder::PresetId) -> Option> { let preset = match id.try_into() { Ok(PRESET_1) => preset_1(), Ok(PRESET_2) => preset_2(), diff --git a/docs/sdk/src/reference_docs/chain_spec_runtime/src/runtime.rs b/docs/sdk/src/reference_docs/chain_spec_runtime/src/runtime.rs index 6d9bc1260b11..c45f0126337e 100644 --- a/docs/sdk/src/reference_docs/chain_spec_runtime/src/runtime.rs +++ b/docs/sdk/src/reference_docs/chain_spec_runtime/src/runtime.rs @@ -25,6 +25,7 @@ use crate::{ pallets::{pallet_bar, pallet_foo}, presets::*, }; +use alloc::{vec, vec::Vec}; use frame::{ deps::frame_support::{ genesis_builder_helper::{build_state, get_preset}, diff --git a/polkadot/core-primitives/Cargo.toml b/polkadot/core-primitives/Cargo.toml index 800434670f83..42ca27953738 100644 --- a/polkadot/core-primitives/Cargo.toml +++ b/polkadot/core-primitives/Cargo.toml @@ -11,7 +11,6 @@ workspace = true [dependencies] sp-core = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } scale-info = { features = ["derive"], workspace = true } codec = { features = ["derive"], workspace = true } @@ -23,5 +22,4 @@ std = [ "scale-info/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] diff --git a/polkadot/core-primitives/src/lib.rs b/polkadot/core-primitives/src/lib.rs index 072c045a8c70..666636def460 100644 --- a/polkadot/core-primitives/src/lib.rs +++ b/polkadot/core-primitives/src/lib.rs @@ -20,6 +20,8 @@ //! //! These core Polkadot types are used by the relay chain and the Parachains. +extern crate alloc; + use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_runtime::{ @@ -81,8 +83,8 @@ impl std::fmt::Display for CandidateHash { } } -impl sp_std::fmt::Debug for CandidateHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for CandidateHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{:?}", self.0) } } @@ -119,7 +121,7 @@ pub type Remark = [u8; 32]; /// A message sent from the relay-chain down to a parachain. /// /// The size of the message is limited by the `config.max_downward_message_size` parameter. -pub type DownwardMessage = sp_std::vec::Vec; +pub type DownwardMessage = alloc::vec::Vec; /// A wrapped version of `DownwardMessage`. The difference is that it has attached the block number /// when the message was sent. @@ -139,7 +141,7 @@ pub struct InboundHrmpMessage { /// enacted. pub sent_at: BlockNumber, /// The message payload. - pub data: sp_std::vec::Vec, + pub data: alloc::vec::Vec, } /// An HRMP message seen from the perspective of a sender. @@ -148,7 +150,7 @@ pub struct OutboundHrmpMessage { /// The para that will get this message in its downward message queue. pub recipient: Id, /// The message payload. - pub data: sp_std::vec::Vec, + pub data: alloc::vec::Vec, } /// `V2` primitives. diff --git a/polkadot/parachain/Cargo.toml b/polkadot/parachain/Cargo.toml index 1491af0148e0..9d0518fd46ad 100644 --- a/polkadot/parachain/Cargo.toml +++ b/polkadot/parachain/Cargo.toml @@ -15,7 +15,6 @@ workspace = true # various unnecessary Substrate-specific endpoints. codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive", "serde"], workspace = true } -sp-std = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-core = { features = ["serde"], workspace = true } sp-weights = { workspace = true } @@ -37,7 +36,6 @@ std = [ "serde/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", "sp-weights/std", ] runtime-benchmarks = ["sp-runtime/runtime-benchmarks"] diff --git a/polkadot/parachain/src/lib.rs b/polkadot/parachain/src/lib.rs index bd75296bf837..8941b7fbb911 100644 --- a/polkadot/parachain/src/lib.rs +++ b/polkadot/parachain/src/lib.rs @@ -51,3 +51,5 @@ mod wasm_api; #[cfg(all(not(feature = "std"), feature = "wasm-api"))] pub use wasm_api::*; + +extern crate alloc; diff --git a/polkadot/parachain/src/primitives.rs b/polkadot/parachain/src/primitives.rs index d92bbee8d28d..c5757928c3fc 100644 --- a/polkadot/parachain/src/primitives.rs +++ b/polkadot/parachain/src/primitives.rs @@ -17,7 +17,7 @@ //! Primitive types which are strictly necessary from a parachain-execution point //! of view. -use sp_std::vec::Vec; +use alloc::vec::Vec; use bounded_collections::{BoundedVec, ConstU32}; use codec::{CompactAs, Decode, Encode, MaxEncodedLen}; @@ -89,14 +89,14 @@ impl ValidationCode { #[derive(Clone, Copy, Encode, Decode, Hash, Eq, PartialEq, PartialOrd, Ord, TypeInfo)] pub struct ValidationCodeHash(Hash); -impl sp_std::fmt::Display for ValidationCodeHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Display for ValidationCodeHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { self.0.fmt(f) } } -impl sp_std::fmt::Debug for ValidationCodeHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for ValidationCodeHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{:?}", self.0) } } @@ -119,9 +119,9 @@ impl From<[u8; 32]> for ValidationCodeHash { } } -impl sp_std::fmt::LowerHex for ValidationCodeHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { - sp_std::fmt::LowerHex::fmt(&self.0, f) +impl core::fmt::LowerHex for ValidationCodeHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::LowerHex::fmt(&self.0, f) } } @@ -225,7 +225,7 @@ impl IsSystem for Id { } } -impl sp_std::ops::Add for Id { +impl core::ops::Add for Id { type Output = Self; fn add(self, other: u32) -> Self { @@ -233,7 +233,7 @@ impl sp_std::ops::Add for Id { } } -impl sp_std::ops::Sub for Id { +impl core::ops::Sub for Id { type Output = Self; fn sub(self, other: u32) -> Self { diff --git a/polkadot/parachain/src/wasm_api.rs b/polkadot/parachain/src/wasm_api.rs index f0c832666284..1c557c9ae505 100644 --- a/polkadot/parachain/src/wasm_api.rs +++ b/polkadot/parachain/src/wasm_api.rs @@ -22,7 +22,7 @@ /// function's entry point. #[cfg(not(feature = "std"))] pub unsafe fn load_params(params: *const u8, len: usize) -> crate::primitives::ValidationParams { - let mut slice = sp_std::slice::from_raw_parts(params, len); + let mut slice = core::slice::from_raw_parts(params, len); codec::Decode::decode(&mut slice).expect("Invalid input data") } diff --git a/polkadot/parachain/test-parachains/adder/Cargo.toml b/polkadot/parachain/test-parachains/adder/Cargo.toml index 1661112a7b32..7a150b75d5cd 100644 --- a/polkadot/parachain/test-parachains/adder/Cargo.toml +++ b/polkadot/parachain/test-parachains/adder/Cargo.toml @@ -14,7 +14,6 @@ workspace = true [dependencies] polkadot-parachain-primitives = { features = ["wasm-api"], workspace = true } codec = { features = ["derive"], workspace = true } -sp-std = { workspace = true } tiny-keccak = { features = ["keccak"], workspace = true } dlmalloc = { features = ["global"], workspace = true } @@ -26,4 +25,4 @@ substrate-wasm-builder = { workspace = true, default-features = true } [features] default = ["std"] -std = ["codec/std", "polkadot-parachain-primitives/std", "sp-io/std", "sp-std/std"] +std = ["codec/std", "polkadot-parachain-primitives/std", "sp-io/std"] diff --git a/polkadot/parachain/test-parachains/adder/src/lib.rs b/polkadot/parachain/test-parachains/adder/src/lib.rs index 28914f02511d..7e8d1bb1e138 100644 --- a/polkadot/parachain/test-parachains/adder/src/lib.rs +++ b/polkadot/parachain/test-parachains/adder/src/lib.rs @@ -18,6 +18,8 @@ #![no_std] +extern crate alloc; + use codec::{Decode, Encode}; use tiny_keccak::{Hasher as _, Keccak}; diff --git a/polkadot/parachain/test-parachains/adder/src/wasm_validation.rs b/polkadot/parachain/test-parachains/adder/src/wasm_validation.rs index 7dba7a964d3b..9c3c77f7350b 100644 --- a/polkadot/parachain/test-parachains/adder/src/wasm_validation.rs +++ b/polkadot/parachain/test-parachains/adder/src/wasm_validation.rs @@ -17,10 +17,10 @@ //! WASM validation for adder parachain. use crate::{BlockData, HeadData}; +use alloc::vec::Vec; use codec::{Decode, Encode}; use core::panic; use polkadot_parachain_primitives::primitives::{HeadData as GenericHeadData, ValidationResult}; -use sp_std::vec::Vec; #[no_mangle] pub extern "C" fn validate_block(params: *const u8, len: usize) -> u64 { @@ -37,10 +37,8 @@ pub extern "C" fn validate_block(params: *const u8, len: usize) -> u64 { polkadot_parachain_primitives::write_result(&ValidationResult { head_data: GenericHeadData(new_head.encode()), new_validation_code: None, - upward_messages: sp_std::vec::Vec::new().try_into().expect("empty vec fits into bounds"), - horizontal_messages: sp_std::vec::Vec::new() - .try_into() - .expect("empty vec fits into bounds"), + upward_messages: alloc::vec::Vec::new().try_into().expect("empty vec fits into bounds"), + horizontal_messages: alloc::vec::Vec::new().try_into().expect("empty vec fits into bounds"), processed_downward_messages: 0, hrmp_watermark: params.relay_parent_number, }) diff --git a/polkadot/parachain/test-parachains/undying/Cargo.toml b/polkadot/parachain/test-parachains/undying/Cargo.toml index 2466c6a0d69d..4b2e12ebf435 100644 --- a/polkadot/parachain/test-parachains/undying/Cargo.toml +++ b/polkadot/parachain/test-parachains/undying/Cargo.toml @@ -14,7 +14,6 @@ workspace = true [dependencies] polkadot-parachain-primitives = { features = ["wasm-api"], workspace = true } codec = { features = ["derive"], workspace = true } -sp-std = { workspace = true } tiny-keccak = { features = ["keccak"], workspace = true } dlmalloc = { features = ["global"], workspace = true } log = { workspace = true } @@ -32,5 +31,4 @@ std = [ "log/std", "polkadot-parachain-primitives/std", "sp-io/std", - "sp-std/std", ] diff --git a/polkadot/parachain/test-parachains/undying/src/lib.rs b/polkadot/parachain/test-parachains/undying/src/lib.rs index dc056e64fa23..e4ec7e99346b 100644 --- a/polkadot/parachain/test-parachains/undying/src/lib.rs +++ b/polkadot/parachain/test-parachains/undying/src/lib.rs @@ -18,8 +18,10 @@ #![no_std] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode}; -use sp_std::vec::Vec; use tiny_keccak::{Hasher as _, Keccak}; #[cfg(not(feature = "std"))] diff --git a/polkadot/parachain/test-parachains/undying/src/wasm_validation.rs b/polkadot/parachain/test-parachains/undying/src/wasm_validation.rs index 23fac43a3c73..46b66aa518e4 100644 --- a/polkadot/parachain/test-parachains/undying/src/wasm_validation.rs +++ b/polkadot/parachain/test-parachains/undying/src/wasm_validation.rs @@ -37,8 +37,8 @@ pub extern "C" fn validate_block(params: *const u8, len: usize) -> u64 { polkadot_parachain_primitives::write_result(&ValidationResult { head_data: GenericHeadData(new_head.encode()), new_validation_code: None, - upward_messages: sp_std::vec::Vec::new().try_into().expect("empty vec fits within bounds"), - horizontal_messages: sp_std::vec::Vec::new() + upward_messages: alloc::vec::Vec::new().try_into().expect("empty vec fits within bounds"), + horizontal_messages: alloc::vec::Vec::new() .try_into() .expect("empty vec fits within bounds"), processed_downward_messages: 0, diff --git a/polkadot/primitives/Cargo.toml b/polkadot/primitives/Cargo.toml index c0b510a8fe9d..8f7ec314ecff 100644 --- a/polkadot/primitives/Cargo.toml +++ b/polkadot/primitives/Cargo.toml @@ -28,7 +28,6 @@ sp-consensus-slots = { features = ["serde"], workspace = true } sp-io = { workspace = true } sp-keystore = { optional = true, workspace = true } sp-staking = { features = ["serde"], workspace = true } -sp-std = { workspace = true } polkadot-core-primitives = { workspace = true } polkadot-parachain-primitives = { workspace = true } @@ -55,7 +54,6 @@ std = [ "sp-keystore?/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ "polkadot-parachain-primitives/runtime-benchmarks", diff --git a/polkadot/primitives/src/lib.rs b/polkadot/primitives/src/lib.rs index 061794ca06d1..73736fd4a3d6 100644 --- a/polkadot/primitives/src/lib.rs +++ b/polkadot/primitives/src/lib.rs @@ -31,6 +31,8 @@ pub mod vstaging; // unstable functions. pub mod runtime_api; +extern crate alloc; + // Current primitives not requiring versioning are exported here. // Primitives requiring versioning must not be exported and must be referred by an exact version. pub use v7::{ diff --git a/polkadot/primitives/src/runtime_api.rs b/polkadot/primitives/src/runtime_api.rs index 7bd92be35c15..b4816ad15075 100644 --- a/polkadot/primitives/src/runtime_api.rs +++ b/polkadot/primitives/src/runtime_api.rs @@ -121,12 +121,12 @@ use crate::{ SessionIndex, SessionInfo, ValidatorId, ValidatorIndex, ValidatorSignature, }; -use polkadot_core_primitives as pcp; -use polkadot_parachain_primitives::primitives as ppp; -use sp_std::{ +use alloc::{ collections::{btree_map::BTreeMap, vec_deque::VecDeque}, - prelude::*, + vec::Vec, }; +use polkadot_core_primitives as pcp; +use polkadot_parachain_primitives::primitives as ppp; sp_api::decl_runtime_apis! { /// The API for querying the state of parachains on-chain. diff --git a/polkadot/primitives/src/v7/async_backing.rs b/polkadot/primitives/src/v7/async_backing.rs index a82d843d28bf..55d436e30de0 100644 --- a/polkadot/primitives/src/v7/async_backing.rs +++ b/polkadot/primitives/src/v7/async_backing.rs @@ -18,6 +18,7 @@ use super::*; +use alloc::vec::Vec; use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_core::RuntimeDebug; diff --git a/polkadot/primitives/src/v7/executor_params.rs b/polkadot/primitives/src/v7/executor_params.rs index e58cf3e76cc2..bfd42ec30bd3 100644 --- a/polkadot/primitives/src/v7/executor_params.rs +++ b/polkadot/primitives/src/v7/executor_params.rs @@ -22,11 +22,12 @@ //! done in `polkadot-node-core-pvf`. use crate::{BlakeTwo256, HashT as _, PvfExecKind, PvfPrepKind}; +use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; use codec::{Decode, Encode}; +use core::{ops::Deref, time::Duration}; use polkadot_core_primitives::Hash; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; -use sp_std::{collections::btree_map::BTreeMap, ops::Deref, time::Duration, vec, vec::Vec}; /// Default maximum number of wasm values allowed for the stack during execution of a PVF. pub const DEFAULT_LOGICAL_STACK_MAX: u32 = 65536; @@ -134,21 +135,21 @@ impl ExecutorParamsHash { } } -impl sp_std::fmt::Display for ExecutorParamsHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Display for ExecutorParamsHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { self.0.fmt(f) } } -impl sp_std::fmt::Debug for ExecutorParamsHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for ExecutorParamsHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{:?}", self.0) } } -impl sp_std::fmt::LowerHex for ExecutorParamsHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { - sp_std::fmt::LowerHex::fmt(&self.0, f) +impl core::fmt::LowerHex for ExecutorParamsHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::LowerHex::fmt(&self.0, f) } } @@ -159,21 +160,21 @@ impl sp_std::fmt::LowerHex for ExecutorParamsHash { #[derive(Clone, Copy, Encode, Decode, Hash, Eq, PartialEq, PartialOrd, Ord, TypeInfo)] pub struct ExecutorParamsPrepHash(Hash); -impl sp_std::fmt::Display for ExecutorParamsPrepHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Display for ExecutorParamsPrepHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { self.0.fmt(f) } } -impl sp_std::fmt::Debug for ExecutorParamsPrepHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for ExecutorParamsPrepHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{:?}", self.0) } } -impl sp_std::fmt::LowerHex for ExecutorParamsPrepHash { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { - sp_std::fmt::LowerHex::fmt(&self.0, f) +impl core::fmt::LowerHex for ExecutorParamsPrepHash { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::LowerHex::fmt(&self.0, f) } } diff --git a/polkadot/primitives/src/v7/metrics.rs b/polkadot/primitives/src/v7/metrics.rs index 1a29471c5450..1d66c9848a7c 100644 --- a/polkadot/primitives/src/v7/metrics.rs +++ b/polkadot/primitives/src/v7/metrics.rs @@ -16,8 +16,8 @@ //! Runtime metric primitives. +use alloc::vec::Vec; use codec::{Decode, Encode}; -use sp_std::prelude::*; /// Runtime metric operations. #[derive(Encode, Decode)] @@ -42,7 +42,7 @@ pub struct RuntimeMetricUpdate { } fn vec_to_str<'a>(v: &'a Vec, default: &'static str) -> &'a str { - return sp_std::str::from_utf8(v).unwrap_or(default) + return alloc::str::from_utf8(v).unwrap_or(default) } impl RuntimeMetricLabels { @@ -99,7 +99,7 @@ pub trait AsStr { impl AsStr for RuntimeMetricLabel { fn as_str(&self) -> Option<&str> { - sp_std::str::from_utf8(&self.0).ok() + alloc::str::from_utf8(&self.0).ok() } } diff --git a/polkadot/primitives/src/v7/mod.rs b/polkadot/primitives/src/v7/mod.rs index 6b7985847a10..06b704652083 100644 --- a/polkadot/primitives/src/v7/mod.rs +++ b/polkadot/primitives/src/v7/mod.rs @@ -16,15 +16,17 @@ //! `V7` Primitives. +use alloc::{ + vec, + vec::{IntoIter, Vec}, +}; use bitvec::{field::BitField, slice::BitSlice, vec::BitVec}; use codec::{Decode, Encode}; -use scale_info::TypeInfo; -use sp_std::{ +use core::{ marker::PhantomData, - prelude::*, slice::{Iter, IterMut}, - vec::IntoIter, }; +use scale_info::TypeInfo; use sp_application_crypto::KeyTypeId; use sp_arithmetic::traits::{BaseArithmetic, Saturating}; @@ -172,10 +174,10 @@ pub type ValidatorSignature = validator_app::Signature; /// A declarations of storage keys where an external observer can find some interesting data. pub mod well_known_keys { use super::{HrmpChannelId, Id, WellKnownKey}; + use alloc::vec::Vec; use codec::Encode as _; use hex_literal::hex; use sp_io::hashing::twox_64; - use sp_std::prelude::*; // A note on generating these magic values below: // @@ -617,13 +619,13 @@ impl CommittedCandidateReceipt { } impl PartialOrd for CommittedCandidateReceipt { - fn partial_cmp(&self, other: &Self) -> Option { + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } impl Ord for CommittedCandidateReceipt { - fn cmp(&self, other: &Self) -> sp_std::cmp::Ordering { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { // TODO: compare signatures or something more sane // https://github.com/paritytech/polkadot/issues/222 self.descriptor() @@ -984,7 +986,7 @@ impl GroupRotationInfo { return GroupIndex(0) } - let cores = sp_std::cmp::min(cores, u32::MAX as usize); + let cores = core::cmp::min(cores, u32::MAX as usize); let blocks_since_start = self.now.saturating_sub(self.session_start_block); let rotations = blocks_since_start / self.group_rotation_frequency; @@ -1006,7 +1008,7 @@ impl GroupRotationInfo { return CoreIndex(0) } - let cores = sp_std::cmp::min(cores, u32::MAX as usize); + let cores = core::cmp::min(cores, u32::MAX as usize); let blocks_since_start = self.now.saturating_sub(self.session_start_block); let rotations = blocks_since_start / self.group_rotation_frequency; let rotations = rotations % cores as u32; @@ -1870,7 +1872,7 @@ pub fn effective_minimum_backing_votes( group_len: usize, configured_minimum_backing_votes: u32, ) -> usize { - sp_std::cmp::min(group_len, configured_minimum_backing_votes as usize) + core::cmp::min(group_len, configured_minimum_backing_votes as usize) } /// Information about validator sets of a session. @@ -1966,7 +1968,7 @@ impl PvfCheckStatement { pub struct WellKnownKey { /// The raw storage key. pub key: Vec, - _p: sp_std::marker::PhantomData, + _p: core::marker::PhantomData, } impl From> for WellKnownKey { diff --git a/polkadot/primitives/src/v7/signed.rs b/polkadot/primitives/src/v7/signed.rs index 62e4df238503..f819b379a30a 100644 --- a/polkadot/primitives/src/v7/signed.rs +++ b/polkadot/primitives/src/v7/signed.rs @@ -17,11 +17,11 @@ use codec::{Decode, Encode}; use scale_info::TypeInfo; +use alloc::vec::Vec; #[cfg(feature = "std")] use sp_application_crypto::AppCrypto; #[cfg(feature = "std")] use sp_keystore::{Error as KeystoreError, KeystorePtr}; -use sp_std::prelude::Vec; use sp_core::RuntimeDebug; use sp_runtime::traits::AppVerify; @@ -57,7 +57,7 @@ pub struct UncheckedSigned { /// The signature by the validator of the signed payload. signature: ValidatorSignature, /// This ensures the real payload is tracked at the typesystem level. - real_payload: sp_std::marker::PhantomData, + real_payload: core::marker::PhantomData, } impl, RealPayload: Encode> Signed { @@ -163,7 +163,7 @@ impl, RealPayload: Encode> Signed, RealPayload: Encode> Signed, RealPayload: Encode> UncheckedSigned, RealPayload: Encode> UncheckedSigned(sp_std::marker::PhantomData); + pub struct VersionUncheckedMigrateToV1(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/common/src/assigned_slots/mod.rs b/polkadot/runtime/common/src/assigned_slots/mod.rs index d0a531b8b6ca..dd39789e10cf 100644 --- a/polkadot/runtime/common/src/assigned_slots/mod.rs +++ b/polkadot/runtime/common/src/assigned_slots/mod.rs @@ -30,6 +30,7 @@ use crate::{ slots::{self, Pallet as Slots, WeightInfo as SlotsWeightInfo}, traits::{LeaseError, Leaser, Registrar}, }; +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{pallet_prelude::*, traits::Currency}; use frame_system::pallet_prelude::*; @@ -41,7 +42,6 @@ use polkadot_runtime_parachains::{ }; use scale_info::TypeInfo; use sp_runtime::traits::{One, Saturating, Zero}; -use sp_std::prelude::*; const LOG_TARGET: &str = "runtime::assigned_slots"; diff --git a/polkadot/runtime/common/src/auctions.rs b/polkadot/runtime/common/src/auctions.rs index 19d82ae85d00..78f20d918bab 100644 --- a/polkadot/runtime/common/src/auctions.rs +++ b/polkadot/runtime/common/src/auctions.rs @@ -22,7 +22,9 @@ use crate::{ slot_range::SlotRange, traits::{AuctionStatus, Auctioneer, LeaseError, Leaser, Registrar}, }; +use alloc::{vec, vec::Vec}; use codec::Decode; +use core::mem::swap; use frame_support::{ dispatch::DispatchResult, ensure, @@ -33,7 +35,6 @@ use frame_system::pallet_prelude::BlockNumberFor; pub use pallet::*; use polkadot_primitives::Id as ParaId; use sp_runtime::traits::{CheckedSub, One, Saturating, Zero}; -use sp_std::{mem::swap, prelude::*}; type CurrencyOf = <::Leaser as Leaser>>::Currency; type BalanceOf = <<::Leaser as Leaser>>::Currency as Currency< diff --git a/polkadot/runtime/common/src/claims.rs b/polkadot/runtime/common/src/claims.rs index c12af215a04d..162bf01c3843 100644 --- a/polkadot/runtime/common/src/claims.rs +++ b/polkadot/runtime/common/src/claims.rs @@ -16,7 +16,11 @@ //! Pallet to process claims from Ethereum addresses. +#[cfg(not(feature = "std"))] +use alloc::{format, string::String}; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; +use core::fmt::Debug; use frame_support::{ ensure, traits::{Currency, Get, IsSubType, VestingSchedule}, @@ -35,9 +39,6 @@ use sp_runtime::{ }, RuntimeDebug, }; -#[cfg(not(feature = "std"))] -use sp_std::alloc::{format, string::String}; -use sp_std::{fmt::Debug, prelude::*}; type CurrencyOf = <::VestingSchedule as VestingSchedule< ::AccountId, @@ -150,8 +151,8 @@ impl PartialEq for EcdsaSignature { } } -impl sp_std::fmt::Debug for EcdsaSignature { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for EcdsaSignature { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "EcdsaSignature({:?})", &self.0[..]) } } @@ -596,12 +597,12 @@ where ::RuntimeCall: IsSubType>, { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "PrevalidateAttests") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -612,7 +613,7 @@ where { /// Create new `SignedExtension` to check runtime version. pub fn new() -> Self { - Self(sp_std::marker::PhantomData) + Self(core::marker::PhantomData) } } diff --git a/polkadot/runtime/common/src/crowdloan/migration.rs b/polkadot/runtime/common/src/crowdloan/migration.rs index 3afd6b3fbc94..0ee3872a366e 100644 --- a/polkadot/runtime/common/src/crowdloan/migration.rs +++ b/polkadot/runtime/common/src/crowdloan/migration.rs @@ -21,7 +21,7 @@ use frame_support::{ Twox64Concat, }; -pub struct MigrateToTrackInactiveV2(sp_std::marker::PhantomData); +pub struct MigrateToTrackInactiveV2(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToTrackInactiveV2 { fn on_runtime_upgrade() -> Weight { let on_chain_version = Pallet::::on_chain_storage_version(); diff --git a/polkadot/runtime/common/src/crowdloan/mod.rs b/polkadot/runtime/common/src/crowdloan/mod.rs index 61d406aa6812..8cf288197e3d 100644 --- a/polkadot/runtime/common/src/crowdloan/mod.rs +++ b/polkadot/runtime/common/src/crowdloan/mod.rs @@ -55,6 +55,7 @@ use crate::{ slot_range::SlotRange, traits::{Auctioneer, Registrar}, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ ensure, @@ -77,7 +78,6 @@ use sp_runtime::{ }, MultiSignature, MultiSigner, RuntimeDebug, }; -use sp_std::vec::Vec; type CurrencyOf = <::Auctioneer as Auctioneer>>::Currency; type LeasePeriodOf = <::Auctioneer as Auctioneer>>::LeasePeriod; @@ -832,16 +832,16 @@ impl Pallet { impl crate::traits::OnSwap for Pallet { fn on_swap(one: ParaId, other: ParaId) { - Funds::::mutate(one, |x| Funds::::mutate(other, |y| sp_std::mem::swap(x, y))) + Funds::::mutate(one, |x| Funds::::mutate(other, |y| core::mem::swap(x, y))) } } #[cfg(any(feature = "runtime-benchmarks", test))] mod crypto { + use alloc::vec::Vec; use sp_core::ed25519; use sp_io::crypto::{ed25519_generate, ed25519_sign}; use sp_runtime::{MultiSignature, MultiSigner}; - use sp_std::vec::Vec; pub fn create_ed25519_pubkey(seed: Vec) -> MultiSigner { ed25519_generate(0.into(), Some(seed)).into() @@ -1968,7 +1968,6 @@ mod benchmarking { use polkadot_runtime_parachains::paras; use sp_core::crypto::UncheckedFrom; use sp_runtime::traits::{Bounded, CheckedSub}; - use sp_std::prelude::*; use frame_benchmarking::{account, benchmarks, whitelisted_caller}; diff --git a/polkadot/runtime/common/src/identity_migrator.rs b/polkadot/runtime/common/src/identity_migrator.rs index 7d02e24b5368..126c886280e6 100644 --- a/polkadot/runtime/common/src/identity_migrator.rs +++ b/polkadot/runtime/common/src/identity_migrator.rs @@ -172,6 +172,7 @@ impl OnReapIdentity for () { #[benchmarks] mod benchmarks { use super::*; + use alloc::{boxed::Box, vec, vec::Vec}; use codec::Encode; use frame_support::traits::EnsureOrigin; use frame_system::RawOrigin; @@ -180,7 +181,6 @@ mod benchmarks { traits::{Bounded, Hash, StaticLookup}, Saturating, }; - use sp_std::{boxed::Box, vec::Vec, *}; const SEED: u32 = 0; diff --git a/polkadot/runtime/common/src/impls.rs b/polkadot/runtime/common/src/impls.rs index 709cc69cdbea..9d61cd018731 100644 --- a/polkadot/runtime/common/src/impls.rs +++ b/polkadot/runtime/common/src/impls.rs @@ -28,7 +28,7 @@ use sp_runtime::{traits::TryConvert, Perquintill, RuntimeDebug}; use xcm::VersionedLocation; /// Logic for the author to get a portion of fees. -pub struct ToAuthor(sp_std::marker::PhantomData); +pub struct ToAuthor(core::marker::PhantomData); impl OnUnbalanced>> for ToAuthor where R: pallet_balances::Config + pallet_authorship::Config, @@ -44,7 +44,7 @@ where } } -pub struct DealWithFees(sp_std::marker::PhantomData); +pub struct DealWithFees(core::marker::PhantomData); impl OnUnbalanced>> for DealWithFees where R: pallet_balances::Config + pallet_authorship::Config + pallet_treasury::Config, diff --git a/polkadot/runtime/common/src/integration_tests.rs b/polkadot/runtime/common/src/integration_tests.rs index 052fb0389db4..7a689a517eaa 100644 --- a/polkadot/runtime/common/src/integration_tests.rs +++ b/polkadot/runtime/common/src/integration_tests.rs @@ -24,6 +24,7 @@ use crate::{ slots, traits::{AuctionStatus, Auctioneer, Leaser, Registrar as RegistrarT}, }; +use alloc::sync::Arc; use codec::Encode; use frame_support::{ assert_noop, assert_ok, derive_impl, parameter_types, @@ -50,7 +51,6 @@ use sp_runtime::{ transaction_validity::TransactionPriority, AccountId32, BuildStorage, MultiSignature, }; -use sp_std::sync::Arc; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlockU32; diff --git a/polkadot/runtime/common/src/lib.rs b/polkadot/runtime/common/src/lib.rs index 6e50384f68c9..41e1cdbab801 100644 --- a/polkadot/runtime/common/src/lib.rs +++ b/polkadot/runtime/common/src/lib.rs @@ -41,6 +41,8 @@ mod integration_tests; #[cfg(test)] mod mock; +extern crate alloc; + use frame_support::{ parameter_types, traits::{ConstU32, Currency, OneSessionHandler}, @@ -169,7 +171,7 @@ static_assertions::assert_eq_size!(polkadot_primitives::Balance, u128); /// A placeholder since there is currently no provided session key handler for parachain validator /// keys. -pub struct ParachainSessionKeyPlaceholder(sp_std::marker::PhantomData); +pub struct ParachainSessionKeyPlaceholder(core::marker::PhantomData); impl sp_runtime::BoundToRuntimeAppPublic for ParachainSessionKeyPlaceholder { type Public = ValidatorId; } @@ -198,7 +200,7 @@ impl OneSessionHandler /// A placeholder since there is currently no provided session key handler for parachain validator /// keys. -pub struct AssignmentSessionKeyPlaceholder(sp_std::marker::PhantomData); +pub struct AssignmentSessionKeyPlaceholder(core::marker::PhantomData); impl sp_runtime::BoundToRuntimeAppPublic for AssignmentSessionKeyPlaceholder { type Public = AssignmentId; } diff --git a/polkadot/runtime/common/src/mock.rs b/polkadot/runtime/common/src/mock.rs index 6534110cc210..54170b07fa62 100644 --- a/polkadot/runtime/common/src/mock.rs +++ b/polkadot/runtime/common/src/mock.rs @@ -37,7 +37,7 @@ thread_local! { static MANAGERS: RefCell>> = RefCell::new(HashMap::new()); } -pub struct TestRegistrar(sp_std::marker::PhantomData); +pub struct TestRegistrar(core::marker::PhantomData); impl Registrar for TestRegistrar { type AccountId = T::AccountId; diff --git a/polkadot/runtime/common/src/paras_registrar/migration.rs b/polkadot/runtime/common/src/paras_registrar/migration.rs index 18bb6bbfb559..6b110d2ff5d5 100644 --- a/polkadot/runtime/common/src/paras_registrar/migration.rs +++ b/polkadot/runtime/common/src/paras_registrar/migration.rs @@ -25,7 +25,7 @@ pub struct ParaInfoV1 { } pub struct VersionUncheckedMigrateToV1( - sp_std::marker::PhantomData<(T, UnlockParaIds)>, + core::marker::PhantomData<(T, UnlockParaIds)>, ); impl> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1 diff --git a/polkadot/runtime/common/src/paras_registrar/mod.rs b/polkadot/runtime/common/src/paras_registrar/mod.rs index 606883b7119b..07f02e926561 100644 --- a/polkadot/runtime/common/src/paras_registrar/mod.rs +++ b/polkadot/runtime/common/src/paras_registrar/mod.rs @@ -19,6 +19,8 @@ pub mod migration; +use alloc::{vec, vec::Vec}; +use core::result; use frame_support::{ dispatch::DispatchResult, ensure, @@ -34,7 +36,6 @@ use polkadot_runtime_parachains::{ paras::{self, ParaGenesisArgs, UpgradeStrategy}, Origin, ParaLifecycle, }; -use sp_std::{prelude::*, result}; use crate::traits::{OnSwap, Registrar}; use codec::{Decode, Encode}; @@ -210,7 +211,7 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, pub next_free_para_id: ParaId, } @@ -717,6 +718,7 @@ mod tests { use crate::{ mock::conclude_pvf_checking, paras_registrar, traits::Registrar as RegistrarTrait, }; + use alloc::collections::btree_map::BTreeMap; use frame_support::{ assert_noop, assert_ok, derive_impl, parameter_types, traits::{OnFinalize, OnInitialize}, @@ -733,7 +735,6 @@ mod tests { transaction_validity::TransactionPriority, BuildStorage, Perbill, }; - use sp_std::collections::btree_map::BTreeMap; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlockU32; diff --git a/polkadot/runtime/common/src/paras_sudo_wrapper.rs b/polkadot/runtime/common/src/paras_sudo_wrapper.rs index 3ff8d4ac08e1..af93c70b4783 100644 --- a/polkadot/runtime/common/src/paras_sudo_wrapper.rs +++ b/polkadot/runtime/common/src/paras_sudo_wrapper.rs @@ -16,6 +16,7 @@ //! A simple wrapper allowing `Sudo` to call into `paras` routines. +use alloc::boxed::Box; use codec::Encode; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; @@ -26,7 +27,6 @@ use polkadot_runtime_parachains::{ paras::{self, AssignCoretime, ParaGenesisArgs}, ParaLifecycle, }; -use sp_std::boxed::Box; #[frame_support::pallet] pub mod pallet { diff --git a/polkadot/runtime/common/src/purchase.rs b/polkadot/runtime/common/src/purchase.rs index eb480e4efe1f..d650548b8ac3 100644 --- a/polkadot/runtime/common/src/purchase.rs +++ b/polkadot/runtime/common/src/purchase.rs @@ -16,6 +16,7 @@ //! Pallet to process purchase of DOTs. +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::{ pallet_prelude::*, @@ -29,7 +30,6 @@ use sp_runtime::{ traits::{CheckedAdd, Saturating, Verify, Zero}, AnySignature, DispatchError, DispatchResult, Permill, RuntimeDebug, }; -use sp_std::prelude::*; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; diff --git a/polkadot/runtime/common/src/slots/mod.rs b/polkadot/runtime/common/src/slots/mod.rs index 747b7b5ca634..333f14c6608a 100644 --- a/polkadot/runtime/common/src/slots/mod.rs +++ b/polkadot/runtime/common/src/slots/mod.rs @@ -25,6 +25,7 @@ pub mod migration; use crate::traits::{LeaseError, Leaser, Registrar}; +use alloc::{vec, vec::Vec}; use frame_support::{ pallet_prelude::*, traits::{Currency, ReservableCurrency}, @@ -34,7 +35,6 @@ use frame_system::pallet_prelude::*; pub use pallet::*; use polkadot_primitives::Id as ParaId; use sp_runtime::traits::{CheckedConversion, CheckedSub, Saturating, Zero}; -use sp_std::prelude::*; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -309,7 +309,7 @@ impl Pallet { // Useful when trying to clean up a parachain leases, as this would tell // you all the balances you need to unreserve. fn all_deposits_held(para: ParaId) -> Vec<(T::AccountId, BalanceOf)> { - let mut tracker = sp_std::collections::btree_map::BTreeMap::new(); + let mut tracker = alloc::collections::btree_map::BTreeMap::new(); Leases::::get(para).into_iter().for_each(|lease| match lease { Some((who, amount)) => match tracker.get(&who) { Some(prev_amount) => @@ -329,7 +329,7 @@ impl Pallet { impl crate::traits::OnSwap for Pallet { fn on_swap(one: ParaId, other: ParaId) { - Leases::::mutate(one, |x| Leases::::mutate(other, |y| sp_std::mem::swap(x, y))) + Leases::::mutate(one, |x| Leases::::mutate(other, |y| core::mem::swap(x, y))) } } diff --git a/polkadot/runtime/common/src/traits.rs b/polkadot/runtime/common/src/traits.rs index eadeac74fcdb..6e49abcee98b 100644 --- a/polkadot/runtime/common/src/traits.rs +++ b/polkadot/runtime/common/src/traits.rs @@ -16,12 +16,12 @@ //! Traits used across pallets for Polkadot. +use alloc::vec::*; use frame_support::{ dispatch::DispatchResult, traits::{Currency, ReservableCurrency}, }; use polkadot_primitives::{HeadData, Id as ParaId, ValidationCode}; -use sp_std::vec::*; /// Parachain registration API. pub trait Registrar { diff --git a/polkadot/runtime/common/src/try_runtime.rs b/polkadot/runtime/common/src/try_runtime.rs index 81aa34317bfd..b22e17032920 100644 --- a/polkadot/runtime/common/src/try_runtime.rs +++ b/polkadot/runtime/common/src/try_runtime.rs @@ -16,13 +16,13 @@ //! Common try-runtime only tests for runtimes. +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use frame_support::{ dispatch::RawOrigin, traits::{Get, Hooks}, }; use pallet_fast_unstake::{Pallet as FastUnstake, *}; use pallet_staking::*; -use sp_std::{collections::btree_set::BTreeSet, prelude::*}; /// register all inactive nominators for fast-unstake, and progress until they have all been /// processed. diff --git a/polkadot/runtime/common/src/xcm_sender.rs b/polkadot/runtime/common/src/xcm_sender.rs index 5858a0ac3ca7..dace785a535b 100644 --- a/polkadot/runtime/common/src/xcm_sender.rs +++ b/polkadot/runtime/common/src/xcm_sender.rs @@ -16,7 +16,9 @@ //! XCM sender for relay chain. +use alloc::vec::Vec; use codec::{Decode, Encode}; +use core::marker::PhantomData; use frame_support::traits::Get; use frame_system::pallet_prelude::BlockNumberFor; use polkadot_primitives::Id as ParaId; @@ -25,7 +27,6 @@ use polkadot_runtime_parachains::{ dmp, FeeTracker, }; use sp_runtime::FixedPointNumber; -use sp_std::{marker::PhantomData, prelude::*}; use xcm::prelude::*; use xcm_builder::InspectMessageQueues; use SendError::*; @@ -56,7 +57,7 @@ impl PriceForMessageDelivery for NoPriceForMessageDelivery { } /// Implementation of [`PriceForMessageDelivery`] which returns a fixed price. -pub struct ConstantPrice(sp_std::marker::PhantomData); +pub struct ConstantPrice(core::marker::PhantomData); impl> PriceForMessageDelivery for ConstantPrice { type Id = (); @@ -79,7 +80,7 @@ impl> PriceForMessageDelivery for ConstantPrice { /// - `B`: The base fee to pay for message delivery. /// - `M`: The fee to pay for each and every byte of the message after encoding it. /// - `F`: A fee factor multiplier. It can be understood as the exponent term in the formula. -pub struct ExponentialPrice(sp_std::marker::PhantomData<(A, B, M, F)>); +pub struct ExponentialPrice(core::marker::PhantomData<(A, B, M, F)>); impl, B: Get, M: Get, F: FeeTracker> PriceForMessageDelivery for ExponentialPrice { @@ -169,7 +170,7 @@ pub struct ToParachainDeliveryHelper< ParaId, ToParaIdHelper, >( - sp_std::marker::PhantomData<( + core::marker::PhantomData<( XcmConfig, ExistentialDeposit, PriceForDelivery, @@ -223,7 +224,7 @@ impl< } // overestimate delivery fee - let overestimated_xcm = vec![ClearOrigin; 128].into(); + let overestimated_xcm = alloc::vec![ClearOrigin; 128].into(); let overestimated_fees = PriceForDelivery::price_for_delivery(Parachain::get(), &overestimated_xcm); @@ -258,6 +259,7 @@ impl EnsureForParachain for () { mod tests { use super::*; use crate::integration_tests::new_test_ext; + use alloc::vec; use frame_support::{assert_ok, parameter_types}; use polkadot_runtime_parachains::FeeTracker; use sp_runtime::FixedU128; diff --git a/polkadot/runtime/metrics/Cargo.toml b/polkadot/runtime/metrics/Cargo.toml index 54c685effc11..3709e1eb697e 100644 --- a/polkadot/runtime/metrics/Cargo.toml +++ b/polkadot/runtime/metrics/Cargo.toml @@ -10,7 +10,6 @@ description = "Runtime metric interface for the Polkadot node" workspace = true [dependencies] -sp-std = { workspace = true } sp-tracing = { workspace = true } codec = { workspace = true } polkadot-primitives = { workspace = true } @@ -25,7 +24,6 @@ std = [ "codec/std", "frame-benchmarking?/std", "polkadot-primitives/std", - "sp-std/std", "sp-tracing/std", ] runtime-metrics = ["frame-benchmarking", "sp-tracing/with-tracing"] diff --git a/polkadot/runtime/metrics/src/lib.rs b/polkadot/runtime/metrics/src/lib.rs index 6164d71f112a..479ec7a69c3a 100644 --- a/polkadot/runtime/metrics/src/lib.rs +++ b/polkadot/runtime/metrics/src/lib.rs @@ -22,6 +22,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "runtime-metrics")] mod with_runtime_metrics; #[cfg(feature = "runtime-metrics")] diff --git a/polkadot/runtime/metrics/src/with_runtime_metrics.rs b/polkadot/runtime/metrics/src/with_runtime_metrics.rs index 1339df9ff687..979d5eda9afc 100644 --- a/polkadot/runtime/metrics/src/with_runtime_metrics.rs +++ b/polkadot/runtime/metrics/src/with_runtime_metrics.rs @@ -22,14 +22,13 @@ const TRACING_TARGET: &'static str = "metrics"; +use alloc::vec::Vec; use codec::Encode; use polkadot_primitives::{ metric_definitions::{CounterDefinition, CounterVecDefinition, HistogramDefinition}, RuntimeMetricLabelValues, RuntimeMetricOp, RuntimeMetricUpdate, }; -use sp_std::prelude::*; - /// Holds a set of counters that have different values for their labels, /// like Prometheus `CounterVec`. pub struct CounterVec { diff --git a/polkadot/runtime/parachains/Cargo.toml b/polkadot/runtime/parachains/Cargo.toml index 82ba22a70f37..7afdf49fe551 100644 --- a/polkadot/runtime/parachains/Cargo.toml +++ b/polkadot/runtime/parachains/Cargo.toml @@ -21,7 +21,6 @@ bitflags = { workspace = true } sp-api = { workspace = true } sp-inherents = { workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-session = { workspace = true } @@ -110,7 +109,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", "xcm-executor/std", "xcm/std", ] diff --git a/polkadot/runtime/parachains/src/assigner_coretime/mod.rs b/polkadot/runtime/parachains/src/assigner_coretime/mod.rs index e68ac2664b89..9ed007919b81 100644 --- a/polkadot/runtime/parachains/src/assigner_coretime/mod.rs +++ b/polkadot/runtime/parachains/src/assigner_coretime/mod.rs @@ -34,14 +34,13 @@ use crate::{ ParaId, }; +use alloc::{vec, vec::Vec}; use frame_support::{defensive, pallet_prelude::*}; use frame_system::pallet_prelude::*; use pallet_broker::CoreAssignment; use polkadot_primitives::CoreIndex; use sp_runtime::traits::{One, Saturating}; -use sp_std::prelude::*; - pub use pallet::*; /// Fraction expressed as a nominator with an assumed denominator of 57,600. diff --git a/polkadot/runtime/parachains/src/assigner_coretime/tests.rs b/polkadot/runtime/parachains/src/assigner_coretime/tests.rs index bab09eda52c2..9b0cbcb2d7d6 100644 --- a/polkadot/runtime/parachains/src/assigner_coretime/tests.rs +++ b/polkadot/runtime/parachains/src/assigner_coretime/tests.rs @@ -26,10 +26,10 @@ use crate::{ paras::{ParaGenesisArgs, ParaKind}, scheduler::common::Assignment, }; +use alloc::collections::btree_map::BTreeMap; use frame_support::{assert_noop, assert_ok, pallet_prelude::*, traits::Currency}; use pallet_broker::TaskId; use polkadot_primitives::{BlockNumber, Id as ParaId, SessionIndex, ValidationCode}; -use sp_std::collections::btree_map::BTreeMap; fn schedule_blank_para(id: ParaId, parakind: ParaKind) { let validation_code: ValidationCode = vec![1, 2, 3].into(); diff --git a/polkadot/runtime/parachains/src/assigner_on_demand/benchmarking.rs b/polkadot/runtime/parachains/src/assigner_on_demand/benchmarking.rs index ba6951a14692..b0ebfe77a966 100644 --- a/polkadot/runtime/parachains/src/assigner_on_demand/benchmarking.rs +++ b/polkadot/runtime/parachains/src/assigner_on_demand/benchmarking.rs @@ -25,6 +25,7 @@ use crate::{ shared::Pallet as ParasShared, }; +use alloc::vec; use frame_benchmarking::v2::*; use frame_system::RawOrigin; use sp_runtime::traits::Bounded; diff --git a/polkadot/runtime/parachains/src/assigner_on_demand/migration.rs b/polkadot/runtime/parachains/src/assigner_on_demand/migration.rs index 314be11adbeb..03f63d7333b6 100644 --- a/polkadot/runtime/parachains/src/assigner_on_demand/migration.rs +++ b/polkadot/runtime/parachains/src/assigner_on_demand/migration.rs @@ -23,7 +23,7 @@ use frame_support::{ mod v0 { use super::*; - use sp_std::collections::vec_deque::VecDeque; + use alloc::collections::vec_deque::VecDeque; #[derive(Encode, Decode, TypeInfo, Debug, PartialEq, Clone)] pub(super) struct EnqueuedOrder { @@ -50,7 +50,7 @@ mod v1 { use crate::assigner_on_demand::LOG_TARGET; /// Migration to V1 - pub struct UncheckedMigrateToV1(sp_std::marker::PhantomData); + pub struct UncheckedMigrateToV1(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for UncheckedMigrateToV1 { fn on_runtime_upgrade() -> Weight { let mut weight: Weight = Weight::zero(); @@ -88,7 +88,7 @@ mod v1 { } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { let n: u32 = v0::OnDemandQueue::::get().len() as u32; log::info!( @@ -100,7 +100,7 @@ mod v1 { } #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), sp_runtime::TryRuntimeError> { + fn post_upgrade(state: alloc::vec::Vec) -> Result<(), sp_runtime::TryRuntimeError> { log::info!(target: LOG_TARGET, "Running post_upgrade()"); ensure!( diff --git a/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs b/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs index 03f05842bca4..f045e957a690 100644 --- a/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs +++ b/polkadot/runtime/parachains/src/assigner_on_demand/mod.rs @@ -61,7 +61,6 @@ use sp_runtime::{ traits::{AccountIdConversion, One, SaturatedConversion}, FixedPointNumber, FixedPointOperand, FixedU128, Perbill, Saturating, }; -use sp_std::prelude::*; use types::{ BalanceOf, CoreAffinityCount, EnqueuedOrder, QueuePushDirection, QueueStatusType, SpotTrafficCalculationErr, diff --git a/polkadot/runtime/parachains/src/assigner_on_demand/tests.rs b/polkadot/runtime/parachains/src/assigner_on_demand/tests.rs index a6074b305b4e..0bad4346cfd9 100644 --- a/polkadot/runtime/parachains/src/assigner_on_demand/tests.rs +++ b/polkadot/runtime/parachains/src/assigner_on_demand/tests.rs @@ -30,16 +30,14 @@ use crate::{ }, paras::{ParaGenesisArgs, ParaKind}, }; +use alloc::collections::btree_map::BTreeMap; +use core::cmp::{Ord, Ordering}; use frame_support::{assert_noop, assert_ok}; use pallet_balances::Error as BalancesError; use polkadot_primitives::{ BlockNumber, SessionIndex, ValidationCode, ON_DEMAND_MAX_QUEUE_MAX_SIZE, }; use sp_runtime::traits::BadOrigin; -use sp_std::{ - cmp::{Ord, Ordering}, - collections::btree_map::BTreeMap, -}; fn schedule_blank_para(id: ParaId, parakind: ParaKind) { let validation_code: ValidationCode = vec![1, 2, 3].into(); diff --git a/polkadot/runtime/parachains/src/assigner_on_demand/types.rs b/polkadot/runtime/parachains/src/assigner_on_demand/types.rs index 51d586a77a17..96367b971fed 100644 --- a/polkadot/runtime/parachains/src/assigner_on_demand/types.rs +++ b/polkadot/runtime/parachains/src/assigner_on_demand/types.rs @@ -18,16 +18,13 @@ use super::{alloc, pallet::Config}; use alloc::collections::BinaryHeap; +use core::cmp::{Ord, Ordering, PartialOrd}; use frame_support::{ pallet_prelude::{Decode, Encode, RuntimeDebug, TypeInfo}, traits::Currency, }; use polkadot_primitives::{CoreIndex, Id as ParaId, ON_DEMAND_MAX_QUEUE_MAX_SIZE}; use sp_runtime::FixedU128; -use sp_std::{ - cmp::{Ord, Ordering, PartialOrd}, - prelude::*, -}; /// Shorthand for the Balance type the runtime is using. pub type BalanceOf = diff --git a/polkadot/runtime/parachains/src/assigner_parachains/tests.rs b/polkadot/runtime/parachains/src/assigner_parachains/tests.rs index 14cb1a897860..817e43a7138d 100644 --- a/polkadot/runtime/parachains/src/assigner_parachains/tests.rs +++ b/polkadot/runtime/parachains/src/assigner_parachains/tests.rs @@ -23,9 +23,9 @@ use crate::{ }, paras::{ParaGenesisArgs, ParaKind}, }; +use alloc::collections::btree_map::BTreeMap; use frame_support::{assert_ok, pallet_prelude::*}; use polkadot_primitives::{BlockNumber, Id as ParaId, SessionIndex, ValidationCode}; -use sp_std::collections::btree_map::BTreeMap; fn schedule_blank_para(id: ParaId, parakind: ParaKind) { let validation_code: ValidationCode = vec![1, 2, 3].into(); diff --git a/polkadot/runtime/parachains/src/builder.rs b/polkadot/runtime/parachains/src/builder.rs index c046526ba372..ec07cca2107e 100644 --- a/polkadot/runtime/parachains/src/builder.rs +++ b/polkadot/runtime/parachains/src/builder.rs @@ -21,6 +21,11 @@ use crate::{ scheduler::{self, common::AssignmentProvider, CoreOccupied, ParasEntry}, session_info, shared, }; +use alloc::{ + collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, + vec, + vec::Vec, +}; use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec}; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; @@ -39,11 +44,6 @@ use sp_runtime::{ traits::{Header as HeaderT, One, TrailingZeroInput, Zero}, RuntimeAppPublic, }; -use sp_std::{ - collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, - prelude::Vec, - vec, -}; fn mock_validation_code() -> ValidationCode { ValidationCode(vec![1, 2, 3]) @@ -112,7 +112,7 @@ pub(crate) struct BenchBuilder { fill_claimqueue: bool, /// Cores which should not be available when being populated with pending candidates. unavailable_cores: Vec, - _phantom: sp_std::marker::PhantomData, + _phantom: core::marker::PhantomData, } /// Paras inherent `enter` benchmark scenario. @@ -143,7 +143,7 @@ impl BenchBuilder { code_upgrade: None, fill_claimqueue: true, unavailable_cores: vec![], - _phantom: sp_std::marker::PhantomData::, + _phantom: core::marker::PhantomData::, } } diff --git a/polkadot/runtime/parachains/src/configuration.rs b/polkadot/runtime/parachains/src/configuration.rs index bffeab4a0d21..d09962ef2b44 100644 --- a/polkadot/runtime/parachains/src/configuration.rs +++ b/polkadot/runtime/parachains/src/configuration.rs @@ -19,6 +19,7 @@ //! Configuration can change only at session boundaries and is buffered until then. use crate::{inclusion::MAX_UPWARD_MESSAGE_SIZE_BOUND, shared}; +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::{pallet_prelude::*, DefaultNoBound}; use frame_system::pallet_prelude::*; @@ -31,7 +32,6 @@ use polkadot_primitives::{ MAX_POV_SIZE, ON_DEMAND_MAX_QUEUE_MAX_SIZE, }; use sp_runtime::{traits::Zero, Perbill, Percent}; -use sp_std::prelude::*; #[cfg(test)] mod tests; @@ -345,7 +345,7 @@ pub enum InconsistentError { impl HostConfiguration where - BlockNumber: Zero + PartialOrd + sp_std::fmt::Debug + Clone + From, + BlockNumber: Zero + PartialOrd + core::fmt::Debug + Clone + From, { /// Checks that this instance is consistent with the requirements on each individual member. /// @@ -1469,7 +1469,7 @@ impl Pallet { /// The implementation of `Get<(u32, u32)>` which reads `ActiveConfig` and returns `P` percent of /// `hrmp_channel_max_message_size` / `hrmp_channel_max_capacity`. -pub struct ActiveConfigHrmpChannelSizeAndCapacityRatio(sp_std::marker::PhantomData<(T, P)>); +pub struct ActiveConfigHrmpChannelSizeAndCapacityRatio(core::marker::PhantomData<(T, P)>); impl> Get<(u32, u32)> for ActiveConfigHrmpChannelSizeAndCapacityRatio { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v10.rs b/polkadot/runtime/parachains/src/configuration/migration/v10.rs index c53f58faaf03..9375af88306f 100644 --- a/polkadot/runtime/parachains/src/configuration/migration/v10.rs +++ b/polkadot/runtime/parachains/src/configuration/migration/v10.rs @@ -17,6 +17,7 @@ //! A module that is responsible for migration of storage. use crate::configuration::{Config, Pallet}; +use alloc::vec::Vec; use frame_support::{ pallet_prelude::*, traits::{Defensive, UncheckedOnRuntimeUpgrade}, @@ -28,7 +29,6 @@ use polkadot_primitives::{ LEGACY_MIN_BACKING_VOTES, ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE, }; use sp_runtime::Perbill; -use sp_std::vec::Vec; use super::v9::V9HostConfiguration; // All configuration of the runtime with respect to paras. @@ -164,7 +164,7 @@ mod v10 { >; } -pub struct VersionUncheckedMigrateToV10(sp_std::marker::PhantomData); +pub struct VersionUncheckedMigrateToV10(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV10 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v11.rs b/polkadot/runtime/parachains/src/configuration/migration/v11.rs index 4d1bfc26196c..4dce48fe52b0 100644 --- a/polkadot/runtime/parachains/src/configuration/migration/v11.rs +++ b/polkadot/runtime/parachains/src/configuration/migration/v11.rs @@ -17,6 +17,7 @@ //! A module that is responsible for migration of storage. use crate::configuration::{self, Config, Pallet}; +use alloc::vec::Vec; use frame_support::{ migrations::VersionedMigration, pallet_prelude::*, @@ -28,7 +29,6 @@ use polkadot_primitives::{ ApprovalVotingParams, AsyncBackingParams, ExecutorParams, NodeFeatures, SessionIndex, LEGACY_MIN_BACKING_VOTES, ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE, }; -use sp_std::vec::Vec; use polkadot_core_primitives::Balance; use sp_arithmetic::Perbill; @@ -177,7 +177,7 @@ pub type MigrateToV11 = VersionedMigration< ::DbWeight, >; -pub struct UncheckedMigrateToV11(sp_std::marker::PhantomData); +pub struct UncheckedMigrateToV11(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for UncheckedMigrateToV11 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v12.rs b/polkadot/runtime/parachains/src/configuration/migration/v12.rs index 126597ed8454..6b77655687f0 100644 --- a/polkadot/runtime/parachains/src/configuration/migration/v12.rs +++ b/polkadot/runtime/parachains/src/configuration/migration/v12.rs @@ -17,6 +17,7 @@ //! A module that is responsible for migration of storage. use crate::configuration::{self, migration::v11::V11HostConfiguration, Config, Pallet}; +use alloc::vec::Vec; use frame_support::{ migrations::VersionedMigration, pallet_prelude::*, @@ -26,7 +27,6 @@ use frame_system::pallet_prelude::BlockNumberFor; use polkadot_primitives::vstaging::SchedulerParams; use sp_core::Get; use sp_staking::SessionIndex; -use sp_std::vec::Vec; type V12HostConfiguration = configuration::HostConfiguration; @@ -68,7 +68,7 @@ pub type MigrateToV12 = VersionedMigration< ::DbWeight, >; -pub struct UncheckedMigrateToV12(sp_std::marker::PhantomData); +pub struct UncheckedMigrateToV12(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for UncheckedMigrateToV12 { #[cfg(feature = "try-runtime")] diff --git a/polkadot/runtime/parachains/src/configuration/migration/v6.rs b/polkadot/runtime/parachains/src/configuration/migration/v6.rs index bec41d3ea0dc..468bf78692a1 100644 --- a/polkadot/runtime/parachains/src/configuration/migration/v6.rs +++ b/polkadot/runtime/parachains/src/configuration/migration/v6.rs @@ -17,13 +17,11 @@ //! Contains the V6 storage definition of the host configuration. use crate::configuration::{Config, Pallet}; +use alloc::vec::Vec; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::BlockNumberFor; -use sp_std::vec::Vec; use polkadot_primitives::{AsyncBackingParams, Balance, ExecutorParams, SessionIndex}; -#[cfg(feature = "try-runtime")] -use sp_std::prelude::*; #[derive(codec::Encode, codec::Decode, Debug, Clone)] pub struct V6HostConfiguration { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v7.rs b/polkadot/runtime/parachains/src/configuration/migration/v7.rs index 8fe4087cf9b1..9acd28d0f764 100644 --- a/polkadot/runtime/parachains/src/configuration/migration/v7.rs +++ b/polkadot/runtime/parachains/src/configuration/migration/v7.rs @@ -17,6 +17,7 @@ //! A module that is responsible for migration of storage. use crate::configuration::{self, Config, Pallet}; +use alloc::vec::Vec; use frame_support::{ pallet_prelude::*, traits::{Defensive, StorageVersion}, @@ -24,7 +25,6 @@ use frame_support::{ }; use frame_system::pallet_prelude::BlockNumberFor; use polkadot_primitives::{AsyncBackingParams, Balance, ExecutorParams, SessionIndex}; -use sp_std::vec::Vec; use frame_support::traits::OnRuntimeUpgrade; @@ -154,7 +154,7 @@ mod v7 { >; } -pub struct MigrateToV7(sp_std::marker::PhantomData); +pub struct MigrateToV7(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV7 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v8.rs b/polkadot/runtime/parachains/src/configuration/migration/v8.rs index 0aa7f550b102..81ced74bebb9 100644 --- a/polkadot/runtime/parachains/src/configuration/migration/v8.rs +++ b/polkadot/runtime/parachains/src/configuration/migration/v8.rs @@ -17,6 +17,7 @@ //! A module that is responsible for migration of storage. use crate::configuration::{self, Config, Pallet}; +use alloc::vec::Vec; use frame_support::{ pallet_prelude::*, traits::{Defensive, StorageVersion}, @@ -27,7 +28,6 @@ use polkadot_primitives::{ AsyncBackingParams, Balance, ExecutorParams, SessionIndex, ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE, }; use sp_runtime::Perbill; -use sp_std::vec::Vec; use frame_support::traits::OnRuntimeUpgrade; @@ -161,7 +161,7 @@ mod v8 { >; } -pub struct MigrateToV8(sp_std::marker::PhantomData); +pub struct MigrateToV8(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV8 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v9.rs b/polkadot/runtime/parachains/src/configuration/migration/v9.rs index 6afdd3cec29e..dff5fdb17a69 100644 --- a/polkadot/runtime/parachains/src/configuration/migration/v9.rs +++ b/polkadot/runtime/parachains/src/configuration/migration/v9.rs @@ -17,6 +17,7 @@ //! A module that is responsible for migration of storage. use crate::configuration::{self, Config, Pallet}; +use alloc::vec::Vec; use frame_support::{ pallet_prelude::*, traits::{Defensive, StorageVersion}, @@ -28,7 +29,6 @@ use polkadot_primitives::{ ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE, }; use sp_runtime::Perbill; -use sp_std::vec::Vec; use frame_support::traits::OnRuntimeUpgrade; @@ -164,7 +164,7 @@ mod v9 { >; } -pub struct MigrateToV9(sp_std::marker::PhantomData); +pub struct MigrateToV9(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV9 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/coretime/migration.rs b/polkadot/runtime/parachains/src/coretime/migration.rs index 3f82472da8aa..4e7508867559 100644 --- a/polkadot/runtime/parachains/src/coretime/migration.rs +++ b/polkadot/runtime/parachains/src/coretime/migration.rs @@ -26,10 +26,12 @@ mod v_coretime { coretime::{mk_coretime_call, Config, PartsOf57600, WeightInfo}, paras, }; + use alloc::{vec, vec::Vec}; #[cfg(feature = "try-runtime")] use codec::Decode; #[cfg(feature = "try-runtime")] use codec::Encode; + use core::{iter, result}; #[cfg(feature = "try-runtime")] use frame_support::ensure; use frame_support::{ @@ -43,9 +45,6 @@ mod v_coretime { use sp_arithmetic::traits::SaturatedConversion; use sp_core::Get; use sp_runtime::BoundedVec; - #[cfg(feature = "try-runtime")] - use sp_std::vec::Vec; - use sp_std::{iter, prelude::*, result}; use xcm::prelude::{send_xcm, Instruction, Junction, Location, SendError, WeightLimit, Xcm}; /// Return information about a legacy lease of a parachain. @@ -59,7 +58,7 @@ mod v_coretime { /// This assumes that the `Coretime` and the `AssignerCoretime` pallets are added at the same /// time to a runtime. pub struct MigrateToCoretime( - sp_std::marker::PhantomData<(T, SendXcm, LegacyLease)>, + core::marker::PhantomData<(T, SendXcm, LegacyLease)>, ); impl>> diff --git a/polkadot/runtime/parachains/src/coretime/mod.rs b/polkadot/runtime/parachains/src/coretime/mod.rs index fc8a3c7d9d24..1c38b3989232 100644 --- a/polkadot/runtime/parachains/src/coretime/mod.rs +++ b/polkadot/runtime/parachains/src/coretime/mod.rs @@ -18,6 +18,8 @@ //! //! +use alloc::{vec, vec::Vec}; +use core::result; use frame_support::{ pallet_prelude::*, traits::{defensive_prelude::*, Currency}, @@ -28,7 +30,6 @@ use pallet_broker::{CoreAssignment, CoreIndex as BrokerCoreIndex}; use polkadot_primitives::{Balance, BlockNumber, CoreIndex, Id as ParaId}; use sp_arithmetic::traits::SaturatedConversion; use sp_runtime::traits::TryConvert; -use sp_std::{prelude::*, result}; use xcm::{ prelude::{send_xcm, Instruction, Junction, Location, OriginKind, SendXcm, WeightLimit, Xcm}, v4::{ diff --git a/polkadot/runtime/parachains/src/disputes.rs b/polkadot/runtime/parachains/src/disputes.rs index 4a0f2390b45d..f86573dadf56 100644 --- a/polkadot/runtime/parachains/src/disputes.rs +++ b/polkadot/runtime/parachains/src/disputes.rs @@ -19,8 +19,10 @@ use crate::{ configuration, initializer::SessionChangeNotification, metrics::METRICS, session_info, }; +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use bitvec::{bitvec, order::Lsb0 as BitOrderLsb0}; use codec::{Decode, Encode}; +use core::cmp::Ordering; use frame_support::{ensure, weights::Weight}; use frame_system::pallet_prelude::*; use polkadot_primitives::{ @@ -36,7 +38,6 @@ use sp_runtime::{ traits::{AppVerify, One, Saturating, Zero}, DispatchError, RuntimeDebug, SaturatedConversion, }; -use sp_std::{cmp::Ordering, collections::btree_set::BTreeSet, prelude::*}; #[cfg(test)] #[allow(unused_imports)] diff --git a/polkadot/runtime/parachains/src/disputes/migration.rs b/polkadot/runtime/parachains/src/disputes/migration.rs index e12edffb51b3..dd32340c9f64 100644 --- a/polkadot/runtime/parachains/src/disputes/migration.rs +++ b/polkadot/runtime/parachains/src/disputes/migration.rs @@ -21,16 +21,16 @@ use frame_support::traits::StorageVersion; pub mod v1 { use super::*; use crate::disputes::{Config, Pallet}; + use alloc::vec::Vec; use frame_support::{ pallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade, weights::Weight, }; use polkadot_primitives::SessionIndex; - use sp_std::prelude::*; #[storage_alias] type SpamSlots = StorageMap, Twox64Concat, SessionIndex, Vec>; - pub struct MigrateToV1(sp_std::marker::PhantomData); + pub struct MigrateToV1(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV1 { fn on_runtime_upgrade() -> Weight { let mut weight: Weight = Weight::zero(); diff --git a/polkadot/runtime/parachains/src/disputes/slashing.rs b/polkadot/runtime/parachains/src/disputes/slashing.rs index b50853ecc696..4b76fb47e1f8 100644 --- a/polkadot/runtime/parachains/src/disputes/slashing.rs +++ b/polkadot/runtime/parachains/src/disputes/slashing.rs @@ -50,6 +50,12 @@ use frame_support::{ }; use frame_system::pallet_prelude::BlockNumberFor; +use alloc::{ + boxed::Box, + collections::{btree_map::Entry, btree_set::BTreeSet}, + vec, + vec::Vec, +}; use polkadot_primitives::{ slashing::{DisputeProof, DisputesTimeSlot, PendingSlashes, SlashingOffenceKind}, CandidateHash, SessionIndex, ValidatorId, ValidatorIndex, @@ -65,10 +71,6 @@ use sp_runtime::{ }; use sp_session::{GetSessionNumber, GetValidatorCount}; use sp_staking::offence::{Kind, Offence, OffenceError, ReportOffence}; -use sp_std::{ - collections::{btree_map::Entry, btree_set::BTreeSet}, - prelude::*, -}; const LOG_TARGET: &str = "runtime::parachains::slashing"; @@ -158,7 +160,7 @@ impl SlashingOffence { /// This type implements `SlashingHandler`. pub struct SlashValidatorsForDisputes { - _phantom: sp_std::marker::PhantomData, + _phantom: core::marker::PhantomData, } impl Default for SlashValidatorsForDisputes { @@ -640,7 +642,7 @@ fn is_known_offence( /// When configured properly, should be instantiated with /// `T::KeyOwnerIdentification, Offences, ReportLongevity` parameters. pub struct SlashingReportHandler { - _phantom: sp_std::marker::PhantomData<(I, R, L)>, + _phantom: core::marker::PhantomData<(I, R, L)>, } impl Default for SlashingReportHandler { diff --git a/polkadot/runtime/parachains/src/dmp.rs b/polkadot/runtime/parachains/src/dmp.rs index c0e1635ba169..54e112d1b8b4 100644 --- a/polkadot/runtime/parachains/src/dmp.rs +++ b/polkadot/runtime/parachains/src/dmp.rs @@ -46,6 +46,8 @@ use crate::{ configuration::{self, HostConfiguration}, initializer, FeeTracker, }; +use alloc::vec::Vec; +use core::fmt; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::BlockNumberFor; use polkadot_primitives::{DownwardMessage, Hash, Id as ParaId, InboundDownwardMessage}; @@ -54,7 +56,6 @@ use sp_runtime::{ traits::{BlakeTwo256, Hash as HashT, SaturatedConversion}, FixedU128, Saturating, }; -use sp_std::{fmt, prelude::*}; use xcm::latest::SendError; pub use pallet::*; diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index e34e4a03e711..8b01a755c3c7 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -18,7 +18,13 @@ use crate::{ configuration::{self, HostConfiguration}, dmp, ensure_parachain, initializer, paras, }; +use alloc::{ + collections::{btree_map::BTreeMap, btree_set::BTreeSet}, + vec, + vec::Vec, +}; use codec::{Decode, Encode}; +use core::{fmt, mem}; use frame_support::{pallet_prelude::*, traits::ReservableCurrency, DefaultNoBound}; use frame_system::pallet_prelude::*; use polkadot_parachain_primitives::primitives::{HorizontalMessages, IsSystem}; @@ -31,11 +37,6 @@ use sp_runtime::{ traits::{AccountIdConversion, BlakeTwo256, Hash as HashT, UniqueSaturatedInto, Zero}, ArithmeticError, }; -use sp_std::{ - collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - fmt, mem, - prelude::*, -}; pub use pallet::*; @@ -487,7 +488,7 @@ pub mod pallet { #[derive(DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - _config: sp_std::marker::PhantomData, + _config: core::marker::PhantomData, preopen_hrmp_channels: Vec<(ParaId, ParaId, u32, u32)>, } diff --git a/polkadot/runtime/parachains/src/inclusion/migration.rs b/polkadot/runtime/parachains/src/inclusion/migration.rs index a340d52643e0..36a810d341c6 100644 --- a/polkadot/runtime/parachains/src/inclusion/migration.rs +++ b/polkadot/runtime/parachains/src/inclusion/migration.rs @@ -73,9 +73,9 @@ mod v1 { CandidatePendingAvailability as V1CandidatePendingAvailability, Config, Pallet, PendingAvailability as V1PendingAvailability, }; + use alloc::{collections::vec_deque::VecDeque, vec::Vec}; use frame_support::{traits::UncheckedOnRuntimeUpgrade, weights::Weight}; use sp_core::Get; - use sp_std::{collections::vec_deque::VecDeque, vec::Vec}; #[cfg(feature = "try-runtime")] use codec::{Decode, Encode}; @@ -85,7 +85,7 @@ mod v1 { traits::{GetStorageVersion, StorageVersion}, }; - pub struct VersionUncheckedMigrateToV1(sp_std::marker::PhantomData); + pub struct VersionUncheckedMigrateToV1(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1 { #[cfg(feature = "try-runtime")] diff --git a/polkadot/runtime/parachains/src/inclusion/mod.rs b/polkadot/runtime/parachains/src/inclusion/mod.rs index a86941a1a0b8..281dc5d0c5f4 100644 --- a/polkadot/runtime/parachains/src/inclusion/mod.rs +++ b/polkadot/runtime/parachains/src/inclusion/mod.rs @@ -27,8 +27,15 @@ use crate::{ shared::{self, AllowedRelayParentsTracker}, util::make_persisted_validation_data_with_parent, }; +use alloc::{ + collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, + vec, + vec::Vec, +}; use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec}; use codec::{Decode, Encode}; +#[cfg(feature = "std")] +use core::fmt; use frame_support::{ defensive, pallet_prelude::*, @@ -46,12 +53,6 @@ use polkadot_primitives::{ }; use scale_info::TypeInfo; use sp_runtime::{traits::One, DispatchError, SaturatedConversion, Saturating}; -#[cfg(feature = "std")] -use sp_std::fmt; -use sp_std::{ - collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque}, - prelude::*, -}; pub use pallet::*; diff --git a/polkadot/runtime/parachains/src/initializer.rs b/polkadot/runtime/parachains/src/initializer.rs index fd0f1c3c0651..340f727097b5 100644 --- a/polkadot/runtime/parachains/src/initializer.rs +++ b/polkadot/runtime/parachains/src/initializer.rs @@ -25,6 +25,7 @@ use crate::{ disputes::{self, DisputesHandler as _, SlashingHandler as _}, dmp, hrmp, inclusion, paras, scheduler, session_info, shared, }; +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::{ traits::{OneSessionHandler, Randomness}, @@ -33,7 +34,6 @@ use frame_support::{ use frame_system::limits::BlockWeights; use polkadot_primitives::{BlockNumber, ConsensusLog, SessionIndex, ValidatorId}; use scale_info::TypeInfo; -use sp_std::prelude::*; #[cfg(test)] mod tests; @@ -249,7 +249,7 @@ impl Pallet { // TODO: audit usage of randomness API // https://github.com/paritytech/polkadot/issues/2601 let (random_hash, _) = T::Randomness::random(&b"paras"[..]); - let len = sp_std::cmp::min(32, random_hash.as_ref().len()); + let len = core::cmp::min(32, random_hash.as_ref().len()); buf[..len].copy_from_slice(&random_hash.as_ref()[..len]); buf }; diff --git a/polkadot/runtime/parachains/src/lib.rs b/polkadot/runtime/parachains/src/lib.rs index 51110e89416c..f2995d770e71 100644 --- a/polkadot/runtime/parachains/src/lib.rs +++ b/polkadot/runtime/parachains/src/lib.rs @@ -53,6 +53,8 @@ mod mock; #[cfg(test)] mod ump_tests; +extern crate alloc; + pub use origin::{ensure_parachain, Origin}; pub use paras::{ParaLifecycle, UpgradeStrategy}; use polkadot_primitives::{HeadData, Id as ParaId, ValidationCode}; diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index 9c23347ebb58..45576668f6d6 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -51,11 +51,10 @@ use sp_runtime::{ transaction_validity::TransactionPriority, BuildStorage, FixedU128, Perbill, Permill, }; -use sp_std::{ +use std::{ cell::RefCell, - collections::{btree_map::BTreeMap, vec_deque::VecDeque}, + collections::{btree_map::BTreeMap, vec_deque::VecDeque, HashMap}, }; -use std::collections::HashMap; use xcm::{ prelude::XcmVersion, v4::{Assets, InteriorLocation, Location, SendError, SendResult, SendXcm, Xcm, XcmHash}, @@ -677,7 +676,7 @@ impl inclusion::RewardValidators for TestRewardValidators { /// Create a new set of test externalities. pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities { use sp_keystore::{testing::MemoryKeystore, KeystoreExt, KeystorePtr}; - use sp_std::sync::Arc; + use std::sync::Arc; sp_tracing::try_init_simple(); diff --git a/polkadot/runtime/parachains/src/origin.rs b/polkadot/runtime/parachains/src/origin.rs index 5202cba232d2..fd22929b08ff 100644 --- a/polkadot/runtime/parachains/src/origin.rs +++ b/polkadot/runtime/parachains/src/origin.rs @@ -16,9 +16,9 @@ //! Declaration of the parachain specific origin and a pallet that hosts it. +use core::result; use polkadot_primitives::Id as ParaId; use sp_runtime::traits::BadOrigin; -use sp_std::result; pub use pallet::*; diff --git a/polkadot/runtime/parachains/src/paras/benchmarking.rs b/polkadot/runtime/parachains/src/paras/benchmarking.rs index 0f3318612a77..630b86132ab8 100644 --- a/polkadot/runtime/parachains/src/paras/benchmarking.rs +++ b/polkadot/runtime/parachains/src/paras/benchmarking.rs @@ -16,6 +16,7 @@ use super::*; use crate::configuration::HostConfiguration; +use alloc::vec; use frame_benchmarking::benchmarks; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use polkadot_primitives::{ diff --git a/polkadot/runtime/parachains/src/paras/benchmarking/pvf_check.rs b/polkadot/runtime/parachains/src/paras/benchmarking/pvf_check.rs index 0bf5fe783a0e..80443c7626e2 100644 --- a/polkadot/runtime/parachains/src/paras/benchmarking/pvf_check.rs +++ b/polkadot/runtime/parachains/src/paras/benchmarking/pvf_check.rs @@ -17,6 +17,7 @@ //! This module focuses on the benchmarking of the `include_pvf_check_statement` dispatchable. use crate::{configuration, paras::*, shared::Pallet as ParasShared}; +use alloc::{vec, vec::Vec}; use frame_support::assert_ok; use frame_system::RawOrigin; use polkadot_primitives::{HeadData, Id as ParaId, ValidationCode, ValidatorId, ValidatorIndex}; diff --git a/polkadot/runtime/parachains/src/paras/mod.rs b/polkadot/runtime/parachains/src/paras/mod.rs index 8cffcbbbb024..3f0b8659b159 100644 --- a/polkadot/runtime/parachains/src/paras/mod.rs +++ b/polkadot/runtime/parachains/src/paras/mod.rs @@ -113,8 +113,10 @@ use crate::{ initializer::SessionChangeNotification, shared, }; +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec}; use codec::{Decode, Encode}; +use core::{cmp, mem}; use frame_support::{pallet_prelude::*, traits::EstimateNextSessionRotation, DefaultNoBound}; use frame_system::pallet_prelude::*; use polkadot_primitives::{ @@ -127,7 +129,6 @@ use sp_runtime::{ traits::{AppVerify, One, Saturating}, DispatchResult, SaturatedConversion, }; -use sp_std::{cmp, collections::btree_set::BTreeSet, mem, prelude::*}; use serde::{Deserialize, Serialize}; @@ -863,7 +864,7 @@ pub mod pallet { #[derive(DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, pub paras: Vec<(ParaId, ParaGenesisArgs)>, } diff --git a/polkadot/runtime/parachains/src/paras_inherent/benchmarking.rs b/polkadot/runtime/parachains/src/paras_inherent/benchmarking.rs index 4c8b093451ed..c5284ba1dd1f 100644 --- a/polkadot/runtime/parachains/src/paras_inherent/benchmarking.rs +++ b/polkadot/runtime/parachains/src/paras_inherent/benchmarking.rs @@ -16,9 +16,10 @@ use super::*; use crate::{inclusion, ParaId}; +use alloc::collections::btree_map::BTreeMap; +use core::cmp::min; use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; use frame_system::RawOrigin; -use sp_std::{cmp::min, collections::btree_map::BTreeMap}; use polkadot_primitives::v7::GroupIndex; diff --git a/polkadot/runtime/parachains/src/paras_inherent/misc.rs b/polkadot/runtime/parachains/src/paras_inherent/misc.rs index dac9e6e256d0..2858c3f95de2 100644 --- a/polkadot/runtime/parachains/src/paras_inherent/misc.rs +++ b/polkadot/runtime/parachains/src/paras_inherent/misc.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use sp_std::{cmp::Ordering, vec::Vec}; +use alloc::vec::Vec; +use core::cmp::Ordering; /// A helper trait to allow calling retain while getting access /// to the index of the item in the `vec`. diff --git a/polkadot/runtime/parachains/src/paras_inherent/mod.rs b/polkadot/runtime/parachains/src/paras_inherent/mod.rs index 8b527c09490d..fe4eef16f022 100644 --- a/polkadot/runtime/parachains/src/paras_inherent/mod.rs +++ b/polkadot/runtime/parachains/src/paras_inherent/mod.rs @@ -32,6 +32,11 @@ use crate::{ shared::{self, AllowedRelayParentsTracker}, ParaId, }; +use alloc::{ + collections::{btree_map::BTreeMap, btree_set::BTreeSet}, + vec, + vec::Vec, +}; use bitvec::prelude::BitVec; use frame_support::{ defensive, @@ -53,11 +58,6 @@ use polkadot_primitives::{ use rand::{seq::SliceRandom, SeedableRng}; use scale_info::TypeInfo; use sp_runtime::traits::{Header as HeaderT, One}; -use sp_std::{ - collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - prelude::*, - vec::Vec, -}; mod misc; mod weights; @@ -295,7 +295,7 @@ impl Pallet { fn process_inherent_data( data: ParachainsInherentData>, context: ProcessInherentDataContext, - ) -> sp_std::result::Result< + ) -> core::result::Result< (ParachainsInherentData>, PostDispatchInfo), DispatchErrorWithPostInfo, > { @@ -762,7 +762,7 @@ pub(crate) fn apply_weight_limit( let mut chained_candidates: Vec> = Vec::new(); let mut current_para_id = None; - for candidate in sp_std::mem::take(candidates).into_iter() { + for candidate in core::mem::take(candidates).into_iter() { let candidate_para_id = candidate.descriptor().para_id; if Some(candidate_para_id) == current_para_id { let chain = chained_candidates diff --git a/polkadot/runtime/parachains/src/paras_inherent/tests.rs b/polkadot/runtime/parachains/src/paras_inherent/tests.rs index abf1c1a56b24..0d5653eb729d 100644 --- a/polkadot/runtime/parachains/src/paras_inherent/tests.rs +++ b/polkadot/runtime/parachains/src/paras_inherent/tests.rs @@ -53,13 +53,13 @@ mod enter { }, session_info, }; + use alloc::collections::btree_map::BTreeMap; use assert_matches::assert_matches; use core::panic; use frame_support::assert_ok; use frame_system::limits; use polkadot_primitives::{vstaging::SchedulerParams, AvailabilityBitfield, UncheckedSigned}; use sp_runtime::Perbill; - use sp_std::collections::btree_map::BTreeMap; struct TestConfig { dispute_statements: BTreeMap, @@ -1744,8 +1744,8 @@ mod sanitizers { scheduler::{common::Assignment, ParasEntry}, util::{make_persisted_validation_data, make_persisted_validation_data_with_parent}, }; + use alloc::collections::vec_deque::VecDeque; use polkadot_primitives::ValidationCode; - use sp_std::collections::vec_deque::VecDeque; use super::*; diff --git a/polkadot/runtime/parachains/src/reward_points.rs b/polkadot/runtime/parachains/src/reward_points.rs index 5f45445b0ba2..69ef2db756c2 100644 --- a/polkadot/runtime/parachains/src/reward_points.rs +++ b/polkadot/runtime/parachains/src/reward_points.rs @@ -22,9 +22,9 @@ //! for the time being, although we will build schemes to do so in the future. use crate::{session_info, shared}; +use alloc::collections::btree_set::BTreeSet; use frame_support::traits::{Defensive, ValidatorSet}; use polkadot_primitives::{SessionIndex, ValidatorIndex}; -use sp_std::collections::btree_set::BTreeSet; /// The amount of era points given by backing a candidate that is included. pub const BACKING_POINTS: u32 = 20; @@ -32,7 +32,7 @@ pub const BACKING_POINTS: u32 = 20; pub const DISPUTE_STATEMENT_POINTS: u32 = 20; /// Rewards validators for participating in parachains with era points in pallet-staking. -pub struct RewardValidatorsWithEraPoints(sp_std::marker::PhantomData); +pub struct RewardValidatorsWithEraPoints(core::marker::PhantomData); impl RewardValidatorsWithEraPoints where diff --git a/polkadot/runtime/parachains/src/runtime_api_impl/v10.rs b/polkadot/runtime/parachains/src/runtime_api_impl/v10.rs index 4417ec75abd6..697890232211 100644 --- a/polkadot/runtime/parachains/src/runtime_api_impl/v10.rs +++ b/polkadot/runtime/parachains/src/runtime_api_impl/v10.rs @@ -22,6 +22,7 @@ use crate::{ scheduler::{self, CoreOccupied}, session_info, shared, }; +use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; use frame_support::traits::{GetStorageVersion, StorageVersion}; use frame_system::pallet_prelude::*; use polkadot_primitives::{ @@ -37,7 +38,6 @@ use polkadot_primitives::{ ValidatorId, ValidatorIndex, ValidatorSignature, }; use sp_runtime::traits::One; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; /// Implementation for the `validators` function of the runtime API. pub fn validators() -> Vec { diff --git a/polkadot/runtime/parachains/src/runtime_api_impl/vstaging.rs b/polkadot/runtime/parachains/src/runtime_api_impl/vstaging.rs index f4e3db185fea..4aa381e33b1b 100644 --- a/polkadot/runtime/parachains/src/runtime_api_impl/vstaging.rs +++ b/polkadot/runtime/parachains/src/runtime_api_impl/vstaging.rs @@ -17,12 +17,12 @@ //! Put implementations of functions from staging APIs here. use crate::{configuration, inclusion, initializer, scheduler}; -use polkadot_primitives::{CommittedCandidateReceipt, CoreIndex, Id as ParaId}; -use sp_runtime::traits::One; -use sp_std::{ +use alloc::{ collections::{btree_map::BTreeMap, vec_deque::VecDeque}, vec::Vec, }; +use polkadot_primitives::{CommittedCandidateReceipt, CoreIndex, Id as ParaId}; +use sp_runtime::traits::One; /// Returns the claimqueue from the scheduler pub fn claim_queue() -> BTreeMap> { diff --git a/polkadot/runtime/parachains/src/scheduler.rs b/polkadot/runtime/parachains/src/scheduler.rs index d7fe5c06863c..445583d929ab 100644 --- a/polkadot/runtime/parachains/src/scheduler.rs +++ b/polkadot/runtime/parachains/src/scheduler.rs @@ -39,6 +39,13 @@ use core::iter::Peekable; use crate::{configuration, initializer::SessionChangeNotification, paras}; +use alloc::{ + collections::{ + btree_map::{self, BTreeMap}, + vec_deque::VecDeque, + }, + vec::Vec, +}; use frame_support::{pallet_prelude::*, traits::Defensive}; use frame_system::pallet_prelude::BlockNumberFor; pub use polkadot_core_primitives::v2::BlockNumber; @@ -46,13 +53,6 @@ use polkadot_primitives::{ CoreIndex, GroupIndex, GroupRotationInfo, Id as ParaId, ScheduledCore, ValidatorIndex, }; use sp_runtime::traits::One; -use sp_std::{ - collections::{ - btree_map::{self, BTreeMap}, - vec_deque::VecDeque, - }, - prelude::*, -}; pub mod common; @@ -314,10 +314,8 @@ impl Pallet { .into_iter() .filter(|(freed_index, _)| (freed_index.0 as usize) < c_len) .for_each(|(freed_index, freed_reason)| { - match sp_std::mem::replace( - &mut cores[freed_index.0 as usize], - CoreOccupied::Free, - ) { + match core::mem::replace(&mut cores[freed_index.0 as usize], CoreOccupied::Free) + { CoreOccupied::Free => {}, CoreOccupied::Paras(entry) => { match freed_reason { @@ -569,7 +567,7 @@ impl Pallet { fn push_occupied_cores_to_assignment_provider() { AvailabilityCores::::mutate(|cores| { for core in cores.iter_mut() { - match sp_std::mem::replace(core, CoreOccupied::Free) { + match core::mem::replace(core, CoreOccupied::Free) { CoreOccupied::Free => continue, CoreOccupied::Paras(entry) => { Self::maybe_push_assignment(entry); diff --git a/polkadot/runtime/parachains/src/scheduler/migration.rs b/polkadot/runtime/parachains/src/scheduler/migration.rs index 84d7d4b56710..125f105ef706 100644 --- a/polkadot/runtime/parachains/src/scheduler/migration.rs +++ b/polkadot/runtime/parachains/src/scheduler/migration.rs @@ -17,6 +17,7 @@ //! A module that is responsible for migration of storage. use super::*; +use alloc::vec::Vec; use frame_support::{ migrations::VersionedMigration, pallet_prelude::ValueQuery, storage_alias, traits::UncheckedOnRuntimeUpgrade, weights::Weight, @@ -164,7 +165,7 @@ mod v1 { } /// Migration to V1 - pub struct UncheckedMigrateToV1(sp_std::marker::PhantomData); + pub struct UncheckedMigrateToV1(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for UncheckedMigrateToV1 { fn on_runtime_upgrade() -> Weight { let mut weight: Weight = Weight::zero(); @@ -301,7 +302,7 @@ mod v2 { } /// Migration to V2 - pub struct UncheckedMigrateToV2(sp_std::marker::PhantomData); + pub struct UncheckedMigrateToV2(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for UncheckedMigrateToV2 { fn on_runtime_upgrade() -> Weight { diff --git a/polkadot/runtime/parachains/src/scheduler/tests.rs b/polkadot/runtime/parachains/src/scheduler/tests.rs index 32811241e171..f3866146e811 100644 --- a/polkadot/runtime/parachains/src/scheduler/tests.rs +++ b/polkadot/runtime/parachains/src/scheduler/tests.rs @@ -16,12 +16,12 @@ use super::*; +use alloc::collections::{btree_map::BTreeMap, btree_set::BTreeSet}; use frame_support::assert_ok; use polkadot_primitives::{ vstaging::SchedulerParams, BlockNumber, SessionIndex, ValidationCode, ValidatorId, }; use sp_keyring::Sr25519Keyring; -use sp_std::collections::{btree_map::BTreeMap, btree_set::BTreeSet}; use crate::{ configuration::HostConfiguration, diff --git a/polkadot/runtime/parachains/src/session_info.rs b/polkadot/runtime/parachains/src/session_info.rs index ff032f7e34d5..ea05c1aacaa9 100644 --- a/polkadot/runtime/parachains/src/session_info.rs +++ b/polkadot/runtime/parachains/src/session_info.rs @@ -24,6 +24,7 @@ use crate::{ configuration, paras, scheduler, shared, util::{take_active_subset, take_active_subset_and_inactive}, }; +use alloc::vec::Vec; use frame_support::{ pallet_prelude::*, traits::{OneSessionHandler, ValidatorSet, ValidatorSetWithIdentification}, @@ -32,7 +33,6 @@ use frame_system::pallet_prelude::BlockNumberFor; use polkadot_primitives::{ AssignmentId, AuthorityDiscoveryId, ExecutorParams, SessionIndex, SessionInfo, }; -use sp_std::vec::Vec; pub use pallet::*; diff --git a/polkadot/runtime/parachains/src/shared.rs b/polkadot/runtime/parachains/src/shared.rs index 417de1fa3fb0..154b7cfefc3a 100644 --- a/polkadot/runtime/parachains/src/shared.rs +++ b/polkadot/runtime/parachains/src/shared.rs @@ -19,14 +19,14 @@ //! To avoid cyclic dependencies, it is important that this pallet is not //! dependent on any of the other pallets. +use alloc::{ + collections::{btree_map::BTreeMap, vec_deque::VecDeque}, + vec::Vec, +}; use frame_support::{pallet_prelude::*, traits::DisabledValidators}; use frame_system::pallet_prelude::BlockNumberFor; use polkadot_primitives::{SessionIndex, ValidatorId, ValidatorIndex}; use sp_runtime::traits::AtLeast32BitUnsigned; -use sp_std::{ - collections::{btree_map::BTreeMap, vec_deque::VecDeque}, - vec::Vec, -}; use rand::{seq::SliceRandom, SeedableRng}; use rand_chacha::ChaCha20Rng; diff --git a/polkadot/runtime/parachains/src/ump_tests.rs b/polkadot/runtime/parachains/src/ump_tests.rs index 4d6da8c9e3c1..d914bf8b6661 100644 --- a/polkadot/runtime/parachains/src/ump_tests.rs +++ b/polkadot/runtime/parachains/src/ump_tests.rs @@ -34,7 +34,6 @@ use frame_support::{ use polkadot_primitives::{well_known_keys, Id as ParaId, UpwardMessage}; use sp_crypto_hashing::{blake2_256, twox_64}; use sp_runtime::traits::Bounded; -use sp_std::prelude::*; pub(super) struct GenesisConfigBuilder { max_upward_message_size: u32, diff --git a/polkadot/runtime/parachains/src/util.rs b/polkadot/runtime/parachains/src/util.rs index cb2deffd7f65..3588e494438d 100644 --- a/polkadot/runtime/parachains/src/util.rs +++ b/polkadot/runtime/parachains/src/util.rs @@ -17,9 +17,9 @@ //! Utilities that don't belong to any particular module but may draw //! on all modules. +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use frame_system::pallet_prelude::BlockNumberFor; use polkadot_primitives::{HeadData, Id as ParaId, PersistedValidationData, ValidatorIndex}; -use sp_std::{collections::btree_set::BTreeSet, vec::Vec}; use crate::{configuration, hrmp, paras}; @@ -118,7 +118,7 @@ pub fn take_active_subset(active: &[ValidatorIndex], set: &[T]) -> Vec #[cfg(test)] mod tests { - use sp_std::vec::Vec; + use alloc::vec::Vec; use crate::util::{split_active_subset, take_active_subset}; use polkadot_primitives::ValidatorIndex; diff --git a/polkadot/runtime/rococo/Cargo.toml b/polkadot/runtime/rococo/Cargo.toml index c4fbd461a631..f93a3ad65754 100644 --- a/polkadot/runtime/rococo/Cargo.toml +++ b/polkadot/runtime/rococo/Cargo.toml @@ -32,7 +32,6 @@ sp-genesis-builder = { workspace = true } sp-inherents = { workspace = true } sp-offchain = { workspace = true } sp-arithmetic = { workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-mmr-primitives = { workspace = true } sp-runtime = { workspace = true } @@ -209,7 +208,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", "sp-storage/std", "sp-tracing/std", "sp-transaction-pool/std", diff --git a/polkadot/runtime/rococo/src/genesis_config_presets.rs b/polkadot/runtime/rococo/src/genesis_config_presets.rs index 1c70c94ce048..67dcd6cd7a51 100644 --- a/polkadot/runtime/rococo/src/genesis_config_presets.rs +++ b/polkadot/runtime/rococo/src/genesis_config_presets.rs @@ -17,6 +17,9 @@ //! Genesis configs presets for the Rococo runtime use crate::{SessionKeys, BABE_GENESIS_EPOCH_CONFIG}; +#[cfg(not(feature = "std"))] +use alloc::format; +use alloc::vec::Vec; use polkadot_primitives::{ vstaging::SchedulerParams, AccountId, AccountPublic, AssignmentId, ValidatorId, }; @@ -27,9 +30,6 @@ use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, Pair, Public}; use sp_runtime::traits::IdentifyAccount; -#[cfg(not(feature = "std"))] -use sp_std::alloc::format; -use sp_std::vec::Vec; /// Helper function to generate a crypto pair from seed fn get_from_seed(seed: &str) -> ::Public { @@ -530,7 +530,7 @@ fn wococo_local_testnet_genesis() -> serde_json::Value { } /// Provides the JSON representation of predefined genesis config for given `id`. -pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { Ok("local_testnet") => rococo_local_testnet_genesis(), Ok("development") => rococo_development_config_genesis(), diff --git a/polkadot/runtime/rococo/src/impls.rs b/polkadot/runtime/rococo/src/impls.rs index 7b5c7b1fb4ac..a4440a1c6e0b 100644 --- a/polkadot/runtime/rococo/src/impls.rs +++ b/polkadot/runtime/rococo/src/impls.rs @@ -15,13 +15,14 @@ // along with Polkadot. If not, see . use crate::xcm_config; +use alloc::{boxed::Box, vec}; use codec::{Decode, Encode}; +use core::marker::PhantomData; use frame_support::pallet_prelude::DispatchResult; use frame_system::RawOrigin; use polkadot_primitives::Balance; use polkadot_runtime_common::identity_migrator::{OnReapIdentity, WeightInfo}; use rococo_runtime_constants::currency::*; -use sp_std::{marker::PhantomData, prelude::*}; use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm}; use xcm_executor::traits::TransactAsset; diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index ef629c7dad15..5adffbd7422f 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -20,7 +20,15 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit. #![recursion_limit = "512"] +extern crate alloc; + +use alloc::{ + collections::{btree_map::BTreeMap, vec_deque::VecDeque}, + vec, + vec::Vec, +}; use codec::{Decode, Encode, MaxEncodedLen}; +use core::cmp::Ordering; use frame_support::{ dynamic_params::{dynamic_pallet_params, dynamic_params}, traits::FromContains, @@ -68,11 +76,6 @@ use sp_consensus_beefy::{ mmr::{BeefyDataProvider, MmrLeafVersion}, }; use sp_genesis_builder::PresetId; -use sp_std::{ - cmp::Ordering, - collections::{btree_map::BTreeMap, vec_deque::VecDeque}, - prelude::*, -}; use frame_support::{ construct_runtime, derive_impl, @@ -1845,7 +1848,7 @@ sp_api::impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -2389,7 +2392,7 @@ sp_api::impl_runtime_apis! { } fn set_up_complex_asset_transfer( - ) -> Option<(Assets, u32, Location, Box)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box)> { // Relay supports only native token, either reserve transfer it to non-system parachains, // or teleport it to system parachain. Use the teleport case for benchmarking as it's // slightly heavier. diff --git a/polkadot/runtime/rococo/src/validator_manager.rs b/polkadot/runtime/rococo/src/validator_manager.rs index 0677ba7fbb2b..ecfbff4fa068 100644 --- a/polkadot/runtime/rococo/src/validator_manager.rs +++ b/polkadot/runtime/rococo/src/validator_manager.rs @@ -16,8 +16,8 @@ //! A pallet for managing validators on Rococo. +use alloc::vec::Vec; use sp_staking::SessionIndex; -use sp_std::vec::Vec; pub use pallet::*; diff --git a/polkadot/runtime/rococo/src/weights/pallet_session.rs b/polkadot/runtime/rococo/src/weights/pallet_session.rs index dbeca534add8..7f573d4e3952 100644 --- a/polkadot/runtime/rococo/src/weights/pallet_session.rs +++ b/polkadot/runtime/rococo/src/weights/pallet_session.rs @@ -38,7 +38,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_session`. pub struct WeightInfo(PhantomData); diff --git a/polkadot/runtime/rococo/src/weights/xcm/mod.rs b/polkadot/runtime/rococo/src/weights/xcm/mod.rs index 12f3df897b1e..bd2b0fbb8c06 100644 --- a/polkadot/runtime/rococo/src/weights/xcm/mod.rs +++ b/polkadot/runtime/rococo/src/weights/xcm/mod.rs @@ -18,8 +18,8 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::Runtime; +use alloc::vec::Vec; use frame_support::weights::Weight; -use sp_std::prelude::*; use xcm::{latest::prelude::*, DoubleEncoded}; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight; diff --git a/polkadot/runtime/test-runtime/Cargo.toml b/polkadot/runtime/test-runtime/Cargo.toml index a66fceedae34..ac379b69e3f2 100644 --- a/polkadot/runtime/test-runtime/Cargo.toml +++ b/polkadot/runtime/test-runtime/Cargo.toml @@ -22,7 +22,6 @@ sp-consensus-beefy = { workspace = true } sp-api = { workspace = true } sp-inherents = { workspace = true } sp-offchain = { workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } sp-staking = { workspace = true } @@ -125,7 +124,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "test-runtime-constants/std", diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index 96392c026d5c..a8a369a68e66 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -20,12 +20,15 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -use codec::Encode; -use pallet_transaction_payment::FungibleAdapter; -use sp_std::{ +extern crate alloc; + +use alloc::{ collections::{btree_map::BTreeMap, vec_deque::VecDeque}, - prelude::*, + vec, + vec::Vec, }; +use codec::Encode; +use pallet_transaction_payment::FungibleAdapter; use polkadot_runtime_parachains::{ assigner_parachains as parachains_assigner_parachains, @@ -793,7 +796,7 @@ sp_api::impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> Vec { Runtime::metadata_versions() } } diff --git a/polkadot/runtime/test-runtime/src/xcm_config.rs b/polkadot/runtime/test-runtime/src/xcm_config.rs index b1d86ff9a85e..b424b9a3ee55 100644 --- a/polkadot/runtime/test-runtime/src/xcm_config.rs +++ b/polkadot/runtime/test-runtime/src/xcm_config.rs @@ -54,7 +54,7 @@ pub type LocalOriginToLocation = ( /// This implementation ensures that messages with non-reanchored assets return higher /// prices than messages with reanchored assets. /// Useful for `deposit_reserve_asset_works_for_any_xcm_sender` integration test. -pub struct TestDeliveryPrice(sp_std::marker::PhantomData<(A, F)>); +pub struct TestDeliveryPrice(core::marker::PhantomData<(A, F)>); impl, F: FeeTracker> PriceForMessageDelivery for TestDeliveryPrice { type Id = F::Id; diff --git a/polkadot/runtime/westend/Cargo.toml b/polkadot/runtime/westend/Cargo.toml index 5a7805c05161..9e739f4c7fe6 100644 --- a/polkadot/runtime/westend/Cargo.toml +++ b/polkadot/runtime/westend/Cargo.toml @@ -28,7 +28,6 @@ sp-offchain = { workspace = true } sp-api = { workspace = true } sp-application-crypto = { workspace = true } sp-arithmetic = { workspace = true } -sp-std = { workspace = true } sp-genesis-builder = { workspace = true } sp-io = { workspace = true } sp-mmr-primitives = { workspace = true } @@ -220,7 +219,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", "sp-storage/std", "sp-tracing/std", "sp-transaction-pool/std", diff --git a/polkadot/runtime/westend/src/impls.rs b/polkadot/runtime/westend/src/impls.rs index d7ca677a7620..11665953bd8e 100644 --- a/polkadot/runtime/westend/src/impls.rs +++ b/polkadot/runtime/westend/src/impls.rs @@ -15,12 +15,13 @@ // along with Polkadot. If not, see . use crate::xcm_config; +use alloc::{boxed::Box, vec}; use codec::{Decode, Encode}; +use core::marker::PhantomData; use frame_support::pallet_prelude::DispatchResult; use frame_system::RawOrigin; use polkadot_primitives::Balance; use polkadot_runtime_common::identity_migrator::{OnReapIdentity, WeightInfo}; -use sp_std::{marker::PhantomData, prelude::*}; use westend_runtime_constants::currency::*; use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm}; use xcm_executor::traits::TransactAsset; diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 0d7a8a6a4ac2..f0b16e731d9e 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -20,6 +20,13 @@ // `#[frame_support::runtime]!` does a lot of recursion and requires us to increase the limit. #![recursion_limit = "512"] +extern crate alloc; + +use alloc::{ + collections::{btree_map::BTreeMap, vec_deque::VecDeque}, + vec, + vec::Vec, +}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_election_provider_support::{bounds::ElectionBoundsBuilder, onchain, SequentialPhragmen}; use frame_support::{ @@ -95,10 +102,6 @@ use sp_runtime::{ ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, }; use sp_staking::SessionIndex; -use sp_std::{ - collections::{btree_map::BTreeMap, vec_deque::VecDeque}, - prelude::*, -}; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -1802,7 +1805,7 @@ sp_api::impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -2420,6 +2423,8 @@ sp_api::impl_runtime_apis! { use xcm_config::{AssetHub, TokenLocation}; + use alloc::boxed::Box; + parameter_types! { pub ExistentialDepositAsset: Option = Some(( TokenLocation::get(), diff --git a/polkadot/runtime/westend/src/weights/xcm/mod.rs b/polkadot/runtime/westend/src/weights/xcm/mod.rs index 09e883a9f7af..cb5894ea51e3 100644 --- a/polkadot/runtime/westend/src/weights/xcm/mod.rs +++ b/polkadot/runtime/westend/src/weights/xcm/mod.rs @@ -18,8 +18,8 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::Runtime; +use alloc::vec::Vec; use frame_support::weights::Weight; -use sp_std::prelude::*; use xcm::{ latest::{prelude::*, QueryResponseInfo}, DoubleEncoded, diff --git a/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/mod.rs b/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/mod.rs index e7d00ac71038..23d6664bdafc 100644 --- a/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/mod.rs +++ b/polkadot/xcm/docs/src/cookbook/relay_token_transactor/parachain/mod.rs @@ -16,7 +16,7 @@ //! # Runtime -use frame::{deps::frame_system, prelude::*, runtime::prelude::*, traits::IdentityLookup}; +use frame::{deps::frame_system, runtime::prelude::*, traits::IdentityLookup}; use xcm_executor::XcmExecutor; use xcm_simulator::mock_message_queue; diff --git a/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml b/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml index 1177d094c6c3..b07bdfdca3d1 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml +++ b/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml @@ -18,7 +18,6 @@ scale-info = { features = ["derive"], workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } xcm-executor = { workspace = true } frame-benchmarking = { workspace = true } @@ -48,7 +47,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", ] diff --git a/polkadot/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs b/polkadot/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs index d99da9184b5d..6ce49074a6e2 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs @@ -16,6 +16,7 @@ use super::*; use crate::{account_and_location, new_executor, AssetTransactorOf, EnsureDelivery, XcmCallOf}; +use alloc::{vec, vec::Vec}; use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError, BenchmarkResult}; use frame_support::{ pallet_prelude::Get, @@ -23,7 +24,6 @@ use frame_support::{ weights::Weight, }; use sp_runtime::traits::{Bounded, Zero}; -use sp_std::{prelude::*, vec}; use xcm::latest::{prelude::*, MAX_ITEMS_IN_ASSETS}; use xcm_executor::traits::{ConvertLocation, FeeReason, TransactAsset}; @@ -37,7 +37,7 @@ benchmarks_instance_pallet! { >::Balance as TryInto - >::Error: sp_std::fmt::Debug, + >::Error: core::fmt::Debug, } withdraw_asset { diff --git a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs index 760b21f93566..40a7da58a687 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs @@ -16,10 +16,10 @@ use super::*; use crate::{account_and_location, new_executor, EnsureDelivery, XcmCallOf}; +use alloc::{vec, vec::Vec}; use codec::Encode; use frame_benchmarking::{benchmarks, BenchmarkError}; use frame_support::{dispatch::GetDispatchInfo, traits::fungible::Inspect}; -use sp_std::{prelude::*, vec}; use xcm::{ latest::{prelude::*, MaxDispatchErrorLen, MaybeErrorCode, Weight, MAX_ITEMS_IN_ASSETS}, DoubleEncoded, diff --git a/polkadot/xcm/pallet-xcm-benchmarks/src/lib.rs b/polkadot/xcm/pallet-xcm-benchmarks/src/lib.rs index a43f27bf47e7..4a12bb7f47c6 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/src/lib.rs +++ b/polkadot/xcm/pallet-xcm-benchmarks/src/lib.rs @@ -18,9 +18,11 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::Encode; use frame_benchmarking::{account, BenchmarkError}; -use sp_std::prelude::*; use xcm::latest::prelude::*; use xcm_builder::EnsureDelivery; use xcm_executor::{traits::ConvertLocation, Config as XcmConfig}; diff --git a/polkadot/xcm/pallet-xcm/Cargo.toml b/polkadot/xcm/pallet-xcm/Cargo.toml index 0cce7a344938..ed4b441d7c33 100644 --- a/polkadot/xcm/pallet-xcm/Cargo.toml +++ b/polkadot/xcm/pallet-xcm/Cargo.toml @@ -21,7 +21,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } @@ -52,7 +51,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", "xcm-runtime-apis/std", diff --git a/polkadot/xcm/pallet-xcm/src/benchmarking.rs b/polkadot/xcm/pallet-xcm/src/benchmarking.rs index da46a6a37c06..d09c81bf434e 100644 --- a/polkadot/xcm/pallet-xcm/src/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm/src/benchmarking.rs @@ -18,7 +18,6 @@ use super::*; use frame_benchmarking::{benchmarks, whitelisted_caller, BenchmarkError, BenchmarkResult}; use frame_support::{assert_ok, weights::Weight}; use frame_system::RawOrigin; -use sp_std::prelude::*; use xcm::latest::prelude::*; use xcm_builder::EnsureDelivery; use xcm_executor::traits::FeeReason; diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs index 668f07c52ce3..6451901279b1 100644 --- a/polkadot/xcm/pallet-xcm/src/lib.rs +++ b/polkadot/xcm/pallet-xcm/src/lib.rs @@ -27,7 +27,11 @@ mod tests; pub mod migration; +extern crate alloc; + +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{Decode, Encode, EncodeLike, MaxEncodedLen}; +use core::{marker::PhantomData, result::Result}; use frame_support::{ dispatch::{ DispatchErrorWithPostInfo, GetDispatchInfo, PostDispatchInfo, WithPostDispatchInfo, @@ -49,7 +53,6 @@ use sp_runtime::{ }, Either, RuntimeDebug, }; -use sp_std::{boxed::Box, marker::PhantomData, prelude::*, result::Result, vec}; use xcm::{latest::QueryResponseInfo, prelude::*}; use xcm_builder::{ ExecuteController, ExecuteControllerWeightInfo, InspectMessageQueues, QueryController, @@ -792,7 +795,7 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, /// The default version to encode outgoing XCM messages with. pub safe_xcm_version: Option, } @@ -1438,8 +1441,8 @@ enum FeesHandling { Separate { local_xcm: Xcm<::RuntimeCall>, remote_xcm: Xcm<()> }, } -impl sp_std::fmt::Debug for FeesHandling { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for FeesHandling { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::Batched { fees } => write!(f, "FeesHandling::Batched({:?})", fees), Self::Separate { local_xcm, remote_xcm } => write!( @@ -1840,8 +1843,8 @@ impl Pallet { FeesHandling::Separate { local_xcm: mut local_fees, remote_xcm: mut remote_fees } => { // fees are handled by separate XCM instructions, prepend fees instructions (for // remote XCM they have to be prepended instead of appended to pass barriers). - sp_std::mem::swap(local, &mut local_fees); - sp_std::mem::swap(remote, &mut remote_fees); + core::mem::swap(local, &mut local_fees); + core::mem::swap(remote, &mut remote_fees); // these are now swapped so fees actually go first local.inner_mut().append(&mut local_fees.into_inner()); remote.inner_mut().append(&mut remote_fees.into_inner()); diff --git a/polkadot/xcm/pallet-xcm/src/migration.rs b/polkadot/xcm/pallet-xcm/src/migration.rs index b157e6b5c3d5..0aec97ab4105 100644 --- a/polkadot/xcm/pallet-xcm/src/migration.rs +++ b/polkadot/xcm/pallet-xcm/src/migration.rs @@ -34,7 +34,7 @@ pub mod v1 { /// enacted on-chain. /// /// Use experimental [`MigrateToV1`] instead. - pub struct VersionUncheckedMigrateToV1(sp_std::marker::PhantomData); + pub struct VersionUncheckedMigrateToV1(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1 { fn on_runtime_upgrade() -> Weight { let mut weight = T::DbWeight::get().reads(1); @@ -81,7 +81,7 @@ pub mod v1 { /// `XCM_VERSION`. /// /// NOTE: This migration can be permanently added to the runtime migrations. -pub struct MigrateToLatestXcmVersion(sp_std::marker::PhantomData); +pub struct MigrateToLatestXcmVersion(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToLatestXcmVersion { fn on_runtime_upgrade() -> Weight { CurrentMigration::::put(VersionMigrationStage::default()); diff --git a/polkadot/xcm/pallet-xcm/src/mock.rs b/polkadot/xcm/pallet-xcm/src/mock.rs index 2be6f301f856..3941d104b81c 100644 --- a/polkadot/xcm/pallet-xcm/src/mock.rs +++ b/polkadot/xcm/pallet-xcm/src/mock.rs @@ -15,6 +15,7 @@ // along with Polkadot. If not, see . use codec::Encode; +pub use core::cell::RefCell; use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{ @@ -28,7 +29,6 @@ use polkadot_parachain_primitives::primitives::Id as ParaId; use polkadot_runtime_parachains::origin; use sp_core::H256; use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; -pub use sp_std::cell::RefCell; use xcm::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, diff --git a/polkadot/xcm/xcm-builder/Cargo.toml b/polkadot/xcm/xcm-builder/Cargo.toml index d43506aa651b..7702e2f9be07 100644 --- a/polkadot/xcm/xcm-builder/Cargo.toml +++ b/polkadot/xcm/xcm-builder/Cargo.toml @@ -15,7 +15,6 @@ codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } -sp-std = { workspace = true } sp-arithmetic = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } @@ -66,7 +65,6 @@ std = [ "sp-arithmetic/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-weights/std", "xcm-executor/std", "xcm/std", diff --git a/polkadot/xcm/xcm-builder/src/asset_conversion.rs b/polkadot/xcm/xcm-builder/src/asset_conversion.rs index 520ce87448ea..16ae05c20795 100644 --- a/polkadot/xcm/xcm-builder/src/asset_conversion.rs +++ b/polkadot/xcm/xcm-builder/src/asset_conversion.rs @@ -16,9 +16,9 @@ //! Adapters to work with [`frame_support::traits::fungibles`] through XCM. +use core::{marker::PhantomData, result}; use frame_support::traits::{Contains, Get}; use sp_runtime::traits::MaybeEquivalence; -use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; use xcm_executor::traits::{Error as MatchError, MatchesFungibles, MatchesNonFungibles}; diff --git a/polkadot/xcm/xcm-builder/src/barriers.rs b/polkadot/xcm/xcm-builder/src/barriers.rs index 11e9122f9a12..5d95005eb663 100644 --- a/polkadot/xcm/xcm-builder/src/barriers.rs +++ b/polkadot/xcm/xcm-builder/src/barriers.rs @@ -17,12 +17,12 @@ //! Various implementations for `ShouldExecute`. use crate::{CreateMatcher, MatchXcm}; +use core::{cell::Cell, marker::PhantomData, ops::ControlFlow, result::Result}; use frame_support::{ ensure, traits::{Contains, Get, ProcessMessageError}, }; use polkadot_parachain_primitives::primitives::IsSystem; -use sp_std::{cell::Cell, marker::PhantomData, ops::ControlFlow, result::Result}; use xcm::prelude::*; use xcm_executor::traits::{CheckSuspension, OnResponse, Properties, ShouldExecute}; diff --git a/polkadot/xcm/xcm-builder/src/controller.rs b/polkadot/xcm/xcm-builder/src/controller.rs index 04b19eaa5870..d4ce2ca5b353 100644 --- a/polkadot/xcm/xcm-builder/src/controller.rs +++ b/polkadot/xcm/xcm-builder/src/controller.rs @@ -18,11 +18,11 @@ //! Controller traits defined in this module are high-level traits that will rely on other traits //! from `xcm-executor` to perform their tasks. +use alloc::boxed::Box; use frame_support::{ dispatch::{DispatchErrorWithPostInfo, WithPostDispatchInfo}, pallet_prelude::DispatchError, }; -use sp_std::boxed::Box; use xcm::prelude::*; pub use xcm_executor::traits::QueryHandler; diff --git a/polkadot/xcm/xcm-builder/src/currency_adapter.rs b/polkadot/xcm/xcm-builder/src/currency_adapter.rs index 99a736d6ac1f..355d6ad85388 100644 --- a/polkadot/xcm/xcm-builder/src/currency_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/currency_adapter.rs @@ -19,9 +19,9 @@ #![allow(deprecated)] use super::MintLocation; +use core::{marker::PhantomData, result}; use frame_support::traits::{ExistenceRequirement::AllowDeath, Get, WithdrawReasons}; use sp_runtime::traits::CheckedSub; -use sp_std::{marker::PhantomData, result}; use xcm::latest::{Asset, Error as XcmError, Location, Result, XcmContext}; use xcm_executor::{ traits::{ConvertLocation, MatchesFungible, TransactAsset}, diff --git a/polkadot/xcm/xcm-builder/src/filter_asset_location.rs b/polkadot/xcm/xcm-builder/src/filter_asset_location.rs index d80c5d70deea..16b7be7f3ba9 100644 --- a/polkadot/xcm/xcm-builder/src/filter_asset_location.rs +++ b/polkadot/xcm/xcm-builder/src/filter_asset_location.rs @@ -17,8 +17,9 @@ //! Various implementations of `ContainsPair` or //! `Contains<(Location, Vec)>`. +use alloc::vec::Vec; +use core::marker::PhantomData; use frame_support::traits::{Contains, ContainsPair, Get}; -use sp_std::{marker::PhantomData, vec::Vec}; use xcm::latest::{Asset, AssetFilter, AssetId, Location, WildAsset}; /// Accepts an asset iff it is a native asset. @@ -44,7 +45,7 @@ impl> ContainsPair for Case /// implementation of the given `Location` and if every asset from `assets` matches at least one of /// the `AssetFilter` instances provided by the `Get` implementation of `AssetFilters`. pub struct LocationWithAssetFilters( - sp_std::marker::PhantomData<(LocationFilter, AssetFilters)>, + core::marker::PhantomData<(LocationFilter, AssetFilters)>, ); impl, AssetFilters: Get>> Contains<(Location, Vec)> for LocationWithAssetFilters @@ -75,7 +76,7 @@ impl, AssetFilters: Get>> pub struct AllAssets; impl Get> for AllAssets { fn get() -> Vec { - sp_std::vec![AssetFilter::Wild(WildAsset::All)] + alloc::vec![AssetFilter::Wild(WildAsset::All)] } } @@ -96,11 +97,11 @@ mod tests { pub AssetYLocation: Location = Location::new(1, [GeneralIndex(2222)]); pub AssetZLocation: Location = Location::new(1, [GeneralIndex(3333)]); - pub OnlyAssetXOrAssetY: sp_std::vec::Vec = sp_std::vec![ + pub OnlyAssetXOrAssetY: alloc::vec::Vec = alloc::vec![ Wild(AllOf { fun: WildFungible, id: AssetId(AssetXLocation::get()) }), Wild(AllOf { fun: WildFungible, id: AssetId(AssetYLocation::get()) }), ]; - pub OnlyAssetZ: sp_std::vec::Vec = sp_std::vec![ + pub OnlyAssetZ: alloc::vec::Vec = alloc::vec![ Wild(AllOf { fun: WildFungible, id: AssetId(AssetZLocation::get()) }) ]; } diff --git a/polkadot/xcm/xcm-builder/src/fungible_adapter.rs b/polkadot/xcm/xcm-builder/src/fungible_adapter.rs index 45a0e2bdca28..25a705a39eb7 100644 --- a/polkadot/xcm/xcm-builder/src/fungible_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/fungible_adapter.rs @@ -17,6 +17,7 @@ //! Adapters to work with [`frame_support::traits::fungible`] through XCM. use super::MintLocation; +use core::{marker::PhantomData, result}; use frame_support::traits::{ tokens::{ fungible, @@ -27,7 +28,6 @@ use frame_support::traits::{ }, Get, }; -use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; use xcm_executor::{ traits::{ConvertLocation, Error as MatchError, MatchesFungible, TransactAsset}, diff --git a/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs b/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs index 88bbf01d9e1f..a259afc6e682 100644 --- a/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/fungibles_adapter.rs @@ -16,6 +16,7 @@ //! Adapters to work with [`frame_support::traits::fungibles`] through XCM. +use core::{marker::PhantomData, result}; use frame_support::traits::{ tokens::{ fungibles, @@ -26,7 +27,6 @@ use frame_support::traits::{ }, Contains, Get, }; -use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; use xcm_executor::traits::{ConvertLocation, Error as MatchError, MatchesFungibles, TransactAsset}; @@ -101,7 +101,7 @@ impl AssetChecking for NoChecking { /// Implementation of `AssetChecking` which subjects a given set of assets `T` to having their /// teleportations recorded with a `MintLocation::Local`. -pub struct LocalMint(sp_std::marker::PhantomData); +pub struct LocalMint(core::marker::PhantomData); impl> AssetChecking for LocalMint { fn asset_checking(asset: &AssetId) -> Option { match T::contains(asset) { @@ -113,7 +113,7 @@ impl> AssetChecking for LocalMint { /// Implementation of `AssetChecking` which subjects a given set of assets `T` to having their /// teleportations recorded with a `MintLocation::NonLocal`. -pub struct NonLocalMint(sp_std::marker::PhantomData); +pub struct NonLocalMint(core::marker::PhantomData); impl> AssetChecking for NonLocalMint { fn asset_checking(asset: &AssetId) -> Option { match T::contains(asset) { @@ -126,7 +126,7 @@ impl> AssetChecking for NonLocalMint { /// Implementation of `AssetChecking` which subjects a given set of assets `L` to having their /// teleportations recorded with a `MintLocation::Local` and a second set of assets `R` to having /// their teleportations recorded with a `MintLocation::NonLocal`. -pub struct DualMint(sp_std::marker::PhantomData<(L, R)>); +pub struct DualMint(core::marker::PhantomData<(L, R)>); impl, R: Contains> AssetChecking for DualMint { diff --git a/polkadot/xcm/xcm-builder/src/lib.rs b/polkadot/xcm/xcm-builder/src/lib.rs index cc06c298a418..c3495601cd87 100644 --- a/polkadot/xcm/xcm-builder/src/lib.rs +++ b/polkadot/xcm/xcm-builder/src/lib.rs @@ -20,6 +20,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(test)] mod tests; diff --git a/polkadot/xcm/xcm-builder/src/location_conversion.rs b/polkadot/xcm/xcm-builder/src/location_conversion.rs index f95258492381..1d840e9c0dde 100644 --- a/polkadot/xcm/xcm-builder/src/location_conversion.rs +++ b/polkadot/xcm/xcm-builder/src/location_conversion.rs @@ -15,11 +15,12 @@ // along with Polkadot. If not, see . use crate::universal_exports::ensure_is_remote; +use alloc::vec::Vec; use codec::{Compact, Decode, Encode}; +use core::marker::PhantomData; use frame_support::traits::Get; use sp_io::hashing::blake2_256; use sp_runtime::traits::{AccountIdConversion, TrailingZeroInput, TryConvert}; -use sp_std::{marker::PhantomData, prelude::*}; use xcm::latest::prelude::*; use xcm_executor::traits::ConvertLocation; @@ -460,7 +461,9 @@ impl #[cfg(test)] mod tests { use super::*; + use alloc::vec; use polkadot_primitives::AccountId; + pub type ForeignChainAliasAccount = HashedDescription; diff --git a/polkadot/xcm/xcm-builder/src/matches_location.rs b/polkadot/xcm/xcm-builder/src/matches_location.rs index b6c2807e6b29..71c5ec1efd6f 100644 --- a/polkadot/xcm/xcm-builder/src/matches_location.rs +++ b/polkadot/xcm/xcm-builder/src/matches_location.rs @@ -17,14 +17,14 @@ //! Various implementations and utilities for matching and filtering `Location` and //! `InteriorLocation` types. +use core::marker::PhantomData; use frame_support::traits::{Contains, Get}; use sp_runtime::traits::MaybeEquivalence; -use sp_std::marker::PhantomData; use xcm::latest::{InteriorLocation, Location, NetworkId}; /// An implementation of `Contains` that checks for `Location` or /// `InteriorLocation` if starts with the provided type `T`. -pub struct StartsWith(sp_std::marker::PhantomData<(T, L)>); +pub struct StartsWith(core::marker::PhantomData<(T, L)>); impl, L: TryInto + Clone> Contains for StartsWith { fn contains(location: &L) -> bool { let latest_location: Location = @@ -42,7 +42,7 @@ impl> Contains for StartsWith { /// An implementation of `Contains` that checks for `Location` or /// `InteriorLocation` if starts with expected `GlobalConsensus(NetworkId)` provided as type /// `T`. -pub struct StartsWithExplicitGlobalConsensus(sp_std::marker::PhantomData); +pub struct StartsWithExplicitGlobalConsensus(core::marker::PhantomData); impl> Contains for StartsWithExplicitGlobalConsensus { fn contains(location: &Location) -> bool { matches!(location.interior().global_consensus(), Ok(requested_network) if requested_network.eq(&T::get())) diff --git a/polkadot/xcm/xcm-builder/src/matches_token.rs b/polkadot/xcm/xcm-builder/src/matches_token.rs index e49fd18f88d8..095c50a5a25b 100644 --- a/polkadot/xcm/xcm-builder/src/matches_token.rs +++ b/polkadot/xcm/xcm-builder/src/matches_token.rs @@ -16,8 +16,8 @@ //! Various implementations for the `MatchesFungible` trait. +use core::marker::PhantomData; use frame_support::traits::Get; -use sp_std::marker::PhantomData; use xcm::latest::{ Asset, AssetId, AssetInstance, Fungibility::{Fungible, NonFungible}, diff --git a/polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs b/polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs index b69002eafc5b..8e6232ea64d2 100644 --- a/polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs @@ -17,11 +17,11 @@ //! Adapters to work with [`frame_support::traits::tokens::nonfungible`] through XCM. use crate::MintLocation; +use core::{marker::PhantomData, result}; use frame_support::{ ensure, traits::{tokens::nonfungible, Get}, }; -use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; use xcm_executor::traits::{ ConvertLocation, Error as MatchError, MatchesNonFungible, TransactAsset, diff --git a/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs b/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs index 3fce953848eb..b111a05a4f1f 100644 --- a/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs @@ -17,11 +17,11 @@ //! Adapters to work with [`frame_support::traits::tokens::nonfungibles`] through XCM. use crate::{AssetChecking, MintLocation}; +use core::{marker::PhantomData, result}; use frame_support::{ ensure, traits::{tokens::nonfungibles, Get}, }; -use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; use xcm_executor::traits::{ ConvertLocation, Error as MatchError, MatchesNonFungibles, TransactAsset, diff --git a/polkadot/xcm/xcm-builder/src/origin_aliases.rs b/polkadot/xcm/xcm-builder/src/origin_aliases.rs index bbf810463a7c..d568adc3127c 100644 --- a/polkadot/xcm/xcm-builder/src/origin_aliases.rs +++ b/polkadot/xcm/xcm-builder/src/origin_aliases.rs @@ -16,8 +16,8 @@ //! Implementation for `ContainsPair`. +use core::marker::PhantomData; use frame_support::traits::{Contains, ContainsPair}; -use sp_std::marker::PhantomData; use xcm::latest::prelude::*; /// Alias a Foreign `AccountId32` with a local `AccountId32` if the foreign `AccountId32` matches diff --git a/polkadot/xcm/xcm-builder/src/origin_conversion.rs b/polkadot/xcm/xcm-builder/src/origin_conversion.rs index f64b5660f667..6e73c0dae7b6 100644 --- a/polkadot/xcm/xcm-builder/src/origin_conversion.rs +++ b/polkadot/xcm/xcm-builder/src/origin_conversion.rs @@ -16,11 +16,11 @@ //! Various implementations for `ConvertOrigin`. +use core::marker::PhantomData; use frame_support::traits::{EnsureOrigin, Get, GetBacking, OriginTrait}; use frame_system::RawOrigin as SystemRawOrigin; use polkadot_parachain_primitives::primitives::IsSystem; use sp_runtime::traits::TryConvert; -use sp_std::marker::PhantomData; use xcm::latest::{BodyId, BodyPart, Junction, Junctions::*, Location, NetworkId, OriginKind}; use xcm_executor::traits::{ConvertLocation, ConvertOrigin}; diff --git a/polkadot/xcm/xcm-builder/src/pay.rs b/polkadot/xcm/xcm-builder/src/pay.rs index 35b624b04153..978c6870cdaf 100644 --- a/polkadot/xcm/xcm-builder/src/pay.rs +++ b/polkadot/xcm/xcm-builder/src/pay.rs @@ -16,12 +16,13 @@ //! `PayOverXcm` struct for paying through XCM and getting the status back. +use alloc::vec; +use core::marker::PhantomData; use frame_support::traits::{ tokens::{Pay, PaymentStatus}, Get, }; use sp_runtime::traits::TryConvert; -use sp_std::{marker::PhantomData, vec}; use xcm::{opaque::lts::Weight, prelude::*}; use xcm_executor::traits::{QueryHandler, QueryResponseStatus}; @@ -199,7 +200,7 @@ pub struct LocatableAssetId { /// Adapter `struct` which implements a conversion from any `AssetKind` into a [`LocatableAssetId`] /// value using a fixed `Location` for the `location` field. -pub struct FixedLocation(sp_std::marker::PhantomData); +pub struct FixedLocation(core::marker::PhantomData); impl, AssetKind: Into> TryConvert for FixedLocation { diff --git a/polkadot/xcm/xcm-builder/src/process_xcm_message.rs b/polkadot/xcm/xcm-builder/src/process_xcm_message.rs index ef8c71fc2495..2e6f8c5fb566 100644 --- a/polkadot/xcm/xcm-builder/src/process_xcm_message.rs +++ b/polkadot/xcm/xcm-builder/src/process_xcm_message.rs @@ -17,9 +17,9 @@ //! Implementation of `ProcessMessage` for an `ExecuteXcm` implementation. use codec::{Decode, FullCodec, MaxEncodedLen}; +use core::{fmt::Debug, marker::PhantomData}; use frame_support::traits::{ProcessMessage, ProcessMessageError}; use scale_info::TypeInfo; -use sp_std::{fmt::Debug, marker::PhantomData}; use sp_weights::{Weight, WeightMeter}; use xcm::prelude::*; @@ -118,6 +118,7 @@ impl< #[cfg(test)] mod tests { use super::*; + use alloc::vec; use codec::Encode; use frame_support::{ assert_err, assert_ok, diff --git a/polkadot/xcm/xcm-builder/src/routing.rs b/polkadot/xcm/xcm-builder/src/routing.rs index 543aef97c340..03ef780ef032 100644 --- a/polkadot/xcm/xcm-builder/src/routing.rs +++ b/polkadot/xcm/xcm-builder/src/routing.rs @@ -16,9 +16,10 @@ //! Various implementations for `SendXcm`. +use alloc::vec::Vec; use codec::Encode; +use core::{marker::PhantomData, result::Result}; use frame_system::unique; -use sp_std::{marker::PhantomData, result::Result, vec::Vec}; use xcm::prelude::*; use xcm_executor::{traits::FeeReason, FeesMode}; @@ -173,7 +174,7 @@ impl InspectMessageQueues for Tuple { /// `Inner::Ticket`. Therefore, this router aims to validate at least the passed `message`. /// /// NOTE: For use in mock runtimes which don't have the DMP/UMP/HRMP XCM validations. -pub struct EnsureDecodableXcm(sp_std::marker::PhantomData); +pub struct EnsureDecodableXcm(core::marker::PhantomData); impl SendXcm for EnsureDecodableXcm { type Ticket = Inner::Ticket; diff --git a/polkadot/xcm/xcm-builder/src/test_utils.rs b/polkadot/xcm/xcm-builder/src/test_utils.rs index 3131dece3757..37a49a1b3dc7 100644 --- a/polkadot/xcm/xcm-builder/src/test_utils.rs +++ b/polkadot/xcm/xcm-builder/src/test_utils.rs @@ -16,11 +16,11 @@ // Shared test utilities and implementations for the XCM Builder. +use alloc::vec::Vec; use frame_support::{ parameter_types, traits::{Contains, CrateVersion, PalletInfoData, PalletsInfoAccess}, }; -use sp_std::vec::Vec; pub use xcm::latest::{prelude::*, Weight}; use xcm_executor::traits::{ClaimAssets, DropAssets, VersionChangeNotifier}; pub use xcm_executor::{ diff --git a/polkadot/xcm/xcm-builder/src/tests/mock.rs b/polkadot/xcm/xcm-builder/src/tests/mock.rs index f35c73bdb685..ac43d217ff3f 100644 --- a/polkadot/xcm/xcm-builder/src/tests/mock.rs +++ b/polkadot/xcm/xcm-builder/src/tests/mock.rs @@ -26,7 +26,12 @@ pub use crate::{ AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, FixedRateOfFungible, FixedWeightBounds, TakeWeightCredit, }; +pub use alloc::collections::{btree_map::BTreeMap, btree_set::BTreeSet}; pub use codec::{Decode, Encode}; +pub use core::{ + cell::{Cell, RefCell}, + fmt::Debug, +}; use frame_support::traits::{ContainsPair, Everything}; pub use frame_support::{ dispatch::{DispatchInfo, DispatchResultWithPostInfo, GetDispatchInfo, PostDispatchInfo}, @@ -34,11 +39,6 @@ pub use frame_support::{ sp_runtime::{traits::Dispatchable, DispatchError, DispatchErrorWithPostInfo}, traits::{Contains, Get, IsInVec}, }; -pub use sp_std::{ - cell::{Cell, RefCell}, - collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - fmt::Debug, -}; pub use xcm::latest::{prelude::*, QueryId, Weight}; use xcm_executor::traits::{Properties, QueryHandler, QueryResponseStatus}; pub use xcm_executor::{ diff --git a/polkadot/xcm/xcm-builder/src/tests/mod.rs b/polkadot/xcm/xcm-builder/src/tests/mod.rs index 16ce3d2cf8ff..379baaf5e376 100644 --- a/polkadot/xcm/xcm-builder/src/tests/mod.rs +++ b/polkadot/xcm/xcm-builder/src/tests/mod.rs @@ -15,6 +15,7 @@ // along with Polkadot. If not, see . use super::{test_utils::*, *}; +use alloc::{vec, vec::Vec}; use frame_support::{ assert_err, traits::{ConstU32, ContainsPair, ProcessMessageError}, diff --git a/polkadot/xcm/xcm-builder/src/universal_exports.rs b/polkadot/xcm/xcm-builder/src/universal_exports.rs index 9820d535f7ef..8aa9602fcc29 100644 --- a/polkadot/xcm/xcm-builder/src/universal_exports.rs +++ b/polkadot/xcm/xcm-builder/src/universal_exports.rs @@ -17,9 +17,10 @@ //! Traits and utilities to help with origin mutation and bridging. use crate::InspectMessageQueues; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; +use core::{convert::TryInto, marker::PhantomData}; use frame_support::{ensure, traits::Get}; -use sp_std::{convert::TryInto, marker::PhantomData, prelude::*}; use xcm::prelude::*; use xcm_executor::traits::{validate_export, ExportXcm}; use SendError::*; @@ -149,7 +150,7 @@ impl NetworkExportTableItem { /// An adapter for the implementation of `ExporterFor`, which attempts to find the /// `(bridge_location, payment)` for the requested `network` and `remote_location` in the provided /// `T` table containing various exporters. -pub struct NetworkExportTable(sp_std::marker::PhantomData); +pub struct NetworkExportTable(core::marker::PhantomData); impl>> ExporterFor for NetworkExportTable { fn exporter_for( network: &NetworkId, @@ -649,7 +650,7 @@ mod tests { pub PaymentForNetworkAAndParachain2000: Asset = (Location::parent(), 150).into(); - pub BridgeTable: sp_std::vec::Vec = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec = alloc::vec![ // NetworkA allows `Parachain(1000)` as remote location WITHOUT payment. NetworkExportTableItem::new( NetworkA::get(), diff --git a/polkadot/xcm/xcm-builder/src/weight.rs b/polkadot/xcm/xcm-builder/src/weight.rs index 1efa42ce9560..7861fdcc2e57 100644 --- a/polkadot/xcm/xcm-builder/src/weight.rs +++ b/polkadot/xcm/xcm-builder/src/weight.rs @@ -15,6 +15,7 @@ // along with Polkadot. If not, see . use codec::Decode; +use core::{marker::PhantomData, result::Result}; use frame_support::{ dispatch::GetDispatchInfo, traits::{ @@ -27,7 +28,6 @@ use frame_support::{ }, }; use sp_runtime::traits::{SaturatedConversion, Saturating, Zero}; -use sp_std::{marker::PhantomData, result::Result}; use xcm::latest::{prelude::*, GetWeight, Weight}; use xcm_executor::{ traits::{WeightBounds, WeightTrader}, diff --git a/polkadot/xcm/xcm-builder/tests/mock/mod.rs b/polkadot/xcm/xcm-builder/tests/mock/mod.rs index 582d596b78f1..0468b0a5410c 100644 --- a/polkadot/xcm/xcm-builder/tests/mock/mod.rs +++ b/polkadot/xcm/xcm-builder/tests/mock/mod.rs @@ -15,6 +15,7 @@ // along with Polkadot. If not, see . use codec::Encode; +use core::cell::RefCell; use frame_support::{ construct_runtime, derive_impl, parameter_types, traits::{Everything, Nothing}, @@ -23,7 +24,6 @@ use frame_support::{ use frame_system::EnsureRoot; use primitive_types::H256; use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; -use sp_std::cell::RefCell; use polkadot_parachain_primitives::primitives::Id as ParaId; use polkadot_runtime_parachains::{configuration, origin, shared}; diff --git a/polkadot/xcm/xcm-executor/Cargo.toml b/polkadot/xcm/xcm-executor/Cargo.toml index 7d1fc48692f9..cc966f91fe4d 100644 --- a/polkadot/xcm/xcm-executor/Cargo.toml +++ b/polkadot/xcm/xcm-executor/Cargo.toml @@ -15,7 +15,6 @@ environmental = { workspace = true } codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive", "serde"], workspace = true } xcm = { workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-arithmetic = { workspace = true } sp-core = { workspace = true } @@ -42,7 +41,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-weights/std", "tracing/std", "xcm/std", diff --git a/polkadot/xcm/xcm-executor/src/assets.rs b/polkadot/xcm/xcm-executor/src/assets.rs index 4407752f7024..09e7535ebf81 100644 --- a/polkadot/xcm/xcm-executor/src/assets.rs +++ b/polkadot/xcm/xcm-executor/src/assets.rs @@ -14,12 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use sp_runtime::{traits::Saturating, RuntimeDebug}; -use sp_std::{ +use alloc::{ collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - mem, - prelude::*, + vec::Vec, }; +use core::mem; +use sp_runtime::{traits::Saturating, RuntimeDebug}; use xcm::latest::{ Asset, AssetFilter, AssetId, AssetInstance, Assets, Fungibility::{Fungible, NonFungible}, @@ -520,7 +520,9 @@ impl AssetsInHolding { #[cfg(test)] mod tests { use super::*; + use alloc::vec; use xcm::latest::prelude::*; + #[allow(non_snake_case)] /// Concrete fungible constructor fn CF(amount: u128) -> Asset { diff --git a/polkadot/xcm/xcm-executor/src/lib.rs b/polkadot/xcm/xcm-executor/src/lib.rs index aeeb24dcf812..1daf5ae750cf 100644 --- a/polkadot/xcm/xcm-executor/src/lib.rs +++ b/polkadot/xcm/xcm-executor/src/lib.rs @@ -16,7 +16,11 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; +use core::{fmt::Debug, marker::PhantomData}; use frame_support::{ dispatch::GetDispatchInfo, ensure, @@ -24,7 +28,6 @@ use frame_support::{ }; use sp_core::defer; use sp_io::hashing::blake2_128; -use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; use sp_weights::Weight; use xcm::latest::prelude::*; @@ -392,7 +395,7 @@ impl XcmExecutor { /// Remove the registered error handler and return it. Do not refund its weight. fn take_error_handler(&mut self) -> Xcm { let mut r = Xcm::(vec![]); - sp_std::mem::swap(&mut self.error_handler, &mut r); + core::mem::swap(&mut self.error_handler, &mut r); self.error_handler_weight = Weight::zero(); r } @@ -407,7 +410,7 @@ impl XcmExecutor { /// Remove the registered appendix and return it. fn take_appendix(&mut self) -> Xcm { let mut r = Xcm::(vec![]); - sp_std::mem::swap(&mut self.appendix, &mut r); + core::mem::swap(&mut self.appendix, &mut r); self.appendix_weight = Weight::zero(); r } diff --git a/polkadot/xcm/xcm-executor/src/traits/asset_lock.rs b/polkadot/xcm/xcm-executor/src/traits/asset_lock.rs index b6270c529452..b4e9f32983fd 100644 --- a/polkadot/xcm/xcm-executor/src/traits/asset_lock.rs +++ b/polkadot/xcm/xcm-executor/src/traits/asset_lock.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use sp_std::convert::Infallible; +use core::convert::Infallible; use xcm::prelude::*; #[derive(Debug)] diff --git a/polkadot/xcm/xcm-executor/src/traits/conversion.rs b/polkadot/xcm/xcm-executor/src/traits/conversion.rs index 1efe138b8c21..bc62ad655669 100644 --- a/polkadot/xcm/xcm-executor/src/traits/conversion.rs +++ b/polkadot/xcm/xcm-executor/src/traits/conversion.rs @@ -14,9 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +use core::{marker::PhantomData, result::Result}; use frame_support::traits::{Contains, OriginTrait}; use sp_runtime::{traits::Dispatchable, DispatchErrorWithPostInfo}; -use sp_std::{marker::PhantomData, result::Result}; use xcm::latest::prelude::*; /// Means of converting a location into an account identifier. diff --git a/polkadot/xcm/xcm-executor/src/traits/on_response.rs b/polkadot/xcm/xcm-executor/src/traits/on_response.rs index 5d2412d61375..a4ed6014b4fc 100644 --- a/polkadot/xcm/xcm-executor/src/traits/on_response.rs +++ b/polkadot/xcm/xcm-executor/src/traits/on_response.rs @@ -16,10 +16,9 @@ use crate::{Junctions::Here, Xcm}; use codec::{Decode, Encode}; -use core::result; +use core::{fmt::Debug, result}; use frame_support::{pallet_prelude::Get, parameter_types}; use sp_arithmetic::traits::Zero; -use sp_std::fmt::Debug; use xcm::latest::{ Error as XcmError, InteriorLocation, Location, QueryId, Response, Result as XcmResult, Weight, XcmContext, diff --git a/polkadot/xcm/xcm-executor/src/traits/should_execute.rs b/polkadot/xcm/xcm-executor/src/traits/should_execute.rs index 2e3acf5960ec..ec9ef70cc817 100644 --- a/polkadot/xcm/xcm-executor/src/traits/should_execute.rs +++ b/polkadot/xcm/xcm-executor/src/traits/should_execute.rs @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . +use core::result::Result; use frame_support::traits::ProcessMessageError; -use sp_std::result::Result; use xcm::latest::{Instruction, Location, Weight, XcmHash}; /// Properties of an XCM message and its imminent execution. diff --git a/polkadot/xcm/xcm-executor/src/traits/token_matching.rs b/polkadot/xcm/xcm-executor/src/traits/token_matching.rs index 45f3dc062a6d..aa44aee4f9de 100644 --- a/polkadot/xcm/xcm-executor/src/traits/token_matching.rs +++ b/polkadot/xcm/xcm-executor/src/traits/token_matching.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -use sp_std::result; +use core::result; use xcm::latest::prelude::*; pub trait MatchesFungible { diff --git a/polkadot/xcm/xcm-executor/src/traits/transact_asset.rs b/polkadot/xcm/xcm-executor/src/traits/transact_asset.rs index eb85af0b80f3..c2331f805b4b 100644 --- a/polkadot/xcm/xcm-executor/src/traits/transact_asset.rs +++ b/polkadot/xcm/xcm-executor/src/traits/transact_asset.rs @@ -15,7 +15,7 @@ // along with Polkadot. If not, see . use crate::AssetsInHolding; -use sp_std::result::Result; +use core::result::Result; use xcm::latest::{Asset, Error as XcmError, Location, Result as XcmResult, XcmContext}; /// Facility for asset transacting. diff --git a/polkadot/xcm/xcm-executor/src/traits/weight.rs b/polkadot/xcm/xcm-executor/src/traits/weight.rs index 985dfcd0cf2d..72de3e0f433b 100644 --- a/polkadot/xcm/xcm-executor/src/traits/weight.rs +++ b/polkadot/xcm/xcm-executor/src/traits/weight.rs @@ -15,7 +15,7 @@ // along with Polkadot. If not, see . use crate::AssetsInHolding; -use sp_std::result::Result; +use core::result::Result; use xcm::latest::{prelude::*, Weight}; /// Determine the weight of an XCM message. diff --git a/polkadot/xcm/xcm-runtime-apis/Cargo.toml b/polkadot/xcm/xcm-runtime-apis/Cargo.toml index 7d3f1a20b639..748d5af68a1f 100644 --- a/polkadot/xcm/xcm-runtime-apis/Cargo.toml +++ b/polkadot/xcm/xcm-runtime-apis/Cargo.toml @@ -16,7 +16,6 @@ scale-info = { features = ["derive", "serde"], workspace = true } frame-support = { workspace = true } sp-api = { workspace = true } -sp-std = { workspace = true } sp-weights = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } @@ -48,7 +47,6 @@ std = [ "scale-info/std", "sp-api/std", "sp-io/std", - "sp-std/std", "sp-weights/std", "xcm-builder/std", "xcm-executor/std", diff --git a/polkadot/xcm/xcm-runtime-apis/src/conversions.rs b/polkadot/xcm/xcm-runtime-apis/src/conversions.rs index d422664557e0..e5eeac013fee 100644 --- a/polkadot/xcm/xcm-runtime-apis/src/conversions.rs +++ b/polkadot/xcm/xcm-runtime-apis/src/conversions.rs @@ -44,7 +44,7 @@ pub enum Error { /// It is useful when you already have a `ConvertLocation` implementation and a default /// `Ss58Prefix`. pub struct LocationToAccountHelper( - sp_std::marker::PhantomData<(AccountId, Conversion)>, + core::marker::PhantomData<(AccountId, Conversion)>, ); impl> LocationToAccountHelper diff --git a/polkadot/xcm/xcm-runtime-apis/src/dry_run.rs b/polkadot/xcm/xcm-runtime-apis/src/dry_run.rs index 9828acab4023..2a1a0daf0d5d 100644 --- a/polkadot/xcm/xcm-runtime-apis/src/dry_run.rs +++ b/polkadot/xcm/xcm-runtime-apis/src/dry_run.rs @@ -18,9 +18,9 @@ //! This API can be used to simulate XCMs and, for example, find the fees //! that need to be paid. +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::pallet_prelude::{DispatchResultWithPostInfo, TypeInfo}; -use sp_std::vec::Vec; use xcm::prelude::*; /// Effects of dry-running an extrinsic. diff --git a/polkadot/xcm/xcm-runtime-apis/src/fees.rs b/polkadot/xcm/xcm-runtime-apis/src/fees.rs index 572d4edf5338..3445d42ecab3 100644 --- a/polkadot/xcm/xcm-runtime-apis/src/fees.rs +++ b/polkadot/xcm/xcm-runtime-apis/src/fees.rs @@ -16,9 +16,9 @@ //! Runtime API definition for getting XCM fees. +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::pallet_prelude::TypeInfo; -use sp_std::vec::Vec; use sp_weights::Weight; use xcm::{Version, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm}; diff --git a/polkadot/xcm/xcm-runtime-apis/src/lib.rs b/polkadot/xcm/xcm-runtime-apis/src/lib.rs index 7b3b86214b3a..b106836c1132 100644 --- a/polkadot/xcm/xcm-runtime-apis/src/lib.rs +++ b/polkadot/xcm/xcm-runtime-apis/src/lib.rs @@ -18,6 +18,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + /// Exposes runtime APIs for various XCM-related conversions. pub mod conversions; diff --git a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs index e723e2546356..c76b26fcd2a3 100644 --- a/polkadot/xcm/xcm-runtime-apis/tests/mock.rs +++ b/polkadot/xcm/xcm-runtime-apis/tests/mock.rs @@ -18,6 +18,7 @@ //! Implements both runtime APIs for fee estimation and getting the messages for transfers. use codec::Encode; +use core::{cell::RefCell, marker::PhantomData}; use frame_support::{ construct_runtime, derive_impl, parameter_types, sp_runtime, sp_runtime::{ @@ -32,7 +33,6 @@ use frame_support::{ }; use frame_system::{EnsureRoot, RawOrigin as SystemRawOrigin}; use pallet_xcm::TestWeightInfo; -use sp_std::{cell::RefCell, marker::PhantomData}; use xcm::{prelude::*, Version as XcmVersion}; use xcm_builder::{ AllowTopLevelPaidExecutionFrom, ConvertedConcreteId, EnsureXcmOrigin, FixedRateOfFungible, diff --git a/polkadot/xcm/xcm-simulator/example/src/parachain/mod.rs b/polkadot/xcm/xcm-simulator/example/src/parachain/mod.rs index 93c8302757cb..bfb455aba3f9 100644 --- a/polkadot/xcm/xcm-simulator/example/src/parachain/mod.rs +++ b/polkadot/xcm/xcm-simulator/example/src/parachain/mod.rs @@ -31,7 +31,6 @@ use sp_runtime::{ traits::{Get, IdentityLookup}, AccountId32, }; -use sp_std::prelude::*; use xcm::latest::prelude::*; use xcm_builder::{EnsureXcmOrigin, SignedToAccountId32}; use xcm_executor::{traits::ConvertLocation, XcmExecutor}; @@ -101,7 +100,7 @@ impl EnsureOriginWithArg for ForeignCreators { fn try_origin( o: RuntimeOrigin, a: &Location, - ) -> sp_std::result::Result { + ) -> core::result::Result { let origin_location = pallet_xcm::EnsureXcm::::try_origin(o.clone())?; if !a.starts_with(&origin_location) { return Err(o); diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs index 11435868d468..616329a2f06b 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/parachain.rs @@ -29,7 +29,6 @@ use sp_runtime::{ traits::{AccountIdLookup, BlakeTwo256, Hash, IdentifyAccount, Verify}, MultiAddress, MultiSignature, }; -use sp_std::prelude::*; use pallet_xcm::XcmPassthrough; use polkadot_core_primitives::BlockNumber as RelayBlockNumber; diff --git a/polkadot/xcm/xcm-simulator/src/lib.rs b/polkadot/xcm/xcm-simulator/src/lib.rs index a6747a4789ed..59df394406ea 100644 --- a/polkadot/xcm/xcm-simulator/src/lib.rs +++ b/polkadot/xcm/xcm-simulator/src/lib.rs @@ -20,15 +20,18 @@ /// Used for sending messages. pub mod mock_message_queue; +extern crate alloc; + pub use codec::Encode; pub use paste; +pub use alloc::collections::vec_deque::VecDeque; +pub use core::{cell::RefCell, marker::PhantomData}; pub use frame_support::{ traits::{EnqueueMessage, Get, ProcessMessage, ProcessMessageError, ServiceQueues}, weights::{Weight, WeightMeter}, }; pub use sp_io::{hashing::blake2_256, TestExternalities}; -pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData}; pub use polkadot_core_primitives::BlockNumber as RelayBlockNumber; pub use polkadot_parachain_primitives::primitives::{ diff --git a/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs b/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs index 96b47999fe95..bf7b0e15967c 100644 --- a/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs +++ b/polkadot/xcm/xcm-simulator/src/mock_message_queue.rs @@ -24,7 +24,6 @@ use polkadot_parachain_primitives::primitives::{ use polkadot_primitives::BlockNumber as RelayBlockNumber; use sp_runtime::traits::{Get, Hash}; -use sp_std::prelude::*; use xcm::{latest::prelude::*, VersionedXcm}; pub use pallet::*; diff --git a/substrate/bin/node/runtime/src/assets_api.rs b/substrate/bin/node/runtime/src/assets_api.rs index 38ec56507113..98187e7391f3 100644 --- a/substrate/bin/node/runtime/src/assets_api.rs +++ b/substrate/bin/node/runtime/src/assets_api.rs @@ -20,8 +20,8 @@ use polkadot_sdk::*; +use alloc::vec::Vec; use codec::Codec; -use sp_std::vec::Vec; sp_api::decl_runtime_apis! { pub trait AssetsApi diff --git a/substrate/bin/node/runtime/src/impls.rs b/substrate/bin/node/runtime/src/impls.rs index dbe562857c99..6c121fad624b 100644 --- a/substrate/bin/node/runtime/src/impls.rs +++ b/substrate/bin/node/runtime/src/impls.rs @@ -17,8 +17,7 @@ //! Some configurable implementations as associated type for the substrate runtime. -use polkadot_sdk::*; - +use alloc::boxed::Box; use frame_support::{ pallet_prelude::*, traits::{ @@ -29,7 +28,7 @@ use frame_support::{ use pallet_alliance::{IdentityVerifier, ProposalIndex, ProposalProvider}; use pallet_asset_tx_payment::HandleCredit; use pallet_identity::legacy::IdentityField; -use sp_std::prelude::*; +use polkadot_sdk::*; use crate::{ AccountId, AllianceCollective, AllianceMotion, Assets, Authorship, Balances, Hash, diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index fc87fea57ba2..2d1f52066f8f 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -22,8 +22,11 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limits. #![recursion_limit = "1024"] +extern crate alloc; + use polkadot_sdk::*; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_election_provider_support::{ bounds::{ElectionBounds, ElectionBoundsBuilder}, @@ -100,7 +103,6 @@ use sp_runtime::{ ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill, RuntimeDebug, }; -use sp_std::prelude::*; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; @@ -2660,7 +2662,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } diff --git a/substrate/client/executor/runtime-test/Cargo.toml b/substrate/client/executor/runtime-test/Cargo.toml index 5f5e7eb46d62..d132f47ff877 100644 --- a/substrate/client/executor/runtime-test/Cargo.toml +++ b/substrate/client/executor/runtime-test/Cargo.toml @@ -20,7 +20,6 @@ sp-core = { workspace = true } sp-io = { features = ["improved_panic_error_reporting"], workspace = true } sp-runtime = { workspace = true } sp-runtime-interface = { workspace = true } -sp-std = { workspace = true } [build-dependencies] substrate-wasm-builder = { optional = true, workspace = true, default-features = true } @@ -32,6 +31,5 @@ std = [ "sp-io/std", "sp-runtime-interface/std", "sp-runtime/std", - "sp-std/std", "substrate-wasm-builder", ] diff --git a/substrate/client/executor/runtime-test/src/lib.rs b/substrate/client/executor/runtime-test/src/lib.rs index 40683fbb664a..08a5e39dff2c 100644 --- a/substrate/client/executor/runtime-test/src/lib.rs +++ b/substrate/client/executor/runtime-test/src/lib.rs @@ -32,7 +32,10 @@ pub fn wasm_binary_unwrap() -> &'static [u8] { } #[cfg(not(feature = "std"))] -use sp_std::{vec, vec::Vec}; +extern crate alloc; + +#[cfg(not(feature = "std"))] +use alloc::{vec, vec::Vec}; #[cfg(not(feature = "std"))] use sp_core::{ed25519, sr25519}; @@ -332,7 +335,7 @@ sp_core::wasm_export_functions! { let test_message = b"Hello invalid heap memory"; let ptr = (heap_base + offset) as *mut u8; - let message_slice = unsafe { sp_std::slice::from_raw_parts_mut(ptr, test_message.len()) }; + let message_slice = unsafe { alloc::slice::from_raw_parts_mut(ptr, test_message.len()) }; assert_ne!(test_message, message_slice); message_slice.copy_from_slice(test_message); diff --git a/substrate/client/sysinfo/src/sysinfo.rs b/substrate/client/sysinfo/src/sysinfo.rs index 3fa583cf7aca..37b35fcb9103 100644 --- a/substrate/client/sysinfo/src/sysinfo.rs +++ b/substrate/client/sysinfo/src/sysinfo.rs @@ -21,13 +21,13 @@ use crate::{ExecutionLimit, HwBench}; use sc_telemetry::SysInfo; use sp_core::{sr25519, Pair}; use sp_io::crypto::sr25519_verify; -use sp_std::{fmt, fmt::Formatter, prelude::*}; use derive_more::From; use rand::{seq::SliceRandom, Rng, RngCore}; use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer}; use std::{ - fmt::Display, + fmt, + fmt::{Display, Formatter}, fs::File, io::{Seek, SeekFrom, Write}, ops::{Deref, DerefMut}, diff --git a/substrate/frame/Cargo.toml b/substrate/frame/Cargo.toml index 594cb505cd60..41ece6c9a27f 100644 --- a/substrate/frame/Cargo.toml +++ b/substrate/frame/Cargo.toml @@ -27,7 +27,6 @@ scale-info = { features = [ # primitive deps, used for developing FRAME pallets. sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-core = { workspace = true } sp-arithmetic = { workspace = true } @@ -104,7 +103,6 @@ std = [ "sp-offchain?/std", "sp-runtime/std", "sp-session?/std", - "sp-std/std", "sp-storage/std", "sp-transaction-pool?/std", "sp-version?/std", diff --git a/substrate/frame/alliance/Cargo.toml b/substrate/frame/alliance/Cargo.toml index 7ad9961d9b89..451b86b35dde 100644 --- a/substrate/frame/alliance/Cargo.toml +++ b/substrate/frame/alliance/Cargo.toml @@ -22,7 +22,6 @@ log = { workspace = true } codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-std = { workspace = true } sp-core = { workspace = true } sp-crypto-hashing = { optional = true, workspace = true } sp-io = { workspace = true } @@ -57,7 +56,6 @@ std = [ "sp-crypto-hashing?/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "array-bytes", diff --git a/substrate/frame/alliance/src/lib.rs b/substrate/frame/alliance/src/lib.rs index ed771c7226ea..be65f49e6e4e 100644 --- a/substrate/frame/alliance/src/lib.rs +++ b/substrate/frame/alliance/src/lib.rs @@ -94,6 +94,9 @@ pub mod migration; mod types; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; @@ -101,7 +104,6 @@ use sp_runtime::{ traits::{Dispatchable, Saturating, StaticLookup, Zero}, DispatchError, RuntimeDebug, }; -use sp_std::prelude::*; use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo, GetDispatchInfo, PostDispatchInfo}, diff --git a/substrate/frame/alliance/src/types.rs b/substrate/frame/alliance/src/types.rs index 149030b52c67..75b949c19b32 100644 --- a/substrate/frame/alliance/src/types.rs +++ b/substrate/frame/alliance/src/types.rs @@ -15,11 +15,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{traits::ConstU32, BoundedVec}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; -use sp_std::prelude::*; /// A Multihash instance that only supports the basic functionality and no hashing. #[derive( diff --git a/substrate/frame/asset-conversion/Cargo.toml b/substrate/frame/asset-conversion/Cargo.toml index 27d86bf6710b..4e867ece1bd2 100644 --- a/substrate/frame/asset-conversion/Cargo.toml +++ b/substrate/frame/asset-conversion/Cargo.toml @@ -25,7 +25,6 @@ scale-info = { features = ["derive"], workspace = true } sp-api = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } sp-arithmetic = { workspace = true } @@ -51,7 +50,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/asset-conversion/ops/Cargo.toml b/substrate/frame/asset-conversion/ops/Cargo.toml index 0dc6cd5b1672..97a676fde10d 100644 --- a/substrate/frame/asset-conversion/ops/Cargo.toml +++ b/substrate/frame/asset-conversion/ops/Cargo.toml @@ -24,7 +24,6 @@ pallet-asset-conversion = { workspace = true } scale-info = { features = ["derive"], workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } sp-arithmetic = { workspace = true } @@ -50,7 +49,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/asset-conversion/ops/src/benchmarking.rs b/substrate/frame/asset-conversion/ops/src/benchmarking.rs index a7370f38bc4b..384e17c9f0aa 100644 --- a/substrate/frame/asset-conversion/ops/src/benchmarking.rs +++ b/substrate/frame/asset-conversion/ops/src/benchmarking.rs @@ -28,7 +28,6 @@ use frame_system::RawOrigin as SystemOrigin; use pallet_asset_conversion::{BenchmarkHelper, Pallet as AssetConversion}; use sp_core::Get; use sp_runtime::traits::One; -use sp_std::prelude::*; /// Provides a pair of amounts expected to serve as sufficient initial liquidity for a pool. fn valid_liquidity_amount(ed1: T::Balance, ed2: T::Balance) -> (T::Balance, T::Balance) diff --git a/substrate/frame/asset-conversion/ops/src/lib.rs b/substrate/frame/asset-conversion/ops/src/lib.rs index a655a9cb4452..58c15b47a3eb 100644 --- a/substrate/frame/asset-conversion/ops/src/lib.rs +++ b/substrate/frame/asset-conversion/ops/src/lib.rs @@ -42,6 +42,9 @@ pub mod weights; pub use pallet::*; pub use weights::WeightInfo; +extern crate alloc; + +use alloc::boxed::Box; use frame_support::traits::{ fungible::{Inspect as FungibleInspect, Mutate as FungibleMutate}, fungibles::{roles::ResetTeam, Inspect, Mutate, Refund}, @@ -50,7 +53,6 @@ use frame_support::traits::{ }; use pallet_asset_conversion::{PoolLocator, Pools}; use sp_runtime::traits::{TryConvert, Zero}; -use sp_std::boxed::Box; #[frame_support::pallet] pub mod pallet { diff --git a/substrate/frame/asset-conversion/ops/src/mock.rs b/substrate/frame/asset-conversion/ops/src/mock.rs index 91c18b2e7949..5c05faa6aa88 100644 --- a/substrate/frame/asset-conversion/ops/src/mock.rs +++ b/substrate/frame/asset-conversion/ops/src/mock.rs @@ -17,7 +17,6 @@ //! Test environment for Asset Conversion Ops pallet. -use super::*; use crate as pallet_asset_conversion_ops; use core::default::Default; use frame_support::{ diff --git a/substrate/frame/asset-conversion/src/benchmarking.rs b/substrate/frame/asset-conversion/src/benchmarking.rs index c5f68476b1d0..b003fe482881 100644 --- a/substrate/frame/asset-conversion/src/benchmarking.rs +++ b/substrate/frame/asset-conversion/src/benchmarking.rs @@ -19,6 +19,8 @@ use super::*; use crate::Pallet as AssetConversion; +use alloc::vec; +use core::marker::PhantomData; use frame_benchmarking::{v2::*, whitelisted_caller}; use frame_support::{ assert_ok, @@ -29,7 +31,6 @@ use frame_support::{ }; use frame_system::RawOrigin as SystemOrigin; use sp_core::Get; -use sp_std::{marker::PhantomData, prelude::*}; /// Benchmark Helper pub trait BenchmarkHelper { diff --git a/substrate/frame/asset-conversion/src/lib.rs b/substrate/frame/asset-conversion/src/lib.rs index 62acb693efb1..a9dc30375e5a 100644 --- a/substrate/frame/asset-conversion/src/lib.rs +++ b/substrate/frame/asset-conversion/src/lib.rs @@ -70,6 +70,9 @@ pub use swap::*; pub use types::*; pub use weights::WeightInfo; +extern crate alloc; + +use alloc::{boxed::Box, collections::btree_set::BTreeSet, vec::Vec}; use codec::Codec; use frame_support::{ storage::{with_storage_layer, with_transaction}, @@ -93,7 +96,6 @@ use sp_runtime::{ }, DispatchError, Saturating, TokenError, TransactionOutcome, }; -use sp_std::{boxed::Box, collections::btree_set::BTreeSet, vec::Vec}; #[frame_support::pallet] pub mod pallet { diff --git a/substrate/frame/asset-rate/Cargo.toml b/substrate/frame/asset-rate/Cargo.toml index 96c87020684f..4aeb6a39e824 100644 --- a/substrate/frame/asset-rate/Cargo.toml +++ b/substrate/frame/asset-rate/Cargo.toml @@ -23,7 +23,6 @@ frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-core = { optional = true, workspace = true } [dev-dependencies] @@ -43,7 +42,6 @@ std = [ "sp-core?/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/asset-rate/src/lib.rs b/substrate/frame/asset-rate/src/lib.rs index 69f8267a4f25..cfb013a73f5e 100644 --- a/substrate/frame/asset-rate/src/lib.rs +++ b/substrate/frame/asset-rate/src/lib.rs @@ -59,6 +59,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::boxed::Box; use frame_support::traits::{ fungible::Inspect, tokens::{ConversionFromAssetBalance, ConversionToAssetBalance}, @@ -67,7 +70,6 @@ use sp_runtime::{ traits::{CheckedDiv, Zero}, FixedPointNumber, FixedU128, }; -use sp_std::boxed::Box; pub use pallet::*; pub use weights::WeightInfo; diff --git a/substrate/frame/assets/Cargo.toml b/substrate/frame/assets/Cargo.toml index d0b5dc777898..802b8b9f39d8 100644 --- a/substrate/frame/assets/Cargo.toml +++ b/substrate/frame/assets/Cargo.toml @@ -20,7 +20,6 @@ codec = { workspace = true } impl-trait-for-tuples = "0.2.2" log = { workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-std = { workspace = true } # Needed for various traits. In our case, `OnFinalize`. sp-runtime = { workspace = true } # Needed for type-safe access to storage DB. @@ -48,7 +47,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/assets/src/benchmarking.rs b/substrate/frame/assets/src/benchmarking.rs index 1b65bb953d77..97cc04174a0c 100644 --- a/substrate/frame/assets/src/benchmarking.rs +++ b/substrate/frame/assets/src/benchmarking.rs @@ -20,13 +20,13 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; +use alloc::vec; use frame_benchmarking::v1::{ account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, BenchmarkError, }; use frame_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable}; use frame_system::RawOrigin as SystemOrigin; use sp_runtime::traits::Bounded; -use sp_std::prelude::*; use crate::Pallet as Assets; @@ -76,7 +76,7 @@ fn swap_is_sufficient, I: 'static>(s: &mut bool) { let asset_id = default_asset_id::(); Asset::::mutate(&asset_id.into(), |maybe_a| { if let Some(ref mut a) = maybe_a { - sp_std::mem::swap(s, &mut a.is_sufficient) + core::mem::swap(s, &mut a.is_sufficient) } }); } diff --git a/substrate/frame/assets/src/functions.rs b/substrate/frame/assets/src/functions.rs index 1e4a9522759c..c218c4ddc952 100644 --- a/substrate/frame/assets/src/functions.rs +++ b/substrate/frame/assets/src/functions.rs @@ -18,6 +18,7 @@ //! Functions for the Assets pallet. use super::*; +use alloc::vec; use frame_support::{defensive, traits::Get, BoundedVec}; #[must_use] @@ -35,20 +36,20 @@ impl, I: 'static> Pallet { /// Return the extra "sid-car" data for `id`/`who`, or `None` if the account doesn't exist. pub fn adjust_extra( id: T::AssetId, - who: impl sp_std::borrow::Borrow, + who: impl core::borrow::Borrow, ) -> Option> { ExtraMutator::maybe_new(id, who) } /// Get the asset `id` balance of `who`, or zero if the asset-account doesn't exist. - pub fn balance(id: T::AssetId, who: impl sp_std::borrow::Borrow) -> T::Balance { + pub fn balance(id: T::AssetId, who: impl core::borrow::Borrow) -> T::Balance { Self::maybe_balance(id, who).unwrap_or_default() } /// Get the asset `id` balance of `who` if the asset-account exists. pub fn maybe_balance( id: T::AssetId, - who: impl sp_std::borrow::Borrow, + who: impl core::borrow::Borrow, ) -> Option { Account::::get(id, who.borrow()).map(|a| a.balance) } diff --git a/substrate/frame/assets/src/impl_fungibles.rs b/substrate/frame/assets/src/impl_fungibles.rs index 30122f6d788f..578fa08c4e63 100644 --- a/substrate/frame/assets/src/impl_fungibles.rs +++ b/substrate/frame/assets/src/impl_fungibles.rs @@ -17,6 +17,7 @@ //! Implementations for fungibles trait. +use alloc::vec::Vec; use frame_support::{ defensive, traits::tokens::{ diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 6dbce717a8e8..b9b5b2388dfb 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -167,13 +167,15 @@ mod impl_stored_map; mod types; pub use types::*; +extern crate alloc; + use scale_info::TypeInfo; use sp_runtime::{ traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Saturating, StaticLookup, Zero}, ArithmeticError, DispatchError, TokenError, }; -use sp_std::prelude::*; +use alloc::vec::Vec; use core::marker::PhantomData; use frame_support::{ dispatch::DispatchResult, diff --git a/substrate/frame/atomic-swap/Cargo.toml b/substrate/frame/atomic-swap/Cargo.toml index 7e2f5fc74ab2..033100630129 100644 --- a/substrate/frame/atomic-swap/Cargo.toml +++ b/substrate/frame/atomic-swap/Cargo.toml @@ -23,7 +23,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -39,7 +38,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/atomic-swap/src/lib.rs b/substrate/frame/atomic-swap/src/lib.rs index dc0300dc1a5c..c3010f5c9c03 100644 --- a/substrate/frame/atomic-swap/src/lib.rs +++ b/substrate/frame/atomic-swap/src/lib.rs @@ -42,6 +42,9 @@ mod tests; +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode}; use core::{ marker::PhantomData, @@ -58,7 +61,6 @@ use frame_system::pallet_prelude::BlockNumberFor; use scale_info::TypeInfo; use sp_io::hashing::blake2_256; use sp_runtime::RuntimeDebug; -use sp_std::vec::Vec; /// Pending atomic swap operation. #[derive(Clone, Eq, PartialEq, RuntimeDebugNoBound, Encode, Decode, TypeInfo, MaxEncodedLen)] diff --git a/substrate/frame/aura/Cargo.toml b/substrate/frame/aura/Cargo.toml index 97582e7d2e9d..f9d745927638 100644 --- a/substrate/frame/aura/Cargo.toml +++ b/substrate/frame/aura/Cargo.toml @@ -25,7 +25,6 @@ pallet-timestamp = { workspace = true } sp-application-crypto = { workspace = true } sp-consensus-aura = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true } @@ -45,7 +44,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/aura/src/lib.rs b/substrate/frame/aura/src/lib.rs index 3ca1444aaae9..f829578fb285 100644 --- a/substrate/frame/aura/src/lib.rs +++ b/substrate/frame/aura/src/lib.rs @@ -38,6 +38,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ traits::{DisabledValidators, FindAuthor, Get, OnTimestampSet, OneSessionHandler}, @@ -50,7 +53,6 @@ use sp_runtime::{ traits::{IsMember, Member, SaturatedConversion, Saturating, Zero}, RuntimeAppPublic, }; -use sp_std::prelude::*; pub mod migrations; mod mock; @@ -66,7 +68,7 @@ const LOG_TARGET: &str = "runtime::aura"; /// /// This was the default behavior of the Aura pallet and may be used for /// backwards compatibility. -pub struct MinimumPeriodTimesTwo(sp_std::marker::PhantomData); +pub struct MinimumPeriodTimesTwo(core::marker::PhantomData); impl Get for MinimumPeriodTimesTwo { fn get() -> T::Moment { @@ -119,7 +121,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(sp_std::marker::PhantomData); + pub struct Pallet(core::marker::PhantomData); #[pallet::hooks] impl Hooks> for Pallet { @@ -362,7 +364,7 @@ impl FindAuthor for Pallet { /// We can not implement `FindAuthor` twice, because the compiler does not know if /// `u32 == T::AuthorityId` and thus, prevents us to implement the trait twice. #[doc(hidden)] -pub struct FindAccountFromAuthorIndex(sp_std::marker::PhantomData<(T, Inner)>); +pub struct FindAccountFromAuthorIndex(core::marker::PhantomData<(T, Inner)>); impl> FindAuthor for FindAccountFromAuthorIndex diff --git a/substrate/frame/authority-discovery/Cargo.toml b/substrate/frame/authority-discovery/Cargo.toml index 79057d94107b..9d55a7fd5dcb 100644 --- a/substrate/frame/authority-discovery/Cargo.toml +++ b/substrate/frame/authority-discovery/Cargo.toml @@ -28,7 +28,6 @@ pallet-session = { features = [ sp-application-crypto = { workspace = true } sp-authority-discovery = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true, default-features = true } @@ -47,7 +46,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/authority-discovery/src/lib.rs b/substrate/frame/authority-discovery/src/lib.rs index 16f71960d693..220b39292b57 100644 --- a/substrate/frame/authority-discovery/src/lib.rs +++ b/substrate/frame/authority-discovery/src/lib.rs @@ -23,12 +23,14 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use frame_support::{ traits::{Get, OneSessionHandler}, WeakBoundedVec, }; use sp_authority_discovery::AuthorityId; -use sp_std::prelude::*; pub use pallet::*; @@ -62,7 +64,7 @@ pub mod pallet { pub struct GenesisConfig { pub keys: Vec, #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -168,6 +170,7 @@ impl OneSessionHandler for Pallet { mod tests { use super::*; use crate as pallet_authority_discovery; + use alloc::vec; use frame_support::{derive_impl, parameter_types, traits::ConstU32}; use sp_application_crypto::Pair; use sp_authority_discovery::AuthorityPair; diff --git a/substrate/frame/authorship/Cargo.toml b/substrate/frame/authorship/Cargo.toml index 58292c0eba39..8ecacca93e0a 100644 --- a/substrate/frame/authorship/Cargo.toml +++ b/substrate/frame/authorship/Cargo.toml @@ -24,7 +24,6 @@ scale-info = { features = ["derive"], workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true, default-features = true } @@ -40,7 +39,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/authorship/src/lib.rs b/substrate/frame/authorship/src/lib.rs index d8f1baab23c8..a0cca806e786 100644 --- a/substrate/frame/authorship/src/lib.rs +++ b/substrate/frame/authorship/src/lib.rs @@ -22,7 +22,6 @@ #![cfg_attr(not(feature = "std"), no_std)] use frame_support::traits::FindAuthor; -use sp_std::prelude::*; pub use pallet::*; diff --git a/substrate/frame/babe/Cargo.toml b/substrate/frame/babe/Cargo.toml index 68638798e796..3dfda3b618be 100644 --- a/substrate/frame/babe/Cargo.toml +++ b/substrate/frame/babe/Cargo.toml @@ -32,7 +32,6 @@ sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-session = { workspace = true } sp-staking = { features = ["serde"], workspace = true } -sp-std = { workspace = true } [dev-dependencies] frame-election-provider-support = { workspace = true, default-features = true } @@ -65,7 +64,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/babe/src/equivocation.rs b/substrate/frame/babe/src/equivocation.rs index ed1df640583b..4be07bdae1f0 100644 --- a/substrate/frame/babe/src/equivocation.rs +++ b/substrate/frame/babe/src/equivocation.rs @@ -33,6 +33,7 @@ //! that the `ValidateUnsigned` for the BABE pallet is used in the runtime //! definition. +use alloc::{boxed::Box, vec, vec::Vec}; use frame_support::traits::{Get, KeyOwnerProofSystem}; use frame_system::pallet_prelude::HeaderFor; use log::{error, info}; @@ -50,7 +51,6 @@ use sp_staking::{ offence::{Kind, Offence, OffenceReportSystem, ReportOffence}, SessionIndex, }; -use sp_std::prelude::*; use crate::{Call, Config, Error, Pallet, LOG_TARGET}; @@ -104,7 +104,7 @@ impl Offence for EquivocationOffence { /// - On-chain validity checks and processing are mostly delegated to the user provided generic /// types implementing `KeyOwnerProofSystem` and `ReportOffence` traits. /// - Offence reporter for unsigned transactions is fetched via the the authorship pallet. -pub struct EquivocationReportSystem(sp_std::marker::PhantomData<(T, R, P, L)>); +pub struct EquivocationReportSystem(core::marker::PhantomData<(T, R, P, L)>); impl OffenceReportSystem, (EquivocationProof>, T::KeyOwnerProof)> diff --git a/substrate/frame/babe/src/lib.rs b/substrate/frame/babe/src/lib.rs index 9e16f1d09515..3e33d5627c47 100644 --- a/substrate/frame/babe/src/lib.rs +++ b/substrate/frame/babe/src/lib.rs @@ -21,6 +21,9 @@ #![cfg_attr(not(feature = "std"), no_std)] #![warn(unused_must_use, unsafe_code, unused_variables, unused_must_use)] +extern crate alloc; + +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ dispatch::{DispatchResultWithPostInfo, Pays}, @@ -44,7 +47,6 @@ use sp_runtime::{ }; use sp_session::{GetSessionNumber, GetValidatorCount}; use sp_staking::{offence::OffenceReportSystem, SessionIndex}; -use sp_std::prelude::*; pub use sp_consensus_babe::AuthorityId; @@ -315,7 +317,7 @@ pub mod pallet { pub authorities: Vec<(AuthorityId, BabeAuthorityWeight)>, pub epoch_config: BabeEpochConfiguration, #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -687,7 +689,7 @@ impl Pallet { // Update the start blocks of the previous and new current epoch. EpochStart::::mutate(|(previous_epoch_start_block, current_epoch_start_block)| { - *previous_epoch_start_block = sp_std::mem::take(current_epoch_start_block); + *previous_epoch_start_block = core::mem::take(current_epoch_start_block); *current_epoch_start_block = >::block_number(); }); @@ -868,7 +870,7 @@ impl Pallet { /// randomness. Returns the new randomness. fn randomness_change_epoch(next_epoch_index: u64) -> BabeRandomness { let this_randomness = NextRandomness::::get(); - let segment_idx: u32 = SegmentIndex::::mutate(|s| sp_std::mem::replace(s, 0)); + let segment_idx: u32 = SegmentIndex::::mutate(|s| core::mem::replace(s, 0)); // overestimate to the segment being full. let rho_size = (segment_idx.saturating_add(1) * UNDER_CONSTRUCTION_SEGMENT_LENGTH) as usize; @@ -1055,7 +1057,7 @@ pub mod migrations { fn pallet_prefix() -> &'static str; } - struct __OldNextEpochConfig(sp_std::marker::PhantomData); + struct __OldNextEpochConfig(core::marker::PhantomData); impl frame_support::traits::StorageInstance for __OldNextEpochConfig { fn pallet_prefix() -> &'static str { T::pallet_prefix() diff --git a/substrate/frame/bags-list/Cargo.toml b/substrate/frame/bags-list/Cargo.toml index bf57bd2af53c..549c4334b55d 100644 --- a/substrate/frame/bags-list/Cargo.toml +++ b/substrate/frame/bags-list/Cargo.toml @@ -25,7 +25,6 @@ scale-info = { features = [ # primitives sp-runtime = { workspace = true } -sp-std = { workspace = true } # FRAME frame-support = { workspace = true } @@ -66,7 +65,6 @@ std = [ "sp-core?/std", "sp-io?/std", "sp-runtime/std", - "sp-std/std", "sp-tracing?/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/bags-list/remote-tests/src/lib.rs b/substrate/frame/bags-list/remote-tests/src/lib.rs index 9f7c22d99dad..1f0584fa07e5 100644 --- a/substrate/frame/bags-list/remote-tests/src/lib.rs +++ b/substrate/frame/bags-list/remote-tests/src/lib.rs @@ -19,7 +19,6 @@ use frame_election_provider_support::ScoreProvider; use pallet_bags_list::Instance1; -use sp_std::prelude::*; /// A common log target to use. pub const LOG_TARGET: &str = "runtime::bags-list::remote-tests"; diff --git a/substrate/frame/bags-list/src/benchmarks.rs b/substrate/frame/bags-list/src/benchmarks.rs index 0c3955c0d7b7..55f4c24835ea 100644 --- a/substrate/frame/bags-list/src/benchmarks.rs +++ b/substrate/frame/bags-list/src/benchmarks.rs @@ -19,6 +19,7 @@ use super::*; use crate::list::List; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{ account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, }; diff --git a/substrate/frame/bags-list/src/lib.rs b/substrate/frame/bags-list/src/lib.rs index 8e3d4cc1f012..f6af1da5e7b7 100644 --- a/substrate/frame/bags-list/src/lib.rs +++ b/substrate/frame/bags-list/src/lib.rs @@ -122,11 +122,13 @@ #[doc = docify::embed!("src/tests.rs", examples_work)] pub mod example {} +extern crate alloc; + +use alloc::boxed::Box; use codec::FullCodec; use frame_election_provider_support::{ScoreProvider, SortedListProvider}; use frame_system::ensure_signed; use sp_runtime::traits::{AtLeast32BitUnsigned, Bounded, StaticLookup}; -use sp_std::prelude::*; #[cfg(any(test, feature = "try-runtime", feature = "fuzz"))] use sp_runtime::TryRuntimeError; @@ -238,7 +240,7 @@ pub mod pallet { + Eq + Ord + PartialOrd - + sp_std::fmt::Debug + + core::fmt::Debug + Copy + AtLeast32BitUnsigned + Bounded @@ -465,7 +467,7 @@ impl, I: 'static> SortedListProvider for Pallet let node = list::Node::::get(who).unwrap(); let current_bag_idx = thresholds .iter() - .chain(sp_std::iter::once(&T::Score::max_value())) + .chain(core::iter::once(&T::Score::max_value())) .position(|w| w == &node.bag_upper) .unwrap(); diff --git a/substrate/frame/bags-list/src/list/mod.rs b/substrate/frame/bags-list/src/list/mod.rs index e90530341a15..696b64d40e9b 100644 --- a/substrate/frame/bags-list/src/list/mod.rs +++ b/substrate/frame/bags-list/src/list/mod.rs @@ -25,7 +25,12 @@ //! interface. use crate::Config; +use alloc::{ + boxed::Box, + collections::{btree_map::BTreeMap, btree_set::BTreeSet}, +}; use codec::{Decode, Encode, MaxEncodedLen}; +use core::{iter, marker::PhantomData}; use frame_election_provider_support::ScoreProvider; use frame_support::{ defensive, ensure, @@ -34,14 +39,15 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_runtime::traits::{Bounded, Zero}; -use sp_std::{ - boxed::Box, - collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - iter, - marker::PhantomData, - prelude::*, -}; +#[cfg(any( + test, + feature = "try-runtime", + feature = "fuzz", + feature = "std", + feature = "runtime-benchmarks" +))] +use alloc::vec::Vec; #[cfg(any(test, feature = "try-runtime", feature = "fuzz"))] use sp_runtime::TryRuntimeError; @@ -274,7 +280,7 @@ impl, I: 'static> List { let start_node = Node::::get(start).ok_or(ListError::NodeNotFound)?; let start_node_upper = start_node.bag_upper; - let start_bag = sp_std::iter::successors(start_node.next(), |prev| prev.next()); + let start_bag = core::iter::successors(start_node.next(), |prev| prev.next()); let thresholds = T::BagThresholds::get(); let idx = thresholds.partition_point(|&threshold| start_node_upper > threshold); @@ -341,7 +347,7 @@ impl, I: 'static> List { if !Self::contains(id) { return Err(ListError::NodeNotFound) } - let _ = Self::remove_many(sp_std::iter::once(id)); + let _ = Self::remove_many(core::iter::once(id)); Ok(()) } @@ -591,7 +597,7 @@ impl, I: 'static> List { Box::new(iter) } else { // otherwise, insert it here. - Box::new(iter.chain(sp_std::iter::once(T::Score::max_value()))) + Box::new(iter.chain(core::iter::once(T::Score::max_value()))) }; iter.filter_map(|t| { @@ -673,7 +679,7 @@ impl, I: 'static> Bag { /// Iterate over the nodes in this bag. pub(crate) fn iter(&self) -> impl Iterator> { - sp_std::iter::successors(self.head(), |prev| prev.next()) + core::iter::successors(self.head(), |prev| prev.next()) } /// Insert a new id into this bag. @@ -804,7 +810,7 @@ impl, I: 'static> Bag { #[cfg(feature = "std")] #[allow(dead_code)] pub fn std_iter(&self) -> impl Iterator> { - sp_std::iter::successors(self.head(), |prev| prev.next()) + core::iter::successors(self.head(), |prev| prev.next()) } } diff --git a/substrate/frame/bags-list/src/migrations.rs b/substrate/frame/bags-list/src/migrations.rs index 7df63a6a44c5..bfc70fef370a 100644 --- a/substrate/frame/bags-list/src/migrations.rs +++ b/substrate/frame/bags-list/src/migrations.rs @@ -28,10 +28,10 @@ use frame_support::ensure; use sp_runtime::TryRuntimeError; #[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; +use alloc::vec::Vec; /// A struct that does not migration, but only checks that the counter prefix exists and is correct. -pub struct CheckCounterPrefix, I: 'static>(sp_std::marker::PhantomData<(T, I)>); +pub struct CheckCounterPrefix, I: 'static>(core::marker::PhantomData<(T, I)>); impl, I: 'static> OnRuntimeUpgrade for CheckCounterPrefix { fn on_runtime_upgrade() -> frame_support::weights::Weight { frame_support::weights::Weight::zero() @@ -88,7 +88,7 @@ mod old { } /// A struct that migrates all bags lists to contain a score value. -pub struct AddScore, I: 'static = ()>(sp_std::marker::PhantomData<(T, I)>); +pub struct AddScore, I: 'static = ()>(core::marker::PhantomData<(T, I)>); impl, I: 'static> OnRuntimeUpgrade for AddScore { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { diff --git a/substrate/frame/balances/Cargo.toml b/substrate/frame/balances/Cargo.toml index 5fa8fa84bf59..85734dce9e9b 100644 --- a/substrate/frame/balances/Cargo.toml +++ b/substrate/frame/balances/Cargo.toml @@ -23,7 +23,6 @@ frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } docify = { workspace = true } [dev-dependencies] @@ -46,7 +45,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] # Enable support for setting the existential deposit to zero. insecure_zero_ed = [] diff --git a/substrate/frame/balances/src/impl_currency.rs b/substrate/frame/balances/src/impl_currency.rs index d5fe9934e239..454aead1773f 100644 --- a/substrate/frame/balances/src/impl_currency.rs +++ b/substrate/frame/balances/src/impl_currency.rs @@ -39,8 +39,8 @@ pub use imbalances::{NegativeImbalance, PositiveImbalance}; // of the inner member. mod imbalances { use super::{result, Config, Imbalance, RuntimeDebug, Saturating, TryDrop, Zero}; + use core::mem; use frame_support::traits::SameOrOther; - use sp_std::mem; /// Opaque, move-only struct with private fields that serves as a token denoting that /// funds have been created without any equal and opposite accounting. diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index d01884293c09..0aaf618b303f 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -150,7 +150,11 @@ mod tests; mod types; pub mod weights; +extern crate alloc; + +use alloc::vec::Vec; use codec::{Codec, MaxEncodedLen}; +use core::{cmp, fmt::Debug, mem, result}; use frame_support::{ ensure, pallet_prelude::DispatchResult, @@ -176,7 +180,6 @@ use sp_runtime::{ }, ArithmeticError, DispatchError, FixedPointOperand, Perbill, RuntimeDebug, TokenError, }; -use sp_std::{cmp, fmt::Debug, mem, prelude::*, result}; pub use types::{ AccountData, AdjustmentDirection, BalanceLock, DustCleaner, ExtraFlags, Reasons, ReserveData, }; @@ -525,7 +528,7 @@ pub mod pallet { .iter() .map(|(x, _)| x) .cloned() - .collect::>(); + .collect::>(); assert!( endowed_accounts.len() == self.balances.len(), @@ -856,13 +859,13 @@ pub mod pallet { } /// Get the free balance of an account. - pub fn free_balance(who: impl sp_std::borrow::Borrow) -> T::Balance { + pub fn free_balance(who: impl core::borrow::Borrow) -> T::Balance { Self::account(who.borrow()).free } /// Get the balance of an account that can be used for transfers, reservations, or any other /// non-locking, non-transaction-fee activity. Will be at most `free_balance`. - pub fn usable_balance(who: impl sp_std::borrow::Borrow) -> T::Balance { + pub fn usable_balance(who: impl core::borrow::Borrow) -> T::Balance { >::reducible_balance(who.borrow(), Expendable, Polite) } @@ -870,14 +873,12 @@ pub mod pallet { /// or any other kind of fees, though). Will be at most `free_balance`. /// /// This requires that the account stays alive. - pub fn usable_balance_for_fees( - who: impl sp_std::borrow::Borrow, - ) -> T::Balance { + pub fn usable_balance_for_fees(who: impl core::borrow::Borrow) -> T::Balance { >::reducible_balance(who.borrow(), Protect, Polite) } /// Get the reserved balance of an account. - pub fn reserved_balance(who: impl sp_std::borrow::Borrow) -> T::Balance { + pub fn reserved_balance(who: impl core::borrow::Borrow) -> T::Balance { Self::account(who.borrow()).reserved } diff --git a/substrate/frame/beefy-mmr/Cargo.toml b/substrate/frame/beefy-mmr/Cargo.toml index b46998a85742..11a7b281e87d 100644 --- a/substrate/frame/beefy-mmr/Cargo.toml +++ b/substrate/frame/beefy-mmr/Cargo.toml @@ -27,7 +27,6 @@ sp-consensus-beefy = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-api = { workspace = true } sp-state-machine = { workspace = true } @@ -56,7 +55,6 @@ std = [ "sp-runtime/std", "sp-staking/std", "sp-state-machine/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/beefy-mmr/src/lib.rs b/substrate/frame/beefy-mmr/src/lib.rs index 18ebc9d8f38a..ec341cad2084 100644 --- a/substrate/frame/beefy-mmr/src/lib.rs +++ b/substrate/frame/beefy-mmr/src/lib.rs @@ -33,9 +33,11 @@ //! //! and thanks to versioning can be easily updated in the future. +extern crate alloc; + use sp_runtime::traits::{Convert, Header, Member}; -use sp_std::prelude::*; +use alloc::vec::Vec; use codec::Decode; use pallet_mmr::{primitives::AncestryProof, LeafDataProvider, ParentNumberAndHash}; use sp_consensus_beefy::{ @@ -56,7 +58,7 @@ mod mock; mod tests; /// A BEEFY consensus digest item with MMR root hash. -pub struct DepositBeefyDigest(sp_std::marker::PhantomData); +pub struct DepositBeefyDigest(core::marker::PhantomData); impl pallet_mmr::primitives::OnNewRoot for DepositBeefyDigest where diff --git a/substrate/frame/beefy/Cargo.toml b/substrate/frame/beefy/Cargo.toml index 8ce3a05985be..089b817e226f 100644 --- a/substrate/frame/beefy/Cargo.toml +++ b/substrate/frame/beefy/Cargo.toml @@ -24,7 +24,6 @@ sp-consensus-beefy = { features = ["serde"], workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-session = { workspace = true } sp-staking = { features = ["serde"], workspace = true } -sp-std = { workspace = true } [dev-dependencies] frame-election-provider-support = { workspace = true, default-features = true } @@ -61,7 +60,6 @@ std = [ "sp-session/std", "sp-staking/std", "sp-state-machine/std", - "sp-std/std", ] try-runtime = [ "frame-election-provider-support/try-runtime", diff --git a/substrate/frame/beefy/src/equivocation.rs b/substrate/frame/beefy/src/equivocation.rs index a1526e781111..15345e6ae199 100644 --- a/substrate/frame/beefy/src/equivocation.rs +++ b/substrate/frame/beefy/src/equivocation.rs @@ -34,6 +34,7 @@ //! that the `ValidateUnsigned` for the BEEFY pallet is used in the runtime //! definition. +use alloc::{vec, vec::Vec}; use codec::{self as codec, Decode, Encode}; use frame_support::traits::{Get, KeyOwnerProofSystem}; use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor}; @@ -54,7 +55,6 @@ use sp_staking::{ offence::{Kind, Offence, OffenceReportSystem, ReportOffence}, SessionIndex, }; -use sp_std::prelude::*; use super::{Call, Config, Error, Pallet, LOG_TARGET}; @@ -122,7 +122,7 @@ where /// - On-chain validity checks and processing are mostly delegated to the user provided generic /// types implementing `KeyOwnerProofSystem` and `ReportOffence` traits. /// - Offence reporter for unsigned transactions is fetched via the authorship pallet. -pub struct EquivocationReportSystem(sp_std::marker::PhantomData<(T, R, P, L)>); +pub struct EquivocationReportSystem(core::marker::PhantomData<(T, R, P, L)>); /// Equivocation evidence convenience alias. pub enum EquivocationEvidenceFor { diff --git a/substrate/frame/beefy/src/lib.rs b/substrate/frame/beefy/src/lib.rs index a49f5d28f455..fd9a0027c6fc 100644 --- a/substrate/frame/beefy/src/lib.rs +++ b/substrate/frame/beefy/src/lib.rs @@ -17,6 +17,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; use codec::{Encode, MaxEncodedLen}; use frame_support::{ @@ -38,7 +41,6 @@ use sp_runtime::{ }; use sp_session::{GetSessionNumber, GetValidatorCount}; use sp_staking::{offence::OffenceReportSystem, SessionIndex}; -use sp_std::prelude::*; use sp_consensus_beefy::{ AncestryHelper, AuthorityIndex, BeefyAuthorityId, ConsensusLog, DoubleVotingProof, diff --git a/substrate/frame/benchmarking/Cargo.toml b/substrate/frame/benchmarking/Cargo.toml index a2c15951a596..61bc706963bb 100644 --- a/substrate/frame/benchmarking/Cargo.toml +++ b/substrate/frame/benchmarking/Cargo.toml @@ -31,7 +31,6 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } sp-runtime-interface = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } static_assertions = { workspace = true, default-features = true } @@ -58,7 +57,6 @@ std = [ "sp-keystore/std", "sp-runtime-interface/std", "sp-runtime/std", - "sp-std/std", "sp-storage/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/benchmarking/pov/Cargo.toml b/substrate/frame/benchmarking/pov/Cargo.toml index 4341f011fcbf..6a449fb597d5 100644 --- a/substrate/frame/benchmarking/pov/Cargo.toml +++ b/substrate/frame/benchmarking/pov/Cargo.toml @@ -22,7 +22,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -34,7 +33,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/benchmarking/pov/src/benchmarking.rs b/substrate/frame/benchmarking/pov/src/benchmarking.rs index 7e6aa8e6bf60..bf3d406d0b2b 100644 --- a/substrate/frame/benchmarking/pov/src/benchmarking.rs +++ b/substrate/frame/benchmarking/pov/src/benchmarking.rs @@ -247,7 +247,7 @@ mod benchmarks { #[benchmark(pov_mode = Measured)] fn measured_storage_value_read_linear_size(l: Linear<0, { 1 << 22 }>) { - let v: sp_runtime::BoundedVec = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::::put(&v); #[block] { @@ -257,7 +257,7 @@ mod benchmarks { #[benchmark(pov_mode = MaxEncodedLen)] fn mel_storage_value_read_linear_size(l: Linear<0, { 1 << 22 }>) { - let v: sp_runtime::BoundedVec = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::::put(&v); #[block] { @@ -267,7 +267,7 @@ mod benchmarks { #[benchmark(pov_mode = Measured)] fn measured_storage_double_value_read_linear_size(l: Linear<0, { 1 << 22 }>) { - let v: sp_runtime::BoundedVec = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::::put(&v); LargeValue2::::put(&v); #[block] @@ -279,7 +279,7 @@ mod benchmarks { #[benchmark(pov_mode = MaxEncodedLen)] fn mel_storage_double_value_read_linear_size(l: Linear<0, { 1 << 22 }>) { - let v: sp_runtime::BoundedVec = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::::put(&v); LargeValue2::::put(&v); #[block] @@ -293,7 +293,7 @@ mod benchmarks { Pov::LargeValue2: Measured })] fn mel_mixed_storage_double_value_read_linear_size(l: Linear<0, { 1 << 22 }>) { - let v: sp_runtime::BoundedVec = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::::put(&v); LargeValue2::::put(&v); #[block] @@ -307,7 +307,7 @@ mod benchmarks { Pov::LargeValue2: MaxEncodedLen })] fn measured_mixed_storage_double_value_read_linear_size(l: Linear<0, { 1 << 22 }>) { - let v: sp_runtime::BoundedVec = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::::put(&v); LargeValue2::::put(&v); #[block] @@ -319,8 +319,8 @@ mod benchmarks { #[benchmark(pov_mode = Measured)] fn storage_map_unbounded_both_measured_read(i: Linear<0, 1000>) { - UnboundedMap::::insert(i, sp_std::vec![0; i as usize]); - UnboundedMap2::::insert(i, sp_std::vec![0; i as usize]); + UnboundedMap::::insert(i, alloc::vec![0; i as usize]); + UnboundedMap2::::insert(i, alloc::vec![0; i as usize]); #[block] { assert!(UnboundedMap::::get(i).is_some()); @@ -333,7 +333,7 @@ mod benchmarks { })] fn storage_map_partial_unbounded_read(i: Linear<0, 1000>) { Map1M::::insert(i, 0); - UnboundedMap::::insert(i, sp_std::vec![0; i as usize]); + UnboundedMap::::insert(i, alloc::vec![0; i as usize]); #[block] { assert!(Map1M::::get(i).is_some()); @@ -346,7 +346,7 @@ mod benchmarks { })] fn storage_map_partial_unbounded_ignored_read(i: Linear<0, 1000>) { Map1M::::insert(i, 0); - UnboundedMap::::insert(i, sp_std::vec![0; i as usize]); + UnboundedMap::::insert(i, alloc::vec![0; i as usize]); #[block] { assert!(Map1M::::get(i).is_some()); @@ -379,7 +379,7 @@ mod benchmarks { #[benchmark] fn storage_iteration() { for i in 0..65000 { - UnboundedMapTwox::::insert(i, sp_std::vec![0; 64]); + UnboundedMapTwox::::insert(i, alloc::vec![0; 64]); } #[block] { diff --git a/substrate/frame/benchmarking/pov/src/lib.rs b/substrate/frame/benchmarking/pov/src/lib.rs index eb02ccc983c0..4cdbaec2305c 100644 --- a/substrate/frame/benchmarking/pov/src/lib.rs +++ b/substrate/frame/benchmarking/pov/src/lib.rs @@ -23,13 +23,15 @@ mod benchmarking; mod tests; mod weights; +extern crate alloc; + pub use pallet::*; #[frame_support::pallet] pub mod pallet { + use alloc::vec::Vec; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; - use sp_std::prelude::*; #[pallet::pallet] pub struct Pallet(_); diff --git a/substrate/frame/benchmarking/src/baseline.rs b/substrate/frame/benchmarking/src/baseline.rs index e76d5aed7b8d..711d2123ca83 100644 --- a/substrate/frame/benchmarking/src/baseline.rs +++ b/substrate/frame/benchmarking/src/baseline.rs @@ -21,12 +21,12 @@ #![cfg(feature = "runtime-benchmarks")] use crate::benchmarks; +use alloc::{vec, vec::Vec}; use frame_system::Pallet as System; use sp_runtime::{ traits::{AppVerify, Hash}, RuntimeAppPublic, }; -use sp_std::{vec, vec::Vec}; mod crypto { use sp_application_crypto::{app_crypto, sr25519, KeyTypeId}; diff --git a/substrate/frame/benchmarking/src/lib.rs b/substrate/frame/benchmarking/src/lib.rs index d4ee0abbecce..625da2a24bd0 100644 --- a/substrate/frame/benchmarking/src/lib.rs +++ b/substrate/frame/benchmarking/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "std")] mod analysis; #[cfg(test)] @@ -35,6 +37,7 @@ pub mod v1; /// The exports are not stable and should not be relied on. #[doc(hidden)] pub mod __private { + pub use alloc::{boxed::Box, str, vec, vec::Vec}; pub use codec; pub use frame_support::{storage, traits}; pub use log; @@ -42,7 +45,6 @@ pub mod __private { pub use sp_core::defer; pub use sp_io::storage::root as storage_root; pub use sp_runtime::{traits::Zero, StateVersion}; - pub use sp_std::{self, boxed::Box, str, vec, vec::Vec}; pub use sp_storage::{well_known_keys, TrackedStorageKey}; } diff --git a/substrate/frame/benchmarking/src/tests.rs b/substrate/frame/benchmarking/src/tests.rs index bcca5fe7c2f2..09011eadb03a 100644 --- a/substrate/frame/benchmarking/src/tests.rs +++ b/substrate/frame/benchmarking/src/tests.rs @@ -25,7 +25,6 @@ use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, BuildStorage, }; -use sp_std::prelude::*; use std::cell::RefCell; #[frame_support::pallet(dev_mode)] @@ -130,7 +129,6 @@ mod benchmarks { use frame_support::{assert_err, assert_ok, ensure, traits::Get}; use frame_system::RawOrigin; use rusty_fork::rusty_fork_test; - use sp_std::prelude::*; // Additional used internally by the benchmark macro. use super::pallet_test::{Call, Config, Pallet}; diff --git a/substrate/frame/benchmarking/src/tests_instance.rs b/substrate/frame/benchmarking/src/tests_instance.rs index d6e1cf99ef73..ecffbd1a018f 100644 --- a/substrate/frame/benchmarking/src/tests_instance.rs +++ b/substrate/frame/benchmarking/src/tests_instance.rs @@ -25,7 +25,6 @@ use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, BuildStorage, }; -use sp_std::prelude::*; #[frame_support::pallet] mod pallet_test { @@ -131,7 +130,6 @@ mod benchmarks { use crate::account; use frame_support::ensure; use frame_system::RawOrigin; - use sp_std::prelude::*; // Additional used internally by the benchmark macro. use super::pallet_test::{Call, Config, Pallet}; diff --git a/substrate/frame/benchmarking/src/utils.rs b/substrate/frame/benchmarking/src/utils.rs index bfa25f63ef33..ca362f7aa7ef 100644 --- a/substrate/frame/benchmarking/src/utils.rs +++ b/substrate/frame/benchmarking/src/utils.rs @@ -16,6 +16,7 @@ // limitations under the License. //! Interfaces, types and utils for benchmarking a FRAME runtime. +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::{dispatch::DispatchErrorWithPostInfo, pallet_prelude::*, traits::StorageInfo}; use scale_info::TypeInfo; @@ -23,7 +24,6 @@ use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; use sp_io::hashing::blake2_256; use sp_runtime::{traits::TrailingZeroInput, DispatchError}; -use sp_std::vec::Vec; use sp_storage::TrackedStorageKey; /// An alphabet of possible parameters to use for benchmarking. diff --git a/substrate/frame/benchmarking/src/v1.rs b/substrate/frame/benchmarking/src/v1.rs index 07778646237e..d687f9fdfa10 100644 --- a/substrate/frame/benchmarking/src/v1.rs +++ b/substrate/frame/benchmarking/src/v1.rs @@ -1741,9 +1741,9 @@ pub fn show_benchmark_debug_info( * Components: {:?}\n\ * Verify: {:?}\n\ * Error message: {}", - sp_std::str::from_utf8(instance_string) + alloc::str::from_utf8(instance_string) .expect("it's all just strings ran through the wasm interface. qed"), - sp_std::str::from_utf8(benchmark) + alloc::str::from_utf8(benchmark) .expect("it's all just strings ran through the wasm interface. qed"), components, verify, diff --git a/substrate/frame/bounties/Cargo.toml b/substrate/frame/bounties/Cargo.toml index 4b242a1a577c..cb9fa1f964b0 100644 --- a/substrate/frame/bounties/Cargo.toml +++ b/substrate/frame/bounties/Cargo.toml @@ -28,7 +28,6 @@ pallet-treasury = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -47,7 +46,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/bounties/src/benchmarking.rs b/substrate/frame/bounties/src/benchmarking.rs index f53d95d919d4..de93ba5c4ce7 100644 --- a/substrate/frame/bounties/src/benchmarking.rs +++ b/substrate/frame/bounties/src/benchmarking.rs @@ -21,6 +21,7 @@ use super::*; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{ account, benchmarks_instance_pallet, whitelisted_caller, BenchmarkError, }; diff --git a/substrate/frame/bounties/src/lib.rs b/substrate/frame/bounties/src/lib.rs index c04bec2d12ae..7b89a6e3e76f 100644 --- a/substrate/frame/bounties/src/lib.rs +++ b/substrate/frame/bounties/src/lib.rs @@ -87,7 +87,9 @@ pub mod migrations; mod tests; pub mod weights; -use sp_std::prelude::*; +extern crate alloc; + +use alloc::vec::Vec; use frame_support::traits::{ Currency, ExistenceRequirement::AllowDeath, Get, Imbalance, OnUnbalanced, ReservableCurrency, diff --git a/substrate/frame/broker/Cargo.toml b/substrate/frame/broker/Cargo.toml index 77c4883e4a43..7593a4e8da14 100644 --- a/substrate/frame/broker/Cargo.toml +++ b/substrate/frame/broker/Cargo.toml @@ -20,7 +20,6 @@ codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } bitvec = { workspace = true } sp-api = { workspace = true } -sp-std = { workspace = true } sp-arithmetic = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } @@ -49,7 +48,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/broker/src/benchmarking.rs b/substrate/frame/broker/src/benchmarking.rs index 3c9ea4cdba4e..33df56c95f65 100644 --- a/substrate/frame/broker/src/benchmarking.rs +++ b/substrate/frame/broker/src/benchmarking.rs @@ -20,6 +20,7 @@ use super::*; use crate::{CoreAssignment::Task, Pallet as Broker}; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v2::*; use frame_support::{ storage::bounded_vec::BoundedVec, @@ -32,7 +33,6 @@ use frame_system::{Pallet as System, RawOrigin}; use sp_arithmetic::{traits::Zero, Perbill}; use sp_core::Get; use sp_runtime::{traits::BlockNumberProvider, Saturating}; -use sp_std::{vec, vec::Vec}; const SEED: u32 = 0; const MAX_CORE_COUNT: u16 = 1_000; diff --git a/substrate/frame/broker/src/coretime_interface.rs b/substrate/frame/broker/src/coretime_interface.rs index f92f8b22091a..9c18e2c4ff0b 100644 --- a/substrate/frame/broker/src/coretime_interface.rs +++ b/substrate/frame/broker/src/coretime_interface.rs @@ -17,13 +17,14 @@ #![deny(missing_docs)] +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; +use core::fmt::Debug; use frame_support::Parameter; use scale_info::TypeInfo; use sp_arithmetic::traits::AtLeast32BitUnsigned; use sp_core::RuntimeDebug; use sp_runtime::traits::BlockNumberProvider; -use sp_std::{fmt::Debug, vec::Vec}; use crate::Timeslice; diff --git a/substrate/frame/broker/src/lib.rs b/substrate/frame/broker/src/lib.rs index 4cb380bae91d..45c33c1bfa61 100644 --- a/substrate/frame/broker/src/lib.rs +++ b/substrate/frame/broker/src/lib.rs @@ -47,12 +47,15 @@ pub use core_mask::*; pub use coretime_interface::*; pub use types::*; +extern crate alloc; + /// The log target for this pallet. const LOG_TARGET: &str = "runtime::broker"; #[frame_support::pallet] pub mod pallet { use super::*; + use alloc::vec::Vec; use frame_support::{ pallet_prelude::{DispatchResult, DispatchResultWithPostInfo, *}, traits::{ @@ -63,7 +66,6 @@ pub mod pallet { }; use frame_system::pallet_prelude::*; use sp_runtime::traits::{Convert, ConvertBack}; - use sp_std::vec::Vec; const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); @@ -496,7 +498,7 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] diff --git a/substrate/frame/broker/src/migration.rs b/substrate/frame/broker/src/migration.rs index 917f44a134cc..c2a243d6f0e8 100644 --- a/substrate/frame/broker/src/migration.rs +++ b/substrate/frame/broker/src/migration.rs @@ -23,9 +23,9 @@ use frame_support::traits::{Get, UncheckedOnRuntimeUpgrade}; use sp_runtime::Saturating; #[cfg(feature = "try-runtime")] -use frame_support::ensure; +use alloc::vec::Vec; #[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; +use frame_support::ensure; mod v1 { use super::*; diff --git a/substrate/frame/broker/src/mock.rs b/substrate/frame/broker/src/mock.rs index f29651abff7b..6b1d2bbf7015 100644 --- a/substrate/frame/broker/src/mock.rs +++ b/substrate/frame/broker/src/mock.rs @@ -18,6 +18,7 @@ #![cfg(test)] use crate::{test_fungibles::TestFungibles, *}; +use alloc::collections::btree_map::BTreeMap; use frame_support::{ assert_ok, derive_impl, ensure, ord_parameter_types, parameter_types, traits::{ @@ -34,7 +35,6 @@ use sp_runtime::{ traits::{BlockNumberProvider, Identity}, BuildStorage, Saturating, }; -use sp_std::collections::btree_map::BTreeMap; type Block = frame_system::mocking::MockBlock; diff --git a/substrate/frame/broker/src/nonfungible_impl.rs b/substrate/frame/broker/src/nonfungible_impl.rs index 80dcc175df53..e272ecbe0081 100644 --- a/substrate/frame/broker/src/nonfungible_impl.rs +++ b/substrate/frame/broker/src/nonfungible_impl.rs @@ -16,11 +16,11 @@ // limitations under the License. use super::*; +use alloc::vec::Vec; use frame_support::{ pallet_prelude::{DispatchResult, *}, traits::nonfungible::{Inspect, Mutate, Transfer}, }; -use sp_std::vec::Vec; impl Inspect for Pallet { type ItemId = u128; diff --git a/substrate/frame/broker/src/test_fungibles.rs b/substrate/frame/broker/src/test_fungibles.rs index d18bff149533..b0a06fc1a326 100644 --- a/substrate/frame/broker/src/test_fungibles.rs +++ b/substrate/frame/broker/src/test_fungibles.rs @@ -15,6 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::collections::btree_map::BTreeMap; use codec::{Decode, Encode}; use frame_support::{ parameter_types, @@ -29,7 +30,6 @@ use scale_info::TypeInfo; use sp_arithmetic::traits::Zero; use sp_core::{Get, TypedGet}; use sp_runtime::{DispatchError, DispatchResult}; -use sp_std::collections::btree_map::BTreeMap; parameter_types! { static TestAssetOf: BTreeMap<(u32, Vec), Vec> = Default::default(); diff --git a/substrate/frame/broker/src/tick_impls.rs b/substrate/frame/broker/src/tick_impls.rs index 3292faa4eb7e..71a1286d7391 100644 --- a/substrate/frame/broker/src/tick_impls.rs +++ b/substrate/frame/broker/src/tick_impls.rs @@ -16,10 +16,10 @@ // limitations under the License. use super::*; +use alloc::{vec, vec::Vec}; use frame_support::{pallet_prelude::*, traits::defensive_prelude::*, weights::WeightMeter}; use sp_arithmetic::traits::{One, SaturatedConversion, Saturating, Zero}; use sp_runtime::traits::ConvertBack; -use sp_std::{vec, vec::Vec}; use CompletionStatus::Complete; impl Pallet { diff --git a/substrate/frame/child-bounties/Cargo.toml b/substrate/frame/child-bounties/Cargo.toml index d0072e3a4761..9c979b41462c 100644 --- a/substrate/frame/child-bounties/Cargo.toml +++ b/substrate/frame/child-bounties/Cargo.toml @@ -29,7 +29,6 @@ pallet-treasury = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -49,7 +48,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/substrate/frame/child-bounties/src/benchmarking.rs b/substrate/frame/child-bounties/src/benchmarking.rs index 947cfcfaa96a..b1f6370f3340 100644 --- a/substrate/frame/child-bounties/src/benchmarking.rs +++ b/substrate/frame/child-bounties/src/benchmarking.rs @@ -21,6 +21,8 @@ use super::*; +use alloc::{vec, vec::Vec}; + use frame_benchmarking::v1::{account, benchmarks, whitelisted_caller, BenchmarkError}; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; diff --git a/substrate/frame/child-bounties/src/lib.rs b/substrate/frame/child-bounties/src/lib.rs index 04a1f9799cb8..911fd4c4c49f 100644 --- a/substrate/frame/child-bounties/src/lib.rs +++ b/substrate/frame/child-bounties/src/lib.rs @@ -56,7 +56,9 @@ mod benchmarking; mod tests; pub mod weights; -use sp_std::prelude::*; +extern crate alloc; + +use alloc::vec::Vec; use frame_support::traits::{ Currency, diff --git a/substrate/frame/collective/Cargo.toml b/substrate/frame/collective/Cargo.toml index 6fc4bb778298..7d9a4c41c812 100644 --- a/substrate/frame/collective/Cargo.toml +++ b/substrate/frame/collective/Cargo.toml @@ -25,7 +25,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -39,7 +38,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/collective/src/lib.rs b/substrate/frame/collective/src/lib.rs index d0009d02f68c..3544a8cddb45 100644 --- a/substrate/frame/collective/src/lib.rs +++ b/substrate/frame/collective/src/lib.rs @@ -41,14 +41,17 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; +use core::{marker::PhantomData, result}; use scale_info::TypeInfo; use sp_io::storage; use sp_runtime::{ traits::{Dispatchable, Hash}, DispatchError, RuntimeDebug, }; -use sp_std::{marker::PhantomData, prelude::*, result}; use frame_support::{ dispatch::{ @@ -239,7 +242,7 @@ pub mod pallet { #[pallet::genesis_build] impl, I: 'static> BuildGenesisConfig for GenesisConfig { fn build(&self) { - use sp_std::collections::btree_set::BTreeSet; + use alloc::collections::btree_set::BTreeSet; let members_set: BTreeSet<_> = self.members.iter().collect(); assert_eq!( members_set.len(), diff --git a/substrate/frame/contracts/mock-network/Cargo.toml b/substrate/frame/contracts/mock-network/Cargo.toml index 7df5d304c34a..85d98206ea57 100644 --- a/substrate/frame/contracts/mock-network/Cargo.toml +++ b/substrate/frame/contracts/mock-network/Cargo.toml @@ -36,7 +36,6 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-keystore = { workspace = true, default-features = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-tracing = { workspace = true, default-features = true } xcm = { workspace = true } xcm-builder = { workspace = true, default-features = true } @@ -67,7 +66,6 @@ std = [ "sp-io/std", "sp-keystore/std", "sp-runtime/std", - "sp-std/std", "xcm-executor/std", "xcm/std", ] diff --git a/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs b/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs index bfdf6dd97eaf..6e922c16c298 100644 --- a/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs +++ b/substrate/frame/contracts/mock-network/src/mocks/msg_queue.rs @@ -25,7 +25,6 @@ use polkadot_parachain_primitives::primitives::{ use polkadot_primitives::BlockNumber as RelayBlockNumber; use sp_runtime::traits::{Get, Hash}; -use sp_std::prelude::*; use xcm::{latest::prelude::*, VersionedXcm}; #[frame_support::pallet] diff --git a/substrate/frame/contracts/mock-network/src/parachain.rs b/substrate/frame/contracts/mock-network/src/parachain.rs index f35846ba32c3..3579b46ea6e9 100644 --- a/substrate/frame/contracts/mock-network/src/parachain.rs +++ b/substrate/frame/contracts/mock-network/src/parachain.rs @@ -35,7 +35,6 @@ use pallet_xcm::XcmPassthrough; use sp_core::{ConstU32, ConstU64, H256}; use sp_runtime::traits::{Get, IdentityLookup, MaybeEquivalence}; -use sp_std::prelude::*; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom, diff --git a/substrate/frame/contracts/proc-macro/src/lib.rs b/substrate/frame/contracts/proc-macro/src/lib.rs index f91f8660cd31..84ea7de00a2f 100644 --- a/substrate/frame/contracts/proc-macro/src/lib.rs +++ b/substrate/frame/contracts/proc-macro/src/lib.rs @@ -649,7 +649,7 @@ fn expand_functions(def: &EnvDef, expand_mode: ExpandMode) -> TokenStream2 { quote! { let result = #body; if ::log::log_enabled!(target: "runtime::contracts::strace", ::log::Level::Trace) { - use sp_std::fmt::Write; + use core::fmt::Write; let mut w = sp_std::Writer::default(); let _ = core::write!(&mut w, #trace_fmt_str, #( #trace_fmt_args, )* result); let msg = core::str::from_utf8(&w.inner()).unwrap_or_default(); diff --git a/substrate/frame/contracts/src/benchmarking/call_builder.rs b/substrate/frame/contracts/src/benchmarking/call_builder.rs index 5d73d825fca9..d87eaba73437 100644 --- a/substrate/frame/contracts/src/benchmarking/call_builder.rs +++ b/substrate/frame/contracts/src/benchmarking/call_builder.rs @@ -23,11 +23,11 @@ use crate::{ BalanceOf, Config, DebugBufferVec, Determinism, ExecReturnValue, GasMeter, Origin, Schedule, TypeInfo, WasmBlob, Weight, }; +use alloc::{vec, vec::Vec}; use codec::{Encode, HasCompact}; use core::fmt::Debug; use frame_benchmarking::benchmarking; use sp_core::Get; -use sp_std::prelude::*; type StackExt<'a, T> = Stack<'a, T, WasmBlob>; diff --git a/substrate/frame/contracts/src/benchmarking/code.rs b/substrate/frame/contracts/src/benchmarking/code.rs index 65bcf30683c0..1473022b5537 100644 --- a/substrate/frame/contracts/src/benchmarking/code.rs +++ b/substrate/frame/contracts/src/benchmarking/code.rs @@ -25,9 +25,9 @@ //! compiles it down into a `WasmModule` that can be used as a contract's code. use crate::Config; +use alloc::{borrow::ToOwned, vec, vec::Vec}; use frame_support::traits::Get; use sp_runtime::{traits::Hash, Saturating}; -use sp_std::{borrow::ToOwned, prelude::*}; use wasm_instrument::parity_wasm::{ builder, elements::{ @@ -338,7 +338,7 @@ pub mod body { .cycle() .take(instructions.len() * usize::try_from(repetitions).unwrap()) .cloned() - .chain(sp_std::iter::once(Instruction::End)) + .chain(core::iter::once(Instruction::End)) .collect(), ); FuncBody::new(locals.to_vec(), instructions) diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 80c7e863d299..612f929e8b19 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -34,6 +34,7 @@ use crate::{ wasm::BenchEnv, Pallet as Contracts, *, }; +use alloc::{vec, vec::Vec}; use codec::{Encode, MaxEncodedLen}; use frame_benchmarking::v2::*; use frame_support::{ @@ -46,7 +47,6 @@ use frame_system::RawOrigin; use pallet_balances; use pallet_contracts_uapi::{CallFlags, ReturnErrorCode}; use sp_runtime::traits::{Bounded, Hash}; -use sp_std::prelude::*; use wasm_instrument::parity_wasm::elements::{Instruction, Local, ValueType}; /// How many runs we do per API benchmark. @@ -186,7 +186,7 @@ fn caller_funding() -> BalanceOf { #[benchmarks( where - as codec::HasCompact>::Type: Clone + Eq + PartialEq + sp_std::fmt::Debug + scale_info::TypeInfo + codec::Encode, + as codec::HasCompact>::Type: Clone + Eq + PartialEq + core::fmt::Debug + scale_info::TypeInfo + codec::Encode, T: Config + pallet_balances::Config, BalanceOf: From< as Currency>::Balance>, as Currency>::Balance: From>, diff --git a/substrate/frame/contracts/src/chain_extension.rs b/substrate/frame/contracts/src/chain_extension.rs index f3a67fcb09a0..b9bb451fd734 100644 --- a/substrate/frame/contracts/src/chain_extension.rs +++ b/substrate/frame/contracts/src/chain_extension.rs @@ -74,17 +74,18 @@ use crate::{ wasm::{Runtime, RuntimeCosts}, Error, }; +use alloc::vec::Vec; use codec::{Decode, MaxEncodedLen}; +use core::marker::PhantomData; use frame_support::weights::Weight; use sp_runtime::DispatchError; -use sp_std::{marker::PhantomData, vec::Vec}; pub use crate::{exec::Ext, gas::ChargedAmount, storage::meter::Diff, Config}; pub use frame_system::Config as SysConfig; pub use pallet_contracts_uapi::ReturnFlags; /// Result that returns a [`DispatchError`] on error. -pub type Result = sp_std::result::Result; +pub type Result = core::result::Result; /// A trait used to extend the set of contract callable functions. /// diff --git a/substrate/frame/contracts/src/exec.rs b/substrate/frame/contracts/src/exec.rs index 84a3f7dc2a14..0cc4844166f3 100644 --- a/substrate/frame/contracts/src/exec.rs +++ b/substrate/frame/contracts/src/exec.rs @@ -24,6 +24,8 @@ use crate::{ DebugBufferVec, Determinism, Error, Event, Nonce, Origin, Pallet as Contracts, Schedule, LOG_TARGET, }; +use alloc::vec::Vec; +use core::{fmt::Debug, marker::PhantomData, mem}; use frame_support::{ crypto::ecdsa::ECDSAExt, dispatch::{DispatchResult, DispatchResultWithPostInfo}, @@ -49,7 +51,6 @@ use sp_runtime::{ traits::{Convert, Dispatchable, Zero}, DispatchError, }; -use sp_std::{fmt::Debug, marker::PhantomData, mem, prelude::*, vec::Vec}; pub type AccountIdOf = ::AccountId; pub type MomentOf = <::Time as Time>::Moment; @@ -1185,12 +1186,12 @@ where /// /// The iterator starts with the top frame and ends with the root frame. fn frames(&self) -> impl Iterator> { - sp_std::iter::once(&self.first_frame).chain(&self.frames).rev() + core::iter::once(&self.first_frame).chain(&self.frames).rev() } /// Same as `frames` but with a mutable reference as iterator item. fn frames_mut(&mut self) -> impl Iterator> { - sp_std::iter::once(&mut self.first_frame).chain(&mut self.frames).rev() + core::iter::once(&mut self.first_frame).chain(&mut self.frames).rev() } /// Returns whether the current contract is on the stack multiple times. diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 33083c7ebe76..ed00fdca62ff 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -87,6 +87,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "runtime-benchmarks", recursion_limit = "1024")] +extern crate alloc; mod address; mod benchmarking; mod exec; @@ -115,6 +116,7 @@ use crate::{ wasm::{CodeInfo, WasmBlob}, }; use codec::{Codec, Decode, Encode, HasCompact, MaxEncodedLen}; +use core::fmt::Debug; use environmental::*; use frame_support::{ dispatch::{GetDispatchInfo, Pays, PostDispatchInfo, RawOrigin, WithPostDispatchInfo}, @@ -137,7 +139,6 @@ use sp_runtime::{ traits::{BadOrigin, Convert, Dispatchable, Saturating, StaticLookup, Zero}, DispatchError, RuntimeDebug, }; -use sp_std::{fmt::Debug, prelude::*}; pub use crate::{ address::{AddressGenerator, DefaultAddressGenerator}, diff --git a/substrate/frame/contracts/src/migration.rs b/substrate/frame/contracts/src/migration.rs index c633ba9c2d50..29ac74d0d50a 100644 --- a/substrate/frame/contracts/src/migration.rs +++ b/substrate/frame/contracts/src/migration.rs @@ -69,17 +69,16 @@ include!(concat!(env!("OUT_DIR"), "/migration_codegen.rs")); use crate::{weights::WeightInfo, Config, Error, MigrationInProgress, Pallet, Weight, LOG_TARGET}; use codec::{Codec, Decode}; +use core::marker::PhantomData; use frame_support::{ pallet_prelude::*, traits::{ConstU32, OnRuntimeUpgrade}, weights::WeightMeter, }; use sp_runtime::Saturating; -use sp_std::marker::PhantomData; #[cfg(feature = "try-runtime")] -use sp_std::prelude::*; - +use alloc::vec::Vec; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; @@ -604,7 +603,7 @@ mod test { let mut meter = WeightMeter::with_limit(Weight::from_all(1)); let result = Migrations::steps(version, &cursor, &mut meter); - cursor = vec![1u8, 0].try_into().unwrap(); + cursor = alloc::vec![1u8, 0].try_into().unwrap(); assert_eq!(result, StepResult::InProgress { cursor: cursor.clone(), steps_done: 1 }); assert_eq!(meter.consumed(), Weight::from_all(1)); diff --git a/substrate/frame/contracts/src/migration/v09.rs b/substrate/frame/contracts/src/migration/v09.rs index 7e84191910d9..6a67395174f5 100644 --- a/substrate/frame/contracts/src/migration/v09.rs +++ b/substrate/frame/contracts/src/migration/v09.rs @@ -22,13 +22,13 @@ use crate::{ weights::WeightInfo, CodeHash, Config, Determinism, Pallet, Weight, LOG_TARGET, }; +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::{ pallet_prelude::*, storage_alias, weights::WeightMeter, DefaultNoBound, Identity, }; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; -use sp_std::prelude::*; mod v8 { use super::*; @@ -56,7 +56,7 @@ pub fn store_old_dummy_code(len: usize) { instruction_weights_version: 0, initial: 0, maximum: 0, - code: vec![42u8; len], + code: alloc::vec![42u8; len], }; let hash = T::Hashing::hash(&module.code); v8::CodeStorage::::insert(hash, module); diff --git a/substrate/frame/contracts/src/migration/v10.rs b/substrate/frame/contracts/src/migration/v10.rs index 61632a1fd1ba..23e7fd238bb7 100644 --- a/substrate/frame/contracts/src/migration/v10.rs +++ b/substrate/frame/contracts/src/migration/v10.rs @@ -40,13 +40,15 @@ use frame_support::{ DefaultNoBound, }; use sp_core::hexdisplay::HexDisplay; -#[cfg(feature = "try-runtime")] -use sp_runtime::TryRuntimeError; use sp_runtime::{ traits::{Hash, TrailingZeroInput, Zero}, Perbill, Saturating, }; -use sp_std::prelude::*; + +#[cfg(feature = "try-runtime")] +use alloc::vec::Vec; +#[cfg(feature = "try-runtime")] +use sp_runtime::TryRuntimeError; mod v9 { use super::*; diff --git a/substrate/frame/contracts/src/migration/v11.rs b/substrate/frame/contracts/src/migration/v11.rs index 9b4316162ca6..bd128e22869f 100644 --- a/substrate/frame/contracts/src/migration/v11.rs +++ b/substrate/frame/contracts/src/migration/v11.rs @@ -23,11 +23,13 @@ use crate::{ weights::WeightInfo, Config, Pallet, TrieId, Weight, LOG_TARGET, }; +use alloc::vec::Vec; use codec::{Decode, Encode}; +use core::marker::PhantomData; use frame_support::{pallet_prelude::*, storage_alias, weights::WeightMeter, DefaultNoBound}; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; -use sp_std::{marker::PhantomData, prelude::*}; + mod v10 { use super::*; diff --git a/substrate/frame/contracts/src/migration/v12.rs b/substrate/frame/contracts/src/migration/v12.rs index aad51a9edcab..3c33591e4351 100644 --- a/substrate/frame/contracts/src/migration/v12.rs +++ b/substrate/frame/contracts/src/migration/v12.rs @@ -23,6 +23,7 @@ use crate::{ weights::WeightInfo, AccountIdOf, BalanceOf, CodeHash, Config, Determinism, Pallet, Weight, LOG_TARGET, }; +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::{ pallet_prelude::*, storage_alias, traits::ReservableCurrency, weights::WeightMeter, @@ -33,7 +34,6 @@ use sp_core::hexdisplay::HexDisplay; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; use sp_runtime::{traits::Zero, FixedPointNumber, FixedU128, Saturating}; -use sp_std::prelude::*; mod v11 { use super::*; @@ -109,7 +109,7 @@ where { use sp_runtime::traits::Hash; - let code = vec![42u8; len]; + let code = alloc::vec![42u8; len]; let hash = T::Hashing::hash(&code); PristineCode::::insert(hash, code.clone()); diff --git a/substrate/frame/contracts/src/migration/v13.rs b/substrate/frame/contracts/src/migration/v13.rs index 6929bbce28e5..d1888b338dac 100644 --- a/substrate/frame/contracts/src/migration/v13.rs +++ b/substrate/frame/contracts/src/migration/v13.rs @@ -26,7 +26,6 @@ use crate::{ use codec::{Decode, Encode}; use frame_support::{pallet_prelude::*, storage_alias, weights::WeightMeter, DefaultNoBound}; use sp_runtime::BoundedBTreeMap; -use sp_std::prelude::*; mod v12 { use super::*; diff --git a/substrate/frame/contracts/src/migration/v14.rs b/substrate/frame/contracts/src/migration/v14.rs index 017fd6d0c15b..11336fe2e7d3 100644 --- a/substrate/frame/contracts/src/migration/v14.rs +++ b/substrate/frame/contracts/src/migration/v14.rs @@ -26,6 +26,8 @@ use crate::{ weights::WeightInfo, BalanceOf, CodeHash, Config, Determinism, HoldReason, Pallet, Weight, LOG_TARGET, }; +#[cfg(feature = "try-runtime")] +use alloc::collections::btree_map::BTreeMap; use codec::{Decode, Encode}; #[cfg(feature = "try-runtime")] use environmental::Vec; @@ -42,8 +44,6 @@ use sp_core::hexdisplay::HexDisplay; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; use sp_runtime::{traits::Zero, Saturating}; -#[cfg(feature = "try-runtime")] -use sp_std::collections::btree_map::BTreeMap; mod v13 { use super::*; @@ -80,8 +80,8 @@ where T: Config, OldCurrency: ReservableCurrency<::AccountId> + 'static, { + use alloc::vec; use sp_runtime::traits::Hash; - use sp_std::vec; let len = T::MaxCodeLen::get(); let code = vec![42u8; len as usize]; diff --git a/substrate/frame/contracts/src/migration/v15.rs b/substrate/frame/contracts/src/migration/v15.rs index 3c700d1c0b02..11f07282d561 100644 --- a/substrate/frame/contracts/src/migration/v15.rs +++ b/substrate/frame/contracts/src/migration/v15.rs @@ -28,6 +28,8 @@ use crate::{ AccountIdOf, BalanceOf, CodeHash, Config, HoldReason, Pallet, TrieId, Weight, LOG_TARGET, }; #[cfg(feature = "try-runtime")] +use alloc::vec::Vec; +#[cfg(feature = "try-runtime")] use frame_support::traits::fungible::InspectHold; use frame_support::{ pallet_prelude::*, @@ -44,8 +46,6 @@ use sp_core::hexdisplay::HexDisplay; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; use sp_runtime::{traits::Zero, Saturating}; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; mod v14 { use super::*; diff --git a/substrate/frame/contracts/src/migration/v16.rs b/substrate/frame/contracts/src/migration/v16.rs index 74fbc997718d..3d5b2d2a85fc 100644 --- a/substrate/frame/contracts/src/migration/v16.rs +++ b/substrate/frame/contracts/src/migration/v16.rs @@ -26,7 +26,6 @@ use crate::{ use codec::{Decode, Encode}; use frame_support::{pallet_prelude::*, storage_alias, DefaultNoBound}; use sp_runtime::{BoundedBTreeMap, Saturating}; -use sp_std::prelude::*; #[cfg(feature = "runtime-benchmarks")] pub fn store_old_contract_info( diff --git a/substrate/frame/contracts/src/primitives.rs b/substrate/frame/contracts/src/primitives.rs index ab73b28e8c49..622a69f529fb 100644 --- a/substrate/frame/contracts/src/primitives.rs +++ b/substrate/frame/contracts/src/primitives.rs @@ -17,6 +17,7 @@ //! A crate that hosts a common definitions that are relevant for the pallet-contracts. +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::weights::Weight; use pallet_contracts_uapi::ReturnFlags; @@ -25,7 +26,6 @@ use sp_runtime::{ traits::{Saturating, Zero}, DispatchError, RuntimeDebug, }; -use sp_std::prelude::*; /// Result type of a `bare_call` or `bare_instantiate` call as well as `ContractsApi::call` and /// `ContractsApi::instantiate`. diff --git a/substrate/frame/contracts/src/storage.rs b/substrate/frame/contracts/src/storage.rs index 1e9739a1599e..23b5a2514eb1 100644 --- a/substrate/frame/contracts/src/storage.rs +++ b/substrate/frame/contracts/src/storage.rs @@ -25,7 +25,9 @@ use crate::{ BalanceOf, CodeHash, CodeInfo, Config, ContractInfoOf, DeletionQueue, DeletionQueueCounter, Error, TrieId, SENTINEL, }; +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; +use core::marker::PhantomData; use frame_support::{ storage::child::{self, ChildInfo}, weights::{Weight, WeightMeter}, @@ -38,7 +40,6 @@ use sp_runtime::{ traits::{Hash, Saturating, Zero}, BoundedBTreeMap, DispatchError, DispatchResult, RuntimeDebug, }; -use sp_std::{marker::PhantomData, prelude::*}; use self::meter::Diff; diff --git a/substrate/frame/contracts/src/storage/meter.rs b/substrate/frame/contracts/src/storage/meter.rs index 7c55ce5d3f0c..951cb25994e1 100644 --- a/substrate/frame/contracts/src/storage/meter.rs +++ b/substrate/frame/contracts/src/storage/meter.rs @@ -22,6 +22,8 @@ use crate::{ Inspect, Origin, Pallet, StorageDeposit as Deposit, System, LOG_TARGET, }; +use alloc::vec::Vec; +use core::{fmt::Debug, marker::PhantomData}; use frame_support::{ ensure, traits::{ @@ -37,7 +39,6 @@ use sp_runtime::{ traits::{Saturating, Zero}, DispatchError, FixedPointNumber, FixedU128, }; -use sp_std::{fmt::Debug, marker::PhantomData, vec::Vec}; /// Deposit that uses the native fungible's balance type. pub type DepositOf = Deposit>; diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index c20577a3f645..3f608d90bea7 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -458,7 +458,7 @@ parameter_types! { pub static InstantiateAccount: Option<::AccountId> = None; } -pub struct EnsureAccount(sp_std::marker::PhantomData<(T, A)>); +pub struct EnsureAccount(core::marker::PhantomData<(T, A)>); impl>>> EnsureOrigin<::RuntimeOrigin> for EnsureAccount where diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 0d65d696758d..2fef07f8b7a4 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -48,6 +48,7 @@ use crate::{ AccountIdOf, BadOrigin, BalanceOf, CodeHash, CodeInfoOf, CodeVec, Config, Error, Event, HoldReason, Pallet, PristineCode, Schedule, Weight, LOG_TARGET, }; +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dispatch::DispatchResult, @@ -56,7 +57,6 @@ use frame_support::{ }; use sp_core::Get; use sp_runtime::{DispatchError, RuntimeDebug}; -use sp_std::prelude::*; use wasmi::{CompilationMode, InstancePre, Linker, Memory, MemoryType, StackLimits, Store}; const BYTES_PER_PAGE: usize = 64 * 1024; diff --git a/substrate/frame/contracts/src/wasm/prepare.rs b/substrate/frame/contracts/src/wasm/prepare.rs index 50eb6d625321..93fe3080d22d 100644 --- a/substrate/frame/contracts/src/wasm/prepare.rs +++ b/substrate/frame/contracts/src/wasm/prepare.rs @@ -28,10 +28,10 @@ use crate::{ }, AccountIdOf, CodeVec, Config, Error, Schedule, LOG_TARGET, }; +#[cfg(any(test, feature = "runtime-benchmarks"))] +use alloc::vec::Vec; use codec::MaxEncodedLen; use sp_runtime::{traits::Hash, DispatchError}; -#[cfg(any(test, feature = "runtime-benchmarks"))] -use sp_std::prelude::Vec; use wasmi::{ core::ValType as WasmiValueType, CompilationMode, Config as WasmiConfig, Engine, ExternType, Module, StackLimits, @@ -56,7 +56,7 @@ pub enum LoadingMode { #[cfg(test)] pub mod tracker { - use sp_std::cell::RefCell; + use core::cell::RefCell; thread_local! { pub static LOADED_MODULE: RefCell> = RefCell::new(Vec::new()); } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 5f50dbf391a2..50b06de080ca 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -24,7 +24,9 @@ use crate::{ weights::WeightInfo, BalanceOf, CodeHash, Config, DebugBufferVec, Error, SENTINEL, }; +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{Decode, DecodeLimit, Encode, MaxEncodedLen}; +use core::fmt; use frame_support::{ dispatch::DispatchInfo, ensure, pallet_prelude::DispatchResultWithPostInfo, parameter_types, traits::Get, weights::Weight, @@ -36,7 +38,6 @@ use sp_runtime::{ traits::{Bounded, Zero}, DispatchError, RuntimeDebug, }; -use sp_std::{fmt, prelude::*}; use wasmi::{core::HostError, errors::LinkerError, Linker, Memory, Store}; type CallOf = ::RuntimeCall; @@ -1900,7 +1901,7 @@ pub mod env { data_len: u32, ) -> Result<(), TrapReason> { let num_topic = topics_len - .checked_div(sp_std::mem::size_of::>() as u32) + .checked_div(core::mem::size_of::>() as u32) .ok_or("Zero sized topics are not allowed")?; ctx.charge_gas(RuntimeCosts::DepositEvent { num_topic, len: data_len })?; if data_len > ctx.ext.max_value_size() { diff --git a/substrate/frame/conviction-voting/Cargo.toml b/substrate/frame/conviction-voting/Cargo.toml index b96809b8aeb4..6184b0ffd6e6 100644 --- a/substrate/frame/conviction-voting/Cargo.toml +++ b/substrate/frame/conviction-voting/Cargo.toml @@ -28,7 +28,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -49,7 +48,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/conviction-voting/src/benchmarking.rs b/substrate/frame/conviction-voting/src/benchmarking.rs index 8701ed7ebb07..546ad5385355 100644 --- a/substrate/frame/conviction-voting/src/benchmarking.rs +++ b/substrate/frame/conviction-voting/src/benchmarking.rs @@ -19,6 +19,7 @@ use super::*; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use assert_matches::assert_matches; use frame_benchmarking::v1::{account, benchmarks_instance_pallet, whitelist_account}; use frame_support::{ @@ -30,7 +31,6 @@ use frame_support::{ }, }; use sp_runtime::traits::Bounded; -use sp_std::collections::btree_map::BTreeMap; use crate::Pallet as ConvictionVoting; diff --git a/substrate/frame/conviction-voting/src/lib.rs b/substrate/frame/conviction-voting/src/lib.rs index 466fc70a619b..be7f7f448070 100644 --- a/substrate/frame/conviction-voting/src/lib.rs +++ b/substrate/frame/conviction-voting/src/lib.rs @@ -27,6 +27,8 @@ #![recursion_limit = "256"] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use frame_support::{ dispatch::DispatchResult, ensure, @@ -40,7 +42,6 @@ use sp_runtime::{ traits::{AtLeast32BitUnsigned, Saturating, StaticLookup, Zero}, ArithmeticError, DispatchError, Perbill, }; -use sp_std::prelude::*; mod conviction; mod types; @@ -559,7 +560,7 @@ impl, I: 'static> Pallet { ensure!(balance <= T::Currency::total_balance(&who), Error::::InsufficientFunds); let votes = VotingFor::::try_mutate(&who, &class, |voting| -> Result { - let old = sp_std::mem::replace( + let old = core::mem::replace( voting, Voting::Delegating(Delegating { balance, @@ -596,7 +597,7 @@ impl, I: 'static> Pallet { fn try_undelegate(who: T::AccountId, class: ClassOf) -> Result { let votes = VotingFor::::try_mutate(&who, &class, |voting| -> Result { - match sp_std::mem::replace(voting, Voting::default()) { + match core::mem::replace(voting, Voting::default()) { Voting::Delegating(Delegating { balance, target, diff --git a/substrate/frame/conviction-voting/src/types.rs b/substrate/frame/conviction-voting/src/types.rs index 2c45b54485bd..d6bbb678a14b 100644 --- a/substrate/frame/conviction-voting/src/types.rs +++ b/substrate/frame/conviction-voting/src/types.rs @@ -18,6 +18,7 @@ //! Miscellaneous additional datatypes. use codec::{Codec, Decode, Encode, MaxEncodedLen}; +use core::{fmt::Debug, marker::PhantomData}; use frame_support::{ traits::VoteTally, CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound, }; @@ -26,7 +27,6 @@ use sp_runtime::{ traits::{Saturating, Zero}, RuntimeDebug, }; -use sp_std::{fmt::Debug, marker::PhantomData}; use super::*; use crate::{AccountVote, Conviction, Vote}; diff --git a/substrate/frame/conviction-voting/src/vote.rs b/substrate/frame/conviction-voting/src/vote.rs index 5ae08f0de65f..1c5b742ba12b 100644 --- a/substrate/frame/conviction-voting/src/vote.rs +++ b/substrate/frame/conviction-voting/src/vote.rs @@ -25,7 +25,6 @@ use sp_runtime::{ traits::{Saturating, Zero}, RuntimeDebug, }; -use sp_std::prelude::*; /// A number of lock periods, plus a vote, one way or the other. #[derive(Copy, Clone, Eq, PartialEq, Default, RuntimeDebug, MaxEncodedLen)] diff --git a/substrate/frame/core-fellowship/Cargo.toml b/substrate/frame/core-fellowship/Cargo.toml index 44290402594a..7ef6f9e11eb1 100644 --- a/substrate/frame/core-fellowship/Cargo.toml +++ b/substrate/frame/core-fellowship/Cargo.toml @@ -26,7 +26,6 @@ sp-arithmetic = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } pallet-ranked-collective = { optional = true, workspace = true } [features] @@ -44,7 +43,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/core-fellowship/src/benchmarking.rs b/substrate/frame/core-fellowship/src/benchmarking.rs index 34461e062b35..adb8a4a091b8 100644 --- a/substrate/frame/core-fellowship/src/benchmarking.rs +++ b/substrate/frame/core-fellowship/src/benchmarking.rs @@ -22,6 +22,7 @@ use super::*; use crate::Pallet as CoreFellowship; +use alloc::{boxed::Box, vec}; use frame_benchmarking::v2::*; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use sp_arithmetic::traits::Bounded; diff --git a/substrate/frame/core-fellowship/src/lib.rs b/substrate/frame/core-fellowship/src/lib.rs index 5ed2562d6d01..c61447e36280 100644 --- a/substrate/frame/core-fellowship/src/lib.rs +++ b/substrate/frame/core-fellowship/src/lib.rs @@ -57,11 +57,14 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::boxed::Box; use codec::{Decode, Encode, MaxEncodedLen}; +use core::{fmt::Debug, marker::PhantomData}; use scale_info::TypeInfo; use sp_arithmetic::traits::{Saturating, Zero}; use sp_runtime::RuntimeDebug; -use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; use frame_support::{ defensive, diff --git a/substrate/frame/core-fellowship/src/migration.rs b/substrate/frame/core-fellowship/src/migration.rs index b8b5540a4b47..b1e27d1e7936 100644 --- a/substrate/frame/core-fellowship/src/migration.rs +++ b/substrate/frame/core-fellowship/src/migration.rs @@ -24,6 +24,8 @@ use frame_support::{ BoundedVec, }; +#[cfg(feature = "try-runtime")] +use alloc::vec::Vec; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; diff --git a/substrate/frame/delegated-staking/Cargo.toml b/substrate/frame/delegated-staking/Cargo.toml index 0c1bcf0df0c5..a7751e1d6c1c 100644 --- a/substrate/frame/delegated-staking/Cargo.toml +++ b/substrate/frame/delegated-staking/Cargo.toml @@ -16,7 +16,6 @@ codec = { features = ["derive"], workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } sp-staking = { workspace = true } @@ -48,7 +47,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-election-provider-support/runtime-benchmarks", diff --git a/substrate/frame/delegated-staking/src/impls.rs b/substrate/frame/delegated-staking/src/impls.rs index 9f5649672d70..f8df9dfe7b46 100644 --- a/substrate/frame/delegated-staking/src/impls.rs +++ b/substrate/frame/delegated-staking/src/impls.rs @@ -139,7 +139,7 @@ impl OnStakingUpdate> for Pallet { fn on_slash( who: &T::AccountId, _slashed_active: BalanceOf, - _slashed_unlocking: &sp_std::collections::btree_map::BTreeMap>, + _slashed_unlocking: &alloc::collections::btree_map::BTreeMap>, slashed_total: BalanceOf, ) { >::mutate(who, |maybe_register| match maybe_register { diff --git a/substrate/frame/delegated-staking/src/lib.rs b/substrate/frame/delegated-staking/src/lib.rs index f16bb0d1dc08..61809dcb54ee 100644 --- a/substrate/frame/delegated-staking/src/lib.rs +++ b/substrate/frame/delegated-staking/src/lib.rs @@ -132,10 +132,13 @@ mod mock; mod tests; mod types; +extern crate alloc; + pub use pallet::*; use types::*; +use core::convert::TryInto; use frame_support::{ pallet_prelude::*, traits::{ @@ -154,7 +157,6 @@ use sp_runtime::{ ArithmeticError, DispatchResult, Perbill, RuntimeDebug, Saturating, }; use sp_staking::{Agent, Delegator, EraIndex, StakingInterface, StakingUnchecked}; -use sp_std::{convert::TryInto, prelude::*}; pub type BalanceOf = <::Currency as FunInspect<::AccountId>>::Balance; @@ -779,7 +781,7 @@ impl Pallet { } #[cfg(any(test, feature = "try-runtime"))] -use sp_std::collections::btree_map::BTreeMap; +use alloc::collections::btree_map::BTreeMap; #[cfg(any(test, feature = "try-runtime"))] impl Pallet { diff --git a/substrate/frame/democracy/Cargo.toml b/substrate/frame/democracy/Cargo.toml index 6a44951e09c4..ce5ffa57d579 100644 --- a/substrate/frame/democracy/Cargo.toml +++ b/substrate/frame/democracy/Cargo.toml @@ -26,7 +26,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-core = { workspace = true } log = { workspace = true } @@ -51,7 +50,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/democracy/src/benchmarking.rs b/substrate/frame/democracy/src/benchmarking.rs index 799d614c37f4..ee36e9212f52 100644 --- a/substrate/frame/democracy/src/benchmarking.rs +++ b/substrate/frame/democracy/src/benchmarking.rs @@ -85,8 +85,8 @@ fn assert_has_event(generic_event: ::RuntimeEvent) { // note a new preimage. fn note_preimage() -> T::Hash { + use alloc::borrow::Cow; use core::sync::atomic::{AtomicU8, Ordering}; - use sp_std::borrow::Cow; // note a new preimage on every function invoke. static COUNTER: AtomicU8 = AtomicU8::new(0); let data = Cow::from(vec![COUNTER.fetch_add(1, Ordering::Relaxed)]); diff --git a/substrate/frame/democracy/src/lib.rs b/substrate/frame/democracy/src/lib.rs index e3b4696f8b2a..27bc36a756e4 100644 --- a/substrate/frame/democracy/src/lib.rs +++ b/substrate/frame/democracy/src/lib.rs @@ -152,6 +152,9 @@ #![recursion_limit = "256"] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ ensure, @@ -168,7 +171,6 @@ use sp_runtime::{ traits::{BadOrigin, Bounded as ArithBounded, One, Saturating, StaticLookup, Zero}, ArithmeticError, DispatchError, DispatchResult, }; -use sp_std::prelude::*; mod conviction; mod types; @@ -438,7 +440,7 @@ pub mod pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - _config: sp_std::marker::PhantomData, + _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -1433,7 +1435,7 @@ impl Pallet { delegations: Default::default(), prior: Default::default(), }; - sp_std::mem::swap(&mut old, voting); + core::mem::swap(&mut old, voting); match old { Voting::Delegating { balance, target, conviction, delegations, mut prior, .. @@ -1474,7 +1476,7 @@ impl Pallet { fn try_undelegate(who: T::AccountId) -> Result { let votes = VotingOf::::try_mutate(&who, |voting| -> Result { let mut old = Voting::default(); - sp_std::mem::swap(&mut old, voting); + core::mem::swap(&mut old, voting); match old { Voting::Delegating { balance, target, conviction, delegations, mut prior } => { // remove any delegation votes to our current target. diff --git a/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs b/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs index 1cb50a157b12..ca0e0f7a091a 100644 --- a/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs +++ b/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs @@ -19,6 +19,7 @@ //! pallet. use crate::{PropIndex, Voting, DEMOCRACY_ID}; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use core::iter::Sum; use frame_support::{ pallet_prelude::ValueQuery, @@ -29,7 +30,6 @@ use frame_support::{ }; use sp_core::Get; use sp_runtime::{traits::Zero, BoundedVec, Saturating}; -use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; const LOG_TARGET: &str = "runtime::democracy::migrations::unlock_and_unreserve_all_funds"; @@ -87,7 +87,7 @@ type VotingOf = StorageMap< /// The pallet should be made inoperable before this migration is run. /// /// (See also [`RemovePallet`][frame_support::migrations::RemovePallet]) -pub struct UnlockAndUnreserveAllFunds(sp_std::marker::PhantomData); +pub struct UnlockAndUnreserveAllFunds(core::marker::PhantomData); impl UnlockAndUnreserveAllFunds { /// Calculates and returns the total amounts reserved by each account by this pallet, and all @@ -170,8 +170,8 @@ where /// the actual total reserved amount for any accounts. #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + use alloc::collections::btree_set::BTreeSet; use codec::Encode; - use sp_std::collections::btree_set::BTreeSet; // Get staked and deposited balances as reported by this pallet. let (account_deposits, account_locks, _) = Self::get_account_deposits_and_locks(); diff --git a/substrate/frame/democracy/src/vote.rs b/substrate/frame/democracy/src/vote.rs index b3fe9aa28e1a..779f7ecd570f 100644 --- a/substrate/frame/democracy/src/vote.rs +++ b/substrate/frame/democracy/src/vote.rs @@ -25,7 +25,6 @@ use sp_runtime::{ traits::{Saturating, Zero}, BoundedVec, RuntimeDebug, }; -use sp_std::prelude::*; /// A number of lock periods, plus a vote, one way or the other. #[derive(Copy, Clone, Eq, PartialEq, Default, RuntimeDebug)] diff --git a/substrate/frame/election-provider-multi-phase/Cargo.toml b/substrate/frame/election-provider-multi-phase/Cargo.toml index 941d720f2c6c..4d1f521d726e 100644 --- a/substrate/frame/election-provider-multi-phase/Cargo.toml +++ b/substrate/frame/election-provider-multi-phase/Cargo.toml @@ -27,7 +27,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } -sp-std = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } sp-npos-elections = { workspace = true } @@ -68,7 +67,6 @@ std = [ "sp-io/std", "sp-npos-elections/std", "sp-runtime/std", - "sp-std/std", "sp-tracing/std", "strum/std", ] diff --git a/substrate/frame/election-provider-multi-phase/src/helpers.rs b/substrate/frame/election-provider-multi-phase/src/helpers.rs index a3f27fc18f07..8269b2cb73be 100644 --- a/substrate/frame/election-provider-multi-phase/src/helpers.rs +++ b/substrate/frame/election-provider-multi-phase/src/helpers.rs @@ -21,7 +21,7 @@ use crate::{ unsigned::{MinerConfig, MinerVoterOf}, SolutionTargetIndexOf, SolutionVoterIndexOf, VoteWeight, }; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; #[macro_export] macro_rules! log { diff --git a/substrate/frame/election-provider-multi-phase/src/lib.rs b/substrate/frame/election-provider-multi-phase/src/lib.rs index 63b4c49cdfe4..9ce8b3890a62 100644 --- a/substrate/frame/election-provider-multi-phase/src/lib.rs +++ b/substrate/frame/election-provider-multi-phase/src/lib.rs @@ -229,6 +229,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode}; use frame_election_provider_support::{ bounds::{CountBound, ElectionBounds, ElectionBoundsBuilder, SizeBound}, @@ -256,7 +259,6 @@ use sp_runtime::{ }, DispatchError, ModuleError, PerThing, Perbill, RuntimeDebug, SaturatedConversion, }; -use sp_std::prelude::*; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; @@ -837,7 +839,7 @@ pub mod pallet { } fn integrity_test() { - use sp_std::mem::size_of; + use core::mem::size_of; // The index type of both voters and targets need to be smaller than that of usize (very // unlikely to be the case, but anyhow).. assert!(size_of::>() <= size_of::()); @@ -1354,7 +1356,7 @@ pub mod pallet { /// This wrapper is created for handling the synchronization of [`Snapshot`], [`SnapshotMetadata`] /// and [`DesiredTargets`] storage items. -pub struct SnapshotWrapper(sp_std::marker::PhantomData); +pub struct SnapshotWrapper(core::marker::PhantomData); impl SnapshotWrapper { /// Kill all snapshot related storage items at the same time. diff --git a/substrate/frame/election-provider-multi-phase/src/migrations.rs b/substrate/frame/election-provider-multi-phase/src/migrations.rs index 156f1c02e27c..73a2d878f150 100644 --- a/substrate/frame/election-provider-multi-phase/src/migrations.rs +++ b/substrate/frame/election-provider-multi-phase/src/migrations.rs @@ -16,15 +16,15 @@ // limitations under the License. pub mod v1 { + use alloc::collections::btree_map::BTreeMap; use frame_support::{ storage::unhashed, traits::{Defensive, GetStorageVersion, OnRuntimeUpgrade}, BoundedVec, }; - use sp_std::collections::btree_map::BTreeMap; use crate::*; - pub struct MigrateToV1(sp_std::marker::PhantomData); + pub struct MigrateToV1(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV1 { fn on_runtime_upgrade() -> Weight { let current = Pallet::::in_code_storage_version(); diff --git a/substrate/frame/election-provider-multi-phase/src/signed.rs b/substrate/frame/election-provider-multi-phase/src/signed.rs index ae830ed0382d..fe07e477e1d5 100644 --- a/substrate/frame/election-provider-multi-phase/src/signed.rs +++ b/substrate/frame/election-provider-multi-phase/src/signed.rs @@ -24,7 +24,12 @@ use crate::{ ReadySolution, SignedSubmissionIndices, SignedSubmissionNextIndex, SignedSubmissionsMap, SolutionOf, SolutionOrSnapshotSize, Weight, WeightInfo, }; +use alloc::{ + collections::{btree_map::BTreeMap, btree_set::BTreeSet}, + vec::Vec, +}; use codec::{Decode, Encode, HasCompact}; +use core::cmp::Ordering; use frame_election_provider_support::NposSolution; use frame_support::traits::{ defensive_prelude::*, Currency, Get, OnUnbalanced, ReservableCurrency, @@ -37,11 +42,6 @@ use sp_runtime::{ traits::{Convert, Saturating, Zero}, FixedPointNumber, FixedPointOperand, FixedU128, Percent, RuntimeDebug, }; -use sp_std::{ - cmp::Ordering, - collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - vec::Vec, -}; /// A raw, unchecked signed submission. /// diff --git a/substrate/frame/election-provider-multi-phase/src/unsigned.rs b/substrate/frame/election-provider-multi-phase/src/unsigned.rs index 8b25815eca13..728ab9302389 100644 --- a/substrate/frame/election-provider-multi-phase/src/unsigned.rs +++ b/substrate/frame/election-provider-multi-phase/src/unsigned.rs @@ -21,6 +21,7 @@ use crate::{ helpers, Call, Config, ElectionCompute, Error, FeasibilityError, Pallet, RawSolution, ReadySolution, RoundSnapshot, SolutionAccuracyOf, SolutionOf, SolutionOrSnapshotSize, Weight, }; +use alloc::{boxed::Box, vec::Vec}; use codec::Encode; use frame_election_provider_support::{NposSolution, NposSolver, PerThing128, VoteWeight}; use frame_support::{ @@ -39,7 +40,6 @@ use sp_runtime::{ offchain::storage::{MutateStorageError, StorageValueRef}, DispatchError, SaturatedConversion, }; -use sp_std::prelude::*; /// Storage key used to store the last block number at which offchain worker ran. pub(crate) const OFFCHAIN_LAST_BLOCK: &[u8] = b"parity/multi-phase-unsigned-election"; @@ -396,14 +396,14 @@ impl Pallet { /// Configurations for a miner that comes with this pallet. pub trait MinerConfig { /// The account id type. - type AccountId: Ord + Clone + codec::Codec + sp_std::fmt::Debug; + type AccountId: Ord + Clone + codec::Codec + core::fmt::Debug; /// The solution that the miner is mining. type Solution: codec::Codec + Default + PartialEq + Eq + Clone - + sp_std::fmt::Debug + + core::fmt::Debug + Ord + NposSolution + TypeInfo; @@ -428,7 +428,7 @@ pub trait MinerConfig { } /// A base miner, suitable to be used for both signed and unsigned submissions. -pub struct Miner(sp_std::marker::PhantomData); +pub struct Miner(core::marker::PhantomData); impl Miner { /// Same as [`Pallet::mine_solution`], but the input snapshot data must be given. pub fn mine_solution_with_snapshot( @@ -505,7 +505,7 @@ impl Miner { stake }) .unwrap_or_default(); - sp_std::cmp::Reverse(stake) + core::cmp::Reverse(stake) }, ); @@ -1016,6 +1016,7 @@ mod tests { Event, InvalidTransaction, Phase, QueuedSolution, TransactionSource, TransactionValidityError, }; + use alloc::vec; use codec::Decode; use frame_election_provider_support::IndexAssignment; use frame_support::{assert_noop, assert_ok, traits::OffchainWorker}; diff --git a/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs b/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs index bb1bdb314205..5c64f2a0bc20 100644 --- a/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs +++ b/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs @@ -38,7 +38,6 @@ use sp_staking::{ offence::{OffenceDetails, OnOffenceHandler}, EraIndex, SessionIndex, }; -use sp_std::prelude::*; use std::collections::BTreeMap; use codec::Decode; diff --git a/substrate/frame/election-provider-support/Cargo.toml b/substrate/frame/election-provider-support/Cargo.toml index 012392ffc59d..80fea6c5ca97 100644 --- a/substrate/frame/election-provider-support/Cargo.toml +++ b/substrate/frame/election-provider-support/Cargo.toml @@ -23,7 +23,6 @@ frame-system = { workspace = true } sp-arithmetic = { workspace = true } sp-npos-elections = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-core = { workspace = true } [dev-dependencies] @@ -44,7 +43,6 @@ std = [ "sp-io/std", "sp-npos-elections/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-support/runtime-benchmarks", diff --git a/substrate/frame/election-provider-support/benchmarking/Cargo.toml b/substrate/frame/election-provider-support/benchmarking/Cargo.toml index ecf41ff9663b..dcfcb9c35cda 100644 --- a/substrate/frame/election-provider-support/benchmarking/Cargo.toml +++ b/substrate/frame/election-provider-support/benchmarking/Cargo.toml @@ -23,7 +23,6 @@ frame-election-provider-support = { workspace = true } frame-system = { workspace = true } sp-npos-elections = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -34,7 +33,6 @@ std = [ "frame-system/std", "sp-npos-elections/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/election-provider-support/benchmarking/src/inner.rs b/substrate/frame/election-provider-support/benchmarking/src/inner.rs index 4722680cfcc1..8cca0d459eac 100644 --- a/substrate/frame/election-provider-support/benchmarking/src/inner.rs +++ b/substrate/frame/election-provider-support/benchmarking/src/inner.rs @@ -18,10 +18,10 @@ //! Election provider support pallet benchmarking. //! This is separated into its own crate to avoid bloating the size of the runtime. +use alloc::vec::Vec; use codec::Decode; use frame_benchmarking::v1::benchmarks; use frame_election_provider_support::{NposSolver, PhragMMS, SequentialPhragmen}; -use sp_std::vec::Vec; pub struct Pallet(frame_system::Pallet); pub trait Config: frame_system::Config {} diff --git a/substrate/frame/election-provider-support/benchmarking/src/lib.rs b/substrate/frame/election-provider-support/benchmarking/src/lib.rs index 78b226e52af6..d092483f9383 100644 --- a/substrate/frame/election-provider-support/benchmarking/src/lib.rs +++ b/substrate/frame/election-provider-support/benchmarking/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] pub mod inner; diff --git a/substrate/frame/election-provider-support/solution-type/src/codec.rs b/substrate/frame/election-provider-support/solution-type/src/codec.rs index 17a256c228e2..16d5f17469b7 100644 --- a/substrate/frame/election-provider-support/solution-type/src/codec.rs +++ b/substrate/frame/election-provider-support/solution-type/src/codec.rs @@ -51,14 +51,14 @@ fn decode_impl( quote! { let #name = < - _fepsp::sp_std::prelude::Vec<(_fepsp::codec::Compact<#voter_type>, _fepsp::codec::Compact<#target_type>)> + _fepsp::Vec<(_fepsp::codec::Compact<#voter_type>, _fepsp::codec::Compact<#target_type>)> as _fepsp::codec::Decode >::decode(value)?; let #name = #name .into_iter() .map(|(v, t)| (v.0, t.0)) - .collect::<_fepsp::sp_std::prelude::Vec<_>>(); + .collect::<_fepsp::Vec<_>>(); } }; @@ -73,7 +73,7 @@ fn decode_impl( quote! { let #name = < - _fepsp::sp_std::prelude::Vec<( + _fepsp::Vec<( _fepsp::codec::Compact<#voter_type>, [(_fepsp::codec::Compact<#target_type>, _fepsp::codec::Compact<#weight_type>); #c-1], _fepsp::codec::Compact<#target_type>, @@ -87,7 +87,7 @@ fn decode_impl( [ #inner_impl ], t_last.0, )) - .collect::<_fepsp::sp_std::prelude::Vec<_>>(); + .collect::<_fepsp::Vec<_>>(); } }) .collect::(); @@ -126,7 +126,7 @@ fn encode_impl(ident: &syn::Ident, count: usize) -> TokenStream2 { _fepsp::codec::Compact(v.clone()), _fepsp::codec::Compact(t.clone()), )) - .collect::<_fepsp::sp_std::prelude::Vec<_>>(); + .collect::<_fepsp::Vec<_>>(); #name.encode_to(&mut r); } }; @@ -153,7 +153,7 @@ fn encode_impl(ident: &syn::Ident, count: usize) -> TokenStream2 { [ #inners_solution_array ], _fepsp::codec::Compact(t_last.clone()), )) - .collect::<_fepsp::sp_std::prelude::Vec<_>>(); + .collect::<_fepsp::Vec<_>>(); #name.encode_to(&mut r); } }) @@ -161,7 +161,7 @@ fn encode_impl(ident: &syn::Ident, count: usize) -> TokenStream2 { quote!( impl _fepsp::codec::Encode for #ident { - fn encode(&self) -> _fepsp::sp_std::prelude::Vec { + fn encode(&self) -> _fepsp::Vec { let mut r = vec![]; #encode_impl_single #encode_impl_rest @@ -182,7 +182,7 @@ fn scale_info_impl( let name = format!("{}", vote_field(1)); quote! { .field(|f| - f.ty::<_fepsp::sp_std::prelude::Vec< + f.ty::<_fepsp::Vec< (_fepsp::codec::Compact<#voter_type>, _fepsp::codec::Compact<#target_type>) >>() .name(#name) @@ -194,7 +194,7 @@ fn scale_info_impl( let name = format!("{}", vote_field(2)); quote! { .field(|f| - f.ty::<_fepsp::sp_std::prelude::Vec<( + f.ty::<_fepsp::Vec<( _fepsp::codec::Compact<#voter_type>, (_fepsp::codec::Compact<#target_type>, _fepsp::codec::Compact<#weight_type>), _fepsp::codec::Compact<#target_type> @@ -209,7 +209,7 @@ fn scale_info_impl( let name = format!("{}", vote_field(c)); quote! { .field(|f| - f.ty::<_fepsp::sp_std::prelude::Vec<( + f.ty::<_fepsp::Vec<( _fepsp::codec::Compact<#voter_type>, [ (_fepsp::codec::Compact<#target_type>, _fepsp::codec::Compact<#weight_type>); diff --git a/substrate/frame/election-provider-support/solution-type/src/single_page.rs b/substrate/frame/election-provider-support/solution-type/src/single_page.rs index 161631ee83fa..de59df162c8a 100644 --- a/substrate/frame/election-provider-support/solution-type/src/single_page.rs +++ b/substrate/frame/election-provider-support/solution-type/src/single_page.rs @@ -40,7 +40,7 @@ pub(crate) fn generate(def: crate::SolutionDef) -> Result { let name = vote_field(1); // NOTE: we use the visibility of the struct for the fields as well.. could be made better. quote!( - #vis #name: _fepsp::sp_std::prelude::Vec<(#voter_type, #target_type)>, + #vis #name: _fepsp::Vec<(#voter_type, #target_type)>, ) }; @@ -49,7 +49,7 @@ pub(crate) fn generate(def: crate::SolutionDef) -> Result { let field_name = vote_field(c); let array_len = c - 1; quote!( - #vis #field_name: _fepsp::sp_std::prelude::Vec<( + #vis #field_name: _fepsp::Vec<( #voter_type, [(#target_type, #weight_type); #array_len], #target_type @@ -147,8 +147,8 @@ pub(crate) fn generate(def: crate::SolutionDef) -> Result { self, voter_at: impl Fn(Self::VoterIndex) -> Option, target_at: impl Fn(Self::TargetIndex) -> Option, - ) -> Result<_fepsp::sp_std::prelude::Vec<_feps::Assignment>, _feps::Error> { - let mut #assignment_name: _fepsp::sp_std::prelude::Vec<_feps::Assignment> = Default::default(); + ) -> Result<_fepsp::Vec<_feps::Assignment>, _feps::Error> { + let mut #assignment_name: _fepsp::Vec<_feps::Assignment> = Default::default(); #into_impl Ok(#assignment_name) } @@ -165,10 +165,10 @@ pub(crate) fn generate(def: crate::SolutionDef) -> Result { all_edges } - fn unique_targets(&self) -> _fepsp::sp_std::prelude::Vec { + fn unique_targets(&self) -> _fepsp::Vec { // NOTE: this implementation returns the targets sorted, but we don't use it yet per // se, nor is the API enforcing it. - use _fepsp::sp_std::collections::btree_set::BTreeSet; + use _fepsp::BTreeSet; let mut all_targets: BTreeSet = BTreeSet::new(); let mut maybe_insert_target = |t: Self::TargetIndex| { all_targets.insert(t); @@ -206,7 +206,7 @@ pub(crate) fn generate(def: crate::SolutionDef) -> Result { .saturating_add((s as usize).saturating_mul(max_element_size)) } } - impl<'a> _fepsp::sp_std::convert::TryFrom<&'a [__IndexAssignment]> for #ident { + impl<'a> core::convert::TryFrom<&'a [__IndexAssignment]> for #ident { type Error = _feps::Error; fn try_from(index_assignments: &'a [__IndexAssignment]) -> Result { let mut #struct_name = #ident::default(); @@ -361,7 +361,7 @@ pub(crate) fn into_impl( let target = target_at(*t_idx).or_invalid_index()?; Ok((target, *p)) }) - .collect::, _feps::Error>>()?; + .collect::, _feps::Error>>()?; if sum >= #per_thing::one() { return Err(_feps::Error::SolutionWeightOverflow); diff --git a/substrate/frame/election-provider-support/src/lib.rs b/substrate/frame/election-provider-support/src/lib.rs index 2e9ee3b8a48b..394f58a38442 100644 --- a/substrate/frame/election-provider-support/src/lib.rs +++ b/substrate/frame/election-provider-support/src/lib.rs @@ -177,11 +177,14 @@ pub mod bounds; pub mod onchain; pub mod traits; +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; +use core::fmt::Debug; use sp_runtime::{ traits::{Bounded, Saturating, Zero}, RuntimeDebug, }; -use sp_std::{fmt::Debug, prelude::*}; pub use bounds::DataProviderBounds; pub use codec::{Decode, Encode}; @@ -202,10 +205,10 @@ use sp_runtime::TryRuntimeError; // re-export for the solution macro, with the dependencies of the macro. #[doc(hidden)] pub mod private { + pub use alloc::{collections::btree_set::BTreeSet, vec::Vec}; pub use codec; pub use scale_info; pub use sp_arithmetic; - pub use sp_std; // Simple Extension trait to easily convert `None` from index closures to `Err`. // @@ -276,7 +279,7 @@ pub type IndexAssignmentOf = IndexAssignment< /// Types that are used by the data provider trait. pub mod data_provider { /// Alias for the result type of the election data provider. - pub type Result = sp_std::result::Result; + pub type Result = core::result::Result; } /// Something that can provide the data to an [`ElectionProvider`]. @@ -431,7 +434,7 @@ pub trait InstantElectionProvider: ElectionProviderBase { } /// An election provider that does nothing whatsoever. -pub struct NoElection(sp_std::marker::PhantomData); +pub struct NoElection(core::marker::PhantomData); impl ElectionProviderBase for NoElection<(AccountId, BlockNumber, DataProvider, MaxWinners)> @@ -486,7 +489,7 @@ where /// used on the implementing side of [`ElectionDataProvider`]. pub trait SortedListProvider { /// The list's error type. - type Error: sp_std::fmt::Debug; + type Error: core::fmt::Debug; /// The type used by the list to compare nodes for ordering. type Score: Bounded + Saturating + Zero; @@ -597,7 +600,7 @@ pub trait NposSolver { /// The accuracy of this solver. This will affect the accuracy of the output. type Accuracy: PerThing128; /// The error type of this implementation. - type Error: sp_std::fmt::Debug + sp_std::cmp::PartialEq; + type Error: core::fmt::Debug + core::cmp::PartialEq; /// Solve an NPoS solution with the given `voters`, `targets`, and select `to_elect` count /// of `targets`. @@ -617,7 +620,7 @@ pub trait NposSolver { /// A wrapper for [`sp_npos_elections::seq_phragmen`] that implements [`NposSolver`]. See the /// documentation of [`sp_npos_elections::seq_phragmen`] for more info. pub struct SequentialPhragmen( - sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>, + core::marker::PhantomData<(AccountId, Accuracy, Balancing)>, ); impl>> @@ -642,7 +645,7 @@ impl( - sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>, + core::marker::PhantomData<(AccountId, Accuracy, Balancing)>, ); impl>> diff --git a/substrate/frame/election-provider-support/src/onchain.rs b/substrate/frame/election-provider-support/src/onchain.rs index ee4f6992a085..1063d5d35aee 100644 --- a/substrate/frame/election-provider-support/src/onchain.rs +++ b/substrate/frame/election-provider-support/src/onchain.rs @@ -24,11 +24,12 @@ use crate::{ BoundedSupportsOf, Debug, ElectionDataProvider, ElectionProvider, ElectionProviderBase, InstantElectionProvider, NposSolver, WeightInfo, }; +use alloc::collections::btree_map::BTreeMap; +use core::marker::PhantomData; use frame_support::{dispatch::DispatchClass, traits::Get}; use sp_npos_elections::{ assignment_ratio_to_staked_normalized, to_supports, BoundedSupports, ElectionResult, VoteWeight, }; -use sp_std::{collections::btree_map::BTreeMap, marker::PhantomData, prelude::*}; /// Errors of the on-chain election. #[derive(Eq, PartialEq, Debug)] diff --git a/substrate/frame/election-provider-support/src/traits.rs b/substrate/frame/election-provider-support/src/traits.rs index 43d183b338e2..84fd57992d34 100644 --- a/substrate/frame/election-provider-support/src/traits.rs +++ b/substrate/frame/election-provider-support/src/traits.rs @@ -18,11 +18,12 @@ //! Traits for the election operations. use crate::{Assignment, IdentifierT, IndexAssignmentOf, PerThing128, VoteWeight}; +use alloc::vec::Vec; use codec::Encode; +use core::fmt::Debug; use scale_info::TypeInfo; use sp_arithmetic::traits::{Bounded, UniqueSaturatedInto}; use sp_npos_elections::{ElectionScore, Error, EvaluateSupport}; -use sp_std::{fmt::Debug, prelude::*}; /// An opaque index-based, NPoS solution type. pub trait NposSolution diff --git a/substrate/frame/elections-phragmen/Cargo.toml b/substrate/frame/elections-phragmen/Cargo.toml index b53118b6b6fd..6d1ecbd07350 100644 --- a/substrate/frame/elections-phragmen/Cargo.toml +++ b/substrate/frame/elections-phragmen/Cargo.toml @@ -28,7 +28,6 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-npos-elections = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-staking = { workspace = true } [dev-dependencies] @@ -52,7 +51,6 @@ std = [ "sp-npos-elections/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", "sp-tracing/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index c6eca40c4718..565ead4059d5 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -98,7 +98,11 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; +use core::cmp::Ordering; use frame_support::{ traits::{ defensive_prelude::*, ChangeMembers, Contains, ContainsLengthBound, Currency, Get, @@ -115,7 +119,6 @@ use sp_runtime::{ DispatchError, Perbill, RuntimeDebug, }; use sp_staking::currency_to_vote::CurrencyToVote; -use sp_std::{cmp::Ordering, prelude::*}; #[cfg(any(feature = "try-runtime", test))] use sp_runtime::TryRuntimeError; diff --git a/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs b/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs index 482766ee97f5..ed4569aa25ee 100644 --- a/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs +++ b/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs @@ -18,6 +18,7 @@ //! A migration that unreserves all deposit and unlocks all stake held in the context of this //! pallet. +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use core::iter::Sum; use frame_support::{ pallet_prelude::ValueQuery, @@ -28,7 +29,6 @@ use frame_support::{ }; use sp_core::Get; use sp_runtime::traits::Zero; -use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; const LOG_TARGET: &str = "elections_phragmen::migrations::unlock_and_unreserve_all_funds"; @@ -93,7 +93,7 @@ type Voting = StorageMap< /// The pallet should be made inoperable before this migration is run. /// /// (See also [`RemovePallet`][frame_support::migrations::RemovePallet]) -pub struct UnlockAndUnreserveAllFunds(sp_std::marker::PhantomData); +pub struct UnlockAndUnreserveAllFunds(core::marker::PhantomData); impl UnlockAndUnreserveAllFunds { /// Calculates and returns the total amounts deposited and staked by each account in the context @@ -187,8 +187,8 @@ where /// reported as staked by the pallet and the amount actually locked in `Balances`. #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + use alloc::collections::btree_set::BTreeSet; use codec::Encode; - use sp_std::collections::btree_set::BTreeSet; // Get staked and deposited balances as reported by this pallet. let (account_deposited_sums, account_staked_sums, _) = diff --git a/substrate/frame/elections-phragmen/src/migrations/v3.rs b/substrate/frame/elections-phragmen/src/migrations/v3.rs index b0092d6c07bb..82f82f23e712 100644 --- a/substrate/frame/elections-phragmen/src/migrations/v3.rs +++ b/substrate/frame/elections-phragmen/src/migrations/v3.rs @@ -19,12 +19,12 @@ use super::super::LOG_TARGET; use crate::{Config, Pallet}; +use alloc::vec::Vec; use codec::{Decode, Encode, FullCodec}; use frame_support::{ pallet_prelude::ValueQuery, traits::StorageVersion, weights::Weight, Twox64Concat, }; use sp_runtime::RuntimeDebug; -use sp_std::prelude::*; #[derive(Encode, Decode, Clone, Default, RuntimeDebug, PartialEq)] struct SeatHolder { diff --git a/substrate/frame/elections-phragmen/src/migrations/v5.rs b/substrate/frame/elections-phragmen/src/migrations/v5.rs index 6e360aa8b8c1..150a4c4fa6c2 100644 --- a/substrate/frame/elections-phragmen/src/migrations/v5.rs +++ b/substrate/frame/elections-phragmen/src/migrations/v5.rs @@ -16,6 +16,7 @@ // limitations under the License. use super::super::*; +use alloc::{boxed::Box, vec::Vec}; /// Migrate the locks and vote stake on accounts (as specified with param `to_migrate`) that have /// more than their free balance locked. diff --git a/substrate/frame/examples/basic/Cargo.toml b/substrate/frame/examples/basic/Cargo.toml index b34d9efc15b7..af547c7eeb21 100644 --- a/substrate/frame/examples/basic/Cargo.toml +++ b/substrate/frame/examples/basic/Cargo.toml @@ -26,7 +26,6 @@ frame-system = { workspace = true } pallet-balances = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true } @@ -44,7 +43,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/examples/basic/src/lib.rs b/substrate/frame/examples/basic/src/lib.rs index 12cadc969fd7..fea04cb447a0 100644 --- a/substrate/frame/examples/basic/src/lib.rs +++ b/substrate/frame/examples/basic/src/lib.rs @@ -53,6 +53,9 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode}; use core::marker::PhantomData; use frame_support::{ @@ -69,7 +72,6 @@ use sp_runtime::{ InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, }, }; -use sp_std::vec::Vec; // Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; diff --git a/substrate/frame/examples/basic/src/tests.rs b/substrate/frame/examples/basic/src/tests.rs index 505cd6f906de..d7095eb3c944 100644 --- a/substrate/frame/examples/basic/src/tests.rs +++ b/substrate/frame/examples/basic/src/tests.rs @@ -92,7 +92,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { example: pallet_example_basic::GenesisConfig { dummy: 42, // we configure the map with (key, value) pairs. - bar: vec![(1, 2), (2, 3)], + bar: alloc::vec![(1, 2), (2, 3)], foo: 24, }, } diff --git a/substrate/frame/examples/default-config/Cargo.toml b/substrate/frame/examples/default-config/Cargo.toml index 8a0d14edbdbf..81509c782a3f 100644 --- a/substrate/frame/examples/default-config/Cargo.toml +++ b/substrate/frame/examples/default-config/Cargo.toml @@ -25,7 +25,6 @@ frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -37,7 +36,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/examples/default-config/src/lib.rs b/substrate/frame/examples/default-config/src/lib.rs index 5b66c78e0628..ccdcd4968598 100644 --- a/substrate/frame/examples/default-config/src/lib.rs +++ b/substrate/frame/examples/default-config/src/lib.rs @@ -32,6 +32,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[frame_support::pallet] pub mod pallet { use frame_support::pallet_prelude::*; @@ -189,7 +191,7 @@ pub mod tests { } parameter_types! { - pub const SomeCall: RuntimeCall = RuntimeCall::System(frame_system::Call::::remark { remark: vec![] }); + pub const SomeCall: RuntimeCall = RuntimeCall::System(frame_system::Call::::remark { remark: alloc::vec![] }); } #[derive_impl(TestDefaultConfig as pallet::DefaultConfig)] diff --git a/substrate/frame/examples/dev-mode/Cargo.toml b/substrate/frame/examples/dev-mode/Cargo.toml index 1dd033d7e071..c3dd7f26f21d 100644 --- a/substrate/frame/examples/dev-mode/Cargo.toml +++ b/substrate/frame/examples/dev-mode/Cargo.toml @@ -24,7 +24,6 @@ frame-system = { workspace = true } pallet-balances = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true } @@ -41,7 +40,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/examples/dev-mode/src/lib.rs b/substrate/frame/examples/dev-mode/src/lib.rs index 15f1a4b5d619..eb94c024280c 100644 --- a/substrate/frame/examples/dev-mode/src/lib.rs +++ b/substrate/frame/examples/dev-mode/src/lib.rs @@ -28,9 +28,11 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{vec, vec::Vec}; use frame_support::dispatch::DispatchResult; use frame_system::ensure_signed; -use sp_std::{vec, vec::Vec}; // Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; diff --git a/substrate/frame/examples/kitchensink/Cargo.toml b/substrate/frame/examples/kitchensink/Cargo.toml index b3869dff9414..f1f9fdb492d9 100644 --- a/substrate/frame/examples/kitchensink/Cargo.toml +++ b/substrate/frame/examples/kitchensink/Cargo.toml @@ -25,7 +25,6 @@ frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } frame-benchmarking = { optional = true, workspace = true } @@ -47,7 +46,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/examples/kitchensink/src/lib.rs b/substrate/frame/examples/kitchensink/src/lib.rs index b7425b0c0846..442318565426 100644 --- a/substrate/frame/examples/kitchensink/src/lib.rs +++ b/substrate/frame/examples/kitchensink/src/lib.rs @@ -42,6 +42,8 @@ use sp_runtime::TryRuntimeError; pub mod weights; pub use weights::*; +extern crate alloc; + #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/substrate/frame/examples/offchain-worker/Cargo.toml b/substrate/frame/examples/offchain-worker/Cargo.toml index f8ccd1f04e47..179a658de312 100644 --- a/substrate/frame/examples/offchain-worker/Cargo.toml +++ b/substrate/frame/examples/offchain-worker/Cargo.toml @@ -27,7 +27,6 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-keystore = { optional = true, workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -42,7 +41,6 @@ std = [ "sp-io/std", "sp-keystore/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/examples/offchain-worker/src/lib.rs b/substrate/frame/examples/offchain-worker/src/lib.rs index 0a90e896188e..add014f6b34a 100644 --- a/substrate/frame/examples/offchain-worker/src/lib.rs +++ b/substrate/frame/examples/offchain-worker/src/lib.rs @@ -45,6 +45,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::traits::Get; use frame_system::{ @@ -67,7 +70,6 @@ use sp_runtime::{ transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction}, RuntimeDebug, }; -use sp_std::vec::Vec; #[cfg(test)] mod tests; @@ -606,7 +608,7 @@ impl Pallet { let body = response.body().collect::>(); // Create a str slice from the body. - let body_str = sp_std::str::from_utf8(&body).map_err(|_| { + let body_str = alloc::str::from_utf8(&body).map_err(|_| { log::warn!("No UTF8 body"); http::Error::Unknown })?; diff --git a/substrate/frame/examples/offchain-worker/src/tests.rs b/substrate/frame/examples/offchain-worker/src/tests.rs index e2c57a8c1e1a..b665cbbb62ae 100644 --- a/substrate/frame/examples/offchain-worker/src/tests.rs +++ b/substrate/frame/examples/offchain-worker/src/tests.rs @@ -375,7 +375,7 @@ fn price_oracle_response(state: &mut testing::OffchainState) { #[test] fn parse_price_works() { - let test_data = vec![ + let test_data = alloc::vec![ ("{\"USD\":6536.92}", Some(653692)), ("{\"USD\":65.92}", Some(6592)), ("{\"USD\":6536.924565}", Some(653692)), diff --git a/substrate/frame/examples/single-block-migrations/Cargo.toml b/substrate/frame/examples/single-block-migrations/Cargo.toml index a6cf020ce535..2d524f2caa26 100644 --- a/substrate/frame/examples/single-block-migrations/Cargo.toml +++ b/substrate/frame/examples/single-block-migrations/Cargo.toml @@ -22,7 +22,6 @@ frame-executive = { workspace = true } frame-system = { workspace = true } frame-try-runtime = { optional = true, workspace = true } pallet-balances = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } @@ -42,7 +41,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-version/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/examples/single-block-migrations/src/lib.rs b/substrate/frame/examples/single-block-migrations/src/lib.rs index 411537aa8c65..07c7199b9322 100644 --- a/substrate/frame/examples/single-block-migrations/src/lib.rs +++ b/substrate/frame/examples/single-block-migrations/src/lib.rs @@ -156,6 +156,9 @@ pub use pallet::*; pub mod migrations; #[doc(hidden)] mod mock; + +extern crate alloc; + use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::traits::StorageVersion; use sp_runtime::RuntimeDebug; diff --git a/substrate/frame/examples/single-block-migrations/src/migrations/v1.rs b/substrate/frame/examples/single-block-migrations/src/migrations/v1.rs index 7b543d72c984..55cf7cef9a7a 100644 --- a/substrate/frame/examples/single-block-migrations/src/migrations/v1.rs +++ b/substrate/frame/examples/single-block-migrations/src/migrations/v1.rs @@ -21,7 +21,7 @@ use frame_support::{ }; #[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; +use alloc::vec::Vec; /// Collection of storage item formats from the previous storage version. /// @@ -41,7 +41,7 @@ mod v0 { /// /// In this migration, update the on-chain storage for the pallet to reflect the new storage /// layout. -pub struct InnerMigrateV0ToV1(sp_std::marker::PhantomData); +pub struct InnerMigrateV0ToV1(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for InnerMigrateV0ToV1 { /// Return the existing [`crate::Value`] so we can check that it was correctly set in diff --git a/substrate/frame/examples/split/Cargo.toml b/substrate/frame/examples/split/Cargo.toml index d8a8c6869ab5..9542902bae64 100644 --- a/substrate/frame/examples/split/Cargo.toml +++ b/substrate/frame/examples/split/Cargo.toml @@ -25,7 +25,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } -sp-std = { workspace = true } frame-benchmarking = { optional = true, workspace = true } @@ -43,7 +42,6 @@ std = [ "scale-info/std", "sp-core/std", "sp-io/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/examples/tasks/Cargo.toml b/substrate/frame/examples/tasks/Cargo.toml index 1ca62fd89943..00695ceddf19 100644 --- a/substrate/frame/examples/tasks/Cargo.toml +++ b/substrate/frame/examples/tasks/Cargo.toml @@ -24,7 +24,6 @@ frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-core = { workspace = true } frame-benchmarking = { optional = true, workspace = true } @@ -41,7 +40,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/executive/Cargo.toml b/substrate/frame/executive/Cargo.toml index 0f9741eec180..78d9ea6fa499 100644 --- a/substrate/frame/executive/Cargo.toml +++ b/substrate/frame/executive/Cargo.toml @@ -28,7 +28,6 @@ frame-try-runtime = { optional = true, workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-tracing = { workspace = true } [dev-dependencies] @@ -57,7 +56,6 @@ std = [ "sp-inherents/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-tracing/std", "sp-version/std", ] diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index 3028eaf318e0..1e7bac64e18f 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -151,7 +151,10 @@ pub mod block_flowchart {} #[cfg(test)] mod tests; +extern crate alloc; + use codec::{Codec, Encode}; +use core::marker::PhantomData; use frame_support::{ defensive_assert, dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, PostDispatchInfo}, @@ -174,7 +177,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, ExtrinsicInclusionMode, }; -use sp_std::{marker::PhantomData, prelude::*}; #[cfg(feature = "try-runtime")] use ::{ @@ -467,7 +469,7 @@ where /// Logs the result of trying to decode the entire state. fn log_decode_result( - res: Result>, + res: Result>, ) -> Result<(), TryRuntimeError> { match res { Ok(bytes) => { diff --git a/substrate/frame/fast-unstake/Cargo.toml b/substrate/frame/fast-unstake/Cargo.toml index 59676ad39951..2b188bad1dfa 100644 --- a/substrate/frame/fast-unstake/Cargo.toml +++ b/substrate/frame/fast-unstake/Cargo.toml @@ -24,7 +24,6 @@ frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-staking = { workspace = true } frame-election-provider-support = { workspace = true } @@ -58,7 +57,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", "sp-tracing/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/fast-unstake/src/benchmarking.rs b/substrate/frame/fast-unstake/src/benchmarking.rs index 4828dcb9b42c..d01ff715ca4f 100644 --- a/substrate/frame/fast-unstake/src/benchmarking.rs +++ b/substrate/frame/fast-unstake/src/benchmarking.rs @@ -20,6 +20,7 @@ #![cfg(feature = "runtime-benchmarks")] use crate::{types::*, Pallet as FastUnstake, *}; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{benchmarks, whitelist_account, BenchmarkError}; use frame_support::{ assert_ok, @@ -28,7 +29,6 @@ use frame_support::{ use frame_system::RawOrigin; use sp_runtime::traits::Zero; use sp_staking::{EraIndex, StakingInterface}; -use sp_std::prelude::*; const USER_SEED: u32 = 0; diff --git a/substrate/frame/fast-unstake/src/lib.rs b/substrate/frame/fast-unstake/src/lib.rs index f31c9c640260..41920907bd57 100644 --- a/substrate/frame/fast-unstake/src/lib.rs +++ b/substrate/frame/fast-unstake/src/lib.rs @@ -112,6 +112,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub use pallet::*; #[cfg(test)] @@ -150,6 +152,7 @@ macro_rules! log { pub mod pallet { use super::*; use crate::types::*; + use alloc::vec::Vec; use frame_support::{ pallet_prelude::*, traits::{Defensive, ReservableCurrency, StorageVersion}, @@ -157,7 +160,6 @@ pub mod pallet { use frame_system::pallet_prelude::*; use sp_runtime::{traits::Zero, DispatchResult}; use sp_staking::{EraIndex, StakingInterface}; - use sp_std::{prelude::*, vec::Vec}; pub use weights::WeightInfo; #[cfg(feature = "try-runtime")] diff --git a/substrate/frame/fast-unstake/src/migrations.rs b/substrate/frame/fast-unstake/src/migrations.rs index 97ad86bfff42..1a873534ac81 100644 --- a/substrate/frame/fast-unstake/src/migrations.rs +++ b/substrate/frame/fast-unstake/src/migrations.rs @@ -17,20 +17,20 @@ pub mod v1 { use crate::{types::BalanceOf, *}; + use alloc::vec::Vec; use frame_support::{ storage::unhashed, traits::{Defensive, Get, GetStorageVersion, OnRuntimeUpgrade}, weights::Weight, }; use sp_staking::EraIndex; - use sp_std::prelude::*; #[cfg(feature = "try-runtime")] use frame_support::ensure; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; - pub struct MigrateToV1(sp_std::marker::PhantomData); + pub struct MigrateToV1(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV1 { fn on_runtime_upgrade() -> Weight { let current = Pallet::::in_code_storage_version(); diff --git a/substrate/frame/fast-unstake/src/mock.rs b/substrate/frame/fast-unstake/src/mock.rs index 7ce7fee14107..757052e230a1 100644 --- a/substrate/frame/fast-unstake/src/mock.rs +++ b/substrate/frame/fast-unstake/src/mock.rs @@ -26,7 +26,6 @@ use frame_support::{ use sp_runtime::{traits::IdentityLookup, BuildStorage}; use pallet_staking::{Exposure, IndividualExposure, StakerStatus}; -use sp_std::prelude::*; pub type AccountId = u128; pub type BlockNumber = u64; diff --git a/substrate/frame/fast-unstake/src/types.rs b/substrate/frame/fast-unstake/src/types.rs index 3fb5720861fa..2a2319ef6129 100644 --- a/substrate/frame/fast-unstake/src/types.rs +++ b/substrate/frame/fast-unstake/src/types.rs @@ -24,7 +24,6 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_staking::{EraIndex, StakingInterface}; -use sp_std::prelude::*; /// Maximum number of eras that we might check for a single staker. /// @@ -32,7 +31,7 @@ use sp_std::prelude::*; #[derive(scale_info::TypeInfo, codec::Encode, codec::Decode, codec::MaxEncodedLen)] #[codec(mel_bound(T: Config))] #[scale_info(skip_type_params(T))] -pub struct MaxChecking(sp_std::marker::PhantomData); +pub struct MaxChecking(core::marker::PhantomData); impl frame_support::traits::Get for MaxChecking { fn get() -> u32 { T::Staking::bonding_duration() + 1 diff --git a/substrate/frame/glutton/Cargo.toml b/substrate/frame/glutton/Cargo.toml index 58faecde6293..5a73e8caef8e 100644 --- a/substrate/frame/glutton/Cargo.toml +++ b/substrate/frame/glutton/Cargo.toml @@ -26,7 +26,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-inherents = { workspace = true } [dev-dependencies] @@ -47,7 +46,6 @@ std = [ "sp-inherents/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/glutton/src/lib.rs b/substrate/frame/glutton/src/lib.rs index 5427173b486b..c8d2981ebfef 100644 --- a/substrate/frame/glutton/src/lib.rs +++ b/substrate/frame/glutton/src/lib.rs @@ -35,12 +35,14 @@ mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use blake2::{Blake2b512, Digest}; use frame_support::{pallet_prelude::*, weights::WeightMeter, DefaultNoBound}; use frame_system::pallet_prelude::*; use sp_io::hashing::twox_256; use sp_runtime::{traits::Zero, FixedPointNumber, FixedU64}; -use sp_std::{vec, vec::Vec}; pub use pallet::*; pub use weights::WeightInfo; @@ -162,7 +164,7 @@ pub mod pallet { pub block_length: FixedU64, #[serde(skip)] /// The required configuration field. - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] diff --git a/substrate/frame/grandpa/Cargo.toml b/substrate/frame/grandpa/Cargo.toml index e08af3a5e91b..e24f9a51db84 100644 --- a/substrate/frame/grandpa/Cargo.toml +++ b/substrate/frame/grandpa/Cargo.toml @@ -31,7 +31,6 @@ sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-session = { workspace = true } sp-staking = { features = ["serde"], workspace = true } -sp-std = { workspace = true } [dev-dependencies] finality-grandpa = { features = ["derive-codec"], workspace = true, default-features = true } @@ -67,7 +66,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/grandpa/src/equivocation.rs b/substrate/frame/grandpa/src/equivocation.rs index 16727f79a58d..b213c1ceb721 100644 --- a/substrate/frame/grandpa/src/equivocation.rs +++ b/substrate/frame/grandpa/src/equivocation.rs @@ -35,6 +35,7 @@ //! that the `ValidateUnsigned` for the GRANDPA pallet is used in the runtime //! definition. +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{self as codec, Decode, Encode}; use frame_support::traits::{Get, KeyOwnerProofSystem}; use frame_system::pallet_prelude::BlockNumberFor; @@ -52,7 +53,6 @@ use sp_staking::{ offence::{Kind, Offence, OffenceReportSystem, ReportOffence}, SessionIndex, }; -use sp_std::prelude::*; use super::{Call, Config, Error, Pallet, LOG_TARGET}; @@ -114,7 +114,7 @@ impl Offence for EquivocationOffence { /// - On-chain validity checks and processing are mostly delegated to the user provided generic /// types implementing `KeyOwnerProofSystem` and `ReportOffence` traits. /// - Offence reporter for unsigned transactions is fetched via the the authorship pallet. -pub struct EquivocationReportSystem(sp_std::marker::PhantomData<(T, R, P, L)>); +pub struct EquivocationReportSystem(core::marker::PhantomData<(T, R, P, L)>); impl OffenceReportSystem< diff --git a/substrate/frame/grandpa/src/lib.rs b/substrate/frame/grandpa/src/lib.rs index 90bcd8721dfa..4f69aeaef523 100644 --- a/substrate/frame/grandpa/src/lib.rs +++ b/substrate/frame/grandpa/src/lib.rs @@ -28,11 +28,14 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + // Re-export since this is necessary for `impl_apis` in runtime. pub use sp_consensus_grandpa::{ self as fg_primitives, AuthorityId, AuthorityList, AuthorityWeight, }; +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dispatch::{DispatchResultWithPostInfo, Pays}, @@ -50,7 +53,6 @@ use sp_consensus_grandpa::{ use sp_runtime::{generic::DigestItem, traits::Zero, DispatchResult}; use sp_session::{GetSessionNumber, GetValidatorCount}; use sp_staking::{offence::OffenceReportSystem, SessionIndex}; -use sp_std::prelude::*; mod default_weights; mod equivocation; @@ -351,7 +353,7 @@ pub mod pallet { pub struct GenesisConfig { pub authorities: AuthorityList, #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] diff --git a/substrate/frame/grandpa/src/migrations/v5.rs b/substrate/frame/grandpa/src/migrations/v5.rs index a0865a3f2bf9..f1af0af42dd0 100644 --- a/substrate/frame/grandpa/src/migrations/v5.rs +++ b/substrate/frame/grandpa/src/migrations/v5.rs @@ -16,7 +16,9 @@ // limitations under the License. use crate::{BoundedAuthorityList, Pallet}; +use alloc::vec::Vec; use codec::Decode; +use core::marker::PhantomData; use frame_support::{ migrations::VersionedMigration, storage, @@ -24,7 +26,6 @@ use frame_support::{ weights::Weight, }; use sp_consensus_grandpa::AuthorityList; -use sp_std::{marker::PhantomData, vec::Vec}; const GRANDPA_AUTHORITIES_KEY: &[u8] = b":grandpa_authorities"; diff --git a/substrate/frame/identity/Cargo.toml b/substrate/frame/identity/Cargo.toml index d0b796cd75d3..6794fbfbbf42 100644 --- a/substrate/frame/identity/Cargo.toml +++ b/substrate/frame/identity/Cargo.toml @@ -25,7 +25,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -48,7 +47,6 @@ std = [ "sp-io/std", "sp-keystore/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/identity/src/benchmarking.rs b/substrate/frame/identity/src/benchmarking.rs index 957549b19f85..ab04000c2281 100644 --- a/substrate/frame/identity/src/benchmarking.rs +++ b/substrate/frame/identity/src/benchmarking.rs @@ -22,6 +22,7 @@ use super::*; use crate::Pallet as Identity; +use alloc::{vec, vec::Vec}; use frame_benchmarking::{account, v2::*, whitelisted_caller, BenchmarkError}; use frame_support::{ assert_ok, ensure, diff --git a/substrate/frame/identity/src/legacy.rs b/substrate/frame/identity/src/legacy.rs index 60e812c2238b..c2107e929038 100644 --- a/substrate/frame/identity/src/legacy.rs +++ b/substrate/frame/identity/src/legacy.rs @@ -15,6 +15,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#[cfg(feature = "runtime-benchmarks")] +use alloc::vec; use codec::{Decode, Encode, MaxEncodedLen}; #[cfg(feature = "runtime-benchmarks")] use enumflags2::BitFlag; @@ -22,7 +24,6 @@ use enumflags2::{bitflags, BitFlags}; use frame_support::{traits::Get, CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound}; use scale_info::{build::Variants, Path, Type, TypeInfo}; use sp_runtime::{BoundedVec, RuntimeDebug}; -use sp_std::prelude::*; use crate::types::{Data, IdentityInformationProvider}; diff --git a/substrate/frame/identity/src/lib.rs b/substrate/frame/identity/src/lib.rs index 50d6de32ac61..776a08f5e9e8 100644 --- a/substrate/frame/identity/src/lib.rs +++ b/substrate/frame/identity/src/lib.rs @@ -101,7 +101,10 @@ mod tests; mod types; pub mod weights; +extern crate alloc; + use crate::types::{AuthorityPropertiesOf, Suffix, Username}; +use alloc::{boxed::Box, vec::Vec}; use codec::Encode; use frame_support::{ ensure, @@ -113,7 +116,6 @@ pub use pallet::*; use sp_runtime::traits::{ AppendZerosInput, Hash, IdentifyAccount, Saturating, StaticLookup, Verify, Zero, }; -use sp_std::prelude::*; pub use types::{ Data, IdentityInformationProvider, Judgement, RegistrarIndex, RegistrarInfo, Registration, }; diff --git a/substrate/frame/identity/src/types.rs b/substrate/frame/identity/src/types.rs index 10f0db8c25d8..45401d53e9e9 100644 --- a/substrate/frame/identity/src/types.rs +++ b/substrate/frame/identity/src/types.rs @@ -16,7 +16,9 @@ // limitations under the License. use super::*; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; +use core::{fmt::Debug, iter::once, ops::Add}; use frame_support::{ traits::{ConstU32, Get}, BoundedVec, CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound, @@ -29,7 +31,6 @@ use sp_runtime::{ traits::{Member, Zero}, RuntimeDebug, }; -use sp_std::{fmt::Debug, iter::once, ops::Add, prelude::*}; /// An identifier for a single name registrar/identity verification service. pub type RegistrarIndex = u32; @@ -65,7 +66,7 @@ impl Data { } impl Decode for Data { - fn decode(input: &mut I) -> sp_std::result::Result { + fn decode(input: &mut I) -> core::result::Result { let b = input.read_byte()?; Ok(match b { 0 => Data::None, @@ -295,7 +296,7 @@ impl< IdentityInfo: IdentityInformationProvider, > Decode for Registration { - fn decode(input: &mut I) -> sp_std::result::Result { + fn decode(input: &mut I) -> core::result::Result { let (judgements, deposit, info) = Decode::decode(&mut AppendZerosInput::new(input))?; Ok(Self { judgements, deposit, info }) } diff --git a/substrate/frame/im-online/Cargo.toml b/substrate/frame/im-online/Cargo.toml index 85cbcb3941b1..2cb03b57d6ca 100644 --- a/substrate/frame/im-online/Cargo.toml +++ b/substrate/frame/im-online/Cargo.toml @@ -28,7 +28,6 @@ sp-core = { features = ["serde"], workspace = true } sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-staking = { features = ["serde"], workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-session = { workspace = true, default-features = true } @@ -49,7 +48,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/im-online/src/lib.rs b/substrate/frame/im-online/src/lib.rs index f91a473e53d5..ee2a8451d6fb 100644 --- a/substrate/frame/im-online/src/lib.rs +++ b/substrate/frame/im-online/src/lib.rs @@ -82,6 +82,9 @@ mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ pallet_prelude::*, @@ -107,7 +110,6 @@ use sp_staking::{ offence::{Kind, Offence, ReportOffence}, SessionIndex, }; -use sp_std::prelude::*; pub use weights::WeightInfo; pub mod sr25519 { @@ -196,8 +198,8 @@ enum OffchainErr { SubmitTransaction, } -impl sp_std::fmt::Debug for OffchainErr { - fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { +impl core::fmt::Debug for OffchainErr { + fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { match *self { OffchainErr::TooEarly => write!(fmt, "Too early to send heartbeat."), OffchainErr::WaitingForInclusion(ref block) => { diff --git a/substrate/frame/im-online/src/migration.rs b/substrate/frame/im-online/src/migration.rs index 754a2e672e6c..6d3a5cda6973 100644 --- a/substrate/frame/im-online/src/migration.rs +++ b/substrate/frame/im-online/src/migration.rs @@ -18,6 +18,7 @@ //! Storage migrations for the im-online pallet. use super::*; +use alloc::vec::Vec; use frame_support::{storage_alias, traits::OnRuntimeUpgrade}; #[cfg(feature = "try-runtime")] diff --git a/substrate/frame/indices/Cargo.toml b/substrate/frame/indices/Cargo.toml index 20c3863ff99b..ea1704815312 100644 --- a/substrate/frame/indices/Cargo.toml +++ b/substrate/frame/indices/Cargo.toml @@ -25,7 +25,6 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-keyring = { optional = true, workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -44,7 +43,6 @@ std = [ "sp-keyring", "sp-keyring?/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/indices/src/lib.rs b/substrate/frame/indices/src/lib.rs index ff12d092cfb8..740d69365df3 100644 --- a/substrate/frame/indices/src/lib.rs +++ b/substrate/frame/indices/src/lib.rs @@ -25,13 +25,15 @@ mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::vec::Vec; use codec::Codec; use frame_support::traits::{BalanceStatus::Reserved, Currency, ReservableCurrency}; use sp_runtime::{ traits::{AtLeast32Bit, LookupError, Saturating, StaticLookup, Zero}, MultiAddress, }; -use sp_std::prelude::*; pub use weights::WeightInfo; type BalanceOf = diff --git a/substrate/frame/insecure-randomness-collective-flip/Cargo.toml b/substrate/frame/insecure-randomness-collective-flip/Cargo.toml index 0da0d5373953..977b9fdb6f60 100644 --- a/substrate/frame/insecure-randomness-collective-flip/Cargo.toml +++ b/substrate/frame/insecure-randomness-collective-flip/Cargo.toml @@ -22,7 +22,6 @@ scale-info = { features = ["derive"], workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true, default-features = true } @@ -39,7 +38,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/lottery/Cargo.toml b/substrate/frame/lottery/Cargo.toml index 34d1728e42ed..0a33e54a825d 100644 --- a/substrate/frame/lottery/Cargo.toml +++ b/substrate/frame/lottery/Cargo.toml @@ -23,7 +23,6 @@ frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] frame-support-test = { workspace = true } @@ -44,7 +43,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/lottery/src/benchmarking.rs b/substrate/frame/lottery/src/benchmarking.rs index 123b425b976f..046bc0acbb64 100644 --- a/substrate/frame/lottery/src/benchmarking.rs +++ b/substrate/frame/lottery/src/benchmarking.rs @@ -22,6 +22,7 @@ use super::*; use crate::Pallet as Lottery; +use alloc::{boxed::Box, vec}; use frame_benchmarking::{ v1::{account, whitelisted_caller, BenchmarkError}, v2::*, diff --git a/substrate/frame/lottery/src/lib.rs b/substrate/frame/lottery/src/lib.rs index 54a8edd38606..0071b258fc45 100644 --- a/substrate/frame/lottery/src/lib.rs +++ b/substrate/frame/lottery/src/lib.rs @@ -54,6 +54,9 @@ mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ dispatch::{DispatchResult, GetDispatchInfo}, @@ -68,7 +71,6 @@ use sp_runtime::{ traits::{AccountIdConversion, Dispatchable, Saturating, Zero}, ArithmeticError, DispatchError, RuntimeDebug, }; -use sp_std::prelude::*; pub use weights::WeightInfo; type BalanceOf = diff --git a/substrate/frame/membership/Cargo.toml b/substrate/frame/membership/Cargo.toml index 35b0eeaa7141..0fc5ce02809e 100644 --- a/substrate/frame/membership/Cargo.toml +++ b/substrate/frame/membership/Cargo.toml @@ -25,7 +25,6 @@ frame-system = { workspace = true } sp-core = { features = ["serde"], workspace = true } sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -39,7 +38,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/membership/src/lib.rs b/substrate/frame/membership/src/lib.rs index d5dad68e811b..e38a6ba5d931 100644 --- a/substrate/frame/membership/src/lib.rs +++ b/substrate/frame/membership/src/lib.rs @@ -23,12 +23,14 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use frame_support::{ traits::{ChangeMembers, Contains, ContainsLengthBound, Get, InitializeMembers, SortedMembers}, BoundedVec, }; use sp_runtime::traits::{StaticLookup, UniqueSaturatedInto}; -use sp_std::prelude::*; pub mod migrations; pub mod weights; @@ -113,7 +115,7 @@ pub mod pallet { #[pallet::genesis_build] impl, I: 'static> BuildGenesisConfig for GenesisConfig { fn build(&self) { - use sp_std::collections::btree_set::BTreeSet; + use alloc::collections::btree_set::BTreeSet; let members_set: BTreeSet<_> = self.members.iter().collect(); assert_eq!( members_set.len(), diff --git a/substrate/frame/merkle-mountain-range/Cargo.toml b/substrate/frame/merkle-mountain-range/Cargo.toml index 27ba77e5a62a..b8a9b6065c6c 100644 --- a/substrate/frame/merkle-mountain-range/Cargo.toml +++ b/substrate/frame/merkle-mountain-range/Cargo.toml @@ -25,7 +25,6 @@ sp-core = { workspace = true } sp-io = { workspace = true } sp-mmr-primitives = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] array-bytes = { workspace = true, default-features = true } @@ -45,7 +44,6 @@ std = [ "sp-io/std", "sp-mmr-primitives/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/merkle-mountain-range/src/lib.rs b/substrate/frame/merkle-mountain-range/src/lib.rs index 47a325db605d..cacb33b50434 100644 --- a/substrate/frame/merkle-mountain-range/src/lib.rs +++ b/substrate/frame/merkle-mountain-range/src/lib.rs @@ -56,6 +56,9 @@ //! NOTE This pallet is experimental and not proven to work in production. #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use frame_support::weights::Weight; use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor}; use log; @@ -64,7 +67,6 @@ use sp_runtime::{ traits::{self, One, Saturating}, SaturatedConversion, }; -use sp_std::prelude::*; pub use pallet::*; pub use sp_mmr_primitives::{ @@ -89,7 +91,7 @@ mod tests; /// is not available (since the block is not finished yet), /// we use the `parent_hash` here along with parent block number. pub struct ParentNumberAndHash { - _phantom: sp_std::marker::PhantomData, + _phantom: core::marker::PhantomData, } impl LeafDataProvider for ParentNumberAndHash { @@ -110,7 +112,7 @@ pub trait BlockHashProvider { /// Default implementation of BlockHashProvider using frame_system. pub struct DefaultBlockHashProvider { - _phantom: sp_std::marker::PhantomData, + _phantom: core::marker::PhantomData, } impl BlockHashProvider, T::Hash> @@ -302,7 +304,7 @@ impl, I: 'static> Pallet { fn node_temp_offchain_key( pos: NodeIndex, parent_hash: ::Hash, - ) -> sp_std::prelude::Vec { + ) -> Vec { NodesUtils::node_temp_offchain_key::>(&T::INDEXING_PREFIX, pos, parent_hash) } @@ -311,7 +313,7 @@ impl, I: 'static> Pallet { /// Used for nodes added by now finalized blocks. /// Never read keys using `node_canon_offchain_key` unless you sure that /// there's no `node_offchain_key` key in the storage. - fn node_canon_offchain_key(pos: NodeIndex) -> sp_std::prelude::Vec { + fn node_canon_offchain_key(pos: NodeIndex) -> Vec { NodesUtils::node_canon_offchain_key(&T::INDEXING_PREFIX, pos) } diff --git a/substrate/frame/merkle-mountain-range/src/mmr/mmr.rs b/substrate/frame/merkle-mountain-range/src/mmr/mmr.rs index 8a99f4d87deb..2b46357c5072 100644 --- a/substrate/frame/merkle-mountain-range/src/mmr/mmr.rs +++ b/substrate/frame/merkle-mountain-range/src/mmr/mmr.rs @@ -23,8 +23,8 @@ use crate::{ primitives::{self, Error, NodeIndex}, Config, HashOf, HashingOf, }; +use alloc::vec::Vec; use sp_mmr_primitives::{mmr_lib, mmr_lib::MMRStoreReadOps, utils::NodesUtils, LeafIndex}; -use sp_std::prelude::*; /// Stateless verification of the proof for a batch of leaves. /// Note, the leaves should be sorted such that corresponding leaves and leaf indices have the diff --git a/substrate/frame/merkle-mountain-range/src/mmr/storage.rs b/substrate/frame/merkle-mountain-range/src/mmr/storage.rs index e27440be35c4..a39089801484 100644 --- a/substrate/frame/merkle-mountain-range/src/mmr/storage.rs +++ b/substrate/frame/merkle-mountain-range/src/mmr/storage.rs @@ -17,14 +17,13 @@ //! An MMR storage implementation. +use alloc::{vec, vec::Vec}; use codec::Encode; +use core::iter::Peekable; use log::{debug, trace}; use sp_core::offchain::StorageKind; use sp_io::offchain_index; use sp_mmr_primitives::{mmr_lib, mmr_lib::helper, utils::NodesUtils}; -use sp_std::iter::Peekable; -#[cfg(not(feature = "std"))] -use sp_std::prelude::*; use crate::{ mmr::{Node, NodeOf}, @@ -52,7 +51,7 @@ pub struct OffchainStorage; /// /// There are two different implementations depending on the use case. /// See docs for [RuntimeStorage] and [OffchainStorage]. -pub struct Storage(sp_std::marker::PhantomData<(StorageType, T, I, L)>); +pub struct Storage(core::marker::PhantomData<(StorageType, T, I, L)>); impl Default for Storage { fn default() -> Self { diff --git a/substrate/frame/message-queue/Cargo.toml b/substrate/frame/message-queue/Cargo.toml index 5ced1a4e08ff..0c3bbb2c883c 100644 --- a/substrate/frame/message-queue/Cargo.toml +++ b/substrate/frame/message-queue/Cargo.toml @@ -21,7 +21,6 @@ environmental = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-arithmetic = { workspace = true } sp-weights = { workspace = true } @@ -49,7 +48,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-tracing/std", "sp-weights/std", ] diff --git a/substrate/frame/message-queue/src/benchmarking.rs b/substrate/frame/message-queue/src/benchmarking.rs index 7e99bc058584..8f0712acc5f5 100644 --- a/substrate/frame/message-queue/src/benchmarking.rs +++ b/substrate/frame/message-queue/src/benchmarking.rs @@ -26,7 +26,6 @@ use frame_benchmarking::v2::*; use frame_support::traits::Get; use frame_system::RawOrigin; use sp_io::hashing::blake2_256; -use sp_std::prelude::*; #[benchmarks( where diff --git a/substrate/frame/message-queue/src/lib.rs b/substrate/frame/message-queue/src/lib.rs index ef3420d21be5..2dbffef7e5a2 100644 --- a/substrate/frame/message-queue/src/lib.rs +++ b/substrate/frame/message-queue/src/lib.rs @@ -203,7 +203,11 @@ pub mod mock_helpers; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{vec, vec::Vec}; use codec::{Codec, Decode, Encode, MaxEncodedLen}; +use core::{fmt::Debug, ops::Deref}; use frame_support::{ defensive, pallet_prelude::*, @@ -223,7 +227,6 @@ use sp_runtime::{ traits::{One, Zero}, SaturatedConversion, Saturating, }; -use sp_std::{fmt::Debug, ops::Deref, prelude::*, vec}; use sp_weights::WeightMeter; pub use weights::WeightInfo; @@ -307,7 +310,7 @@ impl< return Err(()) } - let mut heap = sp_std::mem::take(&mut self.heap).into_inner(); + let mut heap = core::mem::take(&mut self.heap).into_inner(); header.using_encoded(|h| heap.extend_from_slice(h)); heap.extend_from_slice(message.deref()); self.heap = BoundedVec::defensive_truncate_from(heap); @@ -1509,7 +1512,7 @@ pub(crate) fn with_service_mutex R, R>(f: F) -> Result { } /// Provides a [`sp_core::Get`] to access the `MEL` of a [`codec::MaxEncodedLen`] type. -pub struct MaxEncodedLenOf(sp_std::marker::PhantomData); +pub struct MaxEncodedLenOf(core::marker::PhantomData); impl Get for MaxEncodedLenOf { fn get() -> u32 { T::max_encoded_len() as u32 @@ -1518,7 +1521,7 @@ impl Get for MaxEncodedLenOf { /// Calculates the maximum message length and exposed it through the [`codec::MaxEncodedLen`] trait. pub struct MaxMessageLen( - sp_std::marker::PhantomData<(Origin, Size, HeapSize)>, + core::marker::PhantomData<(Origin, Size, HeapSize)>, ); impl, HeapSize: Get> Get for MaxMessageLen @@ -1544,7 +1547,7 @@ pub type BookStateOf = BookState>; /// Converts a [`sp_core::Get`] with returns a type that can be cast into an `u32` into a `Get` /// which returns an `u32`. -pub struct IntoU32(sp_std::marker::PhantomData<(T, O)>); +pub struct IntoU32(core::marker::PhantomData<(T, O)>); impl, O: Into> Get for IntoU32 { fn get() -> u32 { T::get().into() diff --git a/substrate/frame/message-queue/src/mock.rs b/substrate/frame/message-queue/src/mock.rs index 66a242d5a18f..26533cc7c330 100644 --- a/substrate/frame/message-queue/src/mock.rs +++ b/substrate/frame/message-queue/src/mock.rs @@ -23,9 +23,9 @@ pub use super::mock_helpers::*; use super::*; use crate as pallet_message_queue; +use alloc::collections::btree_map::BTreeMap; use frame_support::{derive_impl, parameter_types}; use sp_runtime::BuildStorage; -use sp_std::collections::btree_map::BTreeMap; type Block = frame_system::mocking::MockBlock; diff --git a/substrate/frame/message-queue/src/mock_helpers.rs b/substrate/frame/message-queue/src/mock_helpers.rs index 28395e27cdd2..873add776e20 100644 --- a/substrate/frame/message-queue/src/mock_helpers.rs +++ b/substrate/frame/message-queue/src/mock_helpers.rs @@ -22,6 +22,7 @@ //! Cannot be put into mock.rs since benchmarks require no-std and mock.rs is std. use crate::*; +use alloc::vec::Vec; use frame_support::traits::Defensive; /// Converts `Self` into a `Weight` by using `Self` for all components. diff --git a/substrate/frame/migrations/Cargo.toml b/substrate/frame/migrations/Cargo.toml index 5a946d3aa058..5fbed74a4400 100644 --- a/substrate/frame/migrations/Cargo.toml +++ b/substrate/frame/migrations/Cargo.toml @@ -21,7 +21,6 @@ frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } [dev-dependencies] @@ -46,7 +45,6 @@ std = [ "scale-info/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/migrations/src/lib.rs b/substrate/frame/migrations/src/lib.rs index 649bc314a12b..68041a57eaa2 100644 --- a/substrate/frame/migrations/src/lib.rs +++ b/substrate/frame/migrations/src/lib.rs @@ -69,22 +69,22 @@ //! either be [`MigrationCursor::Active`] or [`MigrationCursor::Stuck`]. In the active case it //! points to the currently active migration and stores its inner cursor. The inner cursor can then //! be used by the migration to store its inner state and advance. Each time when the migration -//! returns `Some(cursor)`, it signals the pallet that it is not done yet. +//! returns `Some(cursor)`, it signals the pallet that it is not done yet. //! The cursor is reset on each runtime upgrade. This ensures that it starts to execute at the //! first migration in the vector. The pallets cursor is only ever incremented or set to `Stuck` //! once it encounters an error (Goal 4). Once in the stuck state, the pallet will stay stuck until -//! it is fixed through manual governance intervention. +//! it is fixed through manual governance intervention. //! As soon as the cursor of the pallet becomes `Some(_)`; [`MultiStepMigrator::ongoing`] returns //! `true` (Goal 2). This can be used by upstream code to possibly pause transactions. //! In `on_initialize` the pallet will load the current migration and check whether it was already //! executed in the past by checking for membership of its ID in the [`Historic`] set. Historic //! migrations are skipped without causing an error. Each successfully executed migration is added -//! to this set (Goal 5). +//! to this set (Goal 5). //! This proceeds until no more migrations remain. At that point, the event `UpgradeCompleted` is -//! emitted (Goal 1). +//! emitted (Goal 1). //! The execution of each migration happens by calling [`SteppedMigration::transactional_step`]. //! This function wraps the inner `step` function into a transactional layer to allow rollback in -//! the error case (Goal 6). +//! the error case (Goal 6). //! Weight limits must be checked by the migration itself. The pallet provides a [`WeightMeter`] for //! that purpose. The pallet may return [`SteppedMigrationError::InsufficientWeight`] at any point. //! In that scenario, one of two things will happen: if that migration was exclusively executed @@ -145,9 +145,12 @@ pub mod mock_helpers; mod tests; pub mod weights; +extern crate alloc; + pub use pallet::*; pub use weights::WeightInfo; +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use core::ops::ControlFlow; use frame_support::{ @@ -159,7 +162,6 @@ use frame_support::{ }; use frame_system::{pallet_prelude::BlockNumberFor, Pallet as System}; use sp_runtime::Saturating; -use sp_std::vec::Vec; /// Points to the next migration to execute. #[derive(Debug, Clone, Eq, PartialEq, Encode, Decode, scale_info::TypeInfo, MaxEncodedLen)] diff --git a/substrate/frame/migrations/src/mock_helpers.rs b/substrate/frame/migrations/src/mock_helpers.rs index d230417d12e6..9d3b4d1193f2 100644 --- a/substrate/frame/migrations/src/mock_helpers.rs +++ b/substrate/frame/migrations/src/mock_helpers.rs @@ -19,6 +19,7 @@ #![allow(missing_docs)] +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ migrations::*, @@ -26,7 +27,6 @@ use frame_support::{ }; use sp_core::ConstU32; use sp_runtime::BoundedVec; -use sp_std::{vec, vec::Vec}; /// Opaque identifier of a migration. pub type MockedIdentifier = BoundedVec>; diff --git a/substrate/frame/mixnet/Cargo.toml b/substrate/frame/mixnet/Cargo.toml index f3bea3d29147..a9980ac268bc 100644 --- a/substrate/frame/mixnet/Cargo.toml +++ b/substrate/frame/mixnet/Cargo.toml @@ -28,7 +28,6 @@ sp-arithmetic = { workspace = true } sp-io = { workspace = true } sp-mixnet = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -45,7 +44,6 @@ std = [ "sp-io/std", "sp-mixnet/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/mixnet/src/lib.rs b/substrate/frame/mixnet/src/lib.rs index c7a5b624157b..c0505a4f0105 100644 --- a/substrate/frame/mixnet/src/lib.rs +++ b/substrate/frame/mixnet/src/lib.rs @@ -21,7 +21,11 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; +use core::cmp::Ordering; use frame_support::{ traits::{EstimateNextSessionRotation, Get, OneSessionHandler}, BoundedVec, @@ -41,7 +45,6 @@ use sp_mixnet::types::{ SessionPhase, SessionStatus, KX_PUBLIC_SIZE, }; use sp_runtime::RuntimeDebug; -use sp_std::{cmp::Ordering, vec::Vec}; const LOG_TARGET: &str = "runtime::mixnet"; diff --git a/substrate/frame/multisig/Cargo.toml b/substrate/frame/multisig/Cargo.toml index 329b2e8824e2..c1571c6c0300 100644 --- a/substrate/frame/multisig/Cargo.toml +++ b/substrate/frame/multisig/Cargo.toml @@ -23,7 +23,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # third party log = { workspace = true } @@ -43,7 +42,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index a83b78e316f5..51c36773bdad 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -48,6 +48,9 @@ pub mod migrations; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dispatch::{ @@ -66,7 +69,6 @@ use sp_runtime::{ traits::{Dispatchable, TrailingZeroInput, Zero}, DispatchError, RuntimeDebug, }; -use sp_std::prelude::*; pub use weights::WeightInfo; pub use pallet::*; diff --git a/substrate/frame/nft-fractionalization/Cargo.toml b/substrate/frame/nft-fractionalization/Cargo.toml index f0613581257e..ca2e70cbe6ce 100644 --- a/substrate/frame/nft-fractionalization/Cargo.toml +++ b/substrate/frame/nft-fractionalization/Cargo.toml @@ -25,7 +25,6 @@ frame-system = { workspace = true } pallet-assets = { workspace = true } pallet-nfts = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -48,7 +47,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/nft-fractionalization/src/benchmarking.rs b/substrate/frame/nft-fractionalization/src/benchmarking.rs index 0b54acdab49e..811b5fe1b317 100644 --- a/substrate/frame/nft-fractionalization/src/benchmarking.rs +++ b/substrate/frame/nft-fractionalization/src/benchmarking.rs @@ -32,7 +32,6 @@ use frame_support::{ use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin as SystemOrigin}; use pallet_nfts::{CollectionConfig, CollectionSettings, ItemConfig, MintSettings}; use sp_runtime::traits::StaticLookup; -use sp_std::prelude::*; use crate::Pallet as NftFractionalization; diff --git a/substrate/frame/nft-fractionalization/src/lib.rs b/substrate/frame/nft-fractionalization/src/lib.rs index cb269f464c48..5fa990ecebe6 100644 --- a/substrate/frame/nft-fractionalization/src/lib.rs +++ b/substrate/frame/nft-fractionalization/src/lib.rs @@ -56,6 +56,7 @@ pub use weights::WeightInfo; #[frame_support::pallet] pub mod pallet { use super::*; + use core::fmt::Display; use frame_support::{ dispatch::DispatchResult, ensure, @@ -83,7 +84,6 @@ pub mod pallet { use frame_system::pallet_prelude::*; use scale_info::prelude::{format, string::String}; use sp_runtime::traits::{One, Zero}; - use sp_std::{fmt::Display, prelude::*}; #[pallet::pallet] pub struct Pallet(_); diff --git a/substrate/frame/nfts/Cargo.toml b/substrate/frame/nfts/Cargo.toml index a1eef3226ecf..e3ffd971a2bb 100644 --- a/substrate/frame/nfts/Cargo.toml +++ b/substrate/frame/nfts/Cargo.toml @@ -26,7 +26,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -47,7 +46,6 @@ std = [ "sp-io/std", "sp-keystore/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/nfts/runtime-api/Cargo.toml b/substrate/frame/nfts/runtime-api/Cargo.toml index 731f5f5ae776..4125aa1aab00 100644 --- a/substrate/frame/nfts/runtime-api/Cargo.toml +++ b/substrate/frame/nfts/runtime-api/Cargo.toml @@ -19,8 +19,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { features = ["derive"], workspace = true } pallet-nfts = { workspace = true } sp-api = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] -std = ["codec/std", "pallet-nfts/std", "sp-api/std", "sp-std/std"] +std = ["codec/std", "pallet-nfts/std", "sp-api/std"] diff --git a/substrate/frame/nfts/runtime-api/src/lib.rs b/substrate/frame/nfts/runtime-api/src/lib.rs index 816088f1b716..87faa7909851 100644 --- a/substrate/frame/nfts/runtime-api/src/lib.rs +++ b/substrate/frame/nfts/runtime-api/src/lib.rs @@ -19,8 +19,10 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode}; -use sp_std::vec::Vec; sp_api::decl_runtime_apis! { pub trait NftsApi diff --git a/substrate/frame/nfts/src/benchmarking.rs b/substrate/frame/nfts/src/benchmarking.rs index 80860bc5a53c..bc81096b459d 100644 --- a/substrate/frame/nfts/src/benchmarking.rs +++ b/substrate/frame/nfts/src/benchmarking.rs @@ -31,7 +31,6 @@ use frame_support::{ }; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin as SystemOrigin}; use sp_runtime::traits::{Bounded, One}; -use sp_std::prelude::*; use crate::Pallet as Nfts; diff --git a/substrate/frame/nfts/src/common_functions.rs b/substrate/frame/nfts/src/common_functions.rs index 1ad523d664c7..2c4778c1444f 100644 --- a/substrate/frame/nfts/src/common_functions.rs +++ b/substrate/frame/nfts/src/common_functions.rs @@ -18,6 +18,7 @@ //! Various pieces of common functionality. use crate::*; +use alloc::vec::Vec; use frame_support::pallet_prelude::*; impl, I: 'static> Pallet { diff --git a/substrate/frame/nfts/src/features/metadata.rs b/substrate/frame/nfts/src/features/metadata.rs index 85edd294d50b..260061603e9c 100644 --- a/substrate/frame/nfts/src/features/metadata.rs +++ b/substrate/frame/nfts/src/features/metadata.rs @@ -18,6 +18,7 @@ //! This module contains helper methods to configure the metadata of collections and items. use crate::*; +use alloc::vec::Vec; use frame_support::pallet_prelude::*; impl, I: 'static> Pallet { diff --git a/substrate/frame/nfts/src/features/roles.rs b/substrate/frame/nfts/src/features/roles.rs index f6d2785fd9cb..aa6394f70bfd 100644 --- a/substrate/frame/nfts/src/features/roles.rs +++ b/substrate/frame/nfts/src/features/roles.rs @@ -18,8 +18,8 @@ //! This module contains helper methods to configure account roles for existing collections. use crate::*; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use frame_support::pallet_prelude::*; -use sp_std::collections::btree_map::BTreeMap; impl, I: 'static> Pallet { /// Set the team roles for a specific collection. diff --git a/substrate/frame/nfts/src/impl_nonfungibles.rs b/substrate/frame/nfts/src/impl_nonfungibles.rs index ee7f42cfc689..c90655aadbfc 100644 --- a/substrate/frame/nfts/src/impl_nonfungibles.rs +++ b/substrate/frame/nfts/src/impl_nonfungibles.rs @@ -25,7 +25,6 @@ use frame_support::{ BoundedSlice, }; use sp_runtime::{DispatchError, DispatchResult}; -use sp_std::prelude::*; impl, I: 'static> Inspect<::AccountId> for Pallet { type ItemId = T::ItemId; diff --git a/substrate/frame/nfts/src/lib.rs b/substrate/frame/nfts/src/lib.rs index 0406cac6e2c9..4e5493a3c755 100644 --- a/substrate/frame/nfts/src/lib.rs +++ b/substrate/frame/nfts/src/lib.rs @@ -48,6 +48,9 @@ mod types; pub mod macros; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::traits::{ tokens::Locker, BalanceStatus::Reserved, Currency, EnsureOriginWithArg, Incrementable, @@ -58,7 +61,6 @@ use sp_runtime::{ traits::{IdentifyAccount, Saturating, StaticLookup, Verify, Zero}, RuntimeDebug, }; -use sp_std::prelude::*; pub use pallet::*; pub use types::*; diff --git a/substrate/frame/nfts/src/tests.rs b/substrate/frame/nfts/src/tests.rs index 4d23aca64ceb..e1b598ca4261 100644 --- a/substrate/frame/nfts/src/tests.rs +++ b/substrate/frame/nfts/src/tests.rs @@ -32,7 +32,6 @@ use sp_runtime::{ traits::{Dispatchable, IdentifyAccount}, MultiSignature, MultiSigner, }; -use sp_std::prelude::*; type AccountIdOf = ::AccountId; diff --git a/substrate/frame/nfts/src/types.rs b/substrate/frame/nfts/src/types.rs index 5a9f6ae2f0e2..1687a03520af 100644 --- a/substrate/frame/nfts/src/types.rs +++ b/substrate/frame/nfts/src/types.rs @@ -19,6 +19,7 @@ use super::*; use crate::macros::*; +use alloc::{vec, vec::Vec}; use codec::EncodeLike; use enumflags2::{bitflags, BitFlags}; use frame_support::{ diff --git a/substrate/frame/nis/Cargo.toml b/substrate/frame/nis/Cargo.toml index 418c906e2b66..fb6c25789b26 100644 --- a/substrate/frame/nis/Cargo.toml +++ b/substrate/frame/nis/Cargo.toml @@ -24,7 +24,6 @@ frame-system = { workspace = true } sp-arithmetic = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -43,7 +42,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/nis/src/benchmarking.rs b/substrate/frame/nis/src/benchmarking.rs index f6a83b78d518..2c7ad651f990 100644 --- a/substrate/frame/nis/src/benchmarking.rs +++ b/substrate/frame/nis/src/benchmarking.rs @@ -30,7 +30,6 @@ use sp_runtime::{ traits::{Bounded, One, Zero}, DispatchError, PerThing, }; -use sp_std::prelude::*; use crate::Pallet as Nis; diff --git a/substrate/frame/nis/src/lib.rs b/substrate/frame/nis/src/lib.rs index d815ea6ac115..016daa4cb78b 100644 --- a/substrate/frame/nis/src/lib.rs +++ b/substrate/frame/nis/src/lib.rs @@ -76,6 +76,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use frame_support::traits::{ fungible::{self, Inspect as FunInspect, Mutate as FunMutate}, tokens::{DepositConsequence, Fortitude, Preservation, Provenance, WithdrawConsequence}, @@ -95,7 +97,7 @@ mod mock; mod tests; pub mod weights; -pub struct WithMaximumOf(sp_std::marker::PhantomData); +pub struct WithMaximumOf(core::marker::PhantomData); impl Convert for WithMaximumOf where A::Type: Clone + Unsigned + From, @@ -116,7 +118,7 @@ where } } -pub struct NoCounterpart(sp_std::marker::PhantomData); +pub struct NoCounterpart(core::marker::PhantomData); impl FunInspect for NoCounterpart { type Balance = u32; fn total_issuance() -> u32 { @@ -171,6 +173,7 @@ impl BenchmarkSetup for () { pub mod pallet { use super::{FunInspect, FunMutate}; pub use crate::weights::WeightInfo; + use alloc::{vec, vec::Vec}; use frame_support::{ pallet_prelude::*, traits::{ @@ -193,7 +196,6 @@ pub mod pallet { traits::{AccountIdConversion, Bounded, Convert, ConvertBack, Saturating, Zero}, Rounding, TokenError, }; - use sp_std::prelude::*; type BalanceOf = <::Currency as FunInspect<::AccountId>>::Balance; @@ -372,7 +374,7 @@ pub mod pallet { pub receipts_on_hold: Balance, } - pub struct OnEmptyQueueTotals(sp_std::marker::PhantomData); + pub struct OnEmptyQueueTotals(core::marker::PhantomData); impl Get> for OnEmptyQueueTotals { fn get() -> QueueTotalsTypeOf { BoundedVec::truncate_from(vec![ @@ -573,7 +575,7 @@ pub mod pallet { // queue is let mut bid = Bid { amount, who: who.clone() }; let net = if queue_full { - sp_std::mem::swap(&mut q[0], &mut bid); + core::mem::swap(&mut q[0], &mut bid); let _ = T::Currency::release( &HoldReason::NftReceipt.into(), &bid.who, diff --git a/substrate/frame/node-authorization/Cargo.toml b/substrate/frame/node-authorization/Cargo.toml index d16e9bc6ead6..b56a76ce641a 100644 --- a/substrate/frame/node-authorization/Cargo.toml +++ b/substrate/frame/node-authorization/Cargo.toml @@ -23,7 +23,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -36,7 +35,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/node-authorization/src/lib.rs b/substrate/frame/node-authorization/src/lib.rs index a7967536079f..7682b54ea0f2 100644 --- a/substrate/frame/node-authorization/src/lib.rs +++ b/substrate/frame/node-authorization/src/lib.rs @@ -44,10 +44,12 @@ mod tests; pub mod weights; +extern crate alloc; + +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; pub use pallet::*; use sp_core::OpaquePeerId as PeerId; use sp_runtime::traits::StaticLookup; -use sp_std::{collections::btree_set::BTreeSet, prelude::*}; pub use weights::WeightInfo; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; diff --git a/substrate/frame/nomination-pools/Cargo.toml b/substrate/frame/nomination-pools/Cargo.toml index 535d5252435f..bfcc92edb7e2 100644 --- a/substrate/frame/nomination-pools/Cargo.toml +++ b/substrate/frame/nomination-pools/Cargo.toml @@ -27,7 +27,6 @@ scale-info = { features = [ frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-staking = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } @@ -55,7 +54,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", "sp-tracing?/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/nomination-pools/benchmarking/Cargo.toml b/substrate/frame/nomination-pools/benchmarking/Cargo.toml index 1516f0154b88..e73a208926ee 100644 --- a/substrate/frame/nomination-pools/benchmarking/Cargo.toml +++ b/substrate/frame/nomination-pools/benchmarking/Cargo.toml @@ -34,7 +34,6 @@ pallet-nomination-pools = { workspace = true } sp-runtime = { workspace = true } sp-runtime-interface = { workspace = true } sp-staking = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true } @@ -64,7 +63,6 @@ std = [ "sp-runtime-interface/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/nomination-pools/benchmarking/src/inner.rs b/substrate/frame/nomination-pools/benchmarking/src/inner.rs index b8c978945e9e..2a4559425111 100644 --- a/substrate/frame/nomination-pools/benchmarking/src/inner.rs +++ b/substrate/frame/nomination-pools/benchmarking/src/inner.rs @@ -17,6 +17,7 @@ //! Benchmarks for the nomination pools coupled with the staking and bags list pallets. +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{account, whitelist_account}; use frame_election_provider_support::SortedListProvider; use frame_support::{ @@ -41,7 +42,6 @@ use sp_runtime::{ Perbill, }; use sp_staking::EraIndex; -use sp_std::{vec, vec::Vec}; // `frame_benchmarking::benchmarks!` macro needs this use pallet_nomination_pools::Call; diff --git a/substrate/frame/nomination-pools/benchmarking/src/lib.rs b/substrate/frame/nomination-pools/benchmarking/src/lib.rs index 910cdf2e3dff..feb73be71681 100644 --- a/substrate/frame/nomination-pools/benchmarking/src/lib.rs +++ b/substrate/frame/nomination-pools/benchmarking/src/lib.rs @@ -20,6 +20,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] pub mod inner; diff --git a/substrate/frame/nomination-pools/runtime-api/Cargo.toml b/substrate/frame/nomination-pools/runtime-api/Cargo.toml index 2b217e021455..2f91e550bc05 100644 --- a/substrate/frame/nomination-pools/runtime-api/Cargo.toml +++ b/substrate/frame/nomination-pools/runtime-api/Cargo.toml @@ -18,9 +18,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { features = ["derive"], workspace = true } sp-api = { workspace = true } -sp-std = { workspace = true } pallet-nomination-pools = { workspace = true } [features] default = ["std"] -std = ["codec/std", "pallet-nomination-pools/std", "sp-api/std", "sp-std/std"] +std = ["codec/std", "pallet-nomination-pools/std", "sp-api/std"] diff --git a/substrate/frame/nomination-pools/src/adapter.rs b/substrate/frame/nomination-pools/src/adapter.rs index 4809fbc0e9da..4d571855e4fe 100644 --- a/substrate/frame/nomination-pools/src/adapter.rs +++ b/substrate/frame/nomination-pools/src/adapter.rs @@ -83,7 +83,7 @@ impl Member { /// [`DelegateStake`] for more detail. pub trait StakeStrategy { type Balance: frame_support::traits::tokens::Balance; - type AccountId: Clone + sp_std::fmt::Debug; + type AccountId: Clone + core::fmt::Debug; type CoreStaking: StakingInterface; /// The type of staking strategy of the current adapter. diff --git a/substrate/frame/nomination-pools/src/lib.rs b/substrate/frame/nomination-pools/src/lib.rs index 641f2b145772..472f0affcc73 100644 --- a/substrate/frame/nomination-pools/src/lib.rs +++ b/substrate/frame/nomination-pools/src/lib.rs @@ -351,8 +351,12 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use adapter::{Member, Pool, StakeStrategy}; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use codec::Codec; +use core::{fmt::Debug, ops::Div}; use frame_support::{ defensive, defensive_assert, ensure, pallet_prelude::{MaxEncodedLen, *}, @@ -375,7 +379,6 @@ use sp_runtime::{ FixedPointNumber, Perbill, }; use sp_staking::{EraIndex, StakingInterface}; -use sp_std::{collections::btree_map::BTreeMap, fmt::Debug, ops::Div, vec::Vec}; #[cfg(any(feature = "try-runtime", feature = "fuzzing", test, debug_assertions))] use sp_runtime::TryRuntimeError; @@ -949,14 +952,14 @@ pub struct BondedPool { inner: BondedPoolInner, } -impl sp_std::ops::Deref for BondedPool { +impl core::ops::Deref for BondedPool { type Target = BondedPoolInner; fn deref(&self) -> &Self::Target { &self.inner } } -impl sp_std::ops::DerefMut for BondedPool { +impl core::ops::DerefMut for BondedPool { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.inner } diff --git a/substrate/frame/nomination-pools/src/migration.rs b/substrate/frame/nomination-pools/src/migration.rs index a9222ea53d75..d8697364a76c 100644 --- a/substrate/frame/nomination-pools/src/migration.rs +++ b/substrate/frame/nomination-pools/src/migration.rs @@ -17,8 +17,8 @@ use super::*; use crate::log; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use frame_support::traits::{OnRuntimeUpgrade, UncheckedOnRuntimeUpgrade}; -use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; @@ -60,7 +60,7 @@ pub mod unversioned { use super::*; /// Checks and updates `TotalValueLocked` if out of sync. - pub struct TotalValueLockedSync(sp_std::marker::PhantomData); + pub struct TotalValueLockedSync(core::marker::PhantomData); impl OnRuntimeUpgrade for TotalValueLockedSync { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { @@ -125,7 +125,7 @@ pub mod unversioned { /// /// If there are pools that fail to migrate or did not fit in the bounds, the remaining pools /// can be migrated via the permission-less extrinsic [`Call::migrate_pool_to_delegate_stake`]. - pub struct DelegationStakeMigration(sp_std::marker::PhantomData<(T, MaxPools)>); + pub struct DelegationStakeMigration(core::marker::PhantomData<(T, MaxPools)>); impl> OnRuntimeUpgrade for DelegationStakeMigration { fn on_runtime_upgrade() -> Weight { @@ -262,7 +262,7 @@ pub mod v8 { } } - pub struct VersionUncheckedMigrateV7ToV8(sp_std::marker::PhantomData); + pub struct VersionUncheckedMigrateV7ToV8(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV7ToV8 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { @@ -341,7 +341,7 @@ pub(crate) mod v7 { pub type BondedPools = CountedStorageMap, Twox64Concat, PoolId, V7BondedPoolInner>; - pub struct VersionUncheckedMigrateV6ToV7(sp_std::marker::PhantomData); + pub struct VersionUncheckedMigrateV6ToV7(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV6ToV7 { fn on_runtime_upgrade() -> Weight { let migrated = BondedPools::::count(); @@ -402,7 +402,7 @@ mod v6 { /// This migration would restrict reward account of pools to go below ED by doing a named /// freeze on all the existing pools. - pub struct MigrateToV6(sp_std::marker::PhantomData); + pub struct MigrateToV6(core::marker::PhantomData); impl MigrateToV6 { fn freeze_ed(pool_id: PoolId) -> Result<(), ()> { @@ -470,7 +470,7 @@ pub mod v5 { /// This migration adds `total_commission_pending` and `total_commission_claimed` field to every /// `RewardPool`, if any. - pub struct MigrateToV5(sp_std::marker::PhantomData); + pub struct MigrateToV5(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV5 { fn on_runtime_upgrade() -> Weight { let in_code = Pallet::::in_code_storage_version(); @@ -625,7 +625,7 @@ pub mod v4 { #[deprecated( note = "To avoid mangled storage please use `MigrateV3ToV5` instead. See: github.com/paritytech/substrate/pull/13715" )] - pub struct MigrateToV4(sp_std::marker::PhantomData<(T, U)>); + pub struct MigrateToV4(core::marker::PhantomData<(T, U)>); #[allow(deprecated)] impl> OnRuntimeUpgrade for MigrateToV4 { fn on_runtime_upgrade() -> Weight { @@ -707,7 +707,7 @@ pub mod v3 { use super::*; /// This migration removes stale bonded-pool metadata, if any. - pub struct MigrateToV3(sp_std::marker::PhantomData); + pub struct MigrateToV3(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV3 { fn on_runtime_upgrade() -> Weight { let current = Pallet::::in_code_storage_version(); @@ -845,7 +845,7 @@ pub mod v2 { /// Migrate the pool reward scheme to the new version, as per /// . - pub struct MigrateToV2(sp_std::marker::PhantomData); + pub struct MigrateToV2(core::marker::PhantomData); impl MigrateToV2 { fn run(current: StorageVersion) -> Weight { let mut reward_pools_translated = 0u64; @@ -1104,7 +1104,7 @@ pub mod v1 { /// Trivial migration which makes the roles of each pool optional. /// /// Note: The depositor is not optional since they can never change. - pub struct MigrateToV1(sp_std::marker::PhantomData); + pub struct MigrateToV1(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV1 { fn on_runtime_upgrade() -> Weight { let current = Pallet::::in_code_storage_version(); diff --git a/substrate/frame/offences/Cargo.toml b/substrate/frame/offences/Cargo.toml index 51eb3e4f4381..9cf5e911a9d3 100644 --- a/substrate/frame/offences/Cargo.toml +++ b/substrate/frame/offences/Cargo.toml @@ -25,7 +25,6 @@ frame-system = { workspace = true } pallet-balances = { workspace = true } sp-runtime = { workspace = true } sp-staking = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true, default-features = true } @@ -45,7 +44,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-support/runtime-benchmarks", diff --git a/substrate/frame/offences/benchmarking/Cargo.toml b/substrate/frame/offences/benchmarking/Cargo.toml index 037812b3ed11..eb97eb3d4132 100644 --- a/substrate/frame/offences/benchmarking/Cargo.toml +++ b/substrate/frame/offences/benchmarking/Cargo.toml @@ -31,7 +31,6 @@ pallet-session = { workspace = true } pallet-staking = { workspace = true } sp-runtime = { workspace = true } sp-staking = { workspace = true } -sp-std = { workspace = true } log = { workspace = true } [dev-dependencies] @@ -62,7 +61,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/offences/benchmarking/src/inner.rs b/substrate/frame/offences/benchmarking/src/inner.rs index 9aa88f7a0d6d..b16e5be653d1 100644 --- a/substrate/frame/offences/benchmarking/src/inner.rs +++ b/substrate/frame/offences/benchmarking/src/inner.rs @@ -17,7 +17,7 @@ //! Offences pallet benchmarking. -use sp_std::{prelude::*, vec}; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{account, benchmarks}; use frame_support::traits::{Currency, Get}; diff --git a/substrate/frame/offences/benchmarking/src/lib.rs b/substrate/frame/offences/benchmarking/src/lib.rs index b08955a13329..f696546d1f0a 100644 --- a/substrate/frame/offences/benchmarking/src/lib.rs +++ b/substrate/frame/offences/benchmarking/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] pub mod inner; diff --git a/substrate/frame/offences/src/lib.rs b/substrate/frame/offences/src/lib.rs index a328b2fee4e2..ffea32a1f470 100644 --- a/substrate/frame/offences/src/lib.rs +++ b/substrate/frame/offences/src/lib.rs @@ -26,16 +26,17 @@ pub mod migration; mod mock; mod tests; -use core::marker::PhantomData; +extern crate alloc; +use alloc::vec::Vec; use codec::Encode; +use core::marker::PhantomData; use frame_support::weights::Weight; use sp_runtime::{traits::Hash, Perbill}; use sp_staking::{ offence::{Kind, Offence, OffenceDetails, OffenceError, OnOffenceHandler, ReportOffence}, SessionIndex, }; -use sp_std::prelude::*; pub use pallet::*; diff --git a/substrate/frame/offences/src/migration.rs b/substrate/frame/offences/src/migration.rs index 199f47491369..abf8acd94875 100644 --- a/substrate/frame/offences/src/migration.rs +++ b/substrate/frame/offences/src/migration.rs @@ -16,6 +16,7 @@ // limitations under the License. use super::{Config, Kind, OffenceDetails, Pallet, Perbill, SessionIndex, LOG_TARGET}; +use alloc::vec::Vec; use frame_support::{ pallet_prelude::ValueQuery, storage_alias, @@ -24,7 +25,6 @@ use frame_support::{ Twox64Concat, }; use sp_staking::offence::OnOffenceHandler; -use sp_std::vec::Vec; #[cfg(feature = "try-runtime")] use frame_support::ensure; @@ -49,7 +49,7 @@ pub mod v1 { use super::*; - pub struct MigrateToV1(sp_std::marker::PhantomData); + pub struct MigrateToV1(core::marker::PhantomData); impl OnRuntimeUpgrade for MigrateToV1 { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, TryRuntimeError> { diff --git a/substrate/frame/paged-list/Cargo.toml b/substrate/frame/paged-list/Cargo.toml index f5a3a2e5bae1..597bdd37f57f 100644 --- a/substrate/frame/paged-list/Cargo.toml +++ b/substrate/frame/paged-list/Cargo.toml @@ -24,7 +24,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-metadata-ir = { optional = true, workspace = true } @@ -42,7 +41,6 @@ std = [ "sp-io/std", "sp-metadata-ir/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/paged-list/src/lib.rs b/substrate/frame/paged-list/src/lib.rs index ddeed174f34b..ed68dac63beb 100644 --- a/substrate/frame/paged-list/src/lib.rs +++ b/substrate/frame/paged-list/src/lib.rs @@ -58,7 +58,7 @@ //! //! ## Low Level / Implementation Details //! -//! Implementation details are documented in [`paged_list::StoragePagedList`]. +//! Implementation details are documented in [`paged_list::StoragePagedList`]. //! All storage entries are prefixed with a unique prefix that is generated by [`ListPrefix`]. #![cfg_attr(not(feature = "std"), no_std)] @@ -69,6 +69,8 @@ pub mod mock; mod paged_list; mod tests; +extern crate alloc; + use codec::FullCodec; use frame_support::{ pallet_prelude::StorageList, diff --git a/substrate/frame/paged-list/src/paged_list.rs b/substrate/frame/paged-list/src/paged_list.rs index eecc728cd62a..bbd889e25218 100644 --- a/substrate/frame/paged-list/src/paged_list.rs +++ b/substrate/frame/paged-list/src/paged_list.rs @@ -23,6 +23,7 @@ #![deny(missing_docs)] #![deny(unsafe_code)] +use alloc::vec::Vec; use codec::{Decode, Encode, EncodeLike, FullCodec}; use core::marker::PhantomData; use frame_support::{ @@ -32,7 +33,6 @@ use frame_support::{ CloneNoBound, DebugNoBound, DefaultNoBound, EqNoBound, PartialEqNoBound, }; use sp_runtime::traits::Saturating; -use sp_std::prelude::*; pub type PageIndex = u32; pub type ValueIndex = u32; @@ -177,7 +177,7 @@ pub struct Page { /// The index of the page. index: PageIndex, /// The remaining values of the page, to be drained by [`Page::next`]. - values: sp_std::iter::Skip>, + values: core::iter::Skip>, } impl Page { @@ -188,7 +188,7 @@ impl Page { ) -> Option { let key = page_key::(index); let values = sp_io::storage::get(&key) - .and_then(|raw| sp_std::vec::Vec::::decode(&mut &raw[..]).ok())?; + .and_then(|raw| alloc::vec::Vec::::decode(&mut &raw[..]).ok())?; if values.is_empty() { // Don't create empty pages. return None diff --git a/substrate/frame/parameters/Cargo.toml b/substrate/frame/parameters/Cargo.toml index b993347d2463..a97ba1172a50 100644 --- a/substrate/frame/parameters/Cargo.toml +++ b/substrate/frame/parameters/Cargo.toml @@ -18,7 +18,6 @@ frame-support = { features = ["experimental"], workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } frame-benchmarking = { optional = true, workspace = true } [dev-dependencies] @@ -38,7 +37,6 @@ std = [ "serde", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/preimage/Cargo.toml b/substrate/frame/preimage/Cargo.toml index ee572b189b23..425c4e81aa7b 100644 --- a/substrate/frame/preimage/Cargo.toml +++ b/substrate/frame/preimage/Cargo.toml @@ -20,7 +20,6 @@ frame-system = { workspace = true } sp-core = { optional = true, workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } log = { workspace = true } [dev-dependencies] @@ -48,7 +47,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/preimage/src/benchmarking.rs b/substrate/frame/preimage/src/benchmarking.rs index f2b76a7999d6..2d3bec16b818 100644 --- a/substrate/frame/preimage/src/benchmarking.rs +++ b/substrate/frame/preimage/src/benchmarking.rs @@ -18,11 +18,11 @@ //! Preimage pallet benchmarking. use super::*; +use alloc::vec; use frame_benchmarking::v1::{account, benchmarks, whitelisted_caller, BenchmarkError}; use frame_support::assert_ok; use frame_system::RawOrigin; use sp_runtime::traits::Bounded; -use sp_std::{prelude::*, vec}; use crate::Pallet as Preimage; diff --git a/substrate/frame/preimage/src/lib.rs b/substrate/frame/preimage/src/lib.rs index dd323a12b8f8..30056fc6d9a4 100644 --- a/substrate/frame/preimage/src/lib.rs +++ b/substrate/frame/preimage/src/lib.rs @@ -37,11 +37,13 @@ mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{borrow::Cow, vec::Vec}; use sp_runtime::{ traits::{BadOrigin, Hash, Saturating}, Perbill, }; -use sp_std::{borrow::Cow, prelude::*}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ diff --git a/substrate/frame/preimage/src/migration.rs b/substrate/frame/preimage/src/migration.rs index a86109f892a4..e38483ee68c6 100644 --- a/substrate/frame/preimage/src/migration.rs +++ b/substrate/frame/preimage/src/migration.rs @@ -18,11 +18,11 @@ //! Storage migrations for the preimage pallet. use super::*; +use alloc::collections::btree_map::BTreeMap; use frame_support::{ storage_alias, traits::{ConstU32, OnRuntimeUpgrade}, }; -use sp_std::collections::btree_map::BTreeMap; #[cfg(feature = "try-runtime")] use frame_support::ensure; @@ -79,7 +79,7 @@ pub mod v1 { /// /// Note: This needs to be run with the same hashing algorithm as before /// since it is not re-hashing the preimages. - pub struct Migration(sp_std::marker::PhantomData); + pub struct Migration(core::marker::PhantomData); impl OnRuntimeUpgrade for Migration { #[cfg(feature = "try-runtime")] diff --git a/substrate/frame/proxy/Cargo.toml b/substrate/frame/proxy/Cargo.toml index 6b4251e1bcc5..af2427da380a 100644 --- a/substrate/frame/proxy/Cargo.toml +++ b/substrate/frame/proxy/Cargo.toml @@ -23,7 +23,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -43,7 +42,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/proxy/src/benchmarking.rs b/substrate/frame/proxy/src/benchmarking.rs index e0d14163d21b..4081af49c243 100644 --- a/substrate/frame/proxy/src/benchmarking.rs +++ b/substrate/frame/proxy/src/benchmarking.rs @@ -21,6 +21,7 @@ use super::*; use crate::Pallet as Proxy; +use alloc::{boxed::Box, vec}; use frame_benchmarking::v1::{account, benchmarks, whitelisted_caller}; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use sp_runtime::traits::Bounded; diff --git a/substrate/frame/proxy/src/lib.rs b/substrate/frame/proxy/src/lib.rs index 2b3fac5f59e4..d681088165c8 100644 --- a/substrate/frame/proxy/src/lib.rs +++ b/substrate/frame/proxy/src/lib.rs @@ -33,6 +33,9 @@ mod benchmarking; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dispatch::GetDispatchInfo, @@ -47,7 +50,6 @@ use sp_runtime::{ traits::{Dispatchable, Hash, Saturating, StaticLookup, TrailingZeroInput, Zero}, DispatchError, DispatchResult, RuntimeDebug, }; -use sp_std::prelude::*; pub use weights::WeightInfo; type CallHashOf = <::CallHasher as Hash>::Output; diff --git a/substrate/frame/proxy/src/tests.rs b/substrate/frame/proxy/src/tests.rs index 3ed61fbedaaa..3edb96026a82 100644 --- a/substrate/frame/proxy/src/tests.rs +++ b/substrate/frame/proxy/src/tests.rs @@ -22,6 +22,7 @@ use super::*; use crate as proxy; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ assert_noop, assert_ok, derive_impl, diff --git a/substrate/frame/ranked-collective/Cargo.toml b/substrate/frame/ranked-collective/Cargo.toml index be48d5cad404..dd9b466e0f91 100644 --- a/substrate/frame/ranked-collective/Cargo.toml +++ b/substrate/frame/ranked-collective/Cargo.toml @@ -26,7 +26,6 @@ sp-arithmetic = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } impl-trait-for-tuples = { workspace = true } [features] @@ -42,7 +41,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/ranked-collective/src/benchmarking.rs b/substrate/frame/ranked-collective/src/benchmarking.rs index 462f55a238d2..dc7f4aaca773 100644 --- a/substrate/frame/ranked-collective/src/benchmarking.rs +++ b/substrate/frame/ranked-collective/src/benchmarking.rs @@ -20,6 +20,7 @@ use super::*; #[allow(unused_imports)] use crate::Pallet as RankedCollective; +use alloc::vec::Vec; use frame_benchmarking::v1::{ account, benchmarks_instance_pallet, whitelisted_caller, BenchmarkError, diff --git a/substrate/frame/ranked-collective/src/lib.rs b/substrate/frame/ranked-collective/src/lib.rs index 53d5f0c6662d..e34cf3d8df71 100644 --- a/substrate/frame/ranked-collective/src/lib.rs +++ b/substrate/frame/ranked-collective/src/lib.rs @@ -40,7 +40,10 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use codec::{Decode, Encode, MaxEncodedLen}; +use core::marker::PhantomData; use scale_info::TypeInfo; use sp_arithmetic::traits::Saturating; use sp_runtime::{ @@ -48,7 +51,6 @@ use sp_runtime::{ ArithmeticError::Overflow, DispatchError, Perbill, RuntimeDebug, }; -use sp_std::{marker::PhantomData, prelude::*}; use frame_support::{ dispatch::{DispatchResultWithPostInfo, PostDispatchInfo}, diff --git a/substrate/frame/recovery/Cargo.toml b/substrate/frame/recovery/Cargo.toml index 3b3a382fe6dc..42493b435105 100644 --- a/substrate/frame/recovery/Cargo.toml +++ b/substrate/frame/recovery/Cargo.toml @@ -23,7 +23,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -49,7 +48,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/recovery/src/benchmarking.rs b/substrate/frame/recovery/src/benchmarking.rs index 72f77336212d..b7639742a620 100644 --- a/substrate/frame/recovery/src/benchmarking.rs +++ b/substrate/frame/recovery/src/benchmarking.rs @@ -20,6 +20,7 @@ use super::*; use crate::Pallet; +use alloc::{boxed::Box, vec, vec::Vec}; use frame_benchmarking::v1::{account, benchmarks, whitelisted_caller}; use frame_support::traits::{Currency, Get}; use frame_system::RawOrigin; diff --git a/substrate/frame/recovery/src/lib.rs b/substrate/frame/recovery/src/lib.rs index 5673147c8e00..69be4df971bc 100644 --- a/substrate/frame/recovery/src/lib.rs +++ b/substrate/frame/recovery/src/lib.rs @@ -150,13 +150,15 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use sp_runtime::{ traits::{CheckedAdd, CheckedMul, Dispatchable, SaturatedConversion, StaticLookup}, RuntimeDebug, }; -use sp_std::prelude::*; use frame_support::{ dispatch::{GetDispatchInfo, PostDispatchInfo}, diff --git a/substrate/frame/referenda/Cargo.toml b/substrate/frame/referenda/Cargo.toml index eb30fef7894b..578486714d63 100644 --- a/substrate/frame/referenda/Cargo.toml +++ b/substrate/frame/referenda/Cargo.toml @@ -28,7 +28,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } log = { workspace = true } [dev-dependencies] @@ -55,7 +54,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "assert_matches", diff --git a/substrate/frame/referenda/src/benchmarking.rs b/substrate/frame/referenda/src/benchmarking.rs index 47d43cc0600c..67ac82787d31 100644 --- a/substrate/frame/referenda/src/benchmarking.rs +++ b/substrate/frame/referenda/src/benchmarking.rs @@ -19,6 +19,7 @@ use super::*; use crate::Pallet as Referenda; +use alloc::{vec, vec::Vec}; use assert_matches::assert_matches; use frame_benchmarking::v1::{ account, benchmarks_instance_pallet, whitelist_account, BenchmarkError, @@ -632,7 +633,7 @@ benchmarks_instance_pallet! { } set_some_metadata { - use sp_std::borrow::Cow; + use alloc::borrow::Cow; let origin = T::SubmitOrigin::try_successful_origin(&RawOrigin::Root.into()) .expect("SubmitOrigin has no successful origin required for the benchmark"); let index = create_referendum::(origin.clone()); @@ -643,7 +644,7 @@ benchmarks_instance_pallet! { } clear_metadata { - use sp_std::borrow::Cow; + use alloc::borrow::Cow; let origin = T::SubmitOrigin::try_successful_origin(&RawOrigin::Root.into()) .expect("SubmitOrigin has no successful origin required for the benchmark"); let index = create_referendum::(origin.clone()); diff --git a/substrate/frame/referenda/src/lib.rs b/substrate/frame/referenda/src/lib.rs index 0cdf450d3b6c..e72dd7f11cbb 100644 --- a/substrate/frame/referenda/src/lib.rs +++ b/substrate/frame/referenda/src/lib.rs @@ -64,7 +64,11 @@ #![recursion_limit = "256"] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::boxed::Box; use codec::{Codec, Encode}; +use core::fmt::Debug; use frame_support::{ dispatch::DispatchResult, ensure, @@ -84,7 +88,6 @@ use sp_runtime::{ traits::{AtLeast32BitUnsigned, Bounded, Dispatchable, One, Saturating, Zero}, DispatchError, Perbill, }; -use sp_std::{fmt::Debug, prelude::*}; mod branch; pub mod migration; @@ -102,6 +105,7 @@ pub use self::{ }, weights::WeightInfo, }; +pub use alloc::vec::Vec; #[cfg(test)] mod mock; @@ -112,7 +116,6 @@ mod tests; pub mod benchmarking; pub use frame_support::traits::Get; -pub use sp_std::vec::Vec; #[macro_export] macro_rules! impl_tracksinfo_get { diff --git a/substrate/frame/referenda/src/types.rs b/substrate/frame/referenda/src/types.rs index b3c583322cce..1039b288b2ae 100644 --- a/substrate/frame/referenda/src/types.rs +++ b/substrate/frame/referenda/src/types.rs @@ -515,7 +515,7 @@ impl Curve { #[cfg(feature = "std")] impl Debug for Curve { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::LinearDecreasing { length, floor, ceil } => { write!( diff --git a/substrate/frame/remark/Cargo.toml b/substrate/frame/remark/Cargo.toml index 44cf5ebc3b49..efc9917428c0 100644 --- a/substrate/frame/remark/Cargo.toml +++ b/substrate/frame/remark/Cargo.toml @@ -25,7 +25,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-core = { workspace = true } @@ -48,7 +47,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/remark/src/benchmarking.rs b/substrate/frame/remark/src/benchmarking.rs index 831946834963..15b72b4748dd 100644 --- a/substrate/frame/remark/src/benchmarking.rs +++ b/substrate/frame/remark/src/benchmarking.rs @@ -20,9 +20,9 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; +use alloc::vec; use frame_benchmarking::v1::{benchmarks, whitelisted_caller}; use frame_system::{EventRecord, Pallet as System, RawOrigin}; -use sp_std::*; #[cfg(test)] use crate::Pallet as Remark; diff --git a/substrate/frame/remark/src/lib.rs b/substrate/frame/remark/src/lib.rs index 8ca3cd395afb..eae8e0b83f5d 100644 --- a/substrate/frame/remark/src/lib.rs +++ b/substrate/frame/remark/src/lib.rs @@ -28,7 +28,9 @@ mod mock; #[cfg(test)] mod tests; -use sp_std::prelude::*; +extern crate alloc; + +use alloc::vec::Vec; // Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; diff --git a/substrate/frame/root-offences/src/mock.rs b/substrate/frame/root-offences/src/mock.rs index 3c758b91d52f..ab43b723e8a9 100644 --- a/substrate/frame/root-offences/src/mock.rs +++ b/substrate/frame/root-offences/src/mock.rs @@ -18,6 +18,7 @@ use super::*; use crate as root_offences; +use alloc::collections::btree_map::BTreeMap; use frame_election_provider_support::{ bounds::{ElectionBounds, ElectionBoundsBuilder}, onchain, SequentialPhragmen, @@ -29,7 +30,6 @@ use frame_support::{ use pallet_staking::StakerStatus; use sp_runtime::{curve::PiecewiseLinear, testing::UintAuthorityId, traits::Zero, BuildStorage}; use sp_staking::{EraIndex, SessionIndex}; -use sp_std::collections::btree_map::BTreeMap; type Block = frame_system::mocking::MockBlock; type AccountId = u64; diff --git a/substrate/frame/root-testing/Cargo.toml b/substrate/frame/root-testing/Cargo.toml index 38d91c8104b9..96d861362622 100644 --- a/substrate/frame/root-testing/Cargo.toml +++ b/substrate/frame/root-testing/Cargo.toml @@ -23,7 +23,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] try-runtime = [ @@ -40,5 +39,4 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] diff --git a/substrate/frame/safe-mode/Cargo.toml b/substrate/frame/safe-mode/Cargo.toml index 749c4bcdc700..b704818f1adf 100644 --- a/substrate/frame/safe-mode/Cargo.toml +++ b/substrate/frame/safe-mode/Cargo.toml @@ -23,7 +23,6 @@ frame-system = { workspace = true } scale-info = { features = ["derive"], workspace = true } sp-arithmetic = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } pallet-balances = { optional = true, workspace = true } pallet-utility = { optional = true, workspace = true } pallet-proxy = { optional = true, workspace = true } @@ -51,7 +50,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/salary/Cargo.toml b/substrate/frame/salary/Cargo.toml index c9b72da2e649..9121f59ff462 100644 --- a/substrate/frame/salary/Cargo.toml +++ b/substrate/frame/salary/Cargo.toml @@ -26,7 +26,6 @@ sp-arithmetic = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } pallet-ranked-collective = { optional = true, workspace = true } [features] @@ -44,7 +43,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/sassafras/Cargo.toml b/substrate/frame/sassafras/Cargo.toml index ecd03c47db68..0eefca57849a 100644 --- a/substrate/frame/sassafras/Cargo.toml +++ b/substrate/frame/sassafras/Cargo.toml @@ -26,7 +26,6 @@ log = { workspace = true } sp-consensus-sassafras = { features = ["serde"], workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] array-bytes = { workspace = true, default-features = true } @@ -45,7 +44,6 @@ std = [ "sp-consensus-sassafras/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/sassafras/src/lib.rs b/substrate/frame/sassafras/src/lib.rs index d521ed9dd91b..285758afbe6d 100644 --- a/substrate/frame/sassafras/src/lib.rs +++ b/substrate/frame/sassafras/src/lib.rs @@ -47,10 +47,13 @@ #![warn(unused_must_use, unsafe_code, unused_variables, unused_imports, missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use codec::{Decode, Encode, MaxEncodedLen}; use log::{debug, error, trace, warn}; use scale_info::TypeInfo; +use alloc::vec::Vec; use frame_support::{ dispatch::{DispatchResultWithPostInfo, Pays}, traits::{Defensive, Get}, @@ -72,7 +75,6 @@ use sp_runtime::{ traits::{One, Zero}, BoundToRuntimeAppPublic, }; -use sp_std::prelude::Vec; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; @@ -288,7 +290,7 @@ pub mod pallet { pub epoch_config: EpochConfiguration, /// Phantom config #[serde(skip)] - pub _phantom: sp_std::marker::PhantomData, + pub _phantom: core::marker::PhantomData, } #[pallet::genesis_build] diff --git a/substrate/frame/scheduler/Cargo.toml b/substrate/frame/scheduler/Cargo.toml index 0a6b646fc8c3..29aaaec9aa40 100644 --- a/substrate/frame/scheduler/Cargo.toml +++ b/substrate/frame/scheduler/Cargo.toml @@ -21,7 +21,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-weights = { workspace = true } docify = { workspace = true } @@ -51,7 +50,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-weights/std", ] try-runtime = [ diff --git a/substrate/frame/scheduler/src/benchmarking.rs b/substrate/frame/scheduler/src/benchmarking.rs index 884f78000384..d0a14fc73d64 100644 --- a/substrate/frame/scheduler/src/benchmarking.rs +++ b/substrate/frame/scheduler/src/benchmarking.rs @@ -18,6 +18,7 @@ //! Scheduler pallet benchmarking. use super::*; +use alloc::vec; use frame_benchmarking::v1::{account, benchmarks, BenchmarkError}; use frame_support::{ ensure, @@ -25,7 +26,6 @@ use frame_support::{ weights::WeightMeter, }; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; -use sp_std::{prelude::*, vec}; use crate::Pallet as Scheduler; use frame_system::{Call as SystemCall, EventRecord}; diff --git a/substrate/frame/scheduler/src/lib.rs b/substrate/frame/scheduler/src/lib.rs index d19a1e0001dd..3eecf6d6f9e8 100644 --- a/substrate/frame/scheduler/src/lib.rs +++ b/substrate/frame/scheduler/src/lib.rs @@ -85,7 +85,11 @@ mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; +use core::{borrow::Borrow, cmp::Ordering, marker::PhantomData}; use frame_support::{ dispatch::{DispatchResult, GetDispatchInfo, Parameter, RawOrigin}, ensure, @@ -106,7 +110,6 @@ use sp_runtime::{ traits::{BadOrigin, Dispatchable, One, Saturating, Zero}, BoundedVec, DispatchError, RuntimeDebug, }; -use sp_std::{borrow::Borrow, cmp::Ordering, marker::PhantomData, prelude::*}; pub use pallet::*; pub use weights::WeightInfo; diff --git a/substrate/frame/scheduler/src/migration.rs b/substrate/frame/scheduler/src/migration.rs index c2e956035a76..a304689a120c 100644 --- a/substrate/frame/scheduler/src/migration.rs +++ b/substrate/frame/scheduler/src/migration.rs @@ -305,8 +305,8 @@ pub mod v4 { mod test { use super::*; use crate::mock::*; + use alloc::borrow::Cow; use frame_support::Hashable; - use sp_std::borrow::Cow; use substrate_test_utils::assert_eq_uvec; #[test] diff --git a/substrate/frame/scored-pool/Cargo.toml b/substrate/frame/scored-pool/Cargo.toml index 69ecd527eb7c..132799ead62a 100644 --- a/substrate/frame/scored-pool/Cargo.toml +++ b/substrate/frame/scored-pool/Cargo.toml @@ -22,7 +22,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -39,7 +38,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/scored-pool/src/lib.rs b/substrate/frame/scored-pool/src/lib.rs index 2bf70cbc574c..c4464bbbfac0 100644 --- a/substrate/frame/scored-pool/src/lib.rs +++ b/substrate/frame/scored-pool/src/lib.rs @@ -98,7 +98,11 @@ mod mock; #[cfg(test)] mod tests; +extern crate alloc; + +use alloc::vec::Vec; use codec::{FullCodec, MaxEncodedLen}; +use core::{cmp::Reverse, fmt::Debug}; use frame_support::{ ensure, traits::{ChangeMembers, Currency, Get, InitializeMembers, ReservableCurrency}, @@ -106,7 +110,6 @@ use frame_support::{ }; pub use pallet::*; use sp_runtime::traits::{AtLeast32Bit, StaticLookup, Zero}; -use sp_std::{fmt::Debug, prelude::*}; type BalanceOf = <>::Currency as Currency<::AccountId>>::Balance; diff --git a/substrate/frame/session/Cargo.toml b/substrate/frame/session/Cargo.toml index c7b499548bdb..09bb93d8c1d0 100644 --- a/substrate/frame/session/Cargo.toml +++ b/substrate/frame/session/Cargo.toml @@ -28,7 +28,6 @@ sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-session = { workspace = true } sp-staking = { features = ["serde"], workspace = true } -sp-std = { workspace = true } sp-trie = { optional = true, workspace = true } sp-state-machine = { workspace = true } @@ -48,7 +47,6 @@ std = [ "sp-session/std", "sp-staking/std", "sp-state-machine/std", - "sp-std/std", "sp-trie/std", ] try-runtime = [ diff --git a/substrate/frame/session/benchmarking/Cargo.toml b/substrate/frame/session/benchmarking/Cargo.toml index ba7f7acfd991..9ca3549f681d 100644 --- a/substrate/frame/session/benchmarking/Cargo.toml +++ b/substrate/frame/session/benchmarking/Cargo.toml @@ -25,7 +25,6 @@ pallet-session = { workspace = true } pallet-staking = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] codec = { features = ["derive"], workspace = true, default-features = true } @@ -53,7 +52,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-session/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/session/benchmarking/src/inner.rs b/substrate/frame/session/benchmarking/src/inner.rs index d86c5d9ad278..f08e10f07869 100644 --- a/substrate/frame/session/benchmarking/src/inner.rs +++ b/substrate/frame/session/benchmarking/src/inner.rs @@ -18,8 +18,8 @@ //! Benchmarks for the Session Pallet. // This is separated into its own crate due to cyclic dependency issues. +use alloc::{vec, vec::Vec}; use sp_runtime::traits::{One, StaticLookup, TrailingZeroInput}; -use sp_std::{prelude::*, vec}; use codec::Decode; use frame_benchmarking::v1::benchmarks; diff --git a/substrate/frame/session/benchmarking/src/lib.rs b/substrate/frame/session/benchmarking/src/lib.rs index b08955a13329..f696546d1f0a 100644 --- a/substrate/frame/session/benchmarking/src/lib.rs +++ b/substrate/frame/session/benchmarking/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] pub mod inner; diff --git a/substrate/frame/session/src/historical/mod.rs b/substrate/frame/session/src/historical/mod.rs index 618497e3d54d..fac580b49b3a 100644 --- a/substrate/frame/session/src/historical/mod.rs +++ b/substrate/frame/session/src/historical/mod.rs @@ -30,14 +30,15 @@ pub mod offchain; pub mod onchain; mod shared; +use alloc::vec::Vec; use codec::{Decode, Encode}; +use core::fmt::Debug; use sp_runtime::{ traits::{Convert, OpaqueKeys}, KeyTypeId, }; use sp_session::{MembershipProof, ValidatorCount}; use sp_staking::SessionIndex; -use sp_std::{fmt::Debug, prelude::*}; use sp_trie::{ trie_types::{TrieDBBuilder, TrieDBMutBuilderV0}, LayoutV0, MemoryDB, Recorder, StorageProof, Trie, TrieMut, TrieRecorder, @@ -103,7 +104,7 @@ impl Pallet { None => return, // nothing to prune. }; - let up_to = sp_std::cmp::min(up_to, end); + let up_to = core::cmp::min(up_to, end); if up_to < start { return // out of bounds. harmless. @@ -168,7 +169,7 @@ pub trait SessionManager: /// An `SessionManager` implementation that wraps an inner `I` and also /// sets the historical trie root of the ending session. -pub struct NoteHistoricalRoot(sp_std::marker::PhantomData<(T, I)>); +pub struct NoteHistoricalRoot(core::marker::PhantomData<(T, I)>); impl> NoteHistoricalRoot { fn do_new_session(new_index: SessionIndex, is_genesis: bool) -> Option> { @@ -374,6 +375,7 @@ pub(crate) mod tests { use crate::mock::{ force_new_session, set_next_validators, NextValidators, Session, System, Test, }; + use alloc::vec; use sp_runtime::{key_types::DUMMY, testing::UintAuthorityId, BuildStorage}; use sp_state_machine::BasicExternalities; diff --git a/substrate/frame/session/src/historical/offchain.rs b/substrate/frame/session/src/historical/offchain.rs index 95f4d762949e..685a0be8e191 100644 --- a/substrate/frame/session/src/historical/offchain.rs +++ b/substrate/frame/session/src/historical/offchain.rs @@ -23,12 +23,12 @@ //! required data to the offchain validator set. This is used in conjunction with [`ProvingTrie`] //! and the off-chain indexing API. +use alloc::vec::Vec; use sp_runtime::{ offchain::storage::{MutateStorageError, StorageRetrievalError, StorageValueRef}, KeyTypeId, }; use sp_session::MembershipProof; -use sp_std::prelude::*; use super::{shared, Config, IdentificationTuple, ProvingTrie}; use crate::{Pallet as SessionModule, SessionIndex}; @@ -60,9 +60,9 @@ impl ValidatorSet { /// Implement conversion into iterator for usage /// with [ProvingTrie](super::ProvingTrie::generate_for). -impl sp_std::iter::IntoIterator for ValidatorSet { +impl core::iter::IntoIterator for ValidatorSet { type Item = (T::ValidatorId, T::FullIdentification); - type IntoIter = sp_std::vec::IntoIter; + type IntoIter = alloc::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { self.validator_set.into_iter() } diff --git a/substrate/frame/session/src/historical/onchain.rs b/substrate/frame/session/src/historical/onchain.rs index 97a7f02bd096..a9eb18474b86 100644 --- a/substrate/frame/session/src/historical/onchain.rs +++ b/substrate/frame/session/src/historical/onchain.rs @@ -17,9 +17,9 @@ //! On-chain logic to store a validator-set for deferred validation using an off-chain worker. +use alloc::vec::Vec; use codec::Encode; use sp_runtime::traits::Convert; -use sp_std::prelude::*; use super::{shared, Config as HistoricalConfig}; use crate::{Config as SessionConfig, Pallet as SessionModule, SessionIndex}; diff --git a/substrate/frame/session/src/historical/shared.rs b/substrate/frame/session/src/historical/shared.rs index 297385dfb426..06b25ec99a4c 100644 --- a/substrate/frame/session/src/historical/shared.rs +++ b/substrate/frame/session/src/historical/shared.rs @@ -18,9 +18,9 @@ //! Shared logic between on-chain and off-chain components used for slashing using an off-chain //! worker. +use alloc::{borrow::ToOwned, vec::Vec}; use codec::Encode; use sp_staking::SessionIndex; -use sp_std::prelude::*; pub(super) const PREFIX: &[u8] = b"session_historical"; pub(super) const LAST_PRUNE: &[u8] = b"session_historical_last_prune"; diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 9506e98adf7d..45f70dfa2582 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -115,7 +115,14 @@ mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, MaxEncodedLen}; +use core::{ + marker::PhantomData, + ops::{Rem, Sub}, +}; use frame_support::{ dispatch::DispatchResult, ensure, @@ -132,11 +139,6 @@ use sp_runtime::{ ConsensusEngineId, DispatchError, KeyTypeId, Permill, RuntimeAppPublic, }; use sp_staking::SessionIndex; -use sp_std::{ - marker::PhantomData, - ops::{Rem, Sub}, - prelude::*, -}; pub use pallet::*; pub use weights::WeightInfo; @@ -917,7 +919,7 @@ impl frame_support::traits::DisabledValidators for Pallet { /// Wraps the author-scraping logic for consensus engines that can recover /// the canonical index of an author. This then transforms it into the /// registering account-ID of that session key index. -pub struct FindAccountFromAuthorIndex(sp_std::marker::PhantomData<(T, Inner)>); +pub struct FindAccountFromAuthorIndex(core::marker::PhantomData<(T, Inner)>); impl> FindAuthor for FindAccountFromAuthorIndex diff --git a/substrate/frame/society/Cargo.toml b/substrate/frame/society/Cargo.toml index 6582d47f1943..b6fa70c42efc 100644 --- a/substrate/frame/society/Cargo.toml +++ b/substrate/frame/society/Cargo.toml @@ -21,7 +21,6 @@ rand_chacha = { workspace = true } scale-info = { features = ["derive"], workspace = true } codec = { features = ["derive"], workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-arithmetic = { workspace = true } sp-runtime = { workspace = true } @@ -52,7 +51,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/substrate/frame/society/src/benchmarking.rs b/substrate/frame/society/src/benchmarking.rs index 20af6e35ada5..8c3d2bf32ce7 100644 --- a/substrate/frame/society/src/benchmarking.rs +++ b/substrate/frame/society/src/benchmarking.rs @@ -24,6 +24,7 @@ use super::*; use frame_benchmarking::{account, benchmarks_instance_pallet, whitelisted_caller}; use frame_system::RawOrigin; +use alloc::vec; use sp_runtime::traits::Bounded; use crate::Pallet as Society; diff --git a/substrate/frame/society/src/lib.rs b/substrate/frame/society/src/lib.rs index 5bce245f73f1..b4c5c88af3d6 100644 --- a/substrate/frame/society/src/lib.rs +++ b/substrate/frame/society/src/lib.rs @@ -257,6 +257,9 @@ pub mod weights; pub mod migrations; +extern crate alloc; + +use alloc::vec::Vec; use frame_support::{ impl_ensure_origin_with_arg_ignoring_arg, pallet_prelude::*, @@ -282,7 +285,6 @@ use sp_runtime::{ ArithmeticError::Overflow, Percent, RuntimeDebug, }; -use sp_std::prelude::*; pub use weights::WeightInfo; @@ -1362,7 +1364,7 @@ pub mod pallet { } /// Simple ensure origin struct to filter for the founder account. -pub struct EnsureFounder(sp_std::marker::PhantomData); +pub struct EnsureFounder(core::marker::PhantomData); impl EnsureOrigin<::RuntimeOrigin> for EnsureFounder { type Success = T::AccountId; fn try_origin(o: T::RuntimeOrigin) -> Result { diff --git a/substrate/frame/society/src/migrations.rs b/substrate/frame/society/src/migrations.rs index 7ded1f84f582..396ed787c784 100644 --- a/substrate/frame/society/src/migrations.rs +++ b/substrate/frame/society/src/migrations.rs @@ -18,6 +18,7 @@ //! # Migrations for Society Pallet use super::*; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::traits::{Defensive, DefensiveOption, Instance, UncheckedOnRuntimeUpgrade}; diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index e09d8fc4fa1d..3836e71cb00f 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -132,10 +132,6 @@ pub mod prelude { #[doc(no_inline)] pub use frame_system::pallet_prelude::*; - /// All of the std alternative types. - #[doc(no_inline)] - pub use sp_std::prelude::*; - /// All FRAME-relevant derive macros. #[doc(no_inline)] pub use super::derive::*; @@ -164,7 +160,6 @@ pub mod testing_prelude { pub use frame_system::{self, mocking::*}; pub use sp_io::TestExternalities as TestState; - pub use sp_std::if_std; } /// All of the types and tools needed to build FRAME-based runtimes. @@ -347,13 +342,13 @@ pub mod primitives { /// This is already part of the [`prelude`]. pub mod derive { pub use codec::{Decode, Encode}; + pub use core::fmt::Debug; pub use frame_support::{ CloneNoBound, DebugNoBound, DefaultNoBound, EqNoBound, OrdNoBound, PartialEqNoBound, PartialOrdNoBound, RuntimeDebugNoBound, }; pub use scale_info::TypeInfo; pub use sp_runtime::RuntimeDebug; - pub use sp_std::fmt::Debug; } /// Access to all of the dependencies of this crate. In case the re-exports are not enough, this @@ -373,7 +368,6 @@ pub mod deps { pub use sp_core; pub use sp_io; pub use sp_runtime; - pub use sp_std; pub use codec; pub use scale_info; diff --git a/substrate/frame/staking/Cargo.toml b/substrate/frame/staking/Cargo.toml index afae4652a4ef..57eeec543634 100644 --- a/substrate/frame/staking/Cargo.toml +++ b/substrate/frame/staking/Cargo.toml @@ -24,7 +24,6 @@ scale-info = { features = ["derive", "serde"], workspace = true } sp-io = { workspace = true } sp-runtime = { features = ["serde"], workspace = true } sp-staking = { features = ["serde"], workspace = true } -sp-std = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } pallet-session = { features = [ @@ -74,7 +73,6 @@ std = [ "sp-npos-elections/std", "sp-runtime/std", "sp-staking/std", - "sp-std/std", "sp-tracing/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/staking/src/benchmarking.rs b/substrate/frame/staking/src/benchmarking.rs index 3ed33ffea422..1f8580d7a3e6 100644 --- a/substrate/frame/staking/src/benchmarking.rs +++ b/substrate/frame/staking/src/benchmarking.rs @@ -33,7 +33,6 @@ use sp_runtime::{ Perbill, Percent, Saturating, }; use sp_staking::{currency_to_vote::CurrencyToVote, SessionIndex}; -use sp_std::prelude::*; pub use frame_benchmarking::v1::{ account, benchmarks, impl_benchmark_test_suite, whitelist_account, whitelisted_caller, @@ -169,7 +168,7 @@ impl ListScenario { // burn the entire issuance. let i = T::Currency::burn(T::Currency::total_issuance()); - sp_std::mem::forget(i); + core::mem::forget(i); // create accounts with the origin weight diff --git a/substrate/frame/staking/src/ledger.rs b/substrate/frame/staking/src/ledger.rs index 294918376d82..dc4b4fc326b8 100644 --- a/substrate/frame/staking/src/ledger.rs +++ b/substrate/frame/staking/src/ledger.rs @@ -36,7 +36,6 @@ use frame_support::{ traits::{Defensive, LockableCurrency}, }; use sp_staking::{StakingAccount, StakingInterface}; -use sp_std::prelude::*; use crate::{ BalanceOf, Bonded, Config, Error, Ledger, Pallet, Payee, RewardDestination, StakingLedger, diff --git a/substrate/frame/staking/src/lib.rs b/substrate/frame/staking/src/lib.rs index 053ecdef2b00..9e59cbd3d0cb 100644 --- a/substrate/frame/staking/src/lib.rs +++ b/substrate/frame/staking/src/lib.rs @@ -304,6 +304,9 @@ pub mod weights; mod pallet; +extern crate alloc; + +use alloc::{collections::btree_map::BTreeMap, vec, vec::Vec}; use codec::{Decode, Encode, HasCompact, MaxEncodedLen}; use frame_support::{ defensive, defensive_assert, @@ -325,7 +328,6 @@ use sp_staking::{ StakingAccount, }; pub use sp_staking::{Exposure, IndividualExposure, StakerStatus}; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; pub use weights::WeightInfo; pub use pallet::{pallet::*, UseNominatorsAndValidatorsMap, UseValidatorsMap}; @@ -674,7 +676,7 @@ impl StakingLedger { // slightly under-slashed, by at most `MaxUnlockingChunks * ED`, which is not a big // deal. slash_from_target = - sp_std::mem::replace(target, Zero::zero()).saturating_add(slash_from_target) + core::mem::replace(target, Zero::zero()).saturating_add(slash_from_target) } self.total = self.total.saturating_sub(slash_from_target); @@ -916,7 +918,7 @@ impl EraPayout for () { /// Adaptor to turn a `PiecewiseLinear` curve definition into an `EraPayout` impl, used for /// backwards compatibility. -pub struct ConvertCurve(sp_std::marker::PhantomData); +pub struct ConvertCurve(core::marker::PhantomData); impl EraPayout for ConvertCurve where Balance: AtLeast32BitUnsigned + Clone + Copy, @@ -974,7 +976,7 @@ impl Default for Forcing { /// A `Convert` implementation that finds the stash of the given controller account, /// if any. -pub struct StashOf(sp_std::marker::PhantomData); +pub struct StashOf(core::marker::PhantomData); impl Convert> for StashOf { fn convert(controller: T::AccountId) -> Option { @@ -987,7 +989,7 @@ impl Convert> for StashOf { /// /// Active exposure is the exposure of the validator set currently validating, i.e. in /// `active_era`. It can differ from the latest planned exposure in `current_era`. -pub struct ExposureOf(sp_std::marker::PhantomData); +pub struct ExposureOf(core::marker::PhantomData); impl Convert>>> for ExposureOf @@ -1000,7 +1002,7 @@ impl Convert /// Filter historical offences out and only allow those from the bonding period. pub struct FilterHistoricalOffences { - _inner: sp_std::marker::PhantomData<(T, R)>, + _inner: core::marker::PhantomData<(T, R)>, } impl ReportOffence @@ -1033,7 +1035,7 @@ where /// Wrapper struct for Era related information. It is not a pure encapsulation as these storage /// items can be accessed directly but nevertheless, its recommended to use `EraInfo` where we /// can and add more functions to it as needed. -pub struct EraInfo(sp_std::marker::PhantomData); +pub struct EraInfo(core::marker::PhantomData); impl EraInfo { /// Returns true if validator has one or more page of era rewards not claimed yet. // Also looks at legacy storage that can be cleaned up after #433. diff --git a/substrate/frame/staking/src/migrations.rs b/substrate/frame/staking/src/migrations.rs index b2ddf77004f9..5c9cf8613213 100644 --- a/substrate/frame/staking/src/migrations.rs +++ b/substrate/frame/staking/src/migrations.rs @@ -67,7 +67,7 @@ pub mod v15 { // The disabling strategy used by staking pallet type DefaultDisablingStrategy = UpToLimitDisablingStrategy; - pub struct VersionUncheckedMigrateV14ToV15(sp_std::marker::PhantomData); + pub struct VersionUncheckedMigrateV14ToV15(core::marker::PhantomData); impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV14ToV15 { fn on_runtime_upgrade() -> Weight { let mut migrated = v14::OffendingValidators::::take() @@ -382,14 +382,14 @@ pub mod v10 { pub mod v9 { use super::*; #[cfg(feature = "try-runtime")] - use codec::{Decode, Encode}; + use alloc::vec::Vec; #[cfg(feature = "try-runtime")] - use sp_std::vec::Vec; + use codec::{Decode, Encode}; /// Migration implementation that injects all validators into sorted list. /// /// This is only useful for chains that started their `VoterList` just based on nominators. - pub struct InjectValidatorsIntoVoterList(sp_std::marker::PhantomData); + pub struct InjectValidatorsIntoVoterList(core::marker::PhantomData); impl OnRuntimeUpgrade for InjectValidatorsIntoVoterList { fn on_runtime_upgrade() -> Weight { if StorageVersion::::get() == ObsoleteReleases::V8_0_0 { diff --git a/substrate/frame/staking/src/pallet/impls.rs b/substrate/frame/staking/src/pallet/impls.rs index 90374451a3a5..b19a127d13c4 100644 --- a/substrate/frame/staking/src/pallet/impls.rs +++ b/substrate/frame/staking/src/pallet/impls.rs @@ -48,7 +48,6 @@ use sp_staking::{ StakingAccount::{self, Controller, Stash}, StakingInterface, }; -use sp_std::prelude::*; use crate::{ election_size_tracker::StaticTracker, log, slashing, weights::WeightInfo, ActiveEraInfo, @@ -56,6 +55,7 @@ use crate::{ LedgerIntegrityState, MaxNominationsOf, MaxWinnersOf, Nominations, NominationsQuota, PositiveImbalanceOf, RewardDestination, SessionInterface, StakingLedger, ValidatorPrefs, }; +use alloc::{boxed::Box, vec, vec::Vec}; use super::pallet::*; @@ -1584,14 +1584,14 @@ impl ScoreProvider for Pallet { let imbalance = T::Currency::burn(T::Currency::total_issuance()); // kinda ugly, but gets the job done. The fact that this works here is a HUGE exception. // Don't try this pattern in other places. - sp_std::mem::forget(imbalance); + core::mem::forget(imbalance); } } /// A simple sorted list implementation that does not require any additional pallets. Note, this /// does not provide validators in sorted order. If you desire nominators in a sorted order take /// a look at [`pallet-bags-list`]. -pub struct UseValidatorsMap(sp_std::marker::PhantomData); +pub struct UseValidatorsMap(core::marker::PhantomData); impl SortedListProvider for UseValidatorsMap { type Score = BalanceOf; type Error = (); @@ -1657,7 +1657,7 @@ impl SortedListProvider for UseValidatorsMap { /// A simple voter list implementation that does not require any additional pallets. Note, this /// does not provided nominators in sorted ordered. If you desire nominators in a sorted order take /// a look at [`pallet-bags-list]. -pub struct UseNominatorsAndValidatorsMap(sp_std::marker::PhantomData); +pub struct UseNominatorsAndValidatorsMap(core::marker::PhantomData); impl SortedListProvider for UseNominatorsAndValidatorsMap { type Error = (); type Score = VoteWeight; @@ -1995,7 +1995,7 @@ impl Pallet { /// is resolved, turn warns into check /// failures. fn check_bonded_consistency() -> Result<(), TryRuntimeError> { - use sp_std::collections::btree_set::BTreeSet; + use alloc::collections::btree_set::BTreeSet; let mut count_controller_double = 0; let mut count_double = 0; @@ -2159,8 +2159,8 @@ impl Pallet { /// = exposure.own + exposure.own). /// * Paged exposures metadata (`ErasStakersOverview`) matches the paged exposures state. fn check_paged_exposures() -> Result<(), TryRuntimeError> { + use alloc::collections::btree_map::BTreeMap; use sp_staking::PagedExposureMetadata; - use sp_std::collections::btree_map::BTreeMap; // Sanity check for the paged exposure of the active era. let mut exposures: BTreeMap>> = diff --git a/substrate/frame/staking/src/pallet/mod.rs b/substrate/frame/staking/src/pallet/mod.rs index a76e47edf380..79f9d298ada7 100644 --- a/substrate/frame/staking/src/pallet/mod.rs +++ b/substrate/frame/staking/src/pallet/mod.rs @@ -17,6 +17,7 @@ //! Staking FRAME Pallet. +use alloc::vec::Vec; use codec::Codec; use frame_election_provider_support::{ ElectionProvider, ElectionProviderBase, SortedListProvider, VoteWeight, @@ -41,7 +42,6 @@ use sp_staking::{ StakingAccount::{self, Controller, Stash}, StakingInterface, }; -use sp_std::prelude::*; mod impls; @@ -101,7 +101,7 @@ pub mod pallet { + codec::FullCodec + Copy + MaybeSerializeDeserialize - + sp_std::fmt::Debug + + core::fmt::Debug + Default + From + TypeInfo diff --git a/substrate/frame/staking/src/slashing.rs b/substrate/frame/staking/src/slashing.rs index 1fe608cd3358..9bc8197c50b3 100644 --- a/substrate/frame/staking/src/slashing.rs +++ b/substrate/frame/staking/src/slashing.rs @@ -54,6 +54,7 @@ use crate::{ NominatorSlashInEra, Pallet, Perbill, SessionInterface, SpanSlash, UnappliedSlash, ValidatorSlashInEra, }; +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ ensure, @@ -65,7 +66,6 @@ use sp_runtime::{ DispatchResult, RuntimeDebug, }; use sp_staking::{EraIndex, StakingInterface}; -use sp_std::vec::Vec; /// The proportion of the slashing reward to be paid out on the first slashing detection. /// This is f_1 in the paper. @@ -148,7 +148,7 @@ impl SlashingSpans { SlashingSpan { index, start, length: Some(length) } }); - sp_std::iter::once(last).chain(prior) + core::iter::once(last).chain(prior) } /// Yields the era index where the most recent non-zero slash occurred. @@ -182,7 +182,7 @@ impl SlashingSpans { }; // readjust the ongoing span, if it started before the beginning of the window. - self.last_start = sp_std::cmp::max(self.last_start, window_start); + self.last_start = core::cmp::max(self.last_start, window_start); pruned } } @@ -408,7 +408,7 @@ struct InspectingSpans<'a, T: Config + 'a> { paid_out: &'a mut BalanceOf, slash_of: &'a mut BalanceOf, reward_proportion: Perbill, - _marker: sp_std::marker::PhantomData, + _marker: core::marker::PhantomData, } // fetches the slashing spans record for a stash account, initializing it if necessary. @@ -433,7 +433,7 @@ fn fetch_spans<'a, T: Config + 'a>( slash_of, paid_out, reward_proportion, - _marker: sp_std::marker::PhantomData, + _marker: core::marker::PhantomData, } } @@ -451,7 +451,7 @@ impl<'a, T: 'a + Config> InspectingSpans<'a, T> { // although `amount` may be zero, as it is only a difference. fn add_slash(&mut self, amount: BalanceOf, slash_era: EraIndex) { *self.slash_of += amount; - self.spans.last_nonzero_slash = sp_std::cmp::max(self.spans.last_nonzero_slash, slash_era); + self.spans.last_nonzero_slash = core::cmp::max(self.spans.last_nonzero_slash, slash_era); } // find the span index of the given era, if covered. diff --git a/substrate/frame/staking/src/testing_utils.rs b/substrate/frame/staking/src/testing_utils.rs index d4938ea43ebe..65aaa5f09de4 100644 --- a/substrate/frame/staking/src/testing_utils.rs +++ b/substrate/frame/staking/src/testing_utils.rs @@ -30,7 +30,6 @@ use sp_io::hashing::blake2_256; use frame_election_provider_support::SortedListProvider; use frame_support::{pallet_prelude::*, traits::Currency}; use sp_runtime::{traits::StaticLookup, Perbill}; -use sp_std::prelude::*; const SEED: u32 = 0; diff --git a/substrate/frame/staking/src/tests.rs b/substrate/frame/staking/src/tests.rs index 825b03b8ecaa..c35e5e8a06c6 100644 --- a/substrate/frame/staking/src/tests.rs +++ b/substrate/frame/staking/src/tests.rs @@ -41,7 +41,6 @@ use sp_staking::{ offence::{OffenceDetails, OnOffenceHandler}, SessionIndex, }; -use sp_std::prelude::*; use substrate_test_utils::assert_eq_uvec; #[test] diff --git a/substrate/frame/state-trie-migration/Cargo.toml b/substrate/frame/state-trie-migration/Cargo.toml index 8bb4079715e2..db8d10dabfde 100644 --- a/substrate/frame/state-trie-migration/Cargo.toml +++ b/substrate/frame/state-trie-migration/Cargo.toml @@ -28,7 +28,6 @@ remote-externalities = { optional = true, workspace = true, default-features = t sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } substrate-state-trie-migration-rpc = { optional = true, workspace = true, default-features = true } [dev-dependencies] @@ -50,7 +49,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-tracing/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/state-trie-migration/src/lib.rs b/substrate/frame/state-trie-migration/src/lib.rs index 22ad640d3bd2..3fe5abb81031 100644 --- a/substrate/frame/state-trie-migration/src/lib.rs +++ b/substrate/frame/state-trie-migration/src/lib.rs @@ -55,6 +55,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub use pallet::*; pub mod weights; @@ -75,6 +77,8 @@ pub mod pallet { pub use crate::weights::WeightInfo; + use alloc::{vec, vec::Vec}; + use core::ops::Deref; use frame_support::{ dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo}, ensure, @@ -93,7 +97,6 @@ pub mod pallet { self, traits::{Saturating, Zero}, }; - use sp_std::{ops::Deref, prelude::*}; pub(crate) type BalanceOf = <::Currency as Inspect<::AccountId>>::Balance; @@ -169,11 +172,11 @@ pub mod pallet { pub(crate) child_items: u32, #[codec(skip)] - pub(crate) _ph: sp_std::marker::PhantomData, + pub(crate) _ph: core::marker::PhantomData, } - impl> sp_std::fmt::Debug for Progress { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + impl> core::fmt::Debug for Progress { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Progress::ToStart => f.write_str("To start"), Progress::LastKey(key) => write!(f, "Last: {:?}", HexDisplay::from(key.deref())), @@ -182,8 +185,8 @@ pub mod pallet { } } - impl sp_std::fmt::Debug for MigrationTask { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + impl core::fmt::Debug for MigrationTask { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("MigrationTask") .field("top", &self.progress_top) .field("child", &self.progress_child) @@ -953,8 +956,8 @@ pub mod pallet { #[cfg(feature = "runtime-benchmarks")] mod benchmarks { use super::{pallet::Pallet as StateTrieMigration, *}; + use alloc::vec; use frame_support::traits::fungible::{Inspect, Mutate}; - use sp_std::prelude::*; // The size of the key seemingly makes no difference in the read/write time, so we make it // constant. @@ -1080,7 +1083,7 @@ mod benchmarks { process_top_key { let v in 1 .. (4 * 1024 * 1024); - let value = sp_std::vec![1u8; v as usize]; + let value = alloc::vec![1u8; v as usize]; sp_io::storage::set(KEY, &value); }: { let data = sp_io::storage::get(KEY).unwrap(); @@ -1101,6 +1104,7 @@ mod benchmarks { mod mock { use super::*; use crate as pallet_state_trie_migration; + use alloc::{vec, vec::Vec}; use frame_support::{derive_impl, parameter_types, traits::Hooks, weights::Weight}; use frame_system::{EnsureRoot, EnsureSigned}; use sp_core::{ diff --git a/substrate/frame/statement/Cargo.toml b/substrate/frame/statement/Cargo.toml index 233b7255fc5d..000e5033d8f1 100644 --- a/substrate/frame/statement/Cargo.toml +++ b/substrate/frame/statement/Cargo.toml @@ -22,7 +22,6 @@ frame-system = { workspace = true } sp-statement-store = { workspace = true } sp-api = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } sp-core = { workspace = true } log = { workspace = true } @@ -44,7 +43,6 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-statement-store/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/statement/src/lib.rs b/substrate/frame/statement/src/lib.rs index c68dac2d2972..6a7f577ab086 100644 --- a/substrate/frame/statement/src/lib.rs +++ b/substrate/frame/statement/src/lib.rs @@ -92,7 +92,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(sp_std::marker::PhantomData); + pub struct Pallet(core::marker::PhantomData); #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] diff --git a/substrate/frame/sudo/Cargo.toml b/substrate/frame/sudo/Cargo.toml index 5d5d09d69234..1a94753728b2 100644 --- a/substrate/frame/sudo/Cargo.toml +++ b/substrate/frame/sudo/Cargo.toml @@ -23,7 +23,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } docify = { workspace = true } @@ -41,7 +40,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/sudo/src/benchmarking.rs b/substrate/frame/sudo/src/benchmarking.rs index e64233fe7480..dee7d09c9d0c 100644 --- a/substrate/frame/sudo/src/benchmarking.rs +++ b/substrate/frame/sudo/src/benchmarking.rs @@ -19,6 +19,7 @@ use super::*; use crate::Pallet; +use alloc::{boxed::Box, vec}; use frame_benchmarking::v2::*; use frame_system::RawOrigin; diff --git a/substrate/frame/sudo/src/extension.rs b/substrate/frame/sudo/src/extension.rs index e90286e5a7c6..fb7eaf789480 100644 --- a/substrate/frame/sudo/src/extension.rs +++ b/substrate/frame/sudo/src/extension.rs @@ -17,6 +17,7 @@ use crate::{Config, Key}; use codec::{Decode, Encode}; +use core::{fmt, marker::PhantomData}; use frame_support::{dispatch::DispatchInfo, ensure}; use scale_info::TypeInfo; use sp_runtime::{ @@ -26,7 +27,6 @@ use sp_runtime::{ UnknownTransaction, ValidTransaction, }, }; -use sp_std::{fmt, marker::PhantomData}; /// Ensure that signed transactions are only valid if they are signed by sudo account. /// diff --git a/substrate/frame/sudo/src/lib.rs b/substrate/frame/sudo/src/lib.rs index 63b68e694307..07296e90b648 100644 --- a/substrate/frame/sudo/src/lib.rs +++ b/substrate/frame/sudo/src/lib.rs @@ -121,8 +121,11 @@ #![deny(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::boxed::Box; + use sp_runtime::{traits::StaticLookup, DispatchResult}; -use sp_std::prelude::*; use frame_support::{dispatch::GetDispatchInfo, traits::UnfilteredDispatchable}; diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/inherent.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/inherent.rs index da483fa6cf0b..c5fe8440d21b 100644 --- a/substrate/frame/support/procedural/src/construct_runtime/expand/inherent.rs +++ b/substrate/frame/support/procedural/src/construct_runtime/expand/inherent.rs @@ -58,17 +58,17 @@ pub fn expand_outer_inherent( trait InherentDataExt { fn create_extrinsics(&self) -> - #scrate::__private::sp_std::vec::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic>; + #scrate::__private::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic>; fn check_extrinsics(&self, block: &#block) -> #scrate::inherent::CheckInherentsResult; } impl InherentDataExt for #scrate::inherent::InherentData { fn create_extrinsics(&self) -> - #scrate::__private::sp_std::vec::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic> + #scrate::__private::Vec<<#block as #scrate::sp_runtime::traits::Block>::Extrinsic> { use #scrate::inherent::ProvideInherent; - let mut inherents = #scrate::__private::sp_std::vec::Vec::new(); + let mut inherents = #scrate::__private::Vec::new(); #( #pallet_attrs diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/metadata.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/metadata.rs index 0e76f9a92469..daef1b171617 100644 --- a/substrate/frame/support/procedural/src/construct_runtime/expand/metadata.rs +++ b/substrate/frame/support/procedural/src/construct_runtime/expand/metadata.rs @@ -111,7 +111,7 @@ pub fn expand_runtime_metadata( >(); #scrate::__private::metadata_ir::MetadataIR { - pallets: #scrate::__private::sp_std::vec![ #(#pallets),* ], + pallets: #scrate::__private::vec![ #(#pallets),* ], extrinsic: #scrate::__private::metadata_ir::ExtrinsicMetadataIR { ty, version: <#extrinsic as #scrate::sp_runtime::traits::ExtrinsicMetadata>::VERSION, @@ -156,7 +156,7 @@ pub fn expand_runtime_metadata( }) } - pub fn metadata_versions() -> #scrate::__private::sp_std::vec::Vec { + pub fn metadata_versions() -> #scrate::__private::Vec { #scrate::__private::metadata_ir::supported_versions() } } diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs index 83049919d01c..4a14853c04ee 100644 --- a/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs +++ b/substrate/frame/support/procedural/src/construct_runtime/expand/origin.rs @@ -105,25 +105,25 @@ pub fn expand_outer_origin( #[derive(Clone)] pub struct RuntimeOrigin { pub caller: OriginCaller, - filter: #scrate::__private::sp_std::rc::Rc::RuntimeCall) -> bool>>, + filter: #scrate::__private::Rc<#scrate::__private::Box::RuntimeCall) -> bool>>, } #[cfg(not(feature = "std"))] - impl #scrate::__private::sp_std::fmt::Debug for RuntimeOrigin { + impl core::fmt::Debug for RuntimeOrigin { fn fmt( &self, - fmt: &mut #scrate::__private::sp_std::fmt::Formatter, - ) -> #scrate::__private::sp_std::result::Result<(), #scrate::__private::sp_std::fmt::Error> { + fmt: &mut core::fmt::Formatter, + ) -> core::result::Result<(), core::fmt::Error> { fmt.write_str("") } } #[cfg(feature = "std")] - impl #scrate::__private::sp_std::fmt::Debug for RuntimeOrigin { + impl core::fmt::Debug for RuntimeOrigin { fn fmt( &self, - fmt: &mut #scrate::__private::sp_std::fmt::Formatter, - ) -> #scrate::__private::sp_std::result::Result<(), #scrate::__private::sp_std::fmt::Error> { + fmt: &mut core::fmt::Formatter, + ) -> core::result::Result<(), core::fmt::Error> { fmt.debug_struct("Origin") .field("caller", &self.caller) .field("filter", &"[function ptr]") @@ -139,7 +139,7 @@ pub fn expand_outer_origin( fn add_filter(&mut self, filter: impl Fn(&Self::Call) -> bool + 'static) { let f = self.filter.clone(); - self.filter = #scrate::__private::sp_std::rc::Rc::new(Box::new(move |call| { + self.filter = #scrate::__private::Rc::new(#scrate::__private::Box::new(move |call| { f(call) && filter(call) })); } @@ -150,7 +150,7 @@ pub fn expand_outer_origin( as #scrate::traits::Contains<<#runtime as #system_path::Config>::RuntimeCall> >::contains; - self.filter = #scrate::__private::sp_std::rc::Rc::new(Box::new(filter)); + self.filter = #scrate::__private::Rc::new(#scrate::__private::Box::new(filter)); } fn set_caller_from(&mut self, other: impl Into) { @@ -252,7 +252,7 @@ pub fn expand_outer_origin( impl TryFrom for #system_path::Origin<#runtime> { type Error = OriginCaller; fn try_from(x: OriginCaller) - -> #scrate::__private::sp_std::result::Result<#system_path::Origin<#runtime>, OriginCaller> + -> core::result::Result<#system_path::Origin<#runtime>, OriginCaller> { if let OriginCaller::system(l) = x { Ok(l) @@ -275,7 +275,7 @@ pub fn expand_outer_origin( fn from(x: OriginCaller) -> Self { let mut o = RuntimeOrigin { caller: x, - filter: #scrate::__private::sp_std::rc::Rc::new(Box::new(|_| true)), + filter: #scrate::__private::Rc::new(#scrate::__private::Box::new(|_| true)), }; #scrate::traits::OriginTrait::reset_filter(&mut o); @@ -284,7 +284,7 @@ pub fn expand_outer_origin( } } - impl From for #scrate::__private::sp_std::result::Result<#system_path::Origin<#runtime>, RuntimeOrigin> { + impl From for core::result::Result<#system_path::Origin<#runtime>, RuntimeOrigin> { /// NOTE: converting to pallet origin loses the origin filter information. fn from(val: RuntimeOrigin) -> Self { if let OriginCaller::system(l) = val.caller { @@ -349,7 +349,7 @@ fn expand_origin_caller_variant( } fn expand_origin_pallet_conversions( - scrate: &TokenStream, + _scrate: &TokenStream, runtime: &Ident, pallet: &Pallet, instance: Option<&Ident>, @@ -394,7 +394,7 @@ fn expand_origin_pallet_conversions( } #attr - impl From for #scrate::__private::sp_std::result::Result<#pallet_origin, RuntimeOrigin> { + impl From for core::result::Result<#pallet_origin, RuntimeOrigin> { /// NOTE: converting to pallet origin loses the origin filter information. fn from(val: RuntimeOrigin) -> Self { if let OriginCaller::#variant_name(l) = val.caller { @@ -410,7 +410,7 @@ fn expand_origin_pallet_conversions( type Error = OriginCaller; fn try_from( x: OriginCaller, - ) -> #scrate::__private::sp_std::result::Result<#pallet_origin, OriginCaller> { + ) -> core::result::Result<#pallet_origin, OriginCaller> { if let OriginCaller::#variant_name(l) = x { Ok(l) } else { @@ -424,7 +424,7 @@ fn expand_origin_pallet_conversions( type Error = (); fn try_from( x: &'a OriginCaller, - ) -> #scrate::__private::sp_std::result::Result<&'a #pallet_origin, ()> { + ) -> core::result::Result<&'a #pallet_origin, ()> { if let OriginCaller::#variant_name(l) = x { Ok(&l) } else { @@ -438,7 +438,7 @@ fn expand_origin_pallet_conversions( type Error = (); fn try_from( x: &'a RuntimeOrigin, - ) -> #scrate::__private::sp_std::result::Result<&'a #pallet_origin, ()> { + ) -> core::result::Result<&'a #pallet_origin, ()> { if let OriginCaller::#variant_name(l) = &x.caller { Ok(&l) } else { diff --git a/substrate/frame/support/procedural/src/construct_runtime/mod.rs b/substrate/frame/support/procedural/src/construct_runtime/mod.rs index 1505d158895f..17042c248780 100644 --- a/substrate/frame/support/procedural/src/construct_runtime/mod.rs +++ b/substrate/frame/support/procedural/src/construct_runtime/mod.rs @@ -470,7 +470,7 @@ fn construct_runtime_final_expansion( #[doc(hidden)] trait InternalConstructRuntime { #[inline(always)] - fn runtime_metadata(&self) -> #scrate::__private::sp_std::vec::Vec<#scrate::__private::metadata_ir::RuntimeApiMetadataIR> { + fn runtime_metadata(&self) -> #scrate::__private::Vec<#scrate::__private::metadata_ir::RuntimeApiMetadataIR> { Default::default() } } @@ -669,10 +669,10 @@ pub(crate) fn decl_pallet_runtime_setup( impl #scrate::traits::PalletInfo for PalletInfo { fn index() -> Option { - let type_id = #scrate::__private::sp_std::any::TypeId::of::

(); + let type_id = core::any::TypeId::of::

(); #( #pallet_attrs - if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() { + if type_id == core::any::TypeId::of::<#names>() { return Some(#indices) } )* @@ -681,10 +681,10 @@ pub(crate) fn decl_pallet_runtime_setup( } fn name() -> Option<&'static str> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::

(); + let type_id = core::any::TypeId::of::

(); #( #pallet_attrs - if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() { + if type_id == core::any::TypeId::of::<#names>() { return Some(#name_strings) } )* @@ -693,10 +693,10 @@ pub(crate) fn decl_pallet_runtime_setup( } fn name_hash() -> Option<[u8; 16]> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::

(); + let type_id = core::any::TypeId::of::

(); #( #pallet_attrs - if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() { + if type_id == core::any::TypeId::of::<#names>() { return Some(#name_hashes) } )* @@ -705,10 +705,10 @@ pub(crate) fn decl_pallet_runtime_setup( } fn module_name() -> Option<&'static str> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::

(); + let type_id = core::any::TypeId::of::

(); #( #pallet_attrs - if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() { + if type_id == core::any::TypeId::of::<#names>() { return Some(#module_names) } )* @@ -717,10 +717,10 @@ pub(crate) fn decl_pallet_runtime_setup( } fn crate_version() -> Option<#scrate::traits::CrateVersion> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::

(); + let type_id = core::any::TypeId::of::

(); #( #pallet_attrs - if type_id == #scrate::__private::sp_std::any::TypeId::of::<#names>() { + if type_id == core::any::TypeId::of::<#names>() { return Some( <#pallet_structs as #scrate::traits::PalletInfoAccess>::crate_version() ) diff --git a/substrate/frame/support/procedural/src/pallet/expand/constants.rs b/substrate/frame/support/procedural/src/pallet/expand/constants.rs index d7fbb5a71897..a36df790bd29 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/constants.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/constants.rs @@ -88,7 +88,7 @@ pub fn expand_constants(def: &mut Def) -> proc_macro2::TokenStream { name: #ident_str, ty: #frame_support::__private::scale_info::meta_type::<#const_type>(), value: { #default_byte_impl }, - docs: #frame_support::__private::sp_std::vec![ #( #doc ),* ], + docs: #frame_support::__private::vec![ #( #doc ),* ], } }) }); @@ -98,9 +98,9 @@ pub fn expand_constants(def: &mut Def) -> proc_macro2::TokenStream { #[doc(hidden)] pub fn pallet_constants_metadata() - -> #frame_support::__private::sp_std::vec::Vec<#frame_support::__private::metadata_ir::PalletConstantMetadataIR> + -> #frame_support::__private::Vec<#frame_support::__private::metadata_ir::PalletConstantMetadataIR> { - #frame_support::__private::sp_std::vec![ #( #consts ),* ] + #frame_support::__private::vec![ #( #consts ),* ] } } ) diff --git a/substrate/frame/support/procedural/src/pallet/expand/documentation.rs b/substrate/frame/support/procedural/src/pallet/expand/documentation.rs index ec19f889a9f2..e2c72ee921c4 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/documentation.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/documentation.rs @@ -163,9 +163,9 @@ pub fn expand_documentation(def: &mut Def) -> proc_macro2::TokenStream { #[doc(hidden)] pub fn pallet_documentation_metadata() - -> #frame_support::__private::sp_std::vec::Vec<&'static str> + -> #frame_support::__private::Vec<&'static str> { - #frame_support::__private::sp_std::vec![ #( #docs ),* ] + #frame_support::__private::vec![ #( #docs ),* ] } } ) diff --git a/substrate/frame/support/procedural/src/pallet/expand/error.rs b/substrate/frame/support/procedural/src/pallet/expand/error.rs index b921d66ff9e7..05478ee39084 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/error.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/error.rs @@ -66,7 +66,7 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream { #[doc(hidden)] #[codec(skip)] __Ignore( - #frame_support::__private::sp_std::marker::PhantomData<(#type_use_gen)>, + core::marker::PhantomData<(#type_use_gen)>, #frame_support::Never, ) ); @@ -124,11 +124,11 @@ pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream { } quote::quote_spanned!(error.attr_span => - impl<#type_impl_gen> #frame_support::__private::sp_std::fmt::Debug for #error_ident<#type_use_gen> + impl<#type_impl_gen> core::fmt::Debug for #error_ident<#type_use_gen> #config_where_clause { - fn fmt(&self, f: &mut #frame_support::__private::sp_std::fmt::Formatter<'_>) - -> #frame_support::__private::sp_std::fmt::Result + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) + -> core::fmt::Result { f.write_str(self.as_str()) } diff --git a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs index 3623b595268d..d7b1ca14f574 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/hooks.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/hooks.rs @@ -255,7 +255,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<#frame_support::__private::sp_std::vec::Vec, #frame_support::sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result<#frame_support::__private::Vec, #frame_support::sp_runtime::TryRuntimeError> { < Self as @@ -264,7 +264,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { } #[cfg(feature = "try-runtime")] - fn post_upgrade(state: #frame_support::__private::sp_std::vec::Vec) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { + fn post_upgrade(state: #frame_support::__private::Vec) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { #post_storage_version_check < diff --git a/substrate/frame/support/procedural/src/pallet/expand/pallet_struct.rs b/substrate/frame/support/procedural/src/pallet/expand/pallet_struct.rs index 7cdf6bde9de8..7ebc4bb2e9dc 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/pallet_struct.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/pallet_struct.rs @@ -54,7 +54,7 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream { if let Some(field) = pallet_item.fields.iter_mut().next() { if field.ty == syn::parse_quote!(_) { field.ty = syn::parse_quote!( - #frame_support::__private::sp_std::marker::PhantomData<(#type_use_gen)> + core::marker::PhantomData<(#type_use_gen)> ); } } @@ -139,10 +139,10 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream { #storages_where_clauses { fn storage_info() - -> #frame_support::__private::sp_std::vec::Vec<#frame_support::traits::StorageInfo> + -> #frame_support::__private::Vec<#frame_support::traits::StorageInfo> { #[allow(unused_mut)] - let mut res = #frame_support::__private::sp_std::vec![]; + let mut res = #frame_support::__private::vec![]; #( #(#storage_cfg_attrs)* @@ -179,8 +179,8 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream { let whitelisted_storage_keys_impl = quote::quote![ use #frame_support::traits::{StorageInfoTrait, TrackedStorageKey, WhitelistedStorageKeys}; impl<#type_impl_gen> WhitelistedStorageKeys for #pallet_ident<#type_use_gen> #storages_where_clauses { - fn whitelisted_storage_keys() -> #frame_support::__private::sp_std::vec::Vec { - use #frame_support::__private::sp_std::vec; + fn whitelisted_storage_keys() -> #frame_support::__private::Vec { + use #frame_support::__private::vec; vec![#( TrackedStorageKey::new(#whitelisted_storage_idents::<#type_use_gen>::hashed_key().to_vec()) ),*] @@ -272,7 +272,7 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream { #config_where_clause { fn count() -> usize { 1 } - fn infos() -> #frame_support::__private::sp_std::vec::Vec<#frame_support::traits::PalletInfoData> { + fn infos() -> #frame_support::__private::Vec<#frame_support::traits::PalletInfoData> { use #frame_support::traits::PalletInfoAccess; let item = #frame_support::traits::PalletInfoData { index: Self::index(), @@ -280,7 +280,7 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream { module_name: Self::module_name(), crate_version: Self::crate_version(), }; - #frame_support::__private::sp_std::vec![item] + #frame_support::__private::vec![item] } } diff --git a/substrate/frame/support/procedural/src/pallet/expand/storage.rs b/substrate/frame/support/procedural/src/pallet/expand/storage.rs index 3cc8a843e3b1..267b0f2dd3ba 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/storage.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/storage.rs @@ -423,7 +423,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { #(#cfg_attrs)* { <#full_ident as #frame_support::storage::StorageEntryMetadataBuilder>::build_metadata( - #frame_support::__private::sp_std::vec![ + #frame_support::__private::vec![ #( #docs, )* ], &mut entries, @@ -853,7 +853,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { impl<#type_impl_gen> #frame_support::traits::TryDecodeEntireStorage for #pallet_ident<#type_use_gen> #completed_where_clause { - fn try_decode_entire_state() -> Result> { + fn try_decode_entire_state() -> Result> { let pallet_name = <::PalletInfo as #frame_support::traits::PalletInfo> ::name::<#pallet_ident<#type_use_gen>>() .expect("Every active pallet has a name in the runtime; qed"); @@ -861,7 +861,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { #frame_support::__private::log::debug!(target: "runtime::try-decode-state", "trying to decode pallet: {pallet_name}"); // NOTE: for now, we have to exclude storage items that are feature gated. - let mut errors = #frame_support::__private::sp_std::vec::Vec::new(); + let mut errors = #frame_support::__private::Vec::new(); let mut decoded = 0usize; #( @@ -902,7 +902,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream { .expect("No name found for the pallet in the runtime! This usually means that the pallet wasn't added to `construct_runtime!`."), entries: { #[allow(unused_mut)] - let mut entries = #frame_support::__private::sp_std::vec![]; + let mut entries = #frame_support::__private::vec![]; #( #entries_builder )* entries }, diff --git a/substrate/frame/support/procedural/src/pallet/expand/tasks.rs b/substrate/frame/support/procedural/src/pallet/expand/tasks.rs index 6697e5c822a3..7201c352d92c 100644 --- a/substrate/frame/support/procedural/src/pallet/expand/tasks.rs +++ b/substrate/frame/support/procedural/src/pallet/expand/tasks.rs @@ -159,7 +159,6 @@ impl ToTokens for TasksDef { let task_fn_names = self.tasks.iter().map(|task| &task.item.sig.ident); let task_arg_names = self.tasks.iter().map(|task| &task.arg_names).collect::>(); - let sp_std = quote!(#scrate::__private::sp_std); let impl_generics = &self.item_impl.generics; tokens.extend(quote! { impl #impl_generics #enum_use @@ -169,13 +168,13 @@ impl ToTokens for TasksDef { impl #impl_generics #scrate::traits::Task for #enum_use { - type Enumeration = #sp_std::vec::IntoIter<#enum_use>; + type Enumeration = #scrate::__private::IntoIter<#enum_use>; fn iter() -> Self::Enumeration { - let mut all_tasks = #sp_std::vec![]; + let mut all_tasks = #scrate::__private::vec![]; #(all_tasks .extend(#task_iters.map(|(#(#task_arg_names),*)| #enum_ident::#task_fn_idents { #(#task_arg_names: #task_arg_names.clone()),* }) - .collect::<#sp_std::vec::Vec<_>>()); + .collect::<#scrate::__private::Vec<_>>()); )* all_tasks.into_iter() } diff --git a/substrate/frame/support/procedural/src/pallet/parse/tests/tasks.rs b/substrate/frame/support/procedural/src/pallet/parse/tests/tasks.rs index 9f1436284047..7df91ae777d7 100644 --- a/substrate/frame/support/procedural/src/pallet/parse/tests/tasks.rs +++ b/substrate/frame/support/procedural/src/pallet/parse/tests/tasks.rs @@ -124,10 +124,10 @@ fn test_parse_pallet_manual_tasks_impl_without_manual_tasks_enum() { where T: TypeInfo, { - type Enumeration = sp_std::vec::IntoIter>; + type Enumeration = alloc::vec::IntoIter>; fn iter() -> Self::Enumeration { - sp_std::vec![Task::increment, Task::decrement].into_iter() + alloc::vec![Task::increment, Task::decrement].into_iter() } } diff --git a/substrate/frame/support/procedural/src/runtime/expand/mod.rs b/substrate/frame/support/procedural/src/runtime/expand/mod.rs index 3cdfb06cb6ea..f34ab1cef543 100644 --- a/substrate/frame/support/procedural/src/runtime/expand/mod.rs +++ b/substrate/frame/support/procedural/src/runtime/expand/mod.rs @@ -280,7 +280,7 @@ fn construct_runtime_final_expansion( #[doc(hidden)] trait InternalConstructRuntime { #[inline(always)] - fn runtime_metadata(&self) -> #scrate::__private::sp_std::vec::Vec<#scrate::__private::metadata_ir::RuntimeApiMetadataIR> { + fn runtime_metadata(&self) -> #scrate::__private::Vec<#scrate::__private::metadata_ir::RuntimeApiMetadataIR> { Default::default() } } diff --git a/substrate/frame/support/src/dispatch.rs b/substrate/frame/support/src/dispatch.rs index 4a313551aca6..351ba3a15efc 100644 --- a/substrate/frame/support/src/dispatch.rs +++ b/substrate/frame/support/src/dispatch.rs @@ -20,6 +20,7 @@ use crate::traits::UnfilteredDispatchable; use codec::{Codec, Decode, Encode, EncodeLike, MaxEncodedLen}; +use core::fmt; use scale_info::TypeInfo; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; @@ -28,7 +29,6 @@ use sp_runtime::{ traits::SignedExtension, DispatchError, RuntimeDebug, }; -use sp_std::fmt; use sp_weights::Weight; /// The return type of a `Dispatchable` in frame. When returned explicitly from @@ -220,14 +220,14 @@ pub trait OneOrMany { } impl OneOrMany for DispatchClass { - type Iter = sp_std::iter::Once; + type Iter = core::iter::Once; fn into_iter(self) -> Self::Iter { - sp_std::iter::once(self) + core::iter::once(self) } } impl<'a> OneOrMany for &'a [DispatchClass] { - type Iter = sp_std::iter::Cloned>; + type Iter = core::iter::Cloned>; fn into_iter(self) -> Self::Iter { self.iter().cloned() } diff --git a/substrate/frame/support/src/dispatch_context.rs b/substrate/frame/support/src/dispatch_context.rs index 254302c8f14d..b34c6bdada3d 100644 --- a/substrate/frame/support/src/dispatch_context.rs +++ b/substrate/frame/support/src/dispatch_context.rs @@ -81,11 +81,11 @@ //! In your pallet you will only have to use [`with_context`], because as described above //! [`run_in_context`] will be handled by FRAME for you. -use sp_std::{ - any::{Any, TypeId}, +use alloc::{ boxed::Box, collections::btree_map::{BTreeMap, Entry}, }; +use core::any::{Any, TypeId}; environmental::environmental!(DISPATCH_CONTEXT: BTreeMap>); @@ -158,7 +158,7 @@ pub fn with_context(callback: impl FnOnce(&mut Value) -> R) -> if value.is_none() { log::error!( "Failed to downcast value for type {} in dispatch context!", - sp_std::any::type_name::(), + core::any::type_name::(), ); } diff --git a/substrate/frame/support/src/genesis_builder_helper.rs b/substrate/frame/support/src/genesis_builder_helper.rs index 7389c5a787d7..662ea2cb1862 100644 --- a/substrate/frame/support/src/genesis_builder_helper.rs +++ b/substrate/frame/support/src/genesis_builder_helper.rs @@ -41,7 +41,7 @@ pub fn build_state(json: Vec) -> BuildResult { /// to [`sp_genesis_builder::GenesisBuilder::get_preset`]. pub fn get_preset( name: &Option, - preset_for_name: impl FnOnce(&sp_genesis_builder::PresetId) -> Option>, + preset_for_name: impl FnOnce(&sp_genesis_builder::PresetId) -> Option>, ) -> Option> where GC: BuildGenesisConfig + Default, diff --git a/substrate/frame/support/src/hash.rs b/substrate/frame/support/src/hash.rs index 9c48f4b187ad..a09890560c64 100644 --- a/substrate/frame/support/src/hash.rs +++ b/substrate/frame/support/src/hash.rs @@ -17,10 +17,10 @@ //! Hash utilities. +use alloc::vec::Vec; use codec::{Codec, MaxEncodedLen}; use sp_io::hashing::{blake2_128, blake2_256, twox_128, twox_256, twox_64}; use sp_metadata_ir as metadata_ir; -use sp_std::prelude::Vec; // This trait must be kept coherent with frame-support-procedural HasherKind usage pub trait Hashable: Sized { diff --git a/substrate/frame/support/src/lib.rs b/substrate/frame/support/src/lib.rs index 94f4b9dd4bdc..3ad8c5fabaa2 100644 --- a/substrate/frame/support/src/lib.rs +++ b/substrate/frame/support/src/lib.rs @@ -33,11 +33,20 @@ #[doc(hidden)] extern crate self as frame_support; +#[doc(hidden)] +extern crate alloc; + /// Private exports that are being used by macros. /// /// The exports are not stable and should not be relied on. #[doc(hidden)] pub mod __private { + pub use alloc::{ + boxed::Box, + rc::Rc, + vec, + vec::{IntoIter, Vec}, + }; pub use codec; pub use frame_metadata as metadata; pub use log; @@ -261,7 +270,7 @@ macro_rules! parameter_types { ) => ( $( #[ $attr ] )* $vis struct $name $( - < $($ty_params),* >( $($crate::__private::sp_std::marker::PhantomData<$ty_params>),* ) + < $($ty_params),* >( $(core::marker::PhantomData<$ty_params>),* ) )?; $crate::parameter_types!(IMPL_CONST $name , $type , $value $( $(, $ty_params)* )?); $crate::parameter_types!( $( $rest )* ); @@ -273,7 +282,7 @@ macro_rules! parameter_types { ) => ( $( #[ $attr ] )* $vis struct $name $( - < $($ty_params),* >( $($crate::__private::sp_std::marker::PhantomData<$ty_params>),* ) + < $($ty_params),* >( $(core::marker::PhantomData<$ty_params>),* ) )?; $crate::parameter_types!(IMPL $name, $type, $value $( $(, $ty_params)* )?); $crate::parameter_types!( $( $rest )* ); @@ -285,7 +294,7 @@ macro_rules! parameter_types { ) => ( $( #[ $attr ] )* $vis struct $name $( - < $($ty_params),* >( $($crate::__private::sp_std::marker::PhantomData<$ty_params>),* ) + < $($ty_params),* >( $(core::marker::PhantomData<$ty_params>),* ) )?; $crate::parameter_types!(IMPL_STORAGE $name, $type, $value $( $(, $ty_params)* )?); $crate::parameter_types!( $( $rest )* ); @@ -468,7 +477,7 @@ macro_rules! ord_parameter_types { (IMPL $name:ident , $type:ty , $value:expr) => { impl $crate::traits::SortedMembers<$type> for $name { fn contains(t: &$type) -> bool { &$value == t } - fn sorted_members() -> $crate::__private::sp_std::prelude::Vec<$type> { vec![$value] } + fn sorted_members() -> $crate::__private::Vec<$type> { vec![$value] } fn count() -> usize { 1 } #[cfg(feature = "runtime-benchmarks")] fn add(_: &$type) {} @@ -499,7 +508,7 @@ macro_rules! runtime_print { } /// Print out the debuggable type. -pub fn debug(data: &impl sp_std::fmt::Debug) { +pub fn debug(data: &impl core::fmt::Debug) { runtime_print!("{:?}", data); } @@ -926,6 +935,7 @@ pub mod pallet_prelude { pub use codec::{Decode, Encode, MaxEncodedLen}; pub use frame_support::pallet_macros::*; + pub use core::marker::PhantomData; /// The optional attribute `#[inject_runtime_type]` can be attached to `RuntimeCall`, /// `RuntimeEvent`, `RuntimeOrigin` or `PalletInfo` in an impl statement that has /// `#[register_default_impl]` attached to indicate that this item is generated by @@ -954,7 +964,6 @@ pub mod pallet_prelude { }, DispatchError, RuntimeDebug, MAX_MODULE_ERROR_ENCODED_SIZE, }; - pub use sp_std::marker::PhantomData; pub use sp_weights::Weight; } @@ -1285,7 +1294,7 @@ pub mod pallet_macros { /// # use frame_support::pallet_prelude::*; /// # use frame_support::inherent::IsFatalError; /// # use sp_timestamp::InherentError; - /// # use sp_std::result; + /// # use core::result; /// # /// // Example inherent identifier /// pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"timstap0"; @@ -1911,7 +1920,7 @@ pub mod pallet_macros { /// Field types in enum variants must also implement [`frame_support::PalletError`], /// otherwise the pallet will fail to compile. Rust primitive types have already /// implemented the [`frame_support::PalletError`] trait along with some commonly used - /// stdlib types such as [`Option`] and [`sp_std::marker::PhantomData`], and hence + /// stdlib types such as [`Option`] and [`core::marker::PhantomData`], and hence /// in most use cases, a manual implementation is not necessary and is discouraged. /// /// The generic `T` must not bound anything and a `where` clause is not allowed. That said, diff --git a/substrate/frame/support/src/migrations.rs b/substrate/frame/support/src/migrations.rs index fa018d743653..7f7461469564 100644 --- a/substrate/frame/support/src/migrations.rs +++ b/substrate/frame/support/src/migrations.rs @@ -24,13 +24,14 @@ use crate::{ }, weights::{RuntimeDbWeight, Weight, WeightMeter}, }; +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; +use core::marker::PhantomData; use impl_trait_for_tuples::impl_for_tuples; use sp_arithmetic::traits::Bounded; use sp_core::Get; use sp_io::{hashing::twox_128, storage::clear_prefix, KillStorageResult}; use sp_runtime::traits::Zero; -use sp_std::{marker::PhantomData, vec::Vec}; /// Handles storage migration pallet versioning. /// @@ -71,7 +72,7 @@ use sp_std::{marker::PhantomData, vec::Vec}; /// /// - https://internals.rust-lang.org/t/lang-team-minutes-private-in-public-rules/4504/40 /// mod version_unchecked { /// use super::*; -/// pub struct VersionUncheckedMigrateV5ToV6(sp_std::marker::PhantomData); +/// pub struct VersionUncheckedMigrateV5ToV6(core::marker::PhantomData); /// impl UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV5ToV6 { /// // `UncheckedOnRuntimeUpgrade` implementation... /// } @@ -102,7 +103,7 @@ pub struct VersionedMigration), + MigrationExecuted(alloc::vec::Vec), /// This migration is a noop, do not run post_upgrade checks. Noop, } @@ -125,7 +126,7 @@ impl< /// [`VersionedPostUpgradeData`] before passing them to post_upgrade, so it knows whether the /// migration ran or not. #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { let on_chain_version = Pallet::on_chain_storage_version(); if on_chain_version == FROM { Ok(VersionedPostUpgradeData::MigrationExecuted(Inner::pre_upgrade()?).encode()) @@ -175,7 +176,7 @@ impl< /// the migration ran, and [`VersionedPostUpgradeData::Noop`] otherwise. #[cfg(feature = "try-runtime")] fn post_upgrade( - versioned_post_upgrade_data_bytes: sp_std::vec::Vec, + versioned_post_upgrade_data_bytes: alloc::vec::Vec, ) -> Result<(), sp_runtime::TryRuntimeError> { use codec::DecodeAll; match ::decode_all(&mut &versioned_post_upgrade_data_bytes[..]) @@ -339,7 +340,7 @@ impl, DbWeight: Get> frame_support::traits } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { use crate::storage::unhashed::contains_prefixed_key; let hashed_prefix = twox_128(P::get().as_bytes()); @@ -350,11 +351,11 @@ impl, DbWeight: Get> frame_support::traits P::get() ), }; - Ok(sp_std::vec::Vec::new()) + Ok(alloc::vec::Vec::new()) } #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: sp_std::vec::Vec) -> Result<(), sp_runtime::TryRuntimeError> { + fn post_upgrade(_state: alloc::vec::Vec) -> Result<(), sp_runtime::TryRuntimeError> { use crate::storage::unhashed::contains_prefixed_key; let hashed_prefix = twox_128(P::get().as_bytes()); @@ -450,7 +451,7 @@ impl, S: Get<&'static str>, DbWeight: Get> } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { use crate::storage::unhashed::contains_prefixed_key; let hashed_prefix = storage_prefix(P::get().as_bytes(), S::get().as_bytes()); @@ -466,7 +467,7 @@ impl, S: Get<&'static str>, DbWeight: Get> } #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: sp_std::vec::Vec) -> Result<(), sp_runtime::TryRuntimeError> { + fn post_upgrade(_state: alloc::vec::Vec) -> Result<(), sp_runtime::TryRuntimeError> { use crate::storage::unhashed::contains_prefixed_key; let hashed_prefix = storage_prefix(P::get().as_bytes(), S::get().as_bytes()); diff --git a/substrate/frame/support/src/storage/bounded_btree_map.rs b/substrate/frame/support/src/storage/bounded_btree_map.rs index 91196be9e802..d3560dd5f0d4 100644 --- a/substrate/frame/support/src/storage/bounded_btree_map.rs +++ b/substrate/frame/support/src/storage/bounded_btree_map.rs @@ -26,9 +26,9 @@ impl StorageDecodeLength for BoundedBTreeMap {} pub mod test { use super::*; use crate::Twox128; + use alloc::collections::btree_map::BTreeMap; use frame_support::traits::{ConstU32, Get}; use sp_io::TestExternalities; - use sp_std::collections::btree_map::BTreeMap; #[crate::storage_alias] type Foo = StorageValue>>; diff --git a/substrate/frame/support/src/storage/bounded_btree_set.rs b/substrate/frame/support/src/storage/bounded_btree_set.rs index cf801eb47874..70ab2304cab0 100644 --- a/substrate/frame/support/src/storage/bounded_btree_set.rs +++ b/substrate/frame/support/src/storage/bounded_btree_set.rs @@ -26,9 +26,9 @@ impl StorageDecodeNonDedupLength for BoundedBTreeSet {} pub mod test { use super::*; use crate::Twox128; + use alloc::collections::btree_set::BTreeSet; use frame_support::traits::{ConstU32, Get}; use sp_io::TestExternalities; - use sp_std::collections::btree_set::BTreeSet; #[crate::storage_alias] type Foo = StorageValue>>; diff --git a/substrate/frame/support/src/storage/child.rs b/substrate/frame/support/src/storage/child.rs index 76e6f4ee4023..5ebba2693658 100644 --- a/substrate/frame/support/src/storage/child.rs +++ b/substrate/frame/support/src/storage/child.rs @@ -21,10 +21,10 @@ // NOTE: could replace unhashed by having only one kind of storage (top trie being the child info // of null length parent storage key). +use alloc::vec::Vec; use codec::{Codec, Decode, Encode}; pub use sp_core::storage::{ChildInfo, ChildType, StateVersion}; pub use sp_io::{KillStorageResult, MultiRemovalResults}; -use sp_std::prelude::*; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. pub fn get(child_info: &ChildInfo, key: &[u8]) -> Option { diff --git a/substrate/frame/support/src/storage/generator/double_map.rs b/substrate/frame/support/src/storage/generator/double_map.rs index a4c1f58203e3..b68f3fa495ff 100644 --- a/substrate/frame/support/src/storage/generator/double_map.rs +++ b/substrate/frame/support/src/storage/generator/double_map.rs @@ -20,8 +20,8 @@ use crate::{ storage::{self, storage_prefix, unhashed, KeyPrefixIterator, PrefixIterator, StorageAppend}, Never, }; +use alloc::vec::Vec; use codec::{Decode, Encode, EncodeLike, FullCodec, FullEncode}; -use sp_std::prelude::*; /// Generator for `StorageDoubleMap` used by `decl_storage`. /// @@ -516,6 +516,7 @@ mod test_iterators { unhashed, }, }; + use alloc::vec; use codec::Encode; #[test] diff --git a/substrate/frame/support/src/storage/generator/map.rs b/substrate/frame/support/src/storage/generator/map.rs index 257aa7e7bcf9..b41f9c717167 100644 --- a/substrate/frame/support/src/storage/generator/map.rs +++ b/substrate/frame/support/src/storage/generator/map.rs @@ -20,9 +20,8 @@ use crate::{ storage::{self, storage_prefix, unhashed, KeyPrefixIterator, PrefixIterator, StorageAppend}, Never, }; +use alloc::vec::Vec; use codec::{Decode, Encode, EncodeLike, FullCodec, FullEncode}; -#[cfg(not(feature = "std"))] -use sp_std::prelude::*; /// Generator for `StorageMap` used by `decl_storage`. /// @@ -80,7 +79,7 @@ pub struct StorageMapIterator { prefix: Vec, previous_key: Vec, drain: bool, - _phantom: ::sp_std::marker::PhantomData<(K, V, Hasher)>, + _phantom: ::core::marker::PhantomData<(K, V, Hasher)>, } impl Iterator @@ -370,6 +369,7 @@ mod test_iterators { unhashed, }, }; + use alloc::vec; use codec::Encode; #[test] diff --git a/substrate/frame/support/src/storage/generator/mod.rs b/substrate/frame/support/src/storage/generator/mod.rs index dd6d622852db..b0b1bda24bb7 100644 --- a/substrate/frame/support/src/storage/generator/mod.rs +++ b/substrate/frame/support/src/storage/generator/mod.rs @@ -36,6 +36,7 @@ pub use value::StorageValue; #[cfg(test)] mod tests { + use alloc::vec::Vec; use codec::Encode; use sp_io::TestExternalities; use sp_runtime::{generic, traits::BlakeTwo256, BuildStorage}; diff --git a/substrate/frame/support/src/storage/generator/nmap.rs b/substrate/frame/support/src/storage/generator/nmap.rs index 4b49ad3eb38d..0466583a2795 100755 --- a/substrate/frame/support/src/storage/generator/nmap.rs +++ b/substrate/frame/support/src/storage/generator/nmap.rs @@ -40,9 +40,8 @@ use crate::{ }, Never, }; +use alloc::vec::Vec; use codec::{Decode, Encode, EncodeLike, FullCodec}; -#[cfg(not(feature = "std"))] -use sp_std::prelude::*; /// Generator for `StorageNMap` used by `decl_storage` and storage types. /// @@ -464,6 +463,7 @@ mod test_iterators { unhashed, }, }; + use alloc::vec; use codec::Encode; #[test] diff --git a/substrate/frame/support/src/storage/hashed.rs b/substrate/frame/support/src/storage/hashed.rs index 6633adce8ff6..d823eb988799 100644 --- a/substrate/frame/support/src/storage/hashed.rs +++ b/substrate/frame/support/src/storage/hashed.rs @@ -18,8 +18,8 @@ //! Operation on runtime storage using hashed keys. use super::unhashed; +use alloc::vec::Vec; use codec::{Decode, Encode}; -use sp_std::prelude::*; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. pub fn get(hash: &HashFn, key: &[u8]) -> Option diff --git a/substrate/frame/support/src/storage/migration.rs b/substrate/frame/support/src/storage/migration.rs index 252625cf4f7d..1dd690c3ed67 100644 --- a/substrate/frame/support/src/storage/migration.rs +++ b/substrate/frame/support/src/storage/migration.rs @@ -22,8 +22,8 @@ use crate::{ storage::{storage_prefix, unhashed}, StorageHasher, Twox128, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; -use sp_std::prelude::*; use super::PrefixIterator; @@ -32,7 +32,7 @@ pub struct StorageIterator { prefix: Vec, previous_key: Vec, drain: bool, - _phantom: ::sp_std::marker::PhantomData, + _phantom: ::core::marker::PhantomData, } impl StorageIterator { @@ -95,7 +95,7 @@ pub struct StorageKeyIterator { prefix: Vec, previous_key: Vec, drain: bool, - _phantom: ::sp_std::marker::PhantomData<(K, T, H)>, + _phantom: ::core::marker::PhantomData<(K, T, H)>, } impl StorageKeyIterator { diff --git a/substrate/frame/support/src/storage/mod.rs b/substrate/frame/support/src/storage/mod.rs index f7d7447482d0..7fb991d37792 100644 --- a/substrate/frame/support/src/storage/mod.rs +++ b/substrate/frame/support/src/storage/mod.rs @@ -24,10 +24,11 @@ use crate::{ ReversibleKeyGenerator, TupleToEncodedIter, }, }; +use alloc::{collections::btree_set::BTreeSet, vec::Vec}; use codec::{Decode, Encode, EncodeLike, FullCodec, FullEncode}; +use core::marker::PhantomData; use sp_core::storage::ChildInfo; use sp_runtime::generic::{Digest, DigestItem}; -use sp_std::{collections::btree_set::BTreeSet, marker::PhantomData, prelude::*}; pub use self::{ stream_iter::StorageStreamIter, diff --git a/substrate/frame/support/src/storage/storage_noop_guard.rs b/substrate/frame/support/src/storage/storage_noop_guard.rs index c4d40fa99a35..23201e58db5b 100644 --- a/substrate/frame/support/src/storage/storage_noop_guard.rs +++ b/substrate/frame/support/src/storage/storage_noop_guard.rs @@ -38,7 +38,7 @@ /// ``` #[must_use] pub struct StorageNoopGuard<'a> { - storage_root: sp_std::vec::Vec, + storage_root: alloc::vec::Vec, error_message: &'a str, } @@ -71,7 +71,8 @@ impl<'a> StorageNoopGuard<'a> { impl<'a> Drop for StorageNoopGuard<'a> { fn drop(&mut self) { // No need to double panic, eg. inside a test assertion failure. - if sp_std::thread::panicking() { + #[cfg(feature = "std")] + if std::thread::panicking() { return } assert_eq!( @@ -85,9 +86,10 @@ impl<'a> Drop for StorageNoopGuard<'a> { #[cfg(test)] mod tests { - use super::*; use sp_io::TestExternalities; + use super::*; + #[test] #[should_panic(expected = "`StorageNoopGuard` detected an attempted storage change.")] fn storage_noop_guard_panics_on_changed() { @@ -112,7 +114,7 @@ mod tests { TestExternalities::default().execute_with(|| { let guard = StorageNoopGuard::default(); frame_support::storage::unhashed::put(b"key", b"value"); - sp_std::mem::drop(guard); + std::mem::drop(guard); frame_support::storage::unhashed::kill(b"key"); }); } @@ -122,7 +124,7 @@ mod tests { TestExternalities::default().execute_with(|| { let guard = StorageNoopGuard::default(); frame_support::storage::unhashed::put(b"key", b"value"); - sp_std::mem::forget(guard); + std::mem::forget(guard); }); } diff --git a/substrate/frame/support/src/storage/stream_iter.rs b/substrate/frame/support/src/storage/stream_iter.rs index 529b2f387c71..0d1e5582f841 100644 --- a/substrate/frame/support/src/storage/stream_iter.rs +++ b/substrate/frame/support/src/storage/stream_iter.rs @@ -16,8 +16,8 @@ // limitations under the License. use crate::{BoundedBTreeMap, BoundedBTreeSet, BoundedVec, WeakBoundedVec}; +use alloc::vec::Vec; use codec::Decode; -use sp_std::vec::Vec; /// Provides the sealed trait `StreamIter`. mod private { @@ -26,7 +26,7 @@ mod private { /// Used as marker trait for types that support stream iteration. pub trait StreamIter { /// The actual iterator implementation. - type Iterator: sp_std::iter::Iterator; + type Iterator: core::iter::Iterator; /// Create the stream iterator for the value found at `key`. fn stream_iter(key: Vec) -> Self::Iterator; @@ -40,7 +40,7 @@ mod private { } } - impl StreamIter for sp_std::collections::btree_set::BTreeSet { + impl StreamIter for alloc::collections::btree_set::BTreeSet { type Iterator = ScaleContainerStreamIter; fn stream_iter(key: Vec) -> Self::Iterator { @@ -49,7 +49,7 @@ mod private { } impl StreamIter - for sp_std::collections::btree_map::BTreeMap + for alloc::collections::btree_map::BTreeMap { type Iterator = ScaleContainerStreamIter<(K, V)>; @@ -116,14 +116,14 @@ impl(len) ++ data`. -/// This type provides an [`Iterator`](sp_std::iter::Iterator) implementation that decodes +/// This type provides an [`Iterator`](core::iter::Iterator) implementation that decodes /// one item after another with each call to [`next`](Self::next). The bytes representing /// the container are also not read at once into memory and instead being read in chunks. As long /// as individual items are smaller than these chunks the memory usage of this iterator should /// be constant. On decoding errors [`next`](Self::next) will return `None` to signal that the /// iterator is finished. pub struct ScaleContainerStreamIter { - marker: sp_std::marker::PhantomData, + marker: core::marker::PhantomData, input: StorageInput, length: u32, read: u32, @@ -156,7 +156,7 @@ impl ScaleContainerStreamIter { 0 }; - Self { marker: sp_std::marker::PhantomData, input, length, read: 0 } + Self { marker: core::marker::PhantomData, input, length, read: 0 } } /// Creates a new instance of the stream iterator. @@ -168,11 +168,11 @@ impl ScaleContainerStreamIter { let mut input = StorageInput::new(key); let length = if input.exists() { codec::Compact::::decode(&mut input)?.0 } else { 0 }; - Ok(Self { marker: sp_std::marker::PhantomData, input, length, read: 0 }) + Ok(Self { marker: core::marker::PhantomData, input, length, read: 0 }) } } -impl sp_std::iter::Iterator for ScaleContainerStreamIter { +impl core::iter::Iterator for ScaleContainerStreamIter { type Item = T; fn next(&mut self) -> Option { @@ -235,7 +235,7 @@ impl StorageInput { /// /// - `key`: The storage key of the storage item that this input will read. fn new(key: Vec) -> Self { - let mut buffer = sp_std::vec![0; STORAGE_INPUT_BUFFER_CAPACITY]; + let mut buffer = alloc::vec![0; STORAGE_INPUT_BUFFER_CAPACITY]; unsafe { buffer.set_len(buffer.capacity()); } @@ -270,7 +270,7 @@ impl StorageInput { sp_io::storage::read(&self.key, &mut self.buffer[present_bytes..], self.offset) { let bytes_read = - sp_std::cmp::min(length_minus_offset as usize, self.buffer.len() - present_bytes); + core::cmp::min(length_minus_offset as usize, self.buffer.len() - present_bytes); let buffer_len = present_bytes + bytes_read; unsafe { self.buffer.set_len(buffer_len); diff --git a/substrate/frame/support/src/storage/types/counted_map.rs b/substrate/frame/support/src/storage/types/counted_map.rs index 0444e269928a..9adcb33ae074 100644 --- a/substrate/frame/support/src/storage/types/counted_map.rs +++ b/substrate/frame/support/src/storage/types/counted_map.rs @@ -29,11 +29,11 @@ use crate::{ traits::{Get, GetDefault, StorageInfo, StorageInfoTrait, StorageInstance}, Never, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen, Ref}; use sp_io::MultiRemovalResults; use sp_metadata_ir::StorageEntryMetadataIR; use sp_runtime::traits::Saturating; -use sp_std::prelude::*; /// A wrapper around a [`StorageMap`] and a [`StorageValue`] (with the value being `u32`) to keep /// track of how many items are in a map, without needing to iterate all the values. diff --git a/substrate/frame/support/src/storage/types/counted_nmap.rs b/substrate/frame/support/src/storage/types/counted_nmap.rs index 51cde93f28c0..13c1b10be39c 100644 --- a/substrate/frame/support/src/storage/types/counted_nmap.rs +++ b/substrate/frame/support/src/storage/types/counted_nmap.rs @@ -28,10 +28,10 @@ use crate::{ traits::{Get, GetDefault, StorageInfo, StorageInstance}, Never, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen, Ref}; use sp_metadata_ir::StorageEntryMetadataIR; use sp_runtime::traits::Saturating; -use sp_std::prelude::*; /// A wrapper around a [`StorageNMap`] and a [`StorageValue`] (with the value being `u32`) to keep /// track of how many items are in a map, without needing to iterate all the values. @@ -683,6 +683,7 @@ mod test { hash::{StorageHasher as _, *}, storage::types::{Key as NMapKey, ValueQuery}, }; + use alloc::boxed::Box; use sp_io::{hashing::twox_128, TestExternalities}; use sp_metadata_ir::{StorageEntryModifierIR, StorageEntryTypeIR, StorageHasherIR}; diff --git a/substrate/frame/support/src/storage/types/double_map.rs b/substrate/frame/support/src/storage/types/double_map.rs index 2a7af7a98463..3d227feb902f 100644 --- a/substrate/frame/support/src/storage/types/double_map.rs +++ b/substrate/frame/support/src/storage/types/double_map.rs @@ -26,11 +26,11 @@ use crate::{ traits::{Get, GetDefault, StorageInfo, StorageInstance}, StorageHasher, Twox128, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen}; use frame_support::storage::StorageDecodeNonDedupLength; use sp_arithmetic::traits::SaturatedConversion; use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR}; -use sp_std::prelude::*; /// A type representing a *double map* in storage. This structure associates a pair of keys with a /// value of a specified type stored on-chain. diff --git a/substrate/frame/support/src/storage/types/key.rs b/substrate/frame/support/src/storage/types/key.rs index 90cf09dd1d34..b9b497b61d94 100755 --- a/substrate/frame/support/src/storage/types/key.rs +++ b/substrate/frame/support/src/storage/types/key.rs @@ -18,10 +18,10 @@ //! Storage key type. use crate::hash::{ReversibleStorageHasher, StorageHasher}; +use alloc::{boxed::Box, vec::Vec}; use codec::{Encode, EncodeLike, FullCodec, MaxEncodedLen}; use paste::paste; use scale_info::StaticTypeInfo; -use sp_std::prelude::*; /// A type used exclusively by storage maps as their key type. /// @@ -203,19 +203,19 @@ impl<'a, T: EncodeLike + EncodeLikeTuple, U: Encode> EncodeLikeTuple /// Trait to indicate that a tuple can be converted into an iterator of a vector of encoded bytes. pub trait TupleToEncodedIter { - fn to_encoded_iter(&self) -> sp_std::vec::IntoIter>; + fn to_encoded_iter(&self) -> alloc::vec::IntoIter>; } #[impl_trait_for_tuples::impl_for_tuples(1, 18)] #[tuple_types_custom_trait_bound(Encode)] impl TupleToEncodedIter for Tuple { - fn to_encoded_iter(&self) -> sp_std::vec::IntoIter> { + fn to_encoded_iter(&self) -> alloc::vec::IntoIter> { [for_tuples!( #(self.Tuple.encode()),* )].to_vec().into_iter() } } impl TupleToEncodedIter for &T { - fn to_encoded_iter(&self) -> sp_std::vec::IntoIter> { + fn to_encoded_iter(&self) -> alloc::vec::IntoIter> { (*self).to_encoded_iter() } } @@ -223,7 +223,7 @@ impl TupleToEncodedIter for &T { impl<'a, T: EncodeLike + TupleToEncodedIter, U: Encode> TupleToEncodedIter for codec::Ref<'a, T, U> { - fn to_encoded_iter(&self) -> sp_std::vec::IntoIter> { + fn to_encoded_iter(&self) -> alloc::vec::IntoIter> { use core::ops::Deref as _; self.deref().to_encoded_iter() } diff --git a/substrate/frame/support/src/storage/types/map.rs b/substrate/frame/support/src/storage/types/map.rs index b79a6ae9b848..b70026eea50e 100644 --- a/substrate/frame/support/src/storage/types/map.rs +++ b/substrate/frame/support/src/storage/types/map.rs @@ -26,11 +26,11 @@ use crate::{ traits::{Get, GetDefault, StorageInfo, StorageInstance}, StorageHasher, Twox128, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen}; use frame_support::storage::StorageDecodeNonDedupLength; use sp_arithmetic::traits::SaturatedConversion; use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR}; -use sp_std::prelude::*; /// A type representing a *map* in storage. A *storage map* is a mapping of keys to values of a /// given type stored on-chain. diff --git a/substrate/frame/support/src/storage/types/mod.rs b/substrate/frame/support/src/storage/types/mod.rs index 631410f425d1..b063e11621d6 100644 --- a/substrate/frame/support/src/storage/types/mod.rs +++ b/substrate/frame/support/src/storage/types/mod.rs @@ -18,9 +18,9 @@ //! Storage types to build abstraction on storage, they implements storage traits such as //! StorageMap and others. +use alloc::vec::Vec; use codec::FullCodec; use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryModifierIR}; -use sp_std::prelude::*; mod counted_map; mod counted_nmap; @@ -93,7 +93,7 @@ where } /// Implements [`QueryKindTrait`] with `Query` type being `Result`. -pub struct ResultQuery(sp_std::marker::PhantomData); +pub struct ResultQuery(core::marker::PhantomData); impl QueryKindTrait for ResultQuery where Value: FullCodec + 'static, diff --git a/substrate/frame/support/src/storage/types/nmap.rs b/substrate/frame/support/src/storage/types/nmap.rs index 253f02a14f07..c3dfd5b3e48c 100755 --- a/substrate/frame/support/src/storage/types/nmap.rs +++ b/substrate/frame/support/src/storage/types/nmap.rs @@ -28,10 +28,10 @@ use crate::{ }, traits::{Get, GetDefault, StorageInfo, StorageInstance}, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen}; use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR}; use sp_runtime::SaturatedConversion; -use sp_std::prelude::*; /// A type representing an *NMap* in storage. This structure associates an arbitrary number of keys /// with a value of a specified type stored on-chain. @@ -655,6 +655,7 @@ mod test { hash::{StorageHasher as _, *}, storage::types::{Key as NMapKey, ValueQuery}, }; + use alloc::boxed::Box; use sp_io::{hashing::twox_128, TestExternalities}; use sp_metadata_ir::{StorageEntryModifierIR, StorageHasherIR}; diff --git a/substrate/frame/support/src/storage/types/value.rs b/substrate/frame/support/src/storage/types/value.rs index a2d93a6a165f..9cc985b36d8c 100644 --- a/substrate/frame/support/src/storage/types/value.rs +++ b/substrate/frame/support/src/storage/types/value.rs @@ -25,11 +25,11 @@ use crate::{ }, traits::{Get, GetDefault, StorageInfo, StorageInstance}, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen}; use frame_support::storage::StorageDecodeNonDedupLength; use sp_arithmetic::traits::SaturatedConversion; use sp_metadata_ir::{StorageEntryMetadataIR, StorageEntryTypeIR}; -use sp_std::prelude::*; /// A type representing a *value* in storage. A *storage value* is a single value of a given type /// stored on-chain. diff --git a/substrate/frame/support/src/storage/unhashed.rs b/substrate/frame/support/src/storage/unhashed.rs index 776c7d0f3c3a..7f9bc93d7d81 100644 --- a/substrate/frame/support/src/storage/unhashed.rs +++ b/substrate/frame/support/src/storage/unhashed.rs @@ -17,8 +17,8 @@ //! Operation on unhashed runtime storage. +use alloc::vec::Vec; use codec::{Decode, Encode}; -use sp_std::prelude::*; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. pub fn get(key: &[u8]) -> Option { diff --git a/substrate/frame/support/src/traits/dynamic_params.rs b/substrate/frame/support/src/traits/dynamic_params.rs index 32dae6799eaf..3ef298fc5a5a 100644 --- a/substrate/frame/support/src/traits/dynamic_params.rs +++ b/substrate/frame/support/src/traits/dynamic_params.rs @@ -85,7 +85,7 @@ impl AggregatedKeyValue for () { /// /// This concretization is useful when configuring pallets, since a pallet will require a parameter /// store for its own KV type and not the aggregated runtime-wide KV type. -pub struct ParameterStoreAdapter(sp_std::marker::PhantomData<(PS, KV)>); +pub struct ParameterStoreAdapter(core::marker::PhantomData<(PS, KV)>); impl ParameterStore for ParameterStoreAdapter where diff --git a/substrate/frame/support/src/traits/filter.rs b/substrate/frame/support/src/traits/filter.rs index 44f9f136cfc2..ff62449847d2 100644 --- a/substrate/frame/support/src/traits/filter.rs +++ b/substrate/frame/support/src/traits/filter.rs @@ -18,7 +18,7 @@ //! Traits and associated utilities for dealing with abstract constraint filters. pub use super::members::Contains; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Trait to add a constraint onto the filter. pub trait FilterStack: Contains { @@ -103,7 +103,7 @@ macro_rules! impl_filter_stack { mod $module { #[allow(unused_imports)] use super::*; - use $crate::__private::sp_std::{boxed::Box, cell::RefCell, mem::{swap, take}, vec::Vec}; + use std::{boxed::Box, cell::RefCell, mem::{swap, take}, vec::Vec}; use $crate::traits::filter::{Contains, FilterStack}; thread_local! { diff --git a/substrate/frame/support/src/traits/hooks.rs b/substrate/frame/support/src/traits/hooks.rs index 1a687cade79f..012a74d0ae92 100644 --- a/substrate/frame/support/src/traits/hooks.rs +++ b/substrate/frame/support/src/traits/hooks.rs @@ -24,9 +24,10 @@ use crate::weights::Weight; use impl_trait_for_tuples::impl_for_tuples; use sp_runtime::traits::AtLeast32BitUnsigned; -use sp_std::prelude::*; use sp_weights::WeightMeter; +#[cfg(feature = "try-runtime")] +use alloc::vec::Vec; #[cfg(feature = "try-runtime")] use sp_runtime::TryRuntimeError; @@ -707,7 +708,7 @@ mod tests { #[test] fn on_idle_round_robin_works() { - static mut ON_IDLE_INVOCATION_ORDER: sp_std::vec::Vec<&str> = sp_std::vec::Vec::new(); + static mut ON_IDLE_INVOCATION_ORDER: alloc::vec::Vec<&str> = alloc::vec::Vec::new(); struct Test1; struct Test2; diff --git a/substrate/frame/support/src/traits/members.rs b/substrate/frame/support/src/traits/members.rs index 53de84ab2245..89b6b6cdfad9 100644 --- a/substrate/frame/support/src/traits/members.rs +++ b/substrate/frame/support/src/traits/members.rs @@ -17,10 +17,11 @@ //! Traits for dealing with the idea of membership. +use alloc::vec::Vec; +use core::marker::PhantomData; use impl_trait_for_tuples::impl_for_tuples; use sp_arithmetic::traits::AtLeast16BitUnsigned; use sp_runtime::DispatchResult; -use sp_std::{marker::PhantomData, prelude::*}; /// A trait for querying whether a type can be said to "contain" a value. pub trait Contains { diff --git a/substrate/frame/support/src/traits/messages.rs b/substrate/frame/support/src/traits/messages.rs index 3f8d80f5c6ba..d28716237119 100644 --- a/substrate/frame/support/src/traits/messages.rs +++ b/substrate/frame/support/src/traits/messages.rs @@ -19,10 +19,10 @@ use super::storage::Footprint; use codec::{Decode, Encode, FullCodec, MaxEncodedLen}; +use core::{fmt::Debug, marker::PhantomData}; use scale_info::TypeInfo; use sp_core::{ConstU32, Get, TypedGet}; use sp_runtime::{traits::Convert, BoundedSlice, RuntimeDebug}; -use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; use sp_weights::{Weight, WeightMeter}; /// Errors that can happen when attempting to process a message with diff --git a/substrate/frame/support/src/traits/metadata.rs b/substrate/frame/support/src/traits/metadata.rs index 8bda4186bc96..1e46470a3911 100644 --- a/substrate/frame/support/src/traits/metadata.rs +++ b/substrate/frame/support/src/traits/metadata.rs @@ -17,10 +17,11 @@ //! Traits for managing information attached to pallets and their constituents. +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; +use core::ops::Add; use impl_trait_for_tuples::impl_for_tuples; use sp_runtime::RuntimeDebug; -use sp_std::{ops::Add, prelude::*}; /// Provides information about the pallet itself and its setup in the runtime. /// @@ -146,16 +147,16 @@ impl CrateVersion { } } -impl sp_std::cmp::Ord for CrateVersion { - fn cmp(&self, other: &Self) -> sp_std::cmp::Ordering { +impl Ord for CrateVersion { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { self.major .cmp(&other.major) .then_with(|| self.minor.cmp(&other.minor).then_with(|| self.patch.cmp(&other.patch))) } } -impl sp_std::cmp::PartialOrd for CrateVersion { - fn partial_cmp(&self, other: &Self) -> Option { +impl PartialOrd for CrateVersion { + fn partial_cmp(&self, other: &Self) -> Option { Some(::cmp(self, other)) } } @@ -248,7 +249,7 @@ impl PartialEq for StorageVersion { } impl PartialOrd for StorageVersion { - fn partial_cmp(&self, other: &u16) -> Option { + fn partial_cmp(&self, other: &u16) -> Option { Some(self.0.cmp(other)) } } diff --git a/substrate/frame/support/src/traits/misc.rs b/substrate/frame/support/src/traits/misc.rs index bc7407a7be62..7c8c22d1ae5a 100644 --- a/substrate/frame/support/src/traits/misc.rs +++ b/substrate/frame/support/src/traits/misc.rs @@ -18,19 +18,20 @@ //! Smaller traits used in FRAME which don't need their own file. use crate::dispatch::{DispatchResult, Parameter}; +use alloc::{vec, vec::Vec}; use codec::{CompactLen, Decode, DecodeLimit, Encode, EncodeLike, Input, MaxEncodedLen}; use impl_trait_for_tuples::impl_for_tuples; use scale_info::{build::Fields, meta_type, Path, Type, TypeInfo, TypeParameter}; use sp_arithmetic::traits::{CheckedAdd, CheckedMul, CheckedSub, One, Saturating}; use sp_core::bounded::bounded_vec::TruncateFrom; +use core::cmp::Ordering; #[doc(hidden)] pub use sp_runtime::traits::{ ConstBool, ConstI128, ConstI16, ConstI32, ConstI64, ConstI8, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Get, GetDefault, TryCollect, TypedGet, }; use sp_runtime::{traits::Block as BlockT, DispatchError}; -use sp_std::{cmp::Ordering, prelude::*}; #[doc(hidden)] pub const DEFENSIVE_OP_PUBLIC_ERROR: &str = "a defensive failure has been triggered; please report the block number at https://github.com/paritytech/substrate/issues"; @@ -48,7 +49,7 @@ impl VariantCount for () { } /// Adapter for `Get` to access `VARIANT_COUNT` from `trait pub trait VariantCount {`. -pub struct VariantCountOf(sp_std::marker::PhantomData); +pub struct VariantCountOf(core::marker::PhantomData); impl Get for VariantCountOf { fn get() -> u32 { T::VARIANT_COUNT @@ -190,10 +191,10 @@ pub trait DefensiveOption { /// Defensively transform this option to a result, mapping `None` to the return value of an /// error closure. - fn defensive_ok_or_else E>(self, err: F) -> Result; + fn defensive_ok_or_else E>(self, err: F) -> Result; /// Defensively transform this option to a result, mapping `None` to a default value. - fn defensive_ok_or(self, err: E) -> Result; + fn defensive_ok_or(self, err: E) -> Result; /// Exactly the same as `map`, but it prints the appropriate warnings if the value being mapped /// is `None`. @@ -252,7 +253,7 @@ impl Defensive for Option { } } -impl Defensive for Result { +impl Defensive for Result { fn defensive_unwrap_or(self, or: T) -> T { match self { Ok(inner) => inner, @@ -307,7 +308,7 @@ impl Defensive for Result { } } -impl DefensiveResult for Result { +impl DefensiveResult for Result { fn defensive_map_err F>(self, o: O) -> Result { self.map_err(|e| { defensive!(e); @@ -357,7 +358,7 @@ impl DefensiveOption for Option { ) } - fn defensive_ok_or_else E>(self, err: F) -> Result { + fn defensive_ok_or_else E>(self, err: F) -> Result { self.ok_or_else(|| { let err_value = err(); defensive!(err_value); @@ -365,7 +366,7 @@ impl DefensiveOption for Option { }) } - fn defensive_ok_or(self, err: E) -> Result { + fn defensive_ok_or(self, err: E) -> Result { self.ok_or_else(|| { defensive!(err); err @@ -416,11 +417,11 @@ impl DefensiveSatura } fn defensive_saturating_accrue(&mut self, other: Self) { // Use `replace` here since `take` would require `T: Default`. - *self = sp_std::mem::replace(self, One::one()).defensive_saturating_add(other); + *self = core::mem::replace(self, One::one()).defensive_saturating_add(other); } fn defensive_saturating_reduce(&mut self, other: Self) { // Use `replace` here since `take` would require `T: Default`. - *self = sp_std::mem::replace(self, One::one()).defensive_saturating_sub(other); + *self = core::mem::replace(self, One::one()).defensive_saturating_sub(other); } fn defensive_saturating_inc(&mut self) { self.defensive_saturating_accrue(One::one()); @@ -510,7 +511,7 @@ pub trait DefensiveMin { impl DefensiveMin for T where - T: sp_std::cmp::PartialOrd, + T: PartialOrd, { fn defensive_min(self, other: T) -> Self { if self <= other { @@ -574,7 +575,7 @@ pub trait DefensiveMax { impl DefensiveMax for T where - T: sp_std::cmp::PartialOrd, + T: PartialOrd, { fn defensive_max(self, other: T) -> Self { if self >= other { @@ -1050,7 +1051,7 @@ impl TypeInfo for WrapperOpaque { #[derive(Debug, Eq, PartialEq, Default, Clone)] pub struct WrapperKeepOpaque { data: Vec, - _phantom: sp_std::marker::PhantomData, + _phantom: core::marker::PhantomData, } impl WrapperKeepOpaque { @@ -1073,7 +1074,7 @@ impl WrapperKeepOpaque { /// Create from the given encoded `data`. pub fn from_encoded(data: Vec) -> Self { - Self { data, _phantom: sp_std::marker::PhantomData } + Self { data, _phantom: core::marker::PhantomData } } } @@ -1100,7 +1101,7 @@ impl Encode for WrapperKeepOpaque { impl Decode for WrapperKeepOpaque { fn decode(input: &mut I) -> Result { - Ok(Self { data: Vec::::decode(input)?, _phantom: sp_std::marker::PhantomData }) + Ok(Self { data: Vec::::decode(input)?, _phantom: core::marker::PhantomData }) } fn skip(input: &mut I) -> Result<(), codec::Error> { @@ -1212,8 +1213,8 @@ pub trait AccountTouch { #[cfg(test)] mod test { use super::*; + use core::marker::PhantomData; use sp_core::bounded::{BoundedSlice, BoundedVec}; - use sp_std::marker::PhantomData; #[test] fn defensive_assert_works() { diff --git a/substrate/frame/support/src/traits/preimages.rs b/substrate/frame/support/src/traits/preimages.rs index 647af029c16d..80020d8d0080 100644 --- a/substrate/frame/support/src/traits/preimages.rs +++ b/substrate/frame/support/src/traits/preimages.rs @@ -17,6 +17,7 @@ //! Stuff for dealing with hashed preimages. +use alloc::borrow::Cow; use codec::{Decode, Encode, EncodeLike, MaxEncodedLen}; use scale_info::TypeInfo; use sp_core::RuntimeDebug; @@ -24,7 +25,6 @@ use sp_runtime::{ traits::{ConstU32, Hash}, DispatchError, }; -use sp_std::borrow::Cow; pub type BoundedInline = crate::BoundedVec>; @@ -37,7 +37,7 @@ pub enum Bounded { /// A hash with no preimage length. We do not support creation of this except /// for transitioning from legacy state. In the future we will make this a pure /// `Dummy` item storing only the final `dummy` field. - Legacy { hash: H::Output, dummy: sp_std::marker::PhantomData }, + Legacy { hash: H::Output, dummy: core::marker::PhantomData }, /// A an bounded `Call`. Its encoding must be at most 128 bytes. Inline(BoundedInline), /// A hash of the call together with an upper limit for its size.` @@ -61,7 +61,7 @@ impl Bounded { { use Bounded::*; match self { - Legacy { hash, .. } => Legacy { hash, dummy: sp_std::marker::PhantomData }, + Legacy { hash, .. } => Legacy { hash, dummy: core::marker::PhantomData }, Inline(x) => Inline(x), Lookup { hash, len } => Lookup { hash, len }, } @@ -123,7 +123,7 @@ impl Bounded { /// Constructs a `Legacy` bounded item. #[deprecated = "This API is only for transitioning to Scheduler v3 API"] pub fn from_legacy_hash(hash: impl Into) -> Self { - Self::Legacy { hash: hash.into(), dummy: sp_std::marker::PhantomData } + Self::Legacy { hash: hash.into(), dummy: core::marker::PhantomData } } } diff --git a/substrate/frame/support/src/traits/schedule.rs b/substrate/frame/support/src/traits/schedule.rs index f41c73fe69a8..a302e28d4ce2 100644 --- a/substrate/frame/support/src/traits/schedule.rs +++ b/substrate/frame/support/src/traits/schedule.rs @@ -19,10 +19,11 @@ #[allow(deprecated)] use super::PreimageProvider; +use alloc::vec::Vec; use codec::{Codec, Decode, Encode, EncodeLike, MaxEncodedLen}; +use core::{fmt::Debug, result::Result}; use scale_info::TypeInfo; use sp_runtime::{traits::Saturating, DispatchError, RuntimeDebug}; -use sp_std::{fmt::Debug, prelude::*, result::Result}; /// Information relating to the period of a scheduled task. First item is the length of the /// period and the second is the number of times it should be executed in total before the task @@ -182,7 +183,7 @@ pub mod v1 { /// A type that can be used as a scheduler. pub trait Named { /// An address which can be used for removing a scheduled task. - type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug + MaxEncodedLen; + type Address: Codec + Clone + Eq + EncodeLike + core::fmt::Debug + MaxEncodedLen; /// Schedule a dispatch to happen at the beginning of some block in the future. /// @@ -353,7 +354,7 @@ pub mod v2 { /// A type that can be used as a scheduler. pub trait Named { /// An address which can be used for removing a scheduled task. - type Address: Codec + Clone + Eq + EncodeLike + sp_std::fmt::Debug + MaxEncodedLen; + type Address: Codec + Clone + Eq + EncodeLike + core::fmt::Debug + MaxEncodedLen; /// A means of expressing a call by the hash of its encoded data. type Hash; @@ -448,7 +449,7 @@ pub mod v3 { /// A type that can be used as a scheduler. pub trait Named { /// An address which can be used for removing a scheduled task. - type Address: Codec + MaxEncodedLen + Clone + Eq + EncodeLike + sp_std::fmt::Debug; + type Address: Codec + MaxEncodedLen + Clone + Eq + EncodeLike + core::fmt::Debug; /// The hasher used in the runtime. type Hasher: sp_runtime::traits::Hash; diff --git a/substrate/frame/support/src/traits/storage.rs b/substrate/frame/support/src/traits/storage.rs index 875ff56bea19..22fb28e4c0e7 100644 --- a/substrate/frame/support/src/traits/storage.rs +++ b/substrate/frame/support/src/traits/storage.rs @@ -17,6 +17,7 @@ //! Traits for encoding data related to pallet's storage items. +use alloc::{collections::btree_set::BTreeSet, vec, vec::Vec}; use codec::{Encode, FullCodec, MaxEncodedLen}; use core::marker::PhantomData; use impl_trait_for_tuples::impl_for_tuples; @@ -27,7 +28,6 @@ use sp_runtime::{ traits::{Convert, Member, Saturating}, DispatchError, RuntimeDebug, }; -use sp_std::{collections::btree_set::BTreeSet, prelude::*}; /// An instance of a pallet in the storage. /// diff --git a/substrate/frame/support/src/traits/tasks.rs b/substrate/frame/support/src/traits/tasks.rs index 42b837e55970..0b5d0c082509 100644 --- a/substrate/frame/support/src/traits/tasks.rs +++ b/substrate/frame/support/src/traits/tasks.rs @@ -18,20 +18,22 @@ //! Contains the [`Task`] trait, which defines a general-purpose way for defining and executing //! service work, and supporting types. +use alloc::{vec, vec::IntoIter}; use codec::FullCodec; +use core::{fmt::Debug, iter::Iterator}; use scale_info::TypeInfo; use sp_runtime::DispatchError; -use sp_std::{fmt::Debug, iter::Iterator, vec, vec::IntoIter}; use sp_weights::Weight; /// Contain's re-exports of all the supporting types for the [`Task`] trait. Used in the macro /// expansion of `RuntimeTask`. #[doc(hidden)] pub mod __private { + pub use alloc::{vec, vec::IntoIter}; pub use codec::FullCodec; + pub use core::{fmt::Debug, iter::Iterator}; pub use scale_info::TypeInfo; pub use sp_runtime::DispatchError; - pub use sp_std::{fmt::Debug, iter::Iterator, vec, vec::IntoIter}; pub use sp_weights::Weight; } diff --git a/substrate/frame/support/src/traits/tokens/currency/reservable.rs b/substrate/frame/support/src/traits/tokens/currency/reservable.rs index ff8b0c6eea83..60ea9a71805f 100644 --- a/substrate/frame/support/src/traits/tokens/currency/reservable.rs +++ b/substrate/frame/support/src/traits/tokens/currency/reservable.rs @@ -242,7 +242,7 @@ pub trait NamedReservableCurrency: ReservableCurrency { /// /// All "anonymous" operations are then implemented as their named counterparts with the given `Id`. pub struct WithName( - sp_std::marker::PhantomData<(NamedReservable, Id, AccountId)>, + core::marker::PhantomData<(NamedReservable, Id, AccountId)>, ); impl< NamedReservable: NamedReservableCurrency, diff --git a/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs b/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs index 020dffe28c85..41907b2aa009 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs @@ -26,9 +26,9 @@ use crate::traits::{ misc::{SameOrOther, TryDrop}, tokens::{AssetId, Balance}, }; +use core::marker::PhantomData; use frame_support_procedural::{EqNoBound, PartialEqNoBound, RuntimeDebugNoBound}; use sp_runtime::traits::Zero; -use sp_std::marker::PhantomData; /// Handler for when an imbalance gets dropped. This could handle either a credit (negative) or /// debt (positive) imbalance. @@ -93,7 +93,7 @@ impl, OppositeOnDrop: HandleImbalance /// Forget the imbalance without invoking the on-drop handler. pub(crate) fn forget(imbalance: Self) { - sp_std::mem::forget(imbalance); + core::mem::forget(imbalance); } } @@ -108,7 +108,7 @@ impl, OppositeOnDrop: HandleImbalance fn drop_zero(self) -> Result<(), Self> { if self.amount.is_zero() { - sp_std::mem::forget(self); + core::mem::forget(self); Ok(()) } else { Err(self) @@ -118,7 +118,7 @@ impl, OppositeOnDrop: HandleImbalance fn split(self, amount: B) -> (Self, Self) { let first = self.amount.min(amount); let second = self.amount - first; - sp_std::mem::forget(self); + core::mem::forget(self); (Imbalance::new(first), Imbalance::new(second)) } @@ -130,19 +130,19 @@ impl, OppositeOnDrop: HandleImbalance fn merge(mut self, other: Self) -> Self { self.amount = self.amount.saturating_add(other.amount); - sp_std::mem::forget(other); + core::mem::forget(other); self } fn subsume(&mut self, other: Self) { self.amount = self.amount.saturating_add(other.amount); - sp_std::mem::forget(other); + core::mem::forget(other); } fn offset( self, other: Imbalance, ) -> SameOrOther> { let (a, b) = (self.amount, other.amount); - sp_std::mem::forget((self, other)); + core::mem::forget((self, other)); if a == b { SameOrOther::None diff --git a/substrate/frame/support/src/traits/tokens/fungible/item_of.rs b/substrate/frame/support/src/traits/tokens/fungible/item_of.rs index 2aa53d622dbf..c9f366911a8b 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/item_of.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/item_of.rs @@ -39,7 +39,7 @@ pub struct ItemOf< F: fungibles::Inspect, A: Get<>::AssetId>, AccountId, ->(sp_std::marker::PhantomData<(F, A, AccountId)>); +>(core::marker::PhantomData<(F, A, AccountId)>); impl< F: fungibles::Inspect, @@ -361,7 +361,7 @@ impl< } pub struct ConvertImbalanceDropHandler( - sp_std::marker::PhantomData<(AccountId, Balance, AssetIdType, AssetId, Handler)>, + core::marker::PhantomData<(AccountId, Balance, AssetIdType, AssetId, Handler)>, ); impl< diff --git a/substrate/frame/support/src/traits/tokens/fungible/mod.rs b/substrate/frame/support/src/traits/tokens/fungible/mod.rs index a113cb01c982..f40e494b930d 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/mod.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/mod.rs @@ -65,7 +65,7 @@ //! "stack". This means that if an account has 3 freezes for 100 units, the account can spend its //! funds for any reason down to 100 units, at which point the freezes will start to come into //! play. -//! +//! //! It's important to note that the frozen balance can exceed the total balance of the account. //! This is useful, eg, in cases where you want to prevent a user from transferring any fund. In //! such a case, setting the frozen balance to `Balance::MAX` would serve that purpose @@ -161,9 +161,9 @@ mod regular; mod union_of; use codec::{Decode, Encode, MaxEncodedLen}; +use core::marker::PhantomData; use frame_support_procedural::{CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound}; use scale_info::TypeInfo; -use sp_std::marker::PhantomData; use super::{ Fortitude::{Force, Polite}, diff --git a/substrate/frame/support/src/traits/tokens/fungible/regular.rs b/substrate/frame/support/src/traits/tokens/fungible/regular.rs index c46614be4734..54a04444649d 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/regular.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/regular.rs @@ -36,9 +36,9 @@ use crate::{ SameOrOther, TryDrop, }, }; +use core::marker::PhantomData; use sp_arithmetic::traits::{CheckedAdd, CheckedSub, One}; use sp_runtime::{traits::Saturating, ArithmeticError, DispatchError, TokenError}; -use sp_std::marker::PhantomData; use super::{Credit, Debt, HandleImbalanceDrop, Imbalance}; diff --git a/substrate/frame/support/src/traits/tokens/fungible/union_of.rs b/substrate/frame/support/src/traits/tokens/fungible/union_of.rs index 63791b052237..3adbbdda3143 100644 --- a/substrate/frame/support/src/traits/tokens/fungible/union_of.rs +++ b/substrate/frame/support/src/traits/tokens/fungible/union_of.rs @@ -21,6 +21,7 @@ //! See the [`crate::traits::fungible`] doc for more information about fungible traits. use codec::{Decode, Encode, MaxEncodedLen}; +use core::cmp::Ordering; use frame_support::traits::{ fungible::imbalance, tokens::{ @@ -36,7 +37,6 @@ use sp_runtime::{ Either::{Left, Right}, RuntimeDebug, }; -use sp_std::cmp::Ordering; /// The `NativeOrWithId` enum classifies an asset as either `Native` to the current chain or as an /// asset with a specific ID. @@ -101,7 +101,7 @@ impl Convert, Either<(), AssetId>> for Nat /// - `AssetKind` is a superset type encompassing asset kinds from `Left` and `Right` sets. /// - `AccountId` is an account identifier type. pub struct UnionOf( - sp_std::marker::PhantomData<(Left, Right, Criterion, AssetKind, AccountId)>, + core::marker::PhantomData<(Left, Right, Criterion, AssetKind, AccountId)>, ); impl< @@ -664,7 +664,7 @@ pub struct ConvertImbalanceDropHandler< Balance, AssetId, AccountId, ->(sp_std::marker::PhantomData<(Left, Right, Criterion, AssetKind, Balance, AssetId, AccountId)>); +>(core::marker::PhantomData<(Left, Right, Criterion, AssetKind, Balance, AssetId, AccountId)>); impl< Left: fungible::HandleImbalanceDrop, diff --git a/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs b/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs index bb0d83721a48..c3b213cc8fc8 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs @@ -26,9 +26,9 @@ use crate::traits::{ misc::{SameOrOther, TryDrop}, tokens::{imbalance::Imbalance as ImbalanceT, AssetId, Balance}, }; +use core::marker::PhantomData; use frame_support_procedural::{EqNoBound, PartialEqNoBound, RuntimeDebugNoBound}; use sp_runtime::traits::Zero; -use sp_std::marker::PhantomData; /// Handler for when an imbalance gets dropped. This could handle either a credit (negative) or /// debt (positive) imbalance. @@ -98,12 +98,12 @@ impl< /// Forget the imbalance without invoking the on-drop handler. pub(crate) fn forget(imbalance: Self) { - sp_std::mem::forget(imbalance); + core::mem::forget(imbalance); } pub fn drop_zero(self) -> Result<(), Self> { if self.amount.is_zero() { - sp_std::mem::forget(self); + core::mem::forget(self); Ok(()) } else { Err(self) @@ -114,7 +114,7 @@ impl< let first = self.amount.min(amount); let second = self.amount - first; let asset = self.asset.clone(); - sp_std::mem::forget(self); + core::mem::forget(self); (Imbalance::new(asset.clone(), first), Imbalance::new(asset, second)) } @@ -129,7 +129,7 @@ impl< pub fn merge(mut self, other: Self) -> Result { if self.asset == other.asset { self.amount = self.amount.saturating_add(other.amount); - sp_std::mem::forget(other); + core::mem::forget(other); Ok(self) } else { Err((self, other)) @@ -138,7 +138,7 @@ impl< pub fn subsume(&mut self, other: Self) -> Result<(), Self> { if self.asset == other.asset { self.amount = self.amount.saturating_add(other.amount); - sp_std::mem::forget(other); + core::mem::forget(other); Ok(()) } else { Err(other) @@ -154,7 +154,7 @@ impl< if self.asset == other.asset { let (a, b) = (self.amount, other.amount); let asset = self.asset.clone(); - sp_std::mem::forget((self, other)); + core::mem::forget((self, other)); if a == b { Ok(SameOrOther::None) diff --git a/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs b/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs index ab722426dadf..27f663e57509 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/metadata.rs @@ -20,7 +20,7 @@ //! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. use crate::dispatch::DispatchResult; -use sp_std::vec::Vec; +use alloc::vec::Vec; pub trait Inspect: super::Inspect { // Get name for an AssetId. diff --git a/substrate/frame/support/src/traits/tokens/fungibles/regular.rs b/substrate/frame/support/src/traits/tokens/fungibles/regular.rs index 946c4756cff6..3985da7856d7 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/regular.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/regular.rs @@ -19,7 +19,7 @@ //! //! See the [`crate::traits::fungibles`] doc for more information about fungibles traits. -use sp_std::marker::PhantomData; +use core::marker::PhantomData; use crate::{ ensure, diff --git a/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs b/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs index f4259a78f0a2..77047150e00c 100644 --- a/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs +++ b/substrate/frame/support/src/traits/tokens/fungibles/union_of.rs @@ -41,7 +41,7 @@ use sp_runtime::{ /// - `AssetKind` is a superset type encompassing asset kinds from `Left` and `Right` sets. /// - `AccountId` is an account identifier type. pub struct UnionOf( - sp_std::marker::PhantomData<(Left, Right, Criterion, AssetKind, AccountId)>, + core::marker::PhantomData<(Left, Right, Criterion, AssetKind, AccountId)>, ); impl< @@ -622,7 +622,7 @@ pub struct ConvertImbalanceDropHandler< Balance, AccountId, >( - sp_std::marker::PhantomData<( + core::marker::PhantomData<( Left, Right, LeftAssetId, diff --git a/substrate/frame/support/src/traits/tokens/imbalance/on_unbalanced.rs b/substrate/frame/support/src/traits/tokens/imbalance/on_unbalanced.rs index ecb8de8841f9..4bf9af3fbb18 100644 --- a/substrate/frame/support/src/traits/tokens/imbalance/on_unbalanced.rs +++ b/substrate/frame/support/src/traits/tokens/imbalance/on_unbalanced.rs @@ -17,9 +17,9 @@ //! Trait for handling imbalances. +use core::marker::PhantomData; use frame_support::traits::{fungible, fungibles, misc::TryDrop}; use sp_core::TypedGet; -use sp_std::marker::PhantomData; /// Handler for when some currency "account" decreased in balance for /// some reason. diff --git a/substrate/frame/support/src/traits/tokens/imbalance/signed_imbalance.rs b/substrate/frame/support/src/traits/tokens/imbalance/signed_imbalance.rs index 03e821b161b6..eec892cc3115 100644 --- a/substrate/frame/support/src/traits/tokens/imbalance/signed_imbalance.rs +++ b/substrate/frame/support/src/traits/tokens/imbalance/signed_imbalance.rs @@ -20,8 +20,8 @@ use super::super::imbalance::Imbalance; use crate::traits::misc::SameOrOther; use codec::FullCodec; +use core::fmt::Debug; use sp_runtime::traits::{AtLeast32BitUnsigned, MaybeSerializeDeserialize}; -use sp_std::fmt::Debug; /// Either a positive or a negative imbalance. pub enum SignedImbalance> { diff --git a/substrate/frame/support/src/traits/tokens/imbalance/split_two_ways.rs b/substrate/frame/support/src/traits/tokens/imbalance/split_two_ways.rs index 59a582389ba6..d79ae562ec67 100644 --- a/substrate/frame/support/src/traits/tokens/imbalance/split_two_ways.rs +++ b/substrate/frame/support/src/traits/tokens/imbalance/split_two_ways.rs @@ -18,8 +18,8 @@ //! Means for splitting an imbalance into two and handling them differently. use super::super::imbalance::{Imbalance, OnUnbalanced}; +use core::{marker::PhantomData, ops::Div}; use sp_runtime::traits::Saturating; -use sp_std::{marker::PhantomData, ops::Div}; /// Split an unbalanced amount two ways between a common divisor. pub struct SplitTwoWays( diff --git a/substrate/frame/support/src/traits/tokens/misc.rs b/substrate/frame/support/src/traits/tokens/misc.rs index e1ff1e058ae7..9fa1df862097 100644 --- a/substrate/frame/support/src/traits/tokens/misc.rs +++ b/substrate/frame/support/src/traits/tokens/misc.rs @@ -19,13 +19,13 @@ use crate::{traits::Contains, TypeInfo}; use codec::{Decode, Encode, FullCodec, MaxEncodedLen}; +use core::fmt::Debug; use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero}; use sp_core::RuntimeDebug; use sp_runtime::{ traits::{Convert, MaybeSerializeDeserialize}, ArithmeticError, DispatchError, TokenError, }; -use sp_std::fmt::Debug; /// The origin of funds to be used for a deposit operation. #[derive(Copy, Clone, RuntimeDebug, Eq, PartialEq)] @@ -351,7 +351,7 @@ pub trait GetSalary { } /// Adapter for a rank-to-salary `Convert` implementation into a `GetSalary` implementation. -pub struct ConvertRank(sp_std::marker::PhantomData); +pub struct ConvertRank(core::marker::PhantomData); impl> GetSalary for ConvertRank { fn get_salary(rank: R, _: &A) -> B { C::convert(rank) diff --git a/substrate/frame/support/src/traits/tokens/nonfungible.rs b/substrate/frame/support/src/traits/tokens/nonfungible.rs index e3fc84f1d57b..249f84b22759 100644 --- a/substrate/frame/support/src/traits/tokens/nonfungible.rs +++ b/substrate/frame/support/src/traits/tokens/nonfungible.rs @@ -26,9 +26,9 @@ use super::nonfungibles; use crate::{dispatch::DispatchResult, traits::Get}; +use alloc::vec::Vec; use codec::{Decode, Encode}; use sp_runtime::TokenError; -use sp_std::prelude::*; /// Trait for providing an interface to a read-only NFT-like set of items. pub trait Inspect { @@ -125,7 +125,7 @@ pub struct ItemOf< F: nonfungibles::Inspect, A: Get<>::CollectionId>, AccountId, ->(sp_std::marker::PhantomData<(F, A, AccountId)>); +>(core::marker::PhantomData<(F, A, AccountId)>); impl< F: nonfungibles::Inspect, diff --git a/substrate/frame/support/src/traits/tokens/nonfungible_v2.rs b/substrate/frame/support/src/traits/tokens/nonfungible_v2.rs index 05f76e2859d2..5775162e34ed 100644 --- a/substrate/frame/support/src/traits/tokens/nonfungible_v2.rs +++ b/substrate/frame/support/src/traits/tokens/nonfungible_v2.rs @@ -29,9 +29,9 @@ use crate::{ dispatch::{DispatchResult, Parameter}, traits::Get, }; +use alloc::vec::Vec; use codec::{Decode, Encode}; use sp_runtime::TokenError; -use sp_std::prelude::*; /// Trait for providing an interface to a read-only NFT-like item. pub trait Inspect { @@ -207,7 +207,7 @@ pub struct ItemOf< F: nonfungibles::Inspect, A: Get<>::CollectionId>, AccountId, ->(sp_std::marker::PhantomData<(F, A, AccountId)>); +>(core::marker::PhantomData<(F, A, AccountId)>); impl< F: nonfungibles::Inspect, diff --git a/substrate/frame/support/src/traits/tokens/nonfungibles.rs b/substrate/frame/support/src/traits/tokens/nonfungibles.rs index 615e79c29c85..22358cf806fb 100644 --- a/substrate/frame/support/src/traits/tokens/nonfungibles.rs +++ b/substrate/frame/support/src/traits/tokens/nonfungibles.rs @@ -28,9 +28,9 @@ //! `nonfungible` traits by using the `nonfungible::ItemOf` type adapter. use crate::dispatch::DispatchResult; +use alloc::vec::Vec; use codec::{Decode, Encode}; use sp_runtime::{DispatchError, TokenError}; -use sp_std::prelude::*; /// Trait for providing an interface to many read-only NFT-like sets of items. pub trait Inspect { diff --git a/substrate/frame/support/src/traits/tokens/nonfungibles_v2.rs b/substrate/frame/support/src/traits/tokens/nonfungibles_v2.rs index c0209b6d5123..edf1c2b8023d 100644 --- a/substrate/frame/support/src/traits/tokens/nonfungibles_v2.rs +++ b/substrate/frame/support/src/traits/tokens/nonfungibles_v2.rs @@ -28,9 +28,9 @@ //! `nonfungible` traits by using the `nonfungible::ItemOf` type adapter. use crate::dispatch::{DispatchResult, Parameter}; +use alloc::vec::Vec; use codec::{Decode, Encode}; use sp_runtime::{DispatchError, TokenError}; -use sp_std::prelude::*; /// Trait for providing an interface to many read-only NFT-like sets of items. pub trait Inspect { diff --git a/substrate/frame/support/src/traits/tokens/pay.rs b/substrate/frame/support/src/traits/tokens/pay.rs index 62d7a056a3f1..5a7ed4d6aa13 100644 --- a/substrate/frame/support/src/traits/tokens/pay.rs +++ b/substrate/frame/support/src/traits/tokens/pay.rs @@ -18,10 +18,10 @@ //! The Pay trait and associated types. use codec::{Decode, Encode, FullCodec, MaxEncodedLen}; +use core::fmt::Debug; use scale_info::TypeInfo; use sp_core::{RuntimeDebug, TypedGet}; use sp_runtime::DispatchError; -use sp_std::fmt::Debug; use super::{fungible, fungibles, Balance, Preservation::Expendable}; diff --git a/substrate/frame/support/src/traits/try_runtime/decode_entire_state.rs b/substrate/frame/support/src/traits/try_runtime/decode_entire_state.rs index d5dc93fcf28f..8dbeecd8e860 100644 --- a/substrate/frame/support/src/traits/try_runtime/decode_entire_state.rs +++ b/substrate/frame/support/src/traits/try_runtime/decode_entire_state.rs @@ -26,10 +26,10 @@ use crate::{ traits::{PartialStorageInfoTrait, StorageInfo}, StorageHasher, }; +use alloc::{vec, vec::Vec}; use codec::{Decode, DecodeAll, FullCodec}; use impl_trait_for_tuples::impl_for_tuples; use sp_core::Get; -use sp_std::prelude::*; /// Decode the entire data under the given storage type. /// @@ -82,8 +82,8 @@ impl core::fmt::Display for TryDecodeEntireStorageError { write!( f, "`{}::{}` key `{}` is undecodable", - &sp_std::str::from_utf8(&self.info.pallet_name).unwrap_or(""), - &sp_std::str::from_utf8(&self.info.storage_name).unwrap_or(""), + &alloc::str::from_utf8(&self.info.pallet_name).unwrap_or(""), + &alloc::str::from_utf8(&self.info.storage_name).unwrap_or(""), array_bytes::bytes2hex("0x", &self.key) ) } diff --git a/substrate/frame/support/src/traits/try_runtime/mod.rs b/substrate/frame/support/src/traits/try_runtime/mod.rs index c1bf1feb19e5..09c33c014406 100644 --- a/substrate/frame/support/src/traits/try_runtime/mod.rs +++ b/substrate/frame/support/src/traits/try_runtime/mod.rs @@ -22,10 +22,10 @@ pub use decode_entire_state::{TryDecodeEntireStorage, TryDecodeEntireStorageErro use super::StorageInstance; +use alloc::vec::Vec; use impl_trait_for_tuples::impl_for_tuples; use sp_arithmetic::traits::AtLeast32BitUnsigned; use sp_runtime::TryRuntimeError; -use sp_std::prelude::*; /// Which state tests to execute. #[derive(codec::Encode, codec::Decode, Clone, scale_info::TypeInfo)] @@ -55,15 +55,15 @@ impl Default for Select { } } -impl sp_std::fmt::Debug for Select { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for Select { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Select::RoundRobin(x) => write!(f, "RoundRobin({})", x), Select::Only(x) => write!( f, "Only({:?})", x.iter() - .map(|x| sp_std::str::from_utf8(x).unwrap_or("")) + .map(|x| alloc::str::from_utf8(x).unwrap_or("")) .collect::>(), ), Select::All => write!(f, "All"), @@ -73,7 +73,7 @@ impl sp_std::fmt::Debug for Select { } #[cfg(feature = "std")] -impl sp_std::str::FromStr for Select { +impl std::str::FromStr for Select { type Err = &'static str; fn from_str(s: &str) -> Result { match s { @@ -153,9 +153,7 @@ pub trait TryState { #[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))] #[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))] #[cfg_attr(all(feature = "tuples-128"), impl_for_tuples(128))] -impl TryState - for Tuple -{ +impl TryState for Tuple { for_tuples!( where #( Tuple: crate::traits::PalletInfoAccess )* ); fn try_state(n: BlockNumber, targets: Select) -> Result<(), TryRuntimeError> { match targets { @@ -221,7 +219,7 @@ impl TryState { /// Initializes a new tally. @@ -74,7 +74,7 @@ impl PollStatus { } } -pub struct ClassCountOf(sp_std::marker::PhantomData<(P, T)>); +pub struct ClassCountOf(core::marker::PhantomData<(P, T)>); impl> sp_runtime::traits::Get for ClassCountOf { fn get() -> u32 { P::classes().len() as u32 diff --git a/substrate/frame/support/test/Cargo.toml b/substrate/frame/support/test/Cargo.toml index 697e14ae1d38..82ac1d2c7475 100644 --- a/substrate/frame/support/test/Cargo.toml +++ b/substrate/frame/support/test/Cargo.toml @@ -28,7 +28,6 @@ frame-support = { features = ["experimental"], workspace = true } frame-benchmarking = { workspace = true } sp-runtime = { workspace = true } sp-core = { workspace = true } -sp-std = { workspace = true } sp-version = { workspace = true } sp-metadata-ir = { workspace = true } trybuild = { features = ["diff"], workspace = true } @@ -57,7 +56,6 @@ std = [ "sp-metadata-ir/std", "sp-runtime/std", "sp-state-machine/std", - "sp-std/std", "sp-version/std", "test-pallet/std", ] diff --git a/substrate/frame/support/test/src/lib.rs b/substrate/frame/support/test/src/lib.rs index a8a723375033..b080740b0a4b 100644 --- a/substrate/frame/support/test/src/lib.rs +++ b/substrate/frame/support/test/src/lib.rs @@ -127,7 +127,7 @@ pub mod pallet_prelude { /// Provides an implementation of [`frame_support::traits::Randomness`] that should only be used in /// tests! -pub struct TestRandomness(sp_std::marker::PhantomData); +pub struct TestRandomness(core::marker::PhantomData); impl frame_support::traits::Randomness> for TestRandomness diff --git a/substrate/frame/support/test/tests/issue2219.rs b/substrate/frame/support/test/tests/issue2219.rs index 20c2773406ff..7a2138d056a0 100644 --- a/substrate/frame/support/test/tests/issue2219.rs +++ b/substrate/frame/support/test/tests/issue2219.rs @@ -139,7 +139,7 @@ mod module { pub enable_storage_role: bool, pub request_life_time: u64, #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] diff --git a/substrate/frame/support/test/tests/origin.rs b/substrate/frame/support/test/tests/origin.rs index 4f14bda184c8..e6dd0cfc0e31 100644 --- a/substrate/frame/support/test/tests/origin.rs +++ b/substrate/frame/support/test/tests/origin.rs @@ -65,7 +65,7 @@ mod nested { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -135,7 +135,7 @@ pub mod module { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index c441d4c371af..6f8af949cc31 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -446,7 +446,7 @@ pub mod pallet { T::AccountId: From + SomeAssociation1 + From, { #[serde(skip)] - _config: sp_std::marker::PhantomData, + _config: core::marker::PhantomData, _myfield: u32, } diff --git a/substrate/frame/support/test/tests/pallet_instance.rs b/substrate/frame/support/test/tests/pallet_instance.rs index dfe4caa476d3..09a49617044d 100644 --- a/substrate/frame/support/test/tests/pallet_instance.rs +++ b/substrate/frame/support/test/tests/pallet_instance.rs @@ -15,6 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use core::any::TypeId; use frame_support::{ derive_impl, dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays}, @@ -33,7 +34,6 @@ use sp_io::{ TestExternalities, }; use sp_runtime::{DispatchError, ModuleError}; -use sp_std::any::TypeId; #[frame_support::pallet(dev_mode)] pub mod pallet { @@ -194,7 +194,7 @@ pub mod pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig, I: 'static = ()> { #[serde(skip)] - _config: sp_std::marker::PhantomData<(T, I)>, + _config: core::marker::PhantomData<(T, I)>, _myfield: u32, } diff --git a/substrate/frame/support/test/tests/runtime.rs b/substrate/frame/support/test/tests/runtime.rs index 1f4d9110a24f..06c2b5b7071c 100644 --- a/substrate/frame/support/test/tests/runtime.rs +++ b/substrate/frame/support/test/tests/runtime.rs @@ -169,7 +169,7 @@ mod nested { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -251,7 +251,7 @@ pub mod module3 { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -871,7 +871,7 @@ fn test_metadata() { PalletMetadata { name: "Module3", storage: Some(PalletStorageMetadata { - prefix: "Module3", + prefix: "Module3", entries: vec![ StorageEntryMetadata { name: "Storage", diff --git a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs index 6330a138e2f2..4233db21e203 100644 --- a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs +++ b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs @@ -169,7 +169,7 @@ mod nested { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -251,7 +251,7 @@ pub mod module3 { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -808,7 +808,7 @@ fn test_metadata() { PalletMetadata { name: "Module3", storage: Some(PalletStorageMetadata { - prefix: "Module3", + prefix: "Module3", entries: vec![ StorageEntryMetadata { name: "Storage", diff --git a/substrate/frame/support/test/tests/versioned_migration.rs b/substrate/frame/support/test/tests/versioned_migration.rs index c83dd6b71de9..58c9e4ce93b5 100644 --- a/substrate/frame/support/test/tests/versioned_migration.rs +++ b/substrate/frame/support/test/tests/versioned_migration.rs @@ -51,7 +51,7 @@ mod dummy_pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { #[serde(skip)] - _config: sp_std::marker::PhantomData, + _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -90,7 +90,7 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities { /// A dummy migration for testing the `VersionedMigration` trait. /// Sets SomeStorage to S. -struct SomeUnversionedMigration(sp_std::marker::PhantomData); +struct SomeUnversionedMigration(core::marker::PhantomData); parameter_types! { const UpgradeReads: u64 = 4; diff --git a/substrate/frame/system/benchmarking/Cargo.toml b/substrate/frame/system/benchmarking/Cargo.toml index 47a6721b93f5..dec68d20b699 100644 --- a/substrate/frame/system/benchmarking/Cargo.toml +++ b/substrate/frame/system/benchmarking/Cargo.toml @@ -23,7 +23,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] sp-io = { workspace = true, default-features = true } @@ -42,7 +41,6 @@ std = [ "sp-externalities/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-version/std", ] diff --git a/substrate/frame/system/benchmarking/src/inner.rs b/substrate/frame/system/benchmarking/src/inner.rs index c1631b0a2e33..0fb592f3dbba 100644 --- a/substrate/frame/system/benchmarking/src/inner.rs +++ b/substrate/frame/system/benchmarking/src/inner.rs @@ -17,13 +17,13 @@ //! Frame System benchmarks. +use alloc::{vec, vec::Vec}; use codec::Encode; use frame_benchmarking::v2::*; use frame_support::{dispatch::DispatchClass, storage, traits::Get}; use frame_system::{Call, Pallet as System, RawOrigin}; use sp_core::storage::well_known_keys; use sp_runtime::traits::Hash; -use sp_std::{prelude::*, vec}; pub struct Pallet(System); pub trait Config: frame_system::Config { diff --git a/substrate/frame/system/benchmarking/src/lib.rs b/substrate/frame/system/benchmarking/src/lib.rs index e55038aeb955..f66d20ac8aed 100644 --- a/substrate/frame/system/benchmarking/src/lib.rs +++ b/substrate/frame/system/benchmarking/src/lib.rs @@ -19,6 +19,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] pub mod inner; diff --git a/substrate/frame/system/src/extensions/check_genesis.rs b/substrate/frame/system/src/extensions/check_genesis.rs index 76a711a823e7..000ec56da64f 100644 --- a/substrate/frame/system/src/extensions/check_genesis.rs +++ b/substrate/frame/system/src/extensions/check_genesis.rs @@ -31,16 +31,16 @@ use sp_runtime::{ /// the extension does not affect any other fields of `TransactionValidity` directly. #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] -pub struct CheckGenesis(sp_std::marker::PhantomData); +pub struct CheckGenesis(core::marker::PhantomData); -impl sp_std::fmt::Debug for CheckGenesis { +impl core::fmt::Debug for CheckGenesis { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "CheckGenesis") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -48,7 +48,7 @@ impl sp_std::fmt::Debug for CheckGenesis { impl CheckGenesis { /// Creates new `SignedExtension` to check genesis hash. pub fn new() -> Self { - Self(sp_std::marker::PhantomData) + Self(core::marker::PhantomData) } } diff --git a/substrate/frame/system/src/extensions/check_mortality.rs b/substrate/frame/system/src/extensions/check_mortality.rs index 31fdbba5950e..6666c4812fbc 100644 --- a/substrate/frame/system/src/extensions/check_mortality.rs +++ b/substrate/frame/system/src/extensions/check_mortality.rs @@ -36,23 +36,23 @@ use sp_runtime::{ /// The extension affects `longevity` of the transaction according to the [`Era`] definition. #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] -pub struct CheckMortality(pub Era, sp_std::marker::PhantomData); +pub struct CheckMortality(pub Era, core::marker::PhantomData); impl CheckMortality { /// utility constructor. Used only in client/factory code. pub fn from(era: Era) -> Self { - Self(era, sp_std::marker::PhantomData) + Self(era, core::marker::PhantomData) } } -impl sp_std::fmt::Debug for CheckMortality { +impl core::fmt::Debug for CheckMortality { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "CheckMortality({:?})", self.0) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } diff --git a/substrate/frame/system/src/extensions/check_non_zero_sender.rs b/substrate/frame/system/src/extensions/check_non_zero_sender.rs index 92eed60fc66b..06dc2bf177ac 100644 --- a/substrate/frame/system/src/extensions/check_non_zero_sender.rs +++ b/substrate/frame/system/src/extensions/check_non_zero_sender.rs @@ -17,6 +17,7 @@ use crate::Config; use codec::{Decode, Encode}; +use core::marker::PhantomData; use frame_support::{dispatch::DispatchInfo, DefaultNoBound}; use scale_info::TypeInfo; use sp_runtime::{ @@ -25,21 +26,20 @@ use sp_runtime::{ InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, }, }; -use sp_std::{marker::PhantomData, prelude::*}; /// Check to ensure that the sender is not the zero address. #[derive(Encode, Decode, DefaultNoBound, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] pub struct CheckNonZeroSender(PhantomData); -impl sp_std::fmt::Debug for CheckNonZeroSender { +impl core::fmt::Debug for CheckNonZeroSender { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "CheckNonZeroSender") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -47,7 +47,7 @@ impl sp_std::fmt::Debug for CheckNonZeroSender { impl CheckNonZeroSender { /// Create new `SignedExtension` to check runtime version. pub fn new() -> Self { - Self(sp_std::marker::PhantomData) + Self(core::marker::PhantomData) } } @@ -61,7 +61,7 @@ where type Pre = (); const IDENTIFIER: &'static str = "CheckNonZeroSender"; - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } diff --git a/substrate/frame/system/src/extensions/check_nonce.rs b/substrate/frame/system/src/extensions/check_nonce.rs index 894ab72eb593..3535870d1b59 100644 --- a/substrate/frame/system/src/extensions/check_nonce.rs +++ b/substrate/frame/system/src/extensions/check_nonce.rs @@ -16,6 +16,7 @@ // limitations under the License. use crate::Config; +use alloc::vec; use codec::{Decode, Encode}; use frame_support::dispatch::DispatchInfo; use scale_info::TypeInfo; @@ -26,7 +27,6 @@ use sp_runtime::{ ValidTransaction, }, }; -use sp_std::vec; /// Nonce check and increment to give replay protection for transactions. /// @@ -46,14 +46,14 @@ impl CheckNonce { } } -impl sp_std::fmt::Debug for CheckNonce { +impl core::fmt::Debug for CheckNonce { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "CheckNonce({})", self.0) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -68,7 +68,7 @@ where type Pre = (); const IDENTIFIER: &'static str = "CheckNonce"; - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } diff --git a/substrate/frame/system/src/extensions/check_spec_version.rs b/substrate/frame/system/src/extensions/check_spec_version.rs index 24d5ef9cafb1..ee7e6f2efd00 100644 --- a/substrate/frame/system/src/extensions/check_spec_version.rs +++ b/substrate/frame/system/src/extensions/check_spec_version.rs @@ -31,16 +31,16 @@ use sp_runtime::{ /// is not affected in any other way. #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] -pub struct CheckSpecVersion(sp_std::marker::PhantomData); +pub struct CheckSpecVersion(core::marker::PhantomData); -impl sp_std::fmt::Debug for CheckSpecVersion { +impl core::fmt::Debug for CheckSpecVersion { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "CheckSpecVersion") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -48,7 +48,7 @@ impl sp_std::fmt::Debug for CheckSpecVersion { impl CheckSpecVersion { /// Create new `SignedExtension` to check runtime version. pub fn new() -> Self { - Self(sp_std::marker::PhantomData) + Self(core::marker::PhantomData) } } diff --git a/substrate/frame/system/src/extensions/check_tx_version.rs b/substrate/frame/system/src/extensions/check_tx_version.rs index 3f9d6a1903fe..15983c2cd088 100644 --- a/substrate/frame/system/src/extensions/check_tx_version.rs +++ b/substrate/frame/system/src/extensions/check_tx_version.rs @@ -31,16 +31,16 @@ use sp_runtime::{ /// is not affected in any other way. #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(T))] -pub struct CheckTxVersion(sp_std::marker::PhantomData); +pub struct CheckTxVersion(core::marker::PhantomData); -impl sp_std::fmt::Debug for CheckTxVersion { +impl core::fmt::Debug for CheckTxVersion { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "CheckTxVersion") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -48,7 +48,7 @@ impl sp_std::fmt::Debug for CheckTxVersion { impl CheckTxVersion { /// Create new `SignedExtension` to check transaction version. pub fn new() -> Self { - Self(sp_std::marker::PhantomData) + Self(core::marker::PhantomData) } } diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index d4705f200efd..22da2a5b9872 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -37,7 +37,7 @@ use sp_weights::Weight; /// transaction is valid. #[derive(Encode, Decode, Clone, Eq, PartialEq, Default, TypeInfo)] #[scale_info(skip_type_params(T))] -pub struct CheckWeight(sp_std::marker::PhantomData); +pub struct CheckWeight(core::marker::PhantomData); impl CheckWeight where @@ -211,7 +211,7 @@ where type Pre = (); const IDENTIFIER: &'static str = "CheckWeight"; - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } @@ -281,14 +281,14 @@ where } } -impl sp_std::fmt::Debug for CheckWeight { +impl core::fmt::Debug for CheckWeight { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "CheckWeight") } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -300,8 +300,8 @@ mod tests { mock::{new_test_ext, System, Test, CALL}, AllExtrinsicsLen, BlockWeight, DispatchClass, }; + use core::marker::PhantomData; use frame_support::{assert_err, assert_ok, dispatch::Pays, weights::Weight}; - use sp_std::marker::PhantomData; fn block_weights() -> crate::limits::BlockWeights { ::BlockWeights::get() diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 84d00a1e917e..0c6ff2cb8ddb 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -97,6 +97,10 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::{boxed::Box, vec, vec::Vec}; +use core::{fmt::Debug, marker::PhantomData}; use pallet_prelude::{BlockNumberFor, HeaderFor}; #[cfg(feature = "std")] use serde::Serialize; @@ -118,7 +122,6 @@ use sp_runtime::{ }; #[cfg(any(feature = "std", test))] use sp_std::map; -use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; use sp_version::RuntimeVersion; use codec::{Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen}; @@ -269,7 +272,7 @@ pub mod pallet { /// /// NOTE: Avoids overriding `BlockHashCount` when using `mocking::{MockBlock, MockBlockU32, /// MockBlockU128}`. - pub struct TestBlockHashCount>(sp_std::marker::PhantomData); + pub struct TestBlockHashCount>(core::marker::PhantomData); impl, C: Get> Get for TestBlockHashCount { fn get() -> I { C::get().into() @@ -511,7 +514,7 @@ pub mod pallet { + Default + Copy + CheckEqual - + sp_std::hash::Hash + + core::hash::Hash + AsRef<[u8]> + AsMut<[u8]> + MaxEncodedLen; @@ -1011,7 +1014,7 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig { #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } #[pallet::genesis_build] @@ -1153,7 +1156,7 @@ impl From for LastRuntimeUpgradeInfo { } /// Ensure the origin is Root. -pub struct EnsureRoot(sp_std::marker::PhantomData); +pub struct EnsureRoot(core::marker::PhantomData); impl, O>> + From>, AccountId> EnsureOrigin for EnsureRoot { @@ -1179,7 +1182,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { /// Ensure the origin is Root and return the provided `Success` value. pub struct EnsureRootWithSuccess( - sp_std::marker::PhantomData<(AccountId, Success)>, + core::marker::PhantomData<(AccountId, Success)>, ); impl< O: Into, O>> + From>, @@ -1209,7 +1212,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { /// Ensure the origin is provided `Ensure` origin and return the provided `Success` value. pub struct EnsureWithSuccess( - sp_std::marker::PhantomData<(Ensure, AccountId, Success)>, + core::marker::PhantomData<(Ensure, AccountId, Success)>, ); impl< @@ -1232,7 +1235,7 @@ impl< } /// Ensure the origin is any `Signed` origin. -pub struct EnsureSigned(sp_std::marker::PhantomData); +pub struct EnsureSigned(core::marker::PhantomData); impl, O>> + From>, AccountId: Decode> EnsureOrigin for EnsureSigned { @@ -1259,7 +1262,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { } /// Ensure the origin is `Signed` origin from the given `AccountId`. -pub struct EnsureSignedBy(sp_std::marker::PhantomData<(Who, AccountId)>); +pub struct EnsureSignedBy(core::marker::PhantomData<(Who, AccountId)>); impl< O: Into, O>> + From>, Who: SortedMembers, @@ -1291,7 +1294,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { } /// Ensure the origin is `None`. i.e. unsigned transaction. -pub struct EnsureNone(sp_std::marker::PhantomData); +pub struct EnsureNone(core::marker::PhantomData); impl, O>> + From>, AccountId> EnsureOrigin for EnsureNone { @@ -1316,7 +1319,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { } /// Always fail. -pub struct EnsureNever(sp_std::marker::PhantomData); +pub struct EnsureNever(core::marker::PhantomData); impl EnsureOrigin for EnsureNever { type Success = Success; fn try_origin(o: O) -> Result { @@ -1906,7 +1909,7 @@ impl Pallet { /// Should only be called if you know what you are doing and outside of the runtime block /// execution else it can have a large impact on the PoV size of a block. pub fn read_events_no_consensus( - ) -> impl sp_std::iter::Iterator>> { + ) -> impl Iterator>> { Events::::stream_iter() } diff --git a/substrate/frame/system/src/migrations/mod.rs b/substrate/frame/system/src/migrations/mod.rs index 945bbc539552..7c69843d73f1 100644 --- a/substrate/frame/system/src/migrations/mod.rs +++ b/substrate/frame/system/src/migrations/mod.rs @@ -24,7 +24,6 @@ use frame_support::{ pallet_prelude::ValueQuery, traits::PalletInfoAccess, weights::Weight, Blake2_128Concat, }; use sp_runtime::RuntimeDebug; -use sp_std::prelude::*; /// Type used to encode the number of references an account has. type RefCount = u32; diff --git a/substrate/frame/system/src/offchain.rs b/substrate/frame/system/src/offchain.rs index a64b32619640..1f72ea2d3745 100644 --- a/substrate/frame/system/src/offchain.rs +++ b/substrate/frame/system/src/offchain.rs @@ -56,13 +56,13 @@ #![warn(missing_docs)] +use alloc::{boxed::Box, collections::btree_set::BTreeSet, vec::Vec}; use codec::Encode; use sp_runtime::{ app_crypto::RuntimeAppPublic, traits::{Extrinsic as ExtrinsicT, IdentifyAccount, One}, RuntimeDebug, }; -use sp_std::{collections::btree_set::BTreeSet, prelude::*}; /// Marker struct used to flag using all supported keys to sign a payload. pub struct ForAll {} @@ -76,7 +76,7 @@ pub struct ForAny {} /// utility function can be used. However, this struct is used by `Signer` /// to submit a signed transactions providing the signature along with the call. pub struct SubmitTransaction, OverarchingCall> { - _phantom: sp_std::marker::PhantomData<(T, OverarchingCall)>, + _phantom: core::marker::PhantomData<(T, OverarchingCall)>, } impl SubmitTransaction @@ -115,7 +115,7 @@ where #[derive(RuntimeDebug)] pub struct Signer, X = ForAny> { accounts: Option>, - _phantom: sp_std::marker::PhantomData<(X, C)>, + _phantom: core::marker::PhantomData<(X, C)>, } impl, X> Default for Signer { diff --git a/substrate/frame/timestamp/Cargo.toml b/substrate/frame/timestamp/Cargo.toml index 2da6e2d5a95d..25aecea7b79e 100644 --- a/substrate/frame/timestamp/Cargo.toml +++ b/substrate/frame/timestamp/Cargo.toml @@ -26,7 +26,6 @@ frame-system = { workspace = true } sp-inherents = { workspace = true } sp-io = { optional = true, workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-storage = { workspace = true } sp-timestamp = { workspace = true } @@ -49,7 +48,6 @@ std = [ "sp-inherents/std", "sp-io?/std", "sp-runtime/std", - "sp-std/std", "sp-storage/std", "sp-timestamp/std", ] diff --git a/substrate/frame/timestamp/src/lib.rs b/substrate/frame/timestamp/src/lib.rs index 6a22ab1cd5ef..ca495c5e24ef 100644 --- a/substrate/frame/timestamp/src/lib.rs +++ b/substrate/frame/timestamp/src/lib.rs @@ -133,9 +133,9 @@ mod mock; mod tests; pub mod weights; +use core::{cmp, result}; use frame_support::traits::{OnTimestampSet, Time, UnixTime}; use sp_runtime::traits::{AtLeast32Bit, SaturatedConversion, Scale, Zero}; -use sp_std::{cmp, result}; use sp_timestamp::{InherentError, InherentType, INHERENT_IDENTIFIER}; pub use weights::WeightInfo; @@ -367,14 +367,12 @@ impl UnixTime for Pallet { // now is duration since unix epoch in millisecond as documented in // `sp_timestamp::InherentDataProvider`. let now = Now::::get(); - sp_std::if_std! { - if now == T::Moment::zero() { - log::error!( - target: "runtime::timestamp", - "`pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0", - ); - } - } + + log::error!( + target: "runtime::timestamp", + "`pallet_timestamp::UnixTime::now` is called at genesis, invalid value returned: 0", + ); + core::time::Duration::from_millis(now.saturated_into::()) } } diff --git a/substrate/frame/tips/Cargo.toml b/substrate/frame/tips/Cargo.toml index abebaa19aeda..bec2ce0a47b8 100644 --- a/substrate/frame/tips/Cargo.toml +++ b/substrate/frame/tips/Cargo.toml @@ -27,7 +27,6 @@ pallet-treasury = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -48,7 +47,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-storage/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/tips/src/lib.rs b/substrate/frame/tips/src/lib.rs index a75aed89d0b4..67bcdfa0685e 100644 --- a/substrate/frame/tips/src/lib.rs +++ b/substrate/frame/tips/src/lib.rs @@ -60,12 +60,14 @@ mod tests; pub mod migrations; pub mod weights; +extern crate alloc; + use sp_runtime::{ traits::{AccountIdConversion, BadOrigin, Hash, StaticLookup, TrailingZeroInput, Zero}, Percent, RuntimeDebug, }; -use sp_std::prelude::*; +use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ ensure, diff --git a/substrate/frame/tips/src/migrations/unreserve_deposits.rs b/substrate/frame/tips/src/migrations/unreserve_deposits.rs index 16cb1a80e812..afc424309bf4 100644 --- a/substrate/frame/tips/src/migrations/unreserve_deposits.rs +++ b/substrate/frame/tips/src/migrations/unreserve_deposits.rs @@ -18,6 +18,7 @@ //! A migration that unreserves all deposit and unlocks all stake held in the context of this //! pallet. +use alloc::collections::btree_map::BTreeMap; use core::iter::Sum; use frame_support::{ pallet_prelude::OptionQuery, @@ -27,7 +28,6 @@ use frame_support::{ Parameter, Twox64Concat, }; use sp_runtime::{traits::Zero, Saturating}; -use sp_std::collections::btree_map::BTreeMap; #[cfg(feature = "try-runtime")] const LOG_TARGET: &str = "runtime::tips::migrations::unreserve_deposits"; @@ -85,7 +85,7 @@ type Tips, I: 'static> = StorageMap< /// The pallet should be made inoperable before or immediately after this migration is run. /// /// (See also the `RemovePallet` migration in `frame/support/src/migrations.rs`) -pub struct UnreserveDeposits, I: 'static>(sp_std::marker::PhantomData<(T, I)>); +pub struct UnreserveDeposits, I: 'static>(core::marker::PhantomData<(T, I)>); impl, I: 'static> UnreserveDeposits { /// Calculates and returns the total amount reserved by each account by this pallet from open @@ -133,7 +133,7 @@ where /// Fails with a `TryRuntimeError` if somehow the amount reserved by this pallet is greater than /// the actual total reserved amount for any accounts. #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { use codec::Encode; use frame_support::ensure; @@ -189,7 +189,7 @@ where /// Verifies that the account reserved balances were reduced by the actual expected amounts. #[cfg(feature = "try-runtime")] fn post_upgrade( - account_reserved_before_bytes: sp_std::vec::Vec, + account_reserved_before_bytes: alloc::vec::Vec, ) -> Result<(), sp_runtime::TryRuntimeError> { use codec::Decode; diff --git a/substrate/frame/transaction-payment/Cargo.toml b/substrate/frame/transaction-payment/Cargo.toml index 3e890a8f7b69..c405ea1e9439 100644 --- a/substrate/frame/transaction-payment/Cargo.toml +++ b/substrate/frame/transaction-payment/Cargo.toml @@ -26,7 +26,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] serde_json = { workspace = true, default-features = true } @@ -44,7 +43,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = [ "frame-support/try-runtime", diff --git a/substrate/frame/transaction-payment/asset-conversion-tx-payment/Cargo.toml b/substrate/frame/transaction-payment/asset-conversion-tx-payment/Cargo.toml index 02ce212deb6a..b87d780b9672 100644 --- a/substrate/frame/transaction-payment/asset-conversion-tx-payment/Cargo.toml +++ b/substrate/frame/transaction-payment/asset-conversion-tx-payment/Cargo.toml @@ -18,7 +18,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # Substrate dependencies sp-runtime = { workspace = true } -sp-std = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } pallet-asset-conversion = { workspace = true } @@ -47,7 +46,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-storage/std", ] try-runtime = [ diff --git a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs index ed0ed56e6e07..538d88bfacfa 100644 --- a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/lib.rs @@ -42,7 +42,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use sp_std::prelude::*; +extern crate alloc; use codec::{Decode, Encode}; use frame_support::{ @@ -214,13 +214,13 @@ where } } -impl sp_std::fmt::Debug for ChargeAssetTxPayment { +impl core::fmt::Debug for ChargeAssetTxPayment { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "ChargeAssetTxPayment<{:?}, {:?}>", self.tip, self.asset_id.encode()) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -252,7 +252,7 @@ where Option>, ); - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } diff --git a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs index f2f2c57bb376..0ef3fb111143 100644 --- a/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs +++ b/substrate/frame/transaction-payment/asset-conversion-tx-payment/src/payment.rs @@ -17,6 +17,8 @@ use super::*; use crate::Config; +use alloc::vec; +use core::marker::PhantomData; use frame_support::{ ensure, traits::{fungible::Inspect, tokens::Balance}, @@ -28,7 +30,6 @@ use sp_runtime::{ transaction_validity::InvalidTransaction, Saturating, }; -use sp_std::marker::PhantomData; /// Handle withdrawing, refunding and depositing of transaction fees. pub trait OnChargeAssetTransaction { diff --git a/substrate/frame/transaction-payment/asset-tx-payment/Cargo.toml b/substrate/frame/transaction-payment/asset-tx-payment/Cargo.toml index 1b92ecf53c02..ec8fb38dda39 100644 --- a/substrate/frame/transaction-payment/asset-tx-payment/Cargo.toml +++ b/substrate/frame/transaction-payment/asset-tx-payment/Cargo.toml @@ -20,7 +20,6 @@ targets = ["x86_64-unknown-linux-gnu"] sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } @@ -57,7 +56,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-storage/std", ] runtime-benchmarks = [ diff --git a/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs b/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs index 753fae747a37..97f1116993fc 100644 --- a/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/asset-tx-payment/src/lib.rs @@ -35,8 +35,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use sp_std::prelude::*; - use codec::{Decode, Encode}; use frame_support::{ dispatch::{DispatchInfo, DispatchResult, PostDispatchInfo}, @@ -198,13 +196,13 @@ where } } -impl sp_std::fmt::Debug for ChargeAssetTxPayment { +impl core::fmt::Debug for ChargeAssetTxPayment { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "ChargeAssetTxPayment<{:?}, {:?}>", self.tip, self.asset_id.encode()) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -232,7 +230,7 @@ where Option>, ); - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } diff --git a/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs b/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs index 717114ab6bd0..2486474bad45 100644 --- a/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs +++ b/substrate/frame/transaction-payment/asset-tx-payment/src/payment.rs @@ -18,6 +18,7 @@ use super::*; use crate::Config; use codec::FullCodec; +use core::{fmt::Debug, marker::PhantomData}; use frame_support::{ traits::{ fungibles::{Balanced, Credit, Inspect}, @@ -33,7 +34,6 @@ use sp_runtime::{ traits::{DispatchInfoOf, MaybeSerializeDeserialize, One, PostDispatchInfoOf}, transaction_validity::InvalidTransaction, }; -use sp_std::{fmt::Debug, marker::PhantomData}; /// Handle withdrawing, refunding and depositing of transaction fees. pub trait OnChargeAssetTransaction { diff --git a/substrate/frame/transaction-payment/skip-feeless-payment/Cargo.toml b/substrate/frame/transaction-payment/skip-feeless-payment/Cargo.toml index 7265979cedc0..b5bc7719def6 100644 --- a/substrate/frame/transaction-payment/skip-feeless-payment/Cargo.toml +++ b/substrate/frame/transaction-payment/skip-feeless-payment/Cargo.toml @@ -16,7 +16,6 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] # Substrate dependencies sp-runtime = { workspace = true } -sp-std = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } @@ -33,7 +32,6 @@ std = [ "frame-system/std", "scale-info/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-support/runtime-benchmarks", diff --git a/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs b/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs index 682fb3203561..3ab38743bafd 100644 --- a/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/skip-feeless-payment/src/lib.rs @@ -77,7 +77,7 @@ pub mod pallet { /// A [`SignedExtension`] that skips the wrapped extension if the dispatchable is feeless. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct SkipCheckIfFeeless(pub S, sp_std::marker::PhantomData); +pub struct SkipCheckIfFeeless(pub S, core::marker::PhantomData); // Make this extension "invisible" from the outside (ie metadata type information) impl TypeInfo for SkipCheckIfFeeless { @@ -87,20 +87,20 @@ impl TypeInfo for SkipCheckIfFeeless { } } -impl sp_std::fmt::Debug for SkipCheckIfFeeless { +impl core::fmt::Debug for SkipCheckIfFeeless { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "SkipCheckIfFeeless<{:?}>", self.0.encode()) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } impl From for SkipCheckIfFeeless { fn from(s: S) -> Self { - Self(s, sp_std::marker::PhantomData) + Self(s, core::marker::PhantomData) } } diff --git a/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs b/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs index 4ddeae11fcab..d6d600f24e77 100644 --- a/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs +++ b/substrate/frame/transaction-payment/skip-feeless-payment/src/mock.rs @@ -45,7 +45,7 @@ impl SignedExtension for DummyExtension { type AdditionalSigned = (); type Pre = (); const IDENTIFIER: &'static str = "DummyExtension"; - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } diff --git a/substrate/frame/transaction-payment/src/lib.rs b/substrate/frame/transaction-payment/src/lib.rs index 0e440ee4e9ff..69fad6e0e324 100644 --- a/substrate/frame/transaction-payment/src/lib.rs +++ b/substrate/frame/transaction-payment/src/lib.rs @@ -69,7 +69,6 @@ use sp_runtime::{ }, FixedPointNumber, FixedU128, Perbill, Perquintill, RuntimeDebug, }; -use sp_std::prelude::*; pub use types::{FeeDetails, InclusionFee, RuntimeDispatchInfo}; #[cfg(test)] @@ -137,7 +136,7 @@ type BalanceOf = <::OnChargeTransaction as OnChargeTransaction -pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData<(T, S, V, M, X)>); +pub struct TargetedFeeAdjustment(core::marker::PhantomData<(T, S, V, M, X)>); /// Something that can convert the current multiplier to the next one. pub trait MultiplierUpdate: Convert { @@ -264,7 +263,7 @@ where } /// A struct to make the fee multiplier a constant -pub struct ConstFeeMultiplier>(sp_std::marker::PhantomData); +pub struct ConstFeeMultiplier>(core::marker::PhantomData); impl> MultiplierUpdate for ConstFeeMultiplier { fn min() -> Multiplier { @@ -406,7 +405,7 @@ pub mod pallet { pub struct GenesisConfig { pub multiplier: Multiplier, #[serde(skip)] - pub _config: sp_std::marker::PhantomData, + pub _config: core::marker::PhantomData, } impl Default for GenesisConfig { @@ -806,13 +805,13 @@ where } } -impl sp_std::fmt::Debug for ChargeTransactionPayment { +impl core::fmt::Debug for ChargeTransactionPayment { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "ChargeTransactionPayment<{:?}>", self.0) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -834,7 +833,7 @@ where // imbalance resulting from withdrawing the fee <::OnChargeTransaction as OnChargeTransaction>::LiquidityInfo, ); - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } diff --git a/substrate/frame/transaction-payment/src/types.rs b/substrate/frame/transaction-payment/src/types.rs index 25cecc58a63a..67c7311d0cab 100644 --- a/substrate/frame/transaction-payment/src/types.rs +++ b/substrate/frame/transaction-payment/src/types.rs @@ -24,7 +24,6 @@ use serde::{Deserialize, Serialize}; use scale_info::TypeInfo; use sp_runtime::traits::{AtLeast32BitUnsigned, Zero}; -use sp_std::prelude::*; use frame_support::dispatch::DispatchClass; diff --git a/substrate/frame/transaction-storage/Cargo.toml b/substrate/frame/transaction-storage/Cargo.toml index 3bb97e0cd015..e57ee1e729c4 100644 --- a/substrate/frame/transaction-storage/Cargo.toml +++ b/substrate/frame/transaction-storage/Cargo.toml @@ -27,7 +27,6 @@ pallet-balances = { workspace = true } sp-inherents = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-transaction-storage-proof = { workspace = true } log = { workspace = true } @@ -58,7 +57,6 @@ std = [ "sp-inherents/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "sp-transaction-storage-proof/std", ] try-runtime = [ diff --git a/substrate/frame/transaction-storage/src/benchmarking.rs b/substrate/frame/transaction-storage/src/benchmarking.rs index 8d485d9f3cac..f360e9847a1e 100644 --- a/substrate/frame/transaction-storage/src/benchmarking.rs +++ b/substrate/frame/transaction-storage/src/benchmarking.rs @@ -20,11 +20,11 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{benchmarks, whitelisted_caller}; use frame_support::traits::{Get, OnFinalize, OnInitialize}; use frame_system::{pallet_prelude::BlockNumberFor, EventRecord, Pallet as System, RawOrigin}; use sp_runtime::traits::{Bounded, CheckedDiv, One, Zero}; -use sp_std::*; use sp_transaction_storage_proof::TransactionStorageProof; use crate::Pallet as TransactionStorage; diff --git a/substrate/frame/transaction-storage/src/lib.rs b/substrate/frame/transaction-storage/src/lib.rs index 6e58ee3e585a..68f24526300d 100644 --- a/substrate/frame/transaction-storage/src/lib.rs +++ b/substrate/frame/transaction-storage/src/lib.rs @@ -28,7 +28,11 @@ mod mock; #[cfg(test)] mod tests; +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; +use core::result; use frame_support::{ dispatch::GetDispatchInfo, traits::{ @@ -38,7 +42,6 @@ use frame_support::{ }, }; use sp_runtime::traits::{BlakeTwo256, Dispatchable, Hash, One, Saturating, Zero}; -use sp_std::{prelude::*, result}; use sp_transaction_storage_proof::{ encode_index, random_chunk, InherentError, TransactionStorageProof, CHUNK_SIZE, INHERENT_IDENTIFIER, diff --git a/substrate/frame/treasury/Cargo.toml b/substrate/frame/treasury/Cargo.toml index 33e74b0a4aa2..2727ab809320 100644 --- a/substrate/frame/treasury/Cargo.toml +++ b/substrate/frame/treasury/Cargo.toml @@ -29,7 +29,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } pallet-balances = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } sp-core = { optional = true, workspace = true } [dev-dependencies] @@ -51,7 +50,6 @@ std = [ "sp-core?/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "dep:sp-core", diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index b437e5ef137e..3954489a2d15 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -81,14 +81,16 @@ use core::marker::PhantomData; #[cfg(feature = "runtime-benchmarks")] pub use benchmarking::ArgumentsFactory; +extern crate alloc; + use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; +use alloc::{boxed::Box, collections::btree_map::BTreeMap}; use sp_runtime::{ traits::{AccountIdConversion, CheckedAdd, Saturating, StaticLookup, Zero}, Permill, RuntimeDebug, }; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; use frame_support::{ dispatch::{DispatchResult, DispatchResultWithPostInfo}, @@ -326,7 +328,7 @@ pub mod pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig, I: 'static = ()> { #[serde(skip)] - _config: sp_std::marker::PhantomData<(T, I)>, + _config: core::marker::PhantomData<(T, I)>, } #[pallet::genesis_build] diff --git a/substrate/frame/try-runtime/Cargo.toml b/substrate/frame/try-runtime/Cargo.toml index 16e815975b54..228d96095ac9 100644 --- a/substrate/frame/try-runtime/Cargo.toml +++ b/substrate/frame/try-runtime/Cargo.toml @@ -19,7 +19,6 @@ codec = { features = ["derive"], workspace = true } frame-support = { workspace = true } sp-api = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [features] default = ["std"] @@ -28,6 +27,5 @@ std = [ "frame-support/std", "sp-api/std", "sp-runtime/std", - "sp-std/std", ] try-runtime = ["frame-support/try-runtime", "sp-runtime/try-runtime"] diff --git a/substrate/frame/tx-pause/Cargo.toml b/substrate/frame/tx-pause/Cargo.toml index fbb71513c6ae..861a85881f2d 100644 --- a/substrate/frame/tx-pause/Cargo.toml +++ b/substrate/frame/tx-pause/Cargo.toml @@ -22,7 +22,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } scale-info = { features = ["derive"], workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } pallet-balances = { optional = true, workspace = true } pallet-utility = { optional = true, workspace = true } pallet-proxy = { optional = true, workspace = true } @@ -48,7 +47,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/tx-pause/src/benchmarking.rs b/substrate/frame/tx-pause/src/benchmarking.rs index 126c0837949d..95ae250eff7b 100644 --- a/substrate/frame/tx-pause/src/benchmarking.rs +++ b/substrate/frame/tx-pause/src/benchmarking.rs @@ -18,6 +18,7 @@ #![cfg(feature = "runtime-benchmarks")] use super::{Pallet as TxPause, *}; +use alloc::vec; use frame_benchmarking::v2::*; #[benchmarks] diff --git a/substrate/frame/tx-pause/src/lib.rs b/substrate/frame/tx-pause/src/lib.rs index 5904b5ed3162..68f7a0312554 100644 --- a/substrate/frame/tx-pause/src/lib.rs +++ b/substrate/frame/tx-pause/src/lib.rs @@ -79,6 +79,9 @@ pub mod mock; mod tests; pub mod weights; +extern crate alloc; + +use alloc::vec::Vec; use frame_support::{ dispatch::GetDispatchInfo, pallet_prelude::*, @@ -87,7 +90,6 @@ use frame_support::{ }; use frame_system::pallet_prelude::*; use sp_runtime::{traits::Dispatchable, DispatchResult}; -use sp_std::prelude::*; pub use pallet::*; pub use weights::*; diff --git a/substrate/frame/uniques/Cargo.toml b/substrate/frame/uniques/Cargo.toml index d41d322bb63f..2b1794aa60fe 100644 --- a/substrate/frame/uniques/Cargo.toml +++ b/substrate/frame/uniques/Cargo.toml @@ -23,7 +23,6 @@ frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -44,7 +43,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/uniques/src/benchmarking.rs b/substrate/frame/uniques/src/benchmarking.rs index 80d02f136218..a8a83010c51f 100644 --- a/substrate/frame/uniques/src/benchmarking.rs +++ b/substrate/frame/uniques/src/benchmarking.rs @@ -20,6 +20,7 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{ account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, BenchmarkError, }; @@ -29,7 +30,6 @@ use frame_support::{ }; use frame_system::RawOrigin as SystemOrigin; use sp_runtime::traits::Bounded; -use sp_std::prelude::*; use crate::Pallet as Uniques; diff --git a/substrate/frame/uniques/src/impl_nonfungibles.rs b/substrate/frame/uniques/src/impl_nonfungibles.rs index 0ae055a98d8c..8e4af723f803 100644 --- a/substrate/frame/uniques/src/impl_nonfungibles.rs +++ b/substrate/frame/uniques/src/impl_nonfungibles.rs @@ -18,13 +18,13 @@ //! Implementations for `nonfungibles` traits. use super::*; +use alloc::vec::Vec; use frame_support::{ storage::KeyPrefixIterator, traits::{tokens::nonfungibles::*, Get}, BoundedSlice, }; use sp_runtime::{DispatchError, DispatchResult}; -use sp_std::prelude::*; impl, I: 'static> Inspect<::AccountId> for Pallet { type ItemId = T::ItemId; diff --git a/substrate/frame/uniques/src/lib.rs b/substrate/frame/uniques/src/lib.rs index 2291d19de2bf..dc27c3356234 100644 --- a/substrate/frame/uniques/src/lib.rs +++ b/substrate/frame/uniques/src/lib.rs @@ -42,6 +42,9 @@ mod types; pub mod migration; pub mod weights; +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode}; use frame_support::traits::{ tokens::Locker, BalanceStatus::Reserved, Currency, EnsureOriginWithArg, ReservableCurrency, @@ -51,7 +54,6 @@ use sp_runtime::{ traits::{Saturating, StaticLookup, Zero}, ArithmeticError, RuntimeDebug, }; -use sp_std::prelude::*; pub use pallet::*; pub use types::*; diff --git a/substrate/frame/uniques/src/tests.rs b/substrate/frame/uniques/src/tests.rs index 5dfe43c96888..a8428c420b3e 100644 --- a/substrate/frame/uniques/src/tests.rs +++ b/substrate/frame/uniques/src/tests.rs @@ -21,7 +21,6 @@ use crate::{mock::*, Event, *}; use frame_support::{assert_noop, assert_ok, traits::Currency}; use pallet_balances::Error as BalancesError; use sp_runtime::traits::Dispatchable; -use sp_std::prelude::*; fn items() -> Vec<(u64, u32, u32)> { let mut r: Vec<_> = Account::::iter().map(|x| x.0).collect(); diff --git a/substrate/frame/utility/Cargo.toml b/substrate/frame/utility/Cargo.toml index 0ccdac6be623..f08232de9cd6 100644 --- a/substrate/frame/utility/Cargo.toml +++ b/substrate/frame/utility/Cargo.toml @@ -24,7 +24,6 @@ frame-system = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -48,7 +47,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/utility/src/benchmarking.rs b/substrate/frame/utility/src/benchmarking.rs index 78911fd310e8..467055ecd800 100644 --- a/substrate/frame/utility/src/benchmarking.rs +++ b/substrate/frame/utility/src/benchmarking.rs @@ -20,6 +20,7 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; +use alloc::{vec, vec::Vec}; use frame_benchmarking::v1::{account, benchmarks, whitelisted_caller}; use frame_system::RawOrigin; diff --git a/substrate/frame/utility/src/lib.rs b/substrate/frame/utility/src/lib.rs index 7f963e3637d6..3ce5b4ff8649 100644 --- a/substrate/frame/utility/src/lib.rs +++ b/substrate/frame/utility/src/lib.rs @@ -56,6 +56,9 @@ mod benchmarking; mod tests; pub mod weights; +extern crate alloc; + +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode}; use frame_support::{ dispatch::{extract_actual_weight, GetDispatchInfo, PostDispatchInfo}, @@ -64,7 +67,6 @@ use frame_support::{ use sp_core::TypeId; use sp_io::hashing::blake2_256; use sp_runtime::traits::{BadOrigin, Dispatchable, TrailingZeroInput}; -use sp_std::prelude::*; pub use weights::WeightInfo; pub use pallet::*; @@ -131,7 +133,7 @@ pub mod pallet { /// The limit on the number of batched calls. fn batched_calls_limit() -> u32 { let allocator_limit = sp_core::MAX_POSSIBLE_ALLOCATION; - let call_size = ((sp_std::mem::size_of::<::RuntimeCall>() as u32 + + let call_size = ((core::mem::size_of::<::RuntimeCall>() as u32 + CALL_ALIGN - 1) / CALL_ALIGN) * CALL_ALIGN; // The margin to take into account vec doubling capacity. @@ -146,7 +148,7 @@ pub mod pallet { fn integrity_test() { // If you hit this error, you need to try to `Box` big dispatchable parameters. assert!( - sp_std::mem::size_of::<::RuntimeCall>() as u32 <= CALL_ALIGN, + core::mem::size_of::<::RuntimeCall>() as u32 <= CALL_ALIGN, "Call enum size should be smaller than {} bytes.", CALL_ALIGN, ); diff --git a/substrate/frame/vesting/Cargo.toml b/substrate/frame/vesting/Cargo.toml index 3aca5683465c..64c26174cfdf 100644 --- a/substrate/frame/vesting/Cargo.toml +++ b/substrate/frame/vesting/Cargo.toml @@ -25,7 +25,6 @@ frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -45,7 +44,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/substrate/frame/vesting/src/lib.rs b/substrate/frame/vesting/src/lib.rs index 3868f1a8592e..bfc10efeed79 100644 --- a/substrate/frame/vesting/src/lib.rs +++ b/substrate/frame/vesting/src/lib.rs @@ -56,7 +56,11 @@ mod vesting_info; pub mod migrations; pub mod weights; +extern crate alloc; + +use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; +use core::{fmt::Debug, marker::PhantomData}; use frame_support::{ dispatch::DispatchResult, ensure, @@ -76,7 +80,6 @@ use sp_runtime::{ }, DispatchError, RuntimeDebug, }; -use sp_std::{fmt::Debug, marker::PhantomData, prelude::*}; pub use pallet::*; pub use vesting_info::*; diff --git a/substrate/frame/vesting/src/migrations.rs b/substrate/frame/vesting/src/migrations.rs index 6fe82312b637..33fa5d0df882 100644 --- a/substrate/frame/vesting/src/migrations.rs +++ b/substrate/frame/vesting/src/migrations.rs @@ -18,6 +18,7 @@ //! Storage migrations for the vesting pallet. use super::*; +use alloc::vec; // Migration from single schedule to multiple schedules. pub mod v1 { diff --git a/substrate/frame/whitelist/Cargo.toml b/substrate/frame/whitelist/Cargo.toml index 922f9124d913..c48a15f21631 100644 --- a/substrate/frame/whitelist/Cargo.toml +++ b/substrate/frame/whitelist/Cargo.toml @@ -22,7 +22,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-api = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -44,7 +43,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/substrate/frame/whitelist/src/benchmarking.rs b/substrate/frame/whitelist/src/benchmarking.rs index 7fb5632fc002..cbe6ee4becd0 100644 --- a/substrate/frame/whitelist/src/benchmarking.rs +++ b/substrate/frame/whitelist/src/benchmarking.rs @@ -73,7 +73,7 @@ mod benchmarks { ) -> Result<(), BenchmarkError> { let origin = T::DispatchWhitelistedOrigin::try_successful_origin() .map_err(|_| BenchmarkError::Weightless)?; - let remark = sp_std::vec![1u8; n as usize]; + let remark = alloc::vec![1u8; n as usize]; let call: ::RuntimeCall = frame_system::Call::remark { remark }.into(); let call_weight = call.get_dispatch_info().weight; let encoded_call = call.encode(); @@ -97,7 +97,7 @@ mod benchmarks { fn dispatch_whitelisted_call_with_preimage(n: Linear<1, 10_000>) -> Result<(), BenchmarkError> { let origin = T::DispatchWhitelistedOrigin::try_successful_origin() .map_err(|_| BenchmarkError::Weightless)?; - let remark = sp_std::vec![1u8; n as usize]; + let remark = alloc::vec![1u8; n as usize]; let call: ::RuntimeCall = frame_system::Call::remark { remark }.into(); let call_hash = T::Hashing::hash_of(&call); diff --git a/substrate/frame/whitelist/src/lib.rs b/substrate/frame/whitelist/src/lib.rs index 44551abd1071..de16c2c2da88 100644 --- a/substrate/frame/whitelist/src/lib.rs +++ b/substrate/frame/whitelist/src/lib.rs @@ -40,6 +40,9 @@ mod tests; pub mod weights; pub use weights::WeightInfo; +extern crate alloc; + +use alloc::boxed::Box; use codec::{DecodeLimit, Encode, FullCodec}; use frame_support::{ dispatch::{GetDispatchInfo, PostDispatchInfo}, @@ -49,7 +52,6 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_runtime::traits::{Dispatchable, Hash}; -use sp_std::prelude::*; pub use pallet::*; diff --git a/substrate/primitives/api/Cargo.toml b/substrate/primitives/api/Cargo.toml index f8cbad8e31f0..d6c64a0ada28 100644 --- a/substrate/primitives/api/Cargo.toml +++ b/substrate/primitives/api/Cargo.toml @@ -19,7 +19,6 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { workspace = true } sp-api-proc-macro = { workspace = true } sp-core = { workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } sp-runtime-interface = { workspace = true } sp-externalities = { optional = true, workspace = true } @@ -53,7 +52,6 @@ std = [ "sp-runtime-interface/std", "sp-runtime/std", "sp-state-machine/std", - "sp-std/std", "sp-test-primitives/std", "sp-trie/std", "sp-version/std", diff --git a/substrate/primitives/api/src/lib.rs b/substrate/primitives/api/src/lib.rs index cd8da8ba2374..d254bf20601f 100644 --- a/substrate/primitives/api/src/lib.rs +++ b/substrate/primitives/api/src/lib.rs @@ -70,6 +70,8 @@ // Make doc tests happy extern crate self as sp_api; +extern crate alloc; + /// Private exports used by the macros. /// /// This is seen as internal API and can change at any point. @@ -90,7 +92,9 @@ pub mod __private { pub use std_imports::*; pub use crate::*; + pub use alloc::vec; pub use codec::{self, Decode, DecodeLimit, Encode}; + pub use core::{mem, slice}; pub use scale_info; pub use sp_core::offchain; #[cfg(not(feature = "std"))] @@ -103,7 +107,6 @@ pub mod __private { transaction_validity::TransactionValidity, ExtrinsicInclusionMode, RuntimeString, TransactionOutcome, }; - pub use sp_std::{mem, slice, vec}; pub use sp_version::{create_apis_vec, ApiId, ApisVec, RuntimeVersion}; #[cfg(all(any(target_arch = "riscv32", target_arch = "riscv64"), substrate_runtime))] @@ -833,7 +836,7 @@ decl_runtime_apis! { /// Returns the supported metadata versions. /// /// This can be used to call `metadata_at_version`. - fn metadata_versions() -> sp_std::vec::Vec; + fn metadata_versions() -> alloc::vec::Vec; } } diff --git a/substrate/primitives/application-crypto/Cargo.toml b/substrate/primitives/application-crypto/Cargo.toml index fbf9def20fce..c0508d377f8b 100644 --- a/substrate/primitives/application-crypto/Cargo.toml +++ b/substrate/primitives/application-crypto/Cargo.toml @@ -22,7 +22,6 @@ sp-core = { workspace = true } codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } serde = { optional = true, features = ["alloc", "derive"], workspace = true } -sp-std = { workspace = true } sp-io = { workspace = true } [features] @@ -34,7 +33,6 @@ std = [ "serde/std", "sp-core/std", "sp-io/std", - "sp-std/std", ] # Serde support without relying on std features. diff --git a/substrate/primitives/application-crypto/src/bandersnatch.rs b/substrate/primitives/application-crypto/src/bandersnatch.rs index fc7383815d70..0e21e5d3bce3 100644 --- a/substrate/primitives/application-crypto/src/bandersnatch.rs +++ b/substrate/primitives/application-crypto/src/bandersnatch.rs @@ -18,8 +18,8 @@ //! Bandersnatch VRF application crypto types. use crate::{KeyTypeId, RuntimePublic}; +use alloc::vec::Vec; pub use sp_core::bandersnatch::*; -use sp_std::vec::Vec; mod app { crate::app_crypto!(super, sp_core::testing::BANDERSNATCH); diff --git a/substrate/primitives/application-crypto/src/bls377.rs b/substrate/primitives/application-crypto/src/bls377.rs index 3bd01de139c9..9d346ea61834 100644 --- a/substrate/primitives/application-crypto/src/bls377.rs +++ b/substrate/primitives/application-crypto/src/bls377.rs @@ -18,8 +18,8 @@ //! BLS12-377 crypto applications. use crate::{KeyTypeId, RuntimePublic}; +use alloc::vec::Vec; pub use sp_core::bls::bls377::*; -use sp_std::vec::Vec; mod app { crate::app_crypto!(super, sp_core::testing::BLS377); diff --git a/substrate/primitives/application-crypto/src/ecdsa.rs b/substrate/primitives/application-crypto/src/ecdsa.rs index 439b51dc6045..94d5288584cc 100644 --- a/substrate/primitives/application-crypto/src/ecdsa.rs +++ b/substrate/primitives/application-crypto/src/ecdsa.rs @@ -19,7 +19,7 @@ use crate::{KeyTypeId, RuntimePublic}; -use sp_std::vec::Vec; +use alloc::vec::Vec; pub use sp_core::ecdsa::*; diff --git a/substrate/primitives/application-crypto/src/ecdsa_bls377.rs b/substrate/primitives/application-crypto/src/ecdsa_bls377.rs index 8dee73095fb2..443d214d6772 100644 --- a/substrate/primitives/application-crypto/src/ecdsa_bls377.rs +++ b/substrate/primitives/application-crypto/src/ecdsa_bls377.rs @@ -18,7 +18,7 @@ //! ECDSA and BLS12-377 paired crypto applications. use crate::{KeyTypeId, RuntimePublic}; -use sp_std::vec::Vec; +use alloc::vec::Vec; pub use sp_core::paired_crypto::ecdsa_bls377::*; diff --git a/substrate/primitives/application-crypto/src/ed25519.rs b/substrate/primitives/application-crypto/src/ed25519.rs index addefe7daf64..6769de4e47c3 100644 --- a/substrate/primitives/application-crypto/src/ed25519.rs +++ b/substrate/primitives/application-crypto/src/ed25519.rs @@ -19,7 +19,7 @@ use crate::{KeyTypeId, RuntimePublic}; -use sp_std::vec::Vec; +use alloc::vec::Vec; pub use sp_core::ed25519::*; diff --git a/substrate/primitives/application-crypto/src/lib.rs b/substrate/primitives/application-crypto/src/lib.rs index 2355f1ba527d..37949d7c41de 100644 --- a/substrate/primitives/application-crypto/src/lib.rs +++ b/substrate/primitives/application-crypto/src/lib.rs @@ -20,6 +20,8 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + pub use sp_core::crypto::{key_types, CryptoTypeId, DeriveJunction, KeyTypeId, Ss58Codec}; #[doc(hidden)] pub use sp_core::crypto::{DeriveError, Pair, SecretStringError}; @@ -30,15 +32,17 @@ pub use sp_core::{ RuntimeDebug, }; +#[doc(hidden)] +pub use alloc::vec::Vec; #[doc(hidden)] pub use codec; #[doc(hidden)] +pub use core::ops::Deref; +#[doc(hidden)] pub use scale_info; #[doc(hidden)] #[cfg(feature = "serde")] pub use serde; -#[doc(hidden)] -pub use sp_std::{ops::Deref, vec::Vec}; #[cfg(feature = "bandersnatch-experimental")] pub mod bandersnatch; @@ -357,7 +361,7 @@ macro_rules! app_crypto_public_common { #[doc(hidden)] pub mod module_format_string_prelude { #[cfg(all(not(feature = "std"), feature = "serde"))] - pub use sp_std::alloc::{format, string::String}; + pub use alloc::{format, string::String}; #[cfg(feature = "std")] pub use std::{format, string::String}; } diff --git a/substrate/primitives/application-crypto/src/sr25519.rs b/substrate/primitives/application-crypto/src/sr25519.rs index d411cc253c0d..ba6f0e3ae6b3 100644 --- a/substrate/primitives/application-crypto/src/sr25519.rs +++ b/substrate/primitives/application-crypto/src/sr25519.rs @@ -19,7 +19,7 @@ use crate::{KeyTypeId, RuntimePublic}; -use sp_std::vec::Vec; +use alloc::vec::Vec; pub use sp_core::sr25519::*; diff --git a/substrate/primitives/application-crypto/src/traits.rs b/substrate/primitives/application-crypto/src/traits.rs index 0b59abf272dc..1789d9b96fd8 100644 --- a/substrate/primitives/application-crypto/src/traits.rs +++ b/substrate/primitives/application-crypto/src/traits.rs @@ -18,8 +18,9 @@ use codec::Codec; use scale_info::TypeInfo; +use alloc::vec::Vec; +use core::fmt::Debug; use sp_core::crypto::{CryptoType, CryptoTypeId, IsWrappedBy, KeyTypeId, Pair, Public}; -use sp_std::{fmt::Debug, vec::Vec}; /// Application-specific cryptographic object. /// @@ -47,8 +48,8 @@ pub trait AppCrypto: 'static + Sized + CryptoType { } /// Type which implements Hash in std, not when no-std (std variant). -pub trait MaybeHash: sp_std::hash::Hash {} -impl MaybeHash for T {} +pub trait MaybeHash: core::hash::Hash {} +impl MaybeHash for T {} /// Application-specific key pair. pub trait AppPair: diff --git a/substrate/primitives/arithmetic/Cargo.toml b/substrate/primitives/arithmetic/Cargo.toml index a0d80fc9b504..4a9d5ba234ba 100644 --- a/substrate/primitives/arithmetic/Cargo.toml +++ b/substrate/primitives/arithmetic/Cargo.toml @@ -26,7 +26,6 @@ num-traits = { workspace = true } scale-info = { features = ["derive"], workspace = true } serde = { features = ["alloc", "derive"], optional = true, workspace = true } static_assertions = { workspace = true, default-features = true } -sp-std = { workspace = true } docify = { workspace = true } [dev-dependencies] @@ -43,7 +42,6 @@ std = [ "scale-info/std", "serde/std", "sp-crypto-hashing/std", - "sp-std/std", ] # Serde support without relying on std features. serde = ["dep:serde", "scale-info/serde"] diff --git a/substrate/primitives/core/src/address_uri.rs b/substrate/primitives/core/src/address_uri.rs index d44f3c0c87c4..bbe31b7553bd 100644 --- a/substrate/primitives/core/src/address_uri.rs +++ b/substrate/primitives/core/src/address_uri.rs @@ -18,8 +18,8 @@ //! Little util for parsing an address URI. Replaces regular expressions. #[cfg(not(feature = "std"))] -use sp_std::{ - alloc::string::{String, ToString}, +use alloc::{ + string::{String, ToString}, vec::Vec, }; @@ -97,10 +97,10 @@ impl InvalidCharacterInfo { } } -impl sp_std::fmt::Display for InvalidCharacterInfo { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { +impl core::fmt::Display for InvalidCharacterInfo { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { let (s, pos) = escape_string(&self.0, self.1); - write!(f, "{s}\n{i}^", i = sp_std::iter::repeat(" ").take(pos).collect::()) + write!(f, "{s}\n{i}^", i = core::iter::repeat(" ").take(pos).collect::()) } } diff --git a/substrate/primitives/core/src/bandersnatch.rs b/substrate/primitives/core/src/bandersnatch.rs index 71ee2da53834..25bf4657030f 100644 --- a/substrate/primitives/core/src/bandersnatch.rs +++ b/substrate/primitives/core/src/bandersnatch.rs @@ -31,7 +31,7 @@ use bandersnatch_vrfs::{CanonicalSerialize, SecretKey}; use codec::{Decode, Encode, EncodeLike, MaxEncodedLen}; use scale_info::TypeInfo; -use sp_std::{vec, vec::Vec}; +use alloc::{vec, vec::Vec}; /// Identifier used to match public keys against bandersnatch-vrf keys. pub const CRYPTO_ID: CryptoTypeId = CryptoTypeId(*b"band"); diff --git a/substrate/primitives/core/src/bls.rs b/substrate/primitives/core/src/bls.rs index bb04babb3f18..a86f67844da2 100644 --- a/substrate/primitives/core/src/bls.rs +++ b/substrate/primitives/core/src/bls.rs @@ -28,7 +28,7 @@ use crate::crypto::{ SignatureBytes, UncheckedFrom, }; -use sp_std::vec::Vec; +use alloc::vec::Vec; use w3f_bls::{ DoublePublicKey, DoublePublicKeyScheme, DoubleSignature, EngineBLS, Keypair, Message, diff --git a/substrate/primitives/core/src/crypto.rs b/substrate/primitives/core/src/crypto.rs index b13899fff517..fd7fe7767204 100644 --- a/substrate/primitives/core/src/crypto.rs +++ b/substrate/primitives/core/src/crypto.rs @@ -18,8 +18,14 @@ //! Cryptographic utilities. use crate::{ed25519, sr25519}; +#[cfg(all(not(feature = "std"), feature = "serde"))] +use alloc::{format, string::String, vec}; +use alloc::{str, vec::Vec}; use bip39::{Language, Mnemonic}; use codec::{Decode, Encode, MaxEncodedLen}; +use core::hash::Hash; +#[doc(hidden)] +pub use core::ops::Deref; #[cfg(feature = "std")] use itertools::Itertools; #[cfg(feature = "std")] @@ -27,14 +33,6 @@ use rand::{rngs::OsRng, RngCore}; use scale_info::TypeInfo; pub use secrecy::{ExposeSecret, SecretString}; use sp_runtime_interface::pass_by::PassByInner; -#[doc(hidden)] -pub use sp_std::ops::Deref; -#[cfg(all(not(feature = "std"), feature = "serde"))] -use sp_std::{ - alloc::{format, string::String}, - vec, -}; -use sp_std::{hash::Hash, str, vec::Vec}; pub use ss58_registry::{from_known_address_format, Ss58AddressFormat, Ss58AddressFormatRegistry}; /// Trait to zeroize a memory buffer. pub use zeroize::Zeroize; @@ -245,8 +243,8 @@ pub enum PublicError { } #[cfg(feature = "std")] -impl sp_std::fmt::Debug for PublicError { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl core::fmt::Debug for PublicError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { // Just use the `Display` implementation write!(f, "{}", self) } @@ -587,8 +585,8 @@ impl std::fmt::Display for AccountId32 { } } -impl sp_std::fmt::Debug for AccountId32 { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { +impl core::fmt::Debug for AccountId32 { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { #[cfg(feature = "serde")] { let s = self.to_ss58check(); @@ -624,7 +622,7 @@ impl<'de> serde::Deserialize<'de> for AccountId32 { } #[cfg(feature = "std")] -impl sp_std::str::FromStr for AccountId32 { +impl std::str::FromStr for AccountId32 { type Err = &'static str; fn from_str(s: &str) -> Result { @@ -786,7 +784,7 @@ pub struct SecretUri { pub junctions: Vec, } -impl sp_std::str::FromStr for SecretUri { +impl alloc::str::FromStr for SecretUri { type Err = SecretStringError; fn from_str(s: &str) -> Result { @@ -925,7 +923,7 @@ pub trait Pair: CryptoType + Sized { s: &str, password_override: Option<&str>, ) -> Result<(Self, Option), SecretStringError> { - use sp_std::str::FromStr; + use alloc::str::FromStr; let SecretUri { junctions, phrase, password } = SecretUri::from_str(s)?; let password = password_override.or_else(|| password.as_ref().map(|p| p.expose_secret().as_str())); diff --git a/substrate/primitives/core/src/crypto_bytes.rs b/substrate/primitives/core/src/crypto_bytes.rs index ee5f3482f743..e5130e6d5007 100644 --- a/substrate/primitives/core/src/crypto_bytes.rs +++ b/substrate/primitives/core/src/crypto_bytes.rs @@ -34,7 +34,7 @@ use crate::crypto::Ss58Codec; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; #[cfg(all(not(feature = "std"), feature = "serde"))] -use sp_std::alloc::{format, string::String}; +use alloc::{format, string::String}; pub use public_bytes::*; pub use signature_bytes::*; @@ -256,7 +256,7 @@ mod public_bytes { impl Public for PublicBytes where Self: CryptoType {} - impl sp_std::fmt::Debug for PublicBytes + impl core::fmt::Debug for PublicBytes where Self: CryptoType, { @@ -267,7 +267,7 @@ mod public_bytes { } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } @@ -362,17 +362,17 @@ mod signature_bytes { } } - impl sp_std::fmt::Debug for SignatureBytes + impl core::fmt::Debug for SignatureBytes where Self: CryptoType, { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "{}", crate::hexdisplay::HexDisplay::from(&&self.0[..])) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } diff --git a/substrate/primitives/core/src/ecdsa.rs b/substrate/primitives/core/src/ecdsa.rs index 9cba8cc3d352..d11811ff2af6 100644 --- a/substrate/primitives/core/src/ecdsa.rs +++ b/substrate/primitives/core/src/ecdsa.rs @@ -22,6 +22,8 @@ use crate::crypto::{ SecretStringError, SignatureBytes, }; +#[cfg(not(feature = "std"))] +use alloc::vec::Vec; #[cfg(not(feature = "std"))] use k256::ecdsa::{SigningKey as SecretKey, VerifyingKey}; #[cfg(feature = "std")] @@ -29,8 +31,6 @@ use secp256k1::{ ecdsa::{RecoverableSignature, RecoveryId}, Message, PublicKey, SecretKey, SECP256K1, }; -#[cfg(not(feature = "std"))] -use sp_std::vec::Vec; /// An identifier used to match public keys against ecdsa keys pub const CRYPTO_ID: CryptoTypeId = CryptoTypeId(*b"ecds"); diff --git a/substrate/primitives/core/src/ed25519.rs b/substrate/primitives/core/src/ed25519.rs index 269b6bfcd8dc..401f9a39d567 100644 --- a/substrate/primitives/core/src/ed25519.rs +++ b/substrate/primitives/core/src/ed25519.rs @@ -24,7 +24,7 @@ use crate::crypto::{ use ed25519_zebra::{SigningKey, VerificationKey}; -use sp_std::vec::Vec; +use alloc::vec::Vec; /// An identifier used to match public keys against ed25519 keys pub const CRYPTO_ID: CryptoTypeId = CryptoTypeId(*b"ed25"); diff --git a/substrate/primitives/core/src/hexdisplay.rs b/substrate/primitives/core/src/hexdisplay.rs index 72bb24a186e5..1902b8cca958 100644 --- a/substrate/primitives/core/src/hexdisplay.rs +++ b/substrate/primitives/core/src/hexdisplay.rs @@ -27,8 +27,8 @@ impl<'a> HexDisplay<'a> { } } -impl<'a> sp_std::fmt::Display for HexDisplay<'a> { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> { +impl<'a> core::fmt::Display for HexDisplay<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> { if self.0.len() < 1027 { for byte in self.0 { f.write_fmt(format_args!("{:02x}", byte))?; @@ -46,8 +46,8 @@ impl<'a> sp_std::fmt::Display for HexDisplay<'a> { } } -impl<'a> sp_std::fmt::Debug for HexDisplay<'a> { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> { +impl<'a> core::fmt::Debug for HexDisplay<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> { for byte in self.0 { f.write_fmt(format_args!("{:02x}", byte))?; } @@ -73,7 +73,7 @@ impl AsBytesRef for [u8] { } } -impl AsBytesRef for sp_std::vec::Vec { +impl AsBytesRef for alloc::vec::Vec { fn as_bytes_ref(&self) -> &[u8] { self } diff --git a/substrate/primitives/core/src/lib.rs b/substrate/primitives/core/src/lib.rs index 78ec92e4be98..46503921453d 100644 --- a/substrate/primitives/core/src/lib.rs +++ b/substrate/primitives/core/src/lib.rs @@ -31,15 +31,18 @@ macro_rules! map { ); } +extern crate alloc; + +use alloc::vec::Vec; #[doc(hidden)] pub use codec::{Decode, Encode, MaxEncodedLen}; +use core::ops::Deref; use scale_info::TypeInfo; #[cfg(feature = "serde")] pub use serde; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use sp_runtime_interface::pass_by::{PassByEnum, PassByInner}; -use sp_std::{ops::Deref, prelude::*}; pub use sp_debug_derive::RuntimeDebug; @@ -137,7 +140,7 @@ impl codec::WrapperTypeDecode for Bytes { } #[cfg(feature = "std")] -impl sp_std::str::FromStr for Bytes { +impl alloc::str::FromStr for Bytes { type Err = bytes::FromHexError; fn from_str(s: &str) -> Result { @@ -156,7 +159,7 @@ impl OpaqueMetadata { } } -impl sp_std::ops::Deref for OpaqueMetadata { +impl Deref for OpaqueMetadata { type Target = Vec; fn deref(&self) -> &Self::Target { @@ -313,7 +316,7 @@ pub fn to_substrate_wasm_fn_return_value(value: &impl Encode) -> u64 { // Leak the output vector to avoid it being freed. // This is fine in a WASM context since the heap // will be discarded after the call. - sp_std::mem::forget(encoded); + core::mem::forget(encoded); res } @@ -456,7 +459,7 @@ macro_rules! generate_feature_enabled_macro { /// // Will add the code depending on the feature being enabled or not. #[doc = concat!(stringify!($macro_name), "!( println!(\"Hello\") )")] /// ``` - // https://github.com/rust-lang/rust/pull/52234 + // https://github.com/rust-lang/rust/pull/52234 pub use [<_ $macro_name>] as $macro_name; } }; diff --git a/substrate/primitives/core/src/offchain/mod.rs b/substrate/primitives/core/src/offchain/mod.rs index cef495dfaacd..9be86e85d587 100644 --- a/substrate/primitives/core/src/offchain/mod.rs +++ b/substrate/primitives/core/src/offchain/mod.rs @@ -18,10 +18,10 @@ //! Offchain workers types use crate::{OpaquePeerId, RuntimeDebug}; +use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_runtime_interface::pass_by::{PassByCodec, PassByEnum, PassByInner}; -use sp_std::prelude::{Box, Vec}; pub use crate::crypto::KeyTypeId; diff --git a/substrate/primitives/core/src/paired_crypto.rs b/substrate/primitives/core/src/paired_crypto.rs index 260e86b6ff9c..57bc5b006197 100644 --- a/substrate/primitives/core/src/paired_crypto.rs +++ b/substrate/primitives/core/src/paired_crypto.rs @@ -24,7 +24,7 @@ use crate::crypto::{ PublicBytes, SecretStringError, Signature as SignatureT, SignatureBytes, UncheckedFrom, }; -use sp_std::vec::Vec; +use alloc::vec::Vec; /// ECDSA and BLS12-377 paired crypto scheme #[cfg(feature = "bls-experimental")] diff --git a/substrate/primitives/core/src/sr25519.rs b/substrate/primitives/core/src/sr25519.rs index 54b9a98db3d2..48780f2ccff9 100644 --- a/substrate/primitives/core/src/sr25519.rs +++ b/substrate/primitives/core/src/sr25519.rs @@ -25,25 +25,25 @@ use crate::crypto::Ss58Codec; use crate::crypto::{ CryptoBytes, DeriveError, DeriveJunction, Pair as TraitPair, SecretStringError, }; +use alloc::vec::Vec; #[cfg(feature = "full_crypto")] use schnorrkel::signing_context; use schnorrkel::{ derive::{ChainCode, Derivation, CHAIN_CODE_LENGTH}, ExpansionMode, Keypair, MiniSecretKey, PublicKey, SecretKey, }; -use sp_std::vec::Vec; use crate::crypto::{CryptoType, CryptoTypeId, Derive, Public as TraitPublic, SignatureBytes}; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; +#[cfg(all(not(feature = "std"), feature = "serde"))] +use alloc::{format, string::String}; use schnorrkel::keys::{MINI_SECRET_KEY_LENGTH, SECRET_KEY_LENGTH}; #[cfg(feature = "serde")] use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "std")] use sp_runtime_interface::pass_by::PassByInner; -#[cfg(all(not(feature = "std"), feature = "serde"))] -use sp_std::alloc::{format, string::String}; // signing context const SIGNING_CTX: &[u8] = b"substrate"; @@ -100,15 +100,15 @@ impl std::fmt::Display for Public { } } -impl sp_std::fmt::Debug for Public { +impl core::fmt::Debug for Public { #[cfg(feature = "std")] - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { let s = self.to_ss58check(); write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(self.inner()), &s[0..8]) } #[cfg(not(feature = "std"))] - fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } diff --git a/substrate/primitives/io/Cargo.toml b/substrate/primitives/io/Cargo.toml index 6b58ea70b8e5..923efc3b8764 100644 --- a/substrate/primitives/io/Cargo.toml +++ b/substrate/primitives/io/Cargo.toml @@ -25,7 +25,6 @@ codec = { features = [ sp-core = { workspace = true } sp-crypto-hashing = { workspace = true } sp-keystore = { optional = true, workspace = true } -sp-std = { workspace = true } libsecp256k1 = { optional = true, workspace = true, default-features = true } sp-state-machine = { optional = true, workspace = true } sp-runtime-interface = { workspace = true } @@ -67,7 +66,6 @@ std = [ "sp-keystore/std", "sp-runtime-interface/std", "sp-state-machine/std", - "sp-std/std", "sp-tracing/std", "sp-trie/std", "tracing-core/std", diff --git a/substrate/primitives/io/src/lib.rs b/substrate/primitives/io/src/lib.rs index 67e822ba7e24..b39a06ed2115 100644 --- a/substrate/primitives/io/src/lib.rs +++ b/substrate/primitives/io/src/lib.rs @@ -77,7 +77,9 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(enable_alloc_error_handler, feature(alloc_error_handler))] -use sp_std::vec::Vec; +extern crate alloc; + +use alloc::vec::Vec; #[cfg(feature = "std")] use tracing; @@ -1771,7 +1773,7 @@ pub fn unreachable() -> ! { #[panic_handler] #[no_mangle] pub fn panic(info: &core::panic::PanicInfo) -> ! { - let message = sp_std::alloc::format!("{}", info); + let message = alloc::format!("{}", info); #[cfg(feature = "improved_panic_error_reporting")] { panic_handler::abort_on_panic(&message); diff --git a/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs b/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs index 0d05dd9aa51e..d0eb382cdc56 100644 --- a/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs +++ b/substrate/primitives/runtime-interface/proc-macro/src/pass_by/enum_.rs @@ -54,7 +54,7 @@ pub fn derive_impl(input: DeriveInput) -> Result { impl TryFrom for #ident { type Error = (); - fn try_from(inner: u8) -> #crate_::sp_std::result::Result { + fn try_from(inner: u8) -> core::result::Result { match inner { #( #try_from_variants, )* _ => Err(()), diff --git a/substrate/primitives/runtime-interface/src/impls.rs b/substrate/primitives/runtime-interface/src/impls.rs index 3530b62662a5..daf5725e7f51 100644 --- a/substrate/primitives/runtime-interface/src/impls.rs +++ b/substrate/primitives/runtime-interface/src/impls.rs @@ -35,10 +35,12 @@ use sp_wasm_interface::{FunctionContext, Result}; use codec::{Decode, Encode}; -use sp_std::{any::TypeId, mem, vec::Vec}; +use core::{any::TypeId, mem}; + +use alloc::vec::Vec; #[cfg(feature = "std")] -use sp_std::borrow::Cow; +use alloc::borrow::Cow; // Make sure that our assumptions for storing a pointer + its size in `u64` is valid. #[cfg(all(not(feature = "std"), not(feature = "disable_target_static_assertions")))] @@ -337,7 +339,7 @@ impl IntoPreallocatedFFIValue for [u8; N] { } } -impl PassBy for sp_std::result::Result { +impl PassBy for core::result::Result { type PassBy = Codec; } diff --git a/substrate/primitives/runtime-interface/src/lib.rs b/substrate/primitives/runtime-interface/src/lib.rs index f6ef27789b36..d6dcb69958af 100644 --- a/substrate/primitives/runtime-interface/src/lib.rs +++ b/substrate/primitives/runtime-interface/src/lib.rs @@ -111,6 +111,8 @@ extern crate self as sp_runtime_interface; +extern crate alloc; + #[doc(hidden)] #[cfg(feature = "std")] pub use sp_wasm_interface; diff --git a/substrate/primitives/runtime-interface/src/pass_by.rs b/substrate/primitives/runtime-interface/src/pass_by.rs index 103e9c162205..dce0b8e4bddb 100644 --- a/substrate/primitives/runtime-interface/src/pass_by.rs +++ b/substrate/primitives/runtime-interface/src/pass_by.rs @@ -33,10 +33,10 @@ use crate::wasm::*; #[cfg(feature = "std")] use sp_wasm_interface::{FunctionContext, Pointer, Result}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; #[cfg(not(feature = "std"))] -use sp_std::vec::Vec; +use alloc::vec::Vec; /// Derive macro for implementing [`PassBy`] with the [`Codec`] strategy. /// diff --git a/substrate/primitives/runtime-interface/test-wasm/Cargo.toml b/substrate/primitives/runtime-interface/test-wasm/Cargo.toml index 759ab99ceacc..77e77c707d9e 100644 --- a/substrate/primitives/runtime-interface/test-wasm/Cargo.toml +++ b/substrate/primitives/runtime-interface/test-wasm/Cargo.toml @@ -20,7 +20,6 @@ bytes = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime-interface = { workspace = true } -sp-std = { workspace = true } [build-dependencies] substrate-wasm-builder = { optional = true, workspace = true, default-features = true } @@ -32,6 +31,5 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime-interface/std", - "sp-std/std", "substrate-wasm-builder", ] diff --git a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs index 2b3fc728f6ff..545f1ff4a115 100644 --- a/substrate/primitives/runtime-interface/test-wasm/src/lib.rs +++ b/substrate/primitives/runtime-interface/test-wasm/src/lib.rs @@ -19,11 +19,14 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + use sp_runtime_interface::runtime_interface; #[cfg(not(feature = "std"))] -use sp_std::{mem, prelude::*}; +use core::mem; +use alloc::{vec, vec::Vec}; use sp_core::{sr25519::Public, wasm_export_functions}; // Include the WASM binary @@ -229,7 +232,7 @@ wasm_export_functions! { fn test_invalid_utf8_data_should_return_an_error() { let data = vec![0, 159, 146, 150]; // I'm an evil hacker, trying to hack! - let data_str = unsafe { sp_std::str::from_utf8_unchecked(&data) }; + let data_str = unsafe { alloc::str::from_utf8_unchecked(&data) }; test_api::invalid_utf8_data(data_str); } diff --git a/substrate/primitives/runtime/src/generic/block.rs b/substrate/primitives/runtime/src/generic/block.rs index 05146e880cb1..8ed79c7c8dcf 100644 --- a/substrate/primitives/runtime/src/generic/block.rs +++ b/substrate/primitives/runtime/src/generic/block.rs @@ -31,8 +31,8 @@ use crate::{ }, Justifications, }; +use alloc::vec::Vec; use sp_core::RuntimeDebug; -use sp_std::prelude::*; /// Something to identify a block. #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)] diff --git a/substrate/primitives/runtime/src/generic/digest.rs b/substrate/primitives/runtime/src/generic/digest.rs index d7db0f91a482..c639576a2867 100644 --- a/substrate/primitives/runtime/src/generic/digest.rs +++ b/substrate/primitives/runtime/src/generic/digest.rs @@ -17,12 +17,11 @@ //! Generic implementation of a digest. +#[cfg(all(not(feature = "std"), feature = "serde"))] +use alloc::format; +use alloc::vec::Vec; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; -#[cfg(all(not(feature = "std"), feature = "serde"))] -use sp_std::alloc::format; - -use sp_std::prelude::*; use crate::{ codec::{Decode, Encode, Error, Input}, diff --git a/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs b/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs index df1f5645f048..499b7c5f5836 100644 --- a/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs +++ b/substrate/primitives/runtime/src/generic/unchecked_extrinsic.rs @@ -26,12 +26,13 @@ use crate::{ transaction_validity::{InvalidTransaction, TransactionValidityError}, OpaqueExtrinsic, }; +#[cfg(all(not(feature = "std"), feature = "serde"))] +use alloc::format; +use alloc::{vec, vec::Vec}; use codec::{Compact, Decode, Encode, EncodeLike, Error, Input}; +use core::fmt; use scale_info::{build::Fields, meta_type, Path, StaticTypeInfo, Type, TypeInfo, TypeParameter}; use sp_io::hashing::blake2_256; -#[cfg(all(not(feature = "std"), feature = "serde"))] -use sp_std::alloc::format; -use sp_std::{fmt, prelude::*}; /// Current version of the [`UncheckedExtrinsic`] encoded format. /// @@ -316,7 +317,7 @@ where Extra: SignedExtension, { fn encode(&self) -> Vec { - let mut tmp = Vec::with_capacity(sp_std::mem::size_of::()); + let mut tmp = Vec::with_capacity(core::mem::size_of::()); // 1 byte version id. match self.signature.as_ref() { @@ -437,7 +438,7 @@ mod tests { type AdditionalSigned = (); type Pre = (); - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } diff --git a/substrate/primitives/runtime/src/lib.rs b/substrate/primitives/runtime/src/lib.rs index 046909b9a38d..d313d23395a0 100644 --- a/substrate/primitives/runtime/src/lib.rs +++ b/substrate/primitives/runtime/src/lib.rs @@ -45,6 +45,11 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +#[doc(hidden)] +extern crate alloc; + +#[doc(hidden)] +pub use alloc::vec::Vec; #[doc(hidden)] pub use codec; #[doc(hidden)] @@ -73,12 +78,12 @@ use sp_core::{ hash::{H256, H512}, sr25519, }; -use sp_std::prelude::*; +#[cfg(all(not(feature = "std"), feature = "serde"))] +use alloc::format; +use alloc::vec; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; -#[cfg(all(not(feature = "std"), feature = "serde"))] -use sp_std::alloc::format; pub mod curve; pub mod generic; @@ -191,7 +196,7 @@ impl Justifications { impl IntoIterator for Justifications { type Item = Justification; - type IntoIter = sp_std::vec::IntoIter; + type IntoIter = alloc::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() @@ -508,11 +513,11 @@ impl From for DispatchOutcome { /// This is the legacy return type of `Dispatchable`. It is still exposed for compatibility reasons. /// The new return type is `DispatchResultWithInfo`. FRAME runtimes should use /// `frame_support::dispatch::DispatchResult`. -pub type DispatchResult = sp_std::result::Result<(), DispatchError>; +pub type DispatchResult = core::result::Result<(), DispatchError>; /// Return type of a `Dispatchable` which contains the `DispatchResult` and additional information /// about the `Dispatchable` that is only known post dispatch. -pub type DispatchResultWithInfo = sp_std::result::Result>; +pub type DispatchResultWithInfo = core::result::Result>; /// Reason why a pallet call failed. #[derive(Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)] @@ -911,14 +916,14 @@ impl OpaqueExtrinsic { } } -impl sp_std::fmt::Debug for OpaqueExtrinsic { +impl core::fmt::Debug for OpaqueExtrinsic { #[cfg(feature = "std")] - fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { write!(fmt, "{}", sp_core::hexdisplay::HexDisplay::from(&self.0)) } #[cfg(not(feature = "std"))] - fn fmt(&self, _fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn fmt(&self, _fmt: &mut core::fmt::Formatter) -> core::fmt::Result { Ok(()) } } diff --git a/substrate/primitives/runtime/src/multiaddress.rs b/substrate/primitives/runtime/src/multiaddress.rs index c435606312e4..4382405a8ebc 100644 --- a/substrate/primitives/runtime/src/multiaddress.rs +++ b/substrate/primitives/runtime/src/multiaddress.rs @@ -17,8 +17,8 @@ //! MultiAddress type is a wrapper for multiple downstream account formats. +use alloc::vec::Vec; use codec::{Decode, Encode}; -use sp_std::vec::Vec; /// A multi-format address wrapper for on-chain accounts. #[derive(Encode, Decode, PartialEq, Eq, Clone, crate::RuntimeDebug, scale_info::TypeInfo)] diff --git a/substrate/primitives/runtime/src/offchain/http.rs b/substrate/primitives/runtime/src/offchain/http.rs index bacc0073825b..798991645402 100644 --- a/substrate/primitives/runtime/src/offchain/http.rs +++ b/substrate/primitives/runtime/src/offchain/http.rs @@ -48,15 +48,13 @@ //! assert_eq!(body.error(), &None); //! ``` +use alloc::{str, vec, vec::Vec}; use sp_core::{ offchain::{ HttpError, HttpRequestId as RequestId, HttpRequestStatus as RequestStatus, Timestamp, }, RuntimeDebug, }; -#[cfg(not(feature = "std"))] -use sp_std::prelude::vec; -use sp_std::{prelude::Vec, str}; /// Request method (HTTP verb) #[derive(Clone, PartialEq, Eq, RuntimeDebug)] diff --git a/substrate/primitives/runtime/src/runtime_logger.rs b/substrate/primitives/runtime/src/runtime_logger.rs index 6f1e738eb0e7..79984b135672 100644 --- a/substrate/primitives/runtime/src/runtime_logger.rs +++ b/substrate/primitives/runtime/src/runtime_logger.rs @@ -53,7 +53,7 @@ impl log::Log for RuntimeLogger { } fn log(&self, record: &log::Record) { - use sp_std::fmt::Write; + use core::fmt::Write; let mut w = sp_std::Writer::default(); let _ = ::core::write!(&mut w, "{}", record.args()); diff --git a/substrate/primitives/runtime/src/runtime_string.rs b/substrate/primitives/runtime/src/runtime_string.rs index 607ae59db632..71aacf07a762 100644 --- a/substrate/primitives/runtime/src/runtime_string.rs +++ b/substrate/primitives/runtime/src/runtime_string.rs @@ -15,9 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use alloc::vec::Vec; use codec::{Decode, Encode}; use sp_core::RuntimeDebug; -use sp_std::vec::Vec; /// A string that wraps a `&'static str` in the runtime and `String`/`Vec` on decode. #[derive(Eq, RuntimeDebug, Clone)] @@ -50,7 +50,7 @@ macro_rules! format_runtime_string { } #[cfg(not(feature = "std"))] { - sp_runtime::RuntimeString::Owned(sp_std::alloc::format!($($args)*).as_bytes().to_vec()) + sp_runtime::RuntimeString::Owned(alloc::format!($($args)*).as_bytes().to_vec()) } }}; } diff --git a/substrate/primitives/runtime/src/traits.rs b/substrate/primitives/runtime/src/traits.rs index d023aa045dbe..25ef15eaf56e 100644 --- a/substrate/primitives/runtime/src/traits.rs +++ b/substrate/primitives/runtime/src/traits.rs @@ -26,7 +26,10 @@ use crate::{ }, DispatchResult, }; +use alloc::vec::Vec; use codec::{Codec, Decode, Encode, EncodeLike, FullCodec, MaxEncodedLen}; +#[doc(hidden)] +pub use core::{fmt::Debug, marker::PhantomData}; use impl_trait_for_tuples::impl_for_tuples; #[cfg(feature = "serde")] use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -44,9 +47,6 @@ pub use sp_core::{ parameter_types, ConstBool, ConstI128, ConstI16, ConstI32, ConstI64, ConstI8, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Get, GetDefault, TryCollect, TypedGet, }; -#[doc(hidden)] -pub use sp_std::marker::PhantomData; -use sp_std::{self, fmt::Debug, prelude::*}; #[cfg(feature = "std")] use std::fmt::Display; #[cfg(feature = "std")] @@ -322,7 +322,7 @@ impl TryMorph for Identity { } /// Implementation of `Morph` which converts between types using `Into`. -pub struct MorphInto(sp_std::marker::PhantomData); +pub struct MorphInto(core::marker::PhantomData); impl> Morph for MorphInto { type Outcome = T; fn morph(a: A) -> T { @@ -331,7 +331,7 @@ impl> Morph for MorphInto { } /// Implementation of `TryMorph` which attempts to convert between types using `TryInto`. -pub struct TryMorphInto(sp_std::marker::PhantomData); +pub struct TryMorphInto(core::marker::PhantomData); impl> TryMorph for TryMorphInto { type Outcome = T; fn try_morph(a: A) -> Result { @@ -692,7 +692,7 @@ impl MaybeEquivalence for Tuple { /// Adapter which turns a [Get] implementation into a [Convert] implementation which always returns /// in the same value no matter the input. -pub struct ConvertToValue(sp_std::marker::PhantomData); +pub struct ConvertToValue(core::marker::PhantomData); impl> Convert for ConvertToValue { fn convert(_: X) -> Y { T::get() @@ -934,17 +934,17 @@ impl Clear for T { pub trait SimpleBitOps: Sized + Clear - + sp_std::ops::BitOr - + sp_std::ops::BitXor - + sp_std::ops::BitAnd + + core::ops::BitOr + + core::ops::BitXor + + core::ops::BitAnd { } impl< T: Sized + Clear - + sp_std::ops::BitOr - + sp_std::ops::BitXor - + sp_std::ops::BitAnd, + + core::ops::BitOr + + core::ops::BitXor + + core::ops::BitAnd, > SimpleBitOps for T { } @@ -988,7 +988,7 @@ pub trait HashOutput: + MaybeDisplay + MaybeFromStr + Debug - + sp_std::hash::Hash + + core::hash::Hash + AsRef<[u8]> + AsMut<[u8]> + Copy @@ -1008,7 +1008,7 @@ impl HashOutput for T where + MaybeDisplay + MaybeFromStr + Debug - + sp_std::hash::Hash + + core::hash::Hash + AsRef<[u8]> + AsMut<[u8]> + Copy @@ -1131,7 +1131,7 @@ sp_core::impl_maybe_marker!( trait MaybeFromStr: FromStr; /// A type that implements Hash when in std environment. - trait MaybeHash: sp_std::hash::Hash; + trait MaybeHash: core::hash::Hash; ); sp_core::impl_maybe_marker_std_or_serde!( @@ -1158,7 +1158,7 @@ pub trait BlockNumber: + MaybeSerializeDeserialize + MaybeFromStr + Debug - + sp_std::hash::Hash + + core::hash::Hash + Copy + MaybeDisplay + AtLeast32BitUnsigned @@ -1176,7 +1176,7 @@ impl< + MaybeSerializeDeserialize + MaybeFromStr + Debug - + sp_std::hash::Hash + + core::hash::Hash + Copy + MaybeDisplay + AtLeast32BitUnsigned @@ -1599,7 +1599,7 @@ pub trait SignedExtension: /// This method provides a default implementation that returns a vec containing a single /// [`SignedExtensionMetadata`]. fn metadata() -> Vec { - sp_std::vec![SignedExtensionMetadata { + alloc::vec![SignedExtensionMetadata { identifier: Self::IDENTIFIER, ty: scale_info::meta_type::(), additional_signed: scale_info::meta_type::() @@ -1702,7 +1702,7 @@ impl SignedExtension for () { type Call = (); type Pre = (); const IDENTIFIER: &'static str = "UnitSignedExtension"; - fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { + fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> { Ok(()) } fn pre_dispatch( @@ -2035,7 +2035,7 @@ macro_rules! impl_opaque_keys_inner { /// The generated key pairs are stored in the keystore. /// /// Returns the concatenated SCALE encoded public keys. - pub fn generate(seed: Option<$crate::sp_std::vec::Vec>) -> $crate::sp_std::vec::Vec { + pub fn generate(seed: Option<$crate::Vec>) -> $crate::Vec { let keys = Self{ $( $field: < @@ -2051,7 +2051,7 @@ macro_rules! impl_opaque_keys_inner { /// Converts `Self` into a `Vec` of `(raw public key, KeyTypeId)`. pub fn into_raw_public_keys( self, - ) -> $crate::sp_std::vec::Vec<($crate::sp_std::vec::Vec, $crate::KeyTypeId)> { + ) -> $crate::Vec<($crate::Vec, $crate::KeyTypeId)> { let mut keys = Vec::new(); $( keys.push(( @@ -2073,7 +2073,7 @@ macro_rules! impl_opaque_keys_inner { /// Returns `None` when the decoding failed, otherwise `Some(_)`. pub fn decode_into_raw_public_keys( encoded: &[u8], - ) -> Option<$crate::sp_std::vec::Vec<($crate::sp_std::vec::Vec, $crate::KeyTypeId)>> { + ) -> Option<$crate::Vec<($crate::Vec, $crate::KeyTypeId)>> { ::decode(&mut &encoded[..]) .ok() .map(|s| s.into_raw_public_keys()) diff --git a/substrate/primitives/runtime/src/transaction_validity.rs b/substrate/primitives/runtime/src/transaction_validity.rs index 836948493823..ffff94e17461 100644 --- a/substrate/primitives/runtime/src/transaction_validity.rs +++ b/substrate/primitives/runtime/src/transaction_validity.rs @@ -21,8 +21,8 @@ use crate::{ codec::{Decode, Encode}, RuntimeDebug, }; +use alloc::{vec, vec::Vec}; use scale_info::TypeInfo; -use sp_std::prelude::*; /// Priority for a transaction. Additive. Higher is better. pub type TransactionPriority = u64; diff --git a/substrate/primitives/version/src/lib.rs b/substrate/primitives/version/src/lib.rs index 789c507742f7..55dea364eef4 100644 --- a/substrate/primitives/version/src/lib.rs +++ b/substrate/primitives/version/src/lib.rs @@ -33,6 +33,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; #[cfg(feature = "std")] @@ -40,6 +42,8 @@ use std::collections::HashSet; #[cfg(feature = "std")] use std::fmt; +#[doc(hidden)] +pub use alloc::borrow::Cow; use codec::{Decode, Encode, Input}; use scale_info::TypeInfo; use sp_runtime::RuntimeString; @@ -139,13 +143,13 @@ pub use sp_version_proc_macro::runtime_version; pub type ApiId = [u8; 8]; /// A vector of pairs of `ApiId` and a `u32` for version. -pub type ApisVec = sp_std::borrow::Cow<'static, [(ApiId, u32)]>; +pub type ApisVec = alloc::borrow::Cow<'static, [(ApiId, u32)]>; /// Create a vector of Api declarations. #[macro_export] macro_rules! create_apis_vec { ( $y:expr ) => { - $crate::sp_std::borrow::Cow::Borrowed(&$y) + $crate::Cow::Borrowed(&$y) }; } @@ -409,9 +413,9 @@ impl GetNativeVersion for std::sync::Arc { #[cfg(feature = "serde")] mod apis_serialize { use super::*; + use alloc::vec::Vec; use impl_serde::serialize as bytes; use serde::{de, ser::SerializeTuple, Serializer}; - use sp_std::vec::Vec; #[derive(Serialize)] struct ApiId<'a>(#[serde(serialize_with = "serialize_bytesref")] &'a super::ApiId, &'a u32); @@ -446,7 +450,7 @@ mod apis_serialize { impl<'de> de::Visitor<'de> for Visitor { type Value = ApisVec; - fn expecting(&self, formatter: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result { formatter.write_str("a sequence of api id and version tuples") } diff --git a/substrate/test-utils/runtime/src/lib.rs b/substrate/test-utils/runtime/src/lib.rs index a13441302e4d..d1a3eaa2daa9 100644 --- a/substrate/test-utils/runtime/src/lib.rs +++ b/substrate/test-utils/runtime/src/lib.rs @@ -27,7 +27,6 @@ pub mod extrinsic; pub mod genesismap; pub mod substrate_test_pallet; -use alloc::boxed::Box; #[cfg(not(feature = "std"))] use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; diff --git a/templates/minimal/runtime/src/lib.rs b/templates/minimal/runtime/src/lib.rs index 8c7867f4cc8c..08ad537ecdd1 100644 --- a/templates/minimal/runtime/src/lib.rs +++ b/templates/minimal/runtime/src/lib.rs @@ -23,6 +23,9 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +extern crate alloc; + +use alloc::{vec, vec::Vec}; use frame::{ deps::frame_support::{ genesis_builder_helper::{build_state, get_preset}, diff --git a/templates/parachain/runtime/src/lib.rs b/templates/parachain/runtime/src/lib.rs index 012ad1d097bf..f53871bb1850 100644 --- a/templates/parachain/runtime/src/lib.rs +++ b/templates/parachain/runtime/src/lib.rs @@ -13,7 +13,7 @@ mod configs; mod weights; extern crate alloc; -use alloc::{boxed::Box, vec::Vec}; +use alloc::vec::Vec; use smallvec::smallvec; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, diff --git a/templates/solochain/runtime/src/lib.rs b/templates/solochain/runtime/src/lib.rs index 936ecd1bd388..9de95ac95695 100644 --- a/templates/solochain/runtime/src/lib.rs +++ b/templates/solochain/runtime/src/lib.rs @@ -4,7 +4,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); extern crate alloc; -use alloc::{boxed::Box, vec, vec::Vec}; +use alloc::{vec, vec::Vec}; use pallet_grandpa::AuthorityId as GrandpaId; use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId;