diff --git a/Cargo.lock b/Cargo.lock index 4a7d47eb0f7802b0352c57a568d634ace0ce684a..9972285780f35edd35aad46c8137c71ae6a28564 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 d81f727b41b9f5382d519c7ea84f625dbd796790..0d82cf64874322c2d9e6e2cb64ed742d35bc58e5 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 8f8d666bd1433ff70556e9867edc7861647dbebf..38ba84748c1e38b8dd3c1fcdd2f8d6351299b18c 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 <http://www.gnu.org/licenses/>. -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 692a1fb537a83b5493c207688fd5d40be5321be9..e32ec6a41a4bf00db5e5db07235bf43bbad1dbf6 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 a5d7c22a2ec89b17c2115a4dd56e4ee935ca51b4..c7eaa45958b0b002a00ec8210d5044bd56aa0569 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 1b6ac4cf07dff2341c366a18e103f7e0ec49e2ac..c08148928b7cec891b8f80cb856714c24b04d809 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 560d477b2a850d11fbc2202b900add53351de476..c1a8568bdd834f0e754bdad20a5a11246cc6ac31 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 4605dd325bee5145974ddc7bca4b5900ad2bc0ed..4c9e61458a87c456766880351da7ecbcce30a92c 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[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<T, I>(sp_std::marker::PhantomData<(T, I)>); +pub struct BlockExecutor<T, I>(core::marker::PhantomData<(T, I)>); impl<Block, T, I> ExecuteBlock<Block> for BlockExecutor<T, I> where diff --git a/cumulus/pallets/collator-selection/Cargo.toml b/cumulus/pallets/collator-selection/Cargo.toml index 206700b7d606c81bef4f33cbfe6e705e6efb49ad..b3512dc2ae6c9a646e63d911bdf09b132f5098cd 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 c6b600445282534951b2c63a6c2a87181688acd1..24823661383b55f26bf19356e72394945c01f577 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<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; diff --git a/cumulus/pallets/collator-selection/src/lib.rs b/cumulus/pallets/collator-selection/src/lib.rs index 2fa384367528a1f1306a6c34c0c45d3ef94843a2..17dc1a552c2de40455933fe8a72d05caa4317a32 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::<sp_std::collections::btree_set::BTreeSet<_>>(); + .collect::<alloc::collections::btree_set::BTreeSet<_>>(); 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 425acdd8bfb59768241399e3be5efb44a13c8a74..c52016948069a65c641fa014a390f1a6a85d3cb3 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<T>(sp_std::marker::PhantomData<T>); + pub struct UncheckedMigrationToV2<T>(PhantomData<T>); impl<T: Config + pallet_balances::Config> UncheckedOnRuntimeUpgrade for UncheckedMigrationToV2<T> { 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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV1<T>(PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> { fn on_runtime_upgrade() -> Weight { let on_chain_version = Pallet::<T>::on_chain_storage_version(); diff --git a/cumulus/pallets/collator-selection/src/weights.rs b/cumulus/pallets/collator-selection/src/weights.rs index 1c01ad6cd6fe8e8ed4bc02c3c2d6703eb2882df4..12e6b755e9769cb4234bc15016c0a3b47650054f 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 052a2547e788b0837cf224cb38095d40c20ed0fd..936526290d93ecd8935620c8f1f6045faadecb64 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 91d1e0eab7e406a214088d8c0e47d03e20cd0286..432d6f3bc7ae54432e3687b7d73e70a11ec2da04 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 9b3ec684febab81fb535c52118cbadb64b61e984..cedca6f3fb97f2186318718d068a2fa120a71bc3 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 349635cce547d81c1be527cb366f67679a471945..b1945e8eb37b85e9c39cbafeba4b6d7ec15502c0 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 8ab5d81efdcf486dff67db6a1f5a62a5a8454ae8..f284fbdc64c600f130b0e5bb531021ecfd2e0e73 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 91353fc7bbda7ce05cfb5259e05bde64c758bbe4..3062396a4e7865bf4e3545b39c6ad9fa6ded6a24 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<const N: u32> ConsensusHook for FixedCapacityUnincludedSegment<N> { 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 bbb74a1b053886b90740562e077ce40804eb01fd..9e0a68d09a14a685da6a66facdd0ac2822d4c6d4 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -1530,7 +1533,7 @@ impl<T: Config> Pallet<T> { } /// Type that implements `SetCode`. -pub struct ParachainSetCode<T>(sp_std::marker::PhantomData<T>); +pub struct ParachainSetCode<T>(core::marker::PhantomData<T>); impl<T: Config> frame_system::SetCode<T> for ParachainSetCode<T> { fn set_code(code: Vec<u8>) -> DispatchResult { Pallet::<T>::schedule_code_upgrade(code) @@ -1645,7 +1648,7 @@ pub trait CheckInherents<Block: BlockT> { /// Struct that always returns `Ok` on inherents check, needed for backwards-compatibility. #[doc(hidden)] -pub struct DummyCheckInherents<Block>(sp_std::marker::PhantomData<Block>); +pub struct DummyCheckInherents<Block>(core::marker::PhantomData<Block>); #[allow(deprecated)] impl<Block: BlockT> CheckInherents<Block> for DummyCheckInherents<Block> { @@ -1718,7 +1721,7 @@ pub type RelaychainBlockNumberProvider<T> = RelaychainDataProvider<T>; /// of [`RelayChainState`]. /// - [`current_block_number`](Self::current_block_number): Will return /// [`Pallet::last_relay_block_number()`]. -pub struct RelaychainDataProvider<T>(sp_std::marker::PhantomData<T>); +pub struct RelaychainDataProvider<T>(core::marker::PhantomData<T>); impl<T: Config> BlockNumberProvider for RelaychainDataProvider<T> { type BlockNumber = relay_chain::BlockNumber; diff --git a/cumulus/pallets/parachain-system/src/mock.rs b/cumulus/pallets/parachain-system/src/mock.rs index da904c0079a00a39dcca24c2d408d0bb381b2252..7bea72224b8ba36c6155597f4b957a2ed3a8d822 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 60eccfb072f41e87223d54f34b5c7eb59c00b2ad..323aaf6503808c954300e27179aa16bc531047c9 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 5ff15036fb6e48b5e1a0567730b1f9035357edc2..51c6e83c113191250c3c2ebe60e2dfad1263d682 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 1e83a945c4ee37f2ad8ee1c45d11892f47c40be4..814bb83aa1acb0541c9cf73ead07e3e3cca84680 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<H: PartialEq>(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 956962fce157d3c5d090dd4bd8de78bba4d80405..42311ca9d8340d038df126175df096777cf989a9 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 763a4cffd77f92171c1f102cfc70485a02e5f27e..3a00d4d352a69830ff225221d2fb63450c96b9e9 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 5d785910fbe026fba487980d1244262146f86a5b..5999b3ce87f9d285412ea8bccdf1258ae1f66733 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 48310670c074d1be2ec86f582c0c84622abc086c..19801340719526ac6775a9a92fc0b3d879f84afb 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 da7f64237e9b6a8b39096b761f6ff923f903529a..5c61879b4d36b903f9f9d81cde76ff3ce42cc747 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 df671566cdc24b8fca9486d0444aad6a1688eedb..e182ac45edebd9c22df15d18f9d3548176c538c5 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 36411d3d71afa2c1ae74870a1eed5ad1ad916a8c..8d5954304878dfd5ff4c4bf912168d70e4e5e53f 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 a95d6fb7d591460f2055f076f60199b213b055b8..f5bfef006169035797d17957beb574200fd153ab 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 ced1b24f1d2bf52f1f6db128affe3bd8595411ba..5fd1939e93a03397dda15bae0eb638f823cbb1ce 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 da948615d4e90a5f109cb56b47f796acead6535c..b42cc74f1cf32220f7767f829cd4a65c9e2e0532 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 1f0cef70e3a72920d6c789acb9051ddf2a7ff8e8..35d7a083b061d204de339407c6e26c4ef948dbb8 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 90a0ec76defe2b0df8d99faacfb611c0f7834a3b..e31df8471c26698d115d798bfc9358dbc4a1b982 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 c542fa373b5ed352edc4e00ea032b6dd64c97415..9c7470eda6da4aeaba942c25f04f4aeb13ee471e 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 49e2cc8367348ad6a81c0017405f8c3148734be5..9cb1301addfe5c9bb29c1b034c76793b6eaeda64 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 9db4b6e74c3987ae08a6d38eb75ffcacb9e5e713..eff4a37b0cef7033c15f2629e54fb7763a35a975 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<SiblingBridgeHubParaId, Runtime>( - sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, + core::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, ); impl<SiblingBridgeHubParaId: Get<ParaId>, Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider @@ -45,7 +45,7 @@ impl<SiblingBridgeHubParaId: Get<ParaId>, 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<SiblingBridgeHubParaId, Runtime>( - sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, + core::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>, ); impl<SiblingBridgeHubParaId: Get<ParaId>, 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 45126a9425d4c0400c7b76f55173339fd4c4a2bb..8c4446a925d4da281d11f09c9e3e3e3b4feb6697 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 b64982a893029f51aeb689d94d54066165ac40a3..d0657aaea9fd0d1daab6003b9721434c8ea769e1 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 247adab7108fac8a278ee81827a9e65e27c320f0..818365f36f605ea3ddceceeb8654cf11ca690e44 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 6eac9a09672675c3cb46d1eb49392bb0651eb7dd..6d436bdf799a4f7682ced2098f4926ec9bc50379 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 16cda1a4ed83850f4e67765a5e7092dad4a24305..42ea50c75a8d4e207ffa6b6ad7682013218de64d 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 b01d623d2b93da529f37bbfd8cf139ea5b98d9ae..3cffb69daac3fae6d5729a985489433f442bf22c 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 0c9f4b840c9166ba9380f06970ad15bb1cac14c6..511d6243cb8c47a0e137f9eec03bbb1afdf5e644 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 a9756af7aed245ea792d12addbbb2fff529eedaf..7c58a2b2405c73477b0b88b95f99af870fdb5c90 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 61cbe7850090195af08bccfd3f0b172dcbb85b60..c52021f67e36233eb46c2fe703c9c6cef963ab76 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 b1c960ad6a0d337d6b84aaaba59f7fa0625a8124..7ea3c2d79fa793fd3726bf9ee0b59eaac598eb38 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 7369c3a2c157624b7af48f860c73ba61716a1038..e0bed23c4f8c0931d1b5b13c36a696378f62fd83 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 a4ef448a6b6b9b934e9e49a4a4797a590ad55d6b..0aaa7adaa51c0198fa1025337a31ff790df2113b 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, pub parachain_id: ParaId, } diff --git a/cumulus/parachains/pallets/ping/Cargo.toml b/cumulus/parachains/pallets/ping/Cargo.toml index f74328207b84387f969bcf94d81d6bef705f877a..51fc384a4f1408ba7ad9c05f9d172146290d4cd5 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 a738c05e0366bc44da562f59f7e9a638a8251d9c..729494cbd251d6ff5ea3271a040c28bb786ea849 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 9ef0aa0072c96a3077c2a9d1c8b3793521938ff5..98df41090a4072f45177326b70f617bf967d735b 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 e8772c0b4830363723b96424d5507c461715354e..f09647854cd0132751889ef2b33bca1c5ec16e74 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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<dyn FnOnce()>)> { + ) -> Option<(XcmAssets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> { // 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 c1e5c6a74293995b6e3702f19b8b3750c34b192f..fc63a0814d0a4af4ac9e264db8757e5abe2da36d 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<T>(PhantomData<T>); 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 45531ccfa797c52ead00833f765347f1282816c7..cd72703104ad0fee8744b904e950def1872d2456 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<T>(PhantomData<T>); 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 8e675ad0cf8e627a1f547a181db1737767e84d7c..8c52ecd9f1b1fa66bc027be7b1d376ff6882517a 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 7fab35842509deceba14e89e5bbf6bebe2240528..03d3785dccbd7f213eee3d8aa51cde7eb5980b48 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<T>(PhantomData<T>); 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 4454494badcbfe9b4f429312e24b63786b83ef75..bee6bcdf21cf3fed11ef63d593b5b0dfb1f0f10b 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<T>(PhantomData<T>); 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 03de2c971b7ff133223db0385919a90d0393fea3..c736d3ee44204156a847bafbb1d4d0b26652a31a 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<xcm::v3::Location> 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<NetworkExportTableItem> = - sp_std::vec::Vec::new().into_iter() + pub BridgeTable: alloc::vec::Vec<NetworkExportTableItem> = + alloc::vec::Vec::new().into_iter() .chain(to_westend::BridgeTable::get()) .collect(); - pub EthereumBridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = - sp_std::vec::Vec::new().into_iter() + pub EthereumBridgeTable: alloc::vec::Vec<NetworkExportTableItem> = + alloc::vec::Vec::new().into_iter() .chain(to_ethereum::BridgeTable::get()) .collect(); } @@ -578,10 +578,10 @@ pub mod bridging { /// Set up exporters configuration. /// `Option<Asset>` represents static "base fee" which is used for total delivery fee calculation. - pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec<NetworkExportTableItem> = 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<Asset>` represents static "base fee" which is used for total delivery fee calculation. - pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec<NetworkExportTableItem> = 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 f670c5f424efeac0e00ddf472f1948e06d93bd68..ee1461b7f9c85664e25dca1d02b4f248812d4219 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 7e618d950b19a86a46903d3b8351c1c1be542cb9..6b1bf769ace3511cc91cb1b557d4a7d5a754fd92 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 55c8a9f0b265daa8e9a4d3d70712d26bd8b9fc9c..178b886fc3e84b741eb6721fec1b4e493626795b 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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<dyn FnOnce()>)> { + ) -> Option<(XcmAssets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> { // 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 c1e5c6a74293995b6e3702f19b8b3750c34b192f..fc63a0814d0a4af4ac9e264db8757e5abe2da36d 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<T>(PhantomData<T>); 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 45531ccfa797c52ead00833f765347f1282816c7..cd72703104ad0fee8744b904e950def1872d2456 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<T>(PhantomData<T>); 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 8c77774da2dd747f4c3321ae9e2dfb3984cedb0f..d39052c5c03b84f8c02f8257bd9f5a739f4f8624 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 eaf07aac52cefa88f524e6f3a2180ab9faf2b088..fe8d186139256fbaac3989e0c56fb3acc494d63e 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<T>(PhantomData<T>); 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 fc196abea0f5e61d746760e2b2bf5a7d8d0a476b..127bc173c103741839ac2466b0d6ae7d5942ea7f 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<T>(PhantomData<T>); 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 fc2e68c599fd1415df04c6b89510503091ef6cb5..2deeb73eb127b8d9dd262e961703c66915a6c6f6 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<xcm::v3::Location> 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<NetworkExportTableItem> = - sp_std::vec::Vec::new().into_iter() + pub BridgeTable: alloc::vec::Vec<NetworkExportTableItem> = + alloc::vec::Vec::new().into_iter() .chain(to_rococo::BridgeTable::get()) .collect(); } @@ -580,10 +580,10 @@ pub mod bridging { /// Set up exporters configuration. /// `Option<Asset>` represents static "base fee" which is used for total delivery fee calculation. - pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec<NetworkExportTableItem> = 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 b5957dd5df92ff1180909535cb6e604deadd8829..48e6c11d268c7c2e915c3ce4c0213ede2c883911 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 94612506f510e3677db444c61c05db46f84cdc0e..c6740269339d808f14d9dd2879f2ddd74b4e842b 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 44bda1eb3709c74d808e696d5d3728a3354b747a..d59fddc4e8f0289fd8ab4aebe7465551c83c136a 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 a9fd79bf939f575ac60007cd6920ac6db3ded773..95edb31da06e5a0ff1f9d40f3d385f6bd2c21e35 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<IsForeign, AccountOf, AccountId, L = Location>( - sp_std::marker::PhantomData<(IsForeign, AccountOf, AccountId, L)>, + core::marker::PhantomData<(IsForeign, AccountOf, AccountId, L)>, ); impl< IsForeign: ContainsPair<L, L>, @@ -41,7 +41,7 @@ where fn try_origin( origin: RuntimeOrigin, asset_location: &L, - ) -> sp_std::result::Result<Self::Success, RuntimeOrigin> { + ) -> core::result::Result<Self::Success, RuntimeOrigin> { let origin_location = EnsureXcm::<Everything, L>::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 e21203485a764c350b3d9890d7dcdaa89110babf..27ee2d6b5653c91bd922045005201439870c324a 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 431b5766147aeb8279ed2b1298691ceede856e5e..4bb593f98929e4dfcaf2879e759f863138f49282 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 58f5d2d57a7669b73876897f90e0da3e20730cbb..8a89089c7187726d30cc485b9280853a9da277e3 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 f356cb541315fa814c3df5d7ad69342c132661d3..9bb35d0c5328b8de455f6f3c75f4d2965d5fe44f 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<IsForeign>(sp_std::marker::PhantomData<IsForeign>); +pub struct IsForeignConcreteAsset<IsForeign>(core::marker::PhantomData<IsForeign>); impl<IsForeign: ContainsPair<Location, Location>> ContainsPair<Asset, Location> for IsForeignConcreteAsset<IsForeign> { @@ -41,7 +41,7 @@ impl<IsForeign: ContainsPair<Location, Location>> ContainsPair<Asset, Location> /// 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<SelfParaId, L = Location>( - sp_std::marker::PhantomData<(SelfParaId, L)>, + core::marker::PhantomData<(SelfParaId, L)>, ); impl<SelfParaId: Get<ParaId>, L: TryFrom<Location> + TryInto<Location> + Clone> ContainsPair<L, L> for FromSiblingParachain<SelfParaId, L> @@ -65,7 +65,7 @@ impl<SelfParaId: Get<ParaId>, L: TryFrom<Location> + TryInto<Location> + 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<UniversalLocation, ExpectedNetworkId, L = Location>( - sp_std::marker::PhantomData<(UniversalLocation, ExpectedNetworkId, L)>, + core::marker::PhantomData<(UniversalLocation, ExpectedNetworkId, L)>, ); impl< UniversalLocation: Get<InteriorLocation>, @@ -100,7 +100,7 @@ impl< /// Accept an asset if it is native to `AssetsAllowedNetworks` and it is coming from /// `OriginLocation`. pub struct RemoteAssetFromLocation<AssetsAllowedNetworks, OriginLocation>( - sp_std::marker::PhantomData<(AssetsAllowedNetworks, OriginLocation)>, + core::marker::PhantomData<(AssetsAllowedNetworks, OriginLocation)>, ); impl<AssetsAllowedNetworks: Contains<Location>, OriginLocation: Get<Location>> ContainsPair<Asset, Location> for RemoteAssetFromLocation<AssetsAllowedNetworks, OriginLocation> diff --git a/cumulus/parachains/runtimes/assets/common/src/runtime_api.rs b/cumulus/parachains/runtimes/assets/common/src/runtime_api.rs index 19977cbedab07b638f71f32470d3768cabeba322..799b2f45b4dfbff288383821598954f30612f806 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 a7aad361e84e1b4c8555f57be2dafacab760c15d..529d6460fc4e46b6a7d04ae77c01f7135f6eed9d 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 39ea636925528a402432168fdf1a2562c339c045..d97e6a1d88e1b698c2a047adb11ede43827f18f1 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 07bb718bd13d60bb8eafd980a1fd642b52a97012..fe854e20c244545a770edcdb6c6c57a49c93b124 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<Call>(is_congested: bool) -> sp_std::vec::Vec<Instruction<Call>> { - sp_std::vec![ +fn build_congestion_message<Call>(is_congested: bool) -> alloc::vec::Vec<Instruction<Call>> { + 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 8ca5898d1a104cfe6b1773ebca3b9ae0004167f5..512c1199f43920f0832d0edf91a4205f37d7c493 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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 dc480c391636a92aad6e303a515524b5ce7ff2b1..8fcd7b10d931b03ec4cd9cc063e0bacf8878ed16 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<T>(PhantomData<T>); 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 2fcd573ceb277116bda67180da8e0701593ab453..b6fee47d1435162a3e24dd204b896eb849a7e146 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<T>(PhantomData<T>); 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 4f5bae0fe597b88b1c23fa4ab806cec98bf7d746..b40cbfeeb8f2770bbc15e77d2a0a657b209a45ef 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 d7e8c41ff8ac41acfeb60f30774e8282939b6c1c..057dc4313510f79aa1daa1216141538ceb357012 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<T>(PhantomData<T>); 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 bafc973bdac444def7058de4a1a2c3feceb1abfc..9c58072d402c91a13f63795bf5b4184f80ab2c0b 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<T>(PhantomData<T>); 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 a0d2e91dffd2e9240ad9364e18ef52a7b3cab3b1..5ec545ee0590f180f661e4bc81f3f3c2ffcd8dcf 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 09d55f4323ab5aa92be471758264e688e7d45e05..42d5ef3eebdb3030d49507fb8cc6d976cb041672 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<Call>(is_congested: bool) -> sp_std::vec::Vec<Instruction<Call>> { - sp_std::vec![ +fn build_congestion_message<Call>(is_congested: bool) -> alloc::vec::Vec<Instruction<Call>> { + 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 993f60432458739834d9a7c4384243fa597d60fe..5d4c35d6610a0fb7a9b15e886750135c36533f5a 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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<dyn FnOnce()>)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> { // 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 dc480c391636a92aad6e303a515524b5ce7ff2b1..8fcd7b10d931b03ec4cd9cc063e0bacf8878ed16 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<T>(PhantomData<T>); 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 2fcd573ceb277116bda67180da8e0701593ab453..b6fee47d1435162a3e24dd204b896eb849a7e146 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<T>(PhantomData<T>); 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 e8950678b40fd7b4e7afca8c998bc20c619e65ef..3961cc6d5cdd63a67b5ea4cbc805448e01f98939 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 295abd481d7dc6decd39032bf6b0972cdc7ccf20..4310b24564758c4a3d95d27f047dd8988a43395c 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<T>(PhantomData<T>); 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 73bea66bf7107f0c73696713c293b9fd9a714380..ba434ff29629ff89a92d6ea663e5fcf8184d102f 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<T>(PhantomData<T>); diff --git a/cumulus/parachains/runtimes/bridge-hubs/common/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/common/Cargo.toml index fd0eed1c05a1a65e9f5c41d1880f57b708e85119..3ae43075000ba2ccd34c9efe1edfc91681201944 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 c1bba65b0abc3c6949f94e9e904a5649f1a9d285..5f91897262f4b8eed44a2da7ad945945dda67cc4 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 fb96d29a497a37084ae83a461f5a2ff2bb6a7af0..44a8646142d6c38d265c0b9cd518b1b7ddd192e3 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 1874f38de2df17e85c1f49723271d090e962eb70..0b3463f0df974dcc9ce46c1d811b363d5011bbb4 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 8f3c7de61f8402d7b28231325a9ddc3ab3bac052..d6dfa93731a7d3fe17203330e86486093ca5d7ed 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<Runtime, AllPalletsWithoutSystem, GPI, MPI>( - sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, MPI)>, + core::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, MPI)>, ); impl<Runtime, AllPalletsWithoutSystem, GPI, MPI> 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 6580648e66063fdd2aff3f8c802cda6efe8e07f3..728b4e76b1055dd215d68a91ecb01704850d38a4 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<Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI>( - sp_std::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI)>, + core::marker::PhantomData<(Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI)>, ); impl<Runtime, AllPalletsWithoutSystem, GPI, PPI, MPI> 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 c990c6e5307cb3f1c390fcb28e1261e2713f899f..78b8a170f0d4b0bb6ed0aa71a5cac0dceeca96fe 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<Runtime, AllPalletsWithoutSystem, MPI>( // 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::Balance>(Runtime::ExistentialDeposit::get(), 1u32.into()) * + core::cmp::max::<Runtime::Balance>(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 87cf42ba87d836976a8997d90ce99eea9c1f1e9f..43fc9083937c351d0df2190c7593bf1e8126e800 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 e5b176fc77873805fb0e4ed6dba74d720ea3479a..ed5d4870e4a6d1722e1587a650395c6dd2c742dd 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<T> = <T as frame_system::Config>::AccountId; diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/lib.rs index f37af88c28436cd333333dffc8d451eb177c0f58..d843d6f6f776e0c4eadec44c72925a19402423df 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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<dyn FnOnce()>)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> { // 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 0b7a2fc21cde4f12c821a0e89982db4813f3f832..92c8c88b515474ed5335f306c487ca1217a938b6 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<T>(PhantomData<T>); 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 4bd71c4e7d497b84f9a5b910015e439b69e41ef9..0bb6d3d0f1c451e6fd9bde07cced236845d380a6 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<T>(PhantomData<T>); diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/cumulus/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index 4fb4bcde02351b9485dc2a5ccf6b48cc729633e7..1fcebb3f16a96d2db051ab1d0108d44abc394f4f 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 d2fe0689f5155ece3c3f1397aa18e0a33583e5d6..47ce6f3628ecdd6a426ccbed9f503258d3c6171a 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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<dyn FnOnce()>)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> { // 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 57a0782b1ef665b376d86ea8cfa750e3b0b4f007..2920bc428d90b202d1035cb3cbe309dd99097013 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 6e36539c7bf79a9ef31b991c432473b90d724185..9fd0093840d3fb7008a8fd0f67cb55b858d8600a 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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 9f79cea831aed66a0d073109233731751cdf99ed..b8db473f10662d5b1ef045d28f943fe0cb1430b9 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 7ff1cce2e072339dccd52c0809aafd59337db7b4..73a71980530707930681ebc82a5cd563372eb24e 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<T>(PhantomData<T>); 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 16412eb49a5267d3f3f38cdd285e8f3b248a5f99..676048f92ad937e7cb80f268fdc1ca4e90779d42 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<T>(PhantomData<T>); diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml b/cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml index d3bf6b43a7ed7453e3c12dc8ecdafeee787e04b5..07a4332800d7f22451caa43ff6668c57ec4fabd7 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 74fdd971f5ce05ba87ec3c1cbf2ac3d233a4d73b..7907f252cf8e47a1d1694c7721f72a81e660dc74 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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 99af88812da2be05bd9273585ea7d186be9f8b90..f35f7bfc188dce73525b5742345e7eb9ed459385 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 8e1461c4a99e2e95dea078280844a157ab4084de..ddfc599fa579dd7ae4b83d0a94b0e7092fbdc9c1 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<T>(PhantomData<T>); 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 9657fa55c1f2fdd4cf6ffdc4888e13e22a262155..7390f35e3974060abf4efd0e621239fa6a9bead0 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<T>(PhantomData<T>); diff --git a/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml b/cumulus/parachains/runtimes/glutton/glutton-westend/Cargo.toml index c201c8375be0d900d3797b11d2597e120eef873c..d20b62a557b950e080ae7eca38526d6af9846861 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 a204bb7276cfe3b58e5d4b9c9737eeaa5a018128..1b505ad3acbf7aa22a84ce9923a621d826358122 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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 890de672e0b5ed74a11435a28dc9f81bbde9297b..a732bec2352d2dfd6fe7e842cb6a5d3206291d7d 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 ff31aba8a27716120f455414058d1aa6e17c95e6..4f007c3fc39db185df12cee525509d9a1433a9d9 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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 88a89711019d59436c1ca270bbf19781f6dc77f0..8211447d68c8a5a53457d1651cc95754c125f7fd 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 fcea5fd1bf679c803509dd4529b45e4994a7438c..5715d56c2186836556973dc6bebbfec77ac99762 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<T>(PhantomData<T>); 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 fe1911b77a72dbfed0309722a1c59f37b56cb40f..47c67901407366a9f07959e2e22ed5bc83c61a76 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<T>(PhantomData<T>); 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 4afd65bdcfea18208046edb4cfe693207cada3bb..11c1bad9aa17866d882f4410d76065a18ab4ef28 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 b279399e7a96b68ac68f7e12ed165efb324fab9b..2364798596d50f396a3a732c1e9dc1ad6c48a5bf 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<T>(PhantomData<T>); 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 e2be324ee2d48c42a8d7340c8cbcd3a52b161f19..a50c8860c48f84197843a9fd4d44ddb39d742095 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<T>(PhantomData<T>); diff --git a/cumulus/parachains/runtimes/people/people-westend/Cargo.toml b/cumulus/parachains/runtimes/people/people-westend/Cargo.toml index 83068e489d2ebb3919d20ac7747d5236ceb5aeb7..20c7e691ebc88622dc57b4a026533fae67cf3044 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 6adaa4b4e50201ae1a073d25a4021ec8e84bfa8a..1378324ce7b022e306c39ce4d8b1669ef057eb96 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<u8>) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> 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 a5c0e66a3f882df14cbbd8dba51572834738015e..0255fd074b1119cf6432a2f9b0346e6523c181f8 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 fcea5fd1bf679c803509dd4529b45e4994a7438c..5715d56c2186836556973dc6bebbfec77ac99762 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<T>(PhantomData<T>); 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 fe1911b77a72dbfed0309722a1c59f37b56cb40f..47c67901407366a9f07959e2e22ed5bc83c61a76 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<T>(PhantomData<T>); 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 b2579230c9ed7afaf9d187a9e783992723444b3a..b1fc7ad8ed832ec6aa9a65c5e4ad3334ff3225d1 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 efffd318817106baf4e2f7661f4cd0a8c333b722..92d08a24618075d21614ae53ed17e3618fc2f8ea 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<T>(PhantomData<T>); 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 d7b10f95c792a9874bd98ccf4eb20bdf87e20bb0..861f038199596ef9813275e58914f252d8842a87 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<T>(PhantomData<T>); diff --git a/cumulus/parachains/runtimes/starters/seedling/Cargo.toml b/cumulus/parachains/runtimes/starters/seedling/Cargo.toml index 8a7c5922362e888723826a04d31b941264a0e5b8..c76c09a31234e6077f97e38c7e38fe4fbddeae86 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 461133f6cfc06ad8cea140ea19d6df6c8aebb520..1fe72604d3731eed1dee3d27477e0e829cccfba0 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { Runtime::metadata_versions() } } diff --git a/cumulus/parachains/runtimes/starters/shell/Cargo.toml b/cumulus/parachains/runtimes/starters/shell/Cargo.toml index 4a1271ca658406b2f4d6c100a70e1ca7b46ef8eb..8f3b2204cfe34b8bb73c6a9062c9a91df262a8e4 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 7422b580cc3e08c1df8af5e9dce23d79d0c4e1a8..1dfbe2b6c41c840846e1d64a4d87e7c9c1b0c7cf 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { Runtime::metadata_versions() } } diff --git a/cumulus/parachains/runtimes/test-utils/Cargo.toml b/cumulus/parachains/runtimes/test-utils/Cargo.toml index 5e895271ab17f8d9d4cf13cded7f1ebc9716000e..01d7fcc2b5c8b77c7daa90d807634193545e95ec 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 3c84243306fbe518dd00ee78411d9ec032e90446..3fc3822a63eb9a2c98bc273814854ee2d56035bf 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 bdd0dfac6065759d10108a7961dbaf987e0ebb16..1a2737f3aa224c1dbf016173a259aafb0224341a 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 8d03f8332764f4a1a478ab4bef9c3dfd663e7169..bf39c02a3f59460156c37e6c652bc69fa7237a2d 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { Runtime::metadata_versions() } } diff --git a/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/cumulus/parachains/runtimes/testing/rococo-parachain/Cargo.toml index 7cbb614babe7988831db0898e6b08242cc66efe0..a0ad248bb7048f9a19cec45f97ad4242c9455f83 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 40f2b78ffd6d5201ff4f8b2c04016f3f0261f71a..dff7046f1972614d30210b6ac6d21c24e0350aea 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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 0b79d338c16813238e70a29d454e91882113128f..7d54e9b4be04304f612916efc292b6a2b2fd6ed7 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<u32> { + fn metadata_versions() -> Vec<u32> { unimplemented!() } } diff --git a/cumulus/polkadot-parachain/src/fake_runtime_api/aura.rs b/cumulus/polkadot-parachain/src/fake_runtime_api/aura.rs index 823eb9ab584a06ea1370d6b4c03ce124c426f9fe..ca5fc8bdf119b586d1d34f39122af2b6c9801831 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<u32> { + fn metadata_versions() -> Vec<u32> { unimplemented!() } } diff --git a/cumulus/primitives/aura/Cargo.toml b/cumulus/primitives/aura/Cargo.toml index f17c2035edd66a46be4810fa470357c1ccd3fdbd..062b9ce736e7f7b9d36f23908bf94437a06f22cb 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 f41213e9485e2509965a25ce556f687a185bba9a..533d368d3b00ed883b1996d376a80f4d5d970570 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 29216d513465160eb94db76faedb6e7fd992b461..6eafecfc3ff574689b5dd3125b97c0e5bade844a 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<B: BlockT> { /// The header of the parachain block. header: B::Header, /// The extrinsics of the parachain block. - extrinsics: sp_std::vec::Vec<B::Extrinsic>, + extrinsics: alloc::vec::Vec<B::Extrinsic>, /// The data that is required to emulate the storage accesses executed by all extrinsics. storage_proof: sp_trie::CompactProof, } @@ -211,7 +213,7 @@ impl<B: BlockT> ParachainBlockData<B> { /// Creates a new instance of `Self`. pub fn new( header: <B as BlockT>::Header, - extrinsics: sp_std::vec::Vec<<B as BlockT>::Extrinsic>, + extrinsics: alloc::vec::Vec<<B as BlockT>::Extrinsic>, storage_proof: sp_trie::CompactProof, ) -> Self { Self { header, extrinsics, storage_proof } @@ -243,7 +245,7 @@ impl<B: BlockT> ParachainBlockData<B> { } /// Deconstruct into the inner parts. - pub fn deconstruct(self) -> (B::Header, sp_std::vec::Vec<B::Extrinsic>, sp_trie::CompactProof) { + pub fn deconstruct(self) -> (B::Header, alloc::vec::Vec<B::Extrinsic>, 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 c07fe07545614c375634027df171948dbdb95285..172af4b9ec63e0843fdf59cdf90f21c842d60b41 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 75a56693958e6a982e21851384535217157b9c82..ad4b39b547c5f24f123e8abfd5a352dd1008adae 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 af32fb68d8bb20e6c61b2065ddfe948c98bd64a6..3a98fdd017aef9b7e411ef59d56fecc89bf0c897 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 35fa334f51c6996c48825cec03a0a90df5b0acbe..f48dd927ee962a23a0d831ec071469bb34e517e3 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 f7bf53a9d7d7cb4180f7afd9bc0c574e89675513..a50011bc3f0e911f2c682fcc02dc8a7693101ffc 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 e6aba6d0bb74043c134400387d84429cf0a712d1..5365f83efdf1111eaf727a4a8fe87ec4f2065726 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 a2fa2dd9806dca4743d13215ae4a30b7738567b7..82d18c8c0aac60b98fad565857fff5561a1ac21e 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 64784eb36f846f7b325aaaa5ed72966e3d59a1b8..9d5bf4e231eb0d4893360d107d92079b775db1df 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<XcmConfig, ExistentialDeposit, PriceForDelivery>( - 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 5d0ded403f63496e93c4b118ea4137830c8a9b0d..119924bca2ee1fc1d4b568a63930bb13128c77e5 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<T>(PhantomData<T>); diff --git a/cumulus/test/relay-sproof-builder/Cargo.toml b/cumulus/test/relay-sproof-builder/Cargo.toml index 454266c90ba74008bbe33d65891e16fb516737e4..e266b5807081aa1bc3dd8d5793d1f03342f094fc 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 fbd2692a36b466827376e0917adfc93aac10a739..d1016085c8073d67f2b8d50a224dce39711403f3 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 <http://www.gnu.org/licenses/>. +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 d5582f2d2a23b28832a5731e1f0ae30ede21d266..54b83e2dfedae35583a7c8baf5308a9d709c1f4a 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 97cb02ab779effdffedac4b4b1bebfe3e5970e5b..274f16ab630d6c0f9cff092b0ed79624e2a27a67 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<u32> { + fn metadata_versions() -> Vec<u32> { Runtime::metadata_versions() } } diff --git a/cumulus/test/runtime/src/test_pallet.rs b/cumulus/test/runtime/src/test_pallet.rs index 7f43f713fadc4c96776adfea90cdd17365a6b1cd..61195386ae79d2501965a8048a08c12143407348 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<T>, - custom_header: sp_std::vec::Vec<u8>, + custom_header: alloc::vec::Vec<u8>, ) -> DispatchResult { cumulus_pallet_parachain_system::Pallet::<T>::set_custom_validation_head_data( custom_header, @@ -79,7 +79,7 @@ pub mod pallet { #[pallet::genesis_config] pub struct GenesisConfig<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] diff --git a/cumulus/xcm/xcm-emulator/src/lib.rs b/cumulus/xcm/xcm-emulator/src/lib.rs index 1a3f3930cb3478d9e7811c49becbfdd7874bbe48..8de3660c223627155a27f5ecc659a3ea030d7b02 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 <http://www.gnu.org/licenses/>. +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 9cf921a492a515ee424f0e47674a9aef2414b034..02849571203285d5a9bbc19d4d3aecad8495c214 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 4606104fb9680628f10dc4ff7738f9c4740ced62..e7effce1bd6697196c3af45bde27e811250d0e5f 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 be4455aa21979f8915d32b0a85c84e278ba3b83f..2ff2d9539e2dbdd13997f925474ecbaf5a2836c7 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 c51947f6cc7cb0c53f8fbf52f2f80a370b1f681c..02c2d90f7c827f51dfe913fd0743109b9f96618a 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<sp_std::vec::Vec<u8>> { +pub fn get_builtin_preset(id: &sp_genesis_builder::PresetId) -> Option<alloc::vec::Vec<u8>> { 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 6d9bc1260b11fa79004b40ded4ab20343cf29037..c45f0126337e5a42b83fee6e80c5be04c03c1d73 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 800434670f83bada72c95423081d89cd1ddeb46d..42ca27953738e5c06dc5cb904323ee6a5bbc91f2 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 072c045a8c7039da82e0128d00e1886a7817ec4d..666636def46048ad2d97c48d5b82591df3108fcc 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<u8>; +pub type DownwardMessage = alloc::vec::Vec<u8>; /// 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<BlockNumber = crate::BlockNumber> { /// enacted. pub sent_at: BlockNumber, /// The message payload. - pub data: sp_std::vec::Vec<u8>, + pub data: alloc::vec::Vec<u8>, } /// An HRMP message seen from the perspective of a sender. @@ -148,7 +150,7 @@ pub struct OutboundHrmpMessage<Id> { /// The para that will get this message in its downward message queue. pub recipient: Id, /// The message payload. - pub data: sp_std::vec::Vec<u8>, + pub data: alloc::vec::Vec<u8>, } /// `V2` primitives. diff --git a/polkadot/parachain/Cargo.toml b/polkadot/parachain/Cargo.toml index 1491af0148e0b16da53078935b802ae3287f6c36..9d0518fd46ade9644af5c21c0a4c5873bfd458e3 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 bd75296bf837128c7b10b8a89a823cb66dc1ca8b..8941b7fbb911e8338972ff37fe3d7231d4841cd2 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 d92bbee8d28d16ea879094607ab74471551c9313..c5757928c3fc2f86fdd6ddb779856f0f39db70f7 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<u32> for Id { +impl core::ops::Add<u32> for Id { type Output = Self; fn add(self, other: u32) -> Self { @@ -233,7 +233,7 @@ impl sp_std::ops::Add<u32> for Id { } } -impl sp_std::ops::Sub<u32> for Id { +impl core::ops::Sub<u32> 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 f0c832666284c2476401e2c8e7ced49a31864b7e..1c557c9ae50584b61b25004880f8aa4f86308d06 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 1661112a7b3263caa55a9ced38b08f33ac6e3d2f..7a150b75d5cdb28a82cdaf9cdeef3cb0c3a4582d 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 28914f02511debbc1beba6253e9f1e74dbfacc17..7e8d1bb1e1383fed96525c34ce44eb4c20f9467d 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 7dba7a964d3b0468d48799557a363d374f4aea38..9c3c77f7350b902b3f99203d2be0f2d675e77274 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 2466c6a0d69d766f53aafab6c59ae35915570f23..4b2e12ebf435422c713fd2319eee08d9fa45d8dc 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 dc056e64fa23fb801a34d7d7b276982e4adf4f55..e4ec7e99346bbef4f3ce2fdb03b6084c053926f8 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 23fac43a3c73129b1af27d12cb0a4a79aa3c7be1..46b66aa518e490e117c6d190d52a4d4dc85574d7 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 c0b510a8fe9d0118fba52f7c8869210c3121969c..8f7ec314ecffe6d7ca7f1f943a47971b4a1e9558 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 061794ca06d1be1883fd3605eb5bc691e5b7b23b..73736fd4a3d6b7fc6f164952fbbc6a49f139de88 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 7bd92be35c159db35b3db7b9dd91afcc73eebd81..b4816ad15075dcc8d739259b779bfda1a9b5c84a 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 a82d843d28bf1ca9993e7951fa8f51c458bd63c3..55d436e30de07812d4b1d722a5cbb9a85cc7d1aa 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 e58cf3e76cc2c75137737c2a6e2b34685e1a78fd..bfd42ec30bd39dbaa3299cda634fd0f4743ab2e2 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 1a29471c5450aa23ad00f8a41c54aca34ea7dbf4..1d66c9848a7c4016a86f5ed1eb85e880b35bba91 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<u8>, 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 6b7985847a10699d36ef0f953cd5d2605c6beca0..06b7046520835b5d71f554e1c7c5c357eb6a6de9 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<H: Clone> CommittedCandidateReceipt<H> { } impl PartialOrd for CommittedCandidateReceipt { - fn partial_cmp(&self, other: &Self) -> Option<sp_std::cmp::Ordering> { + fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> { 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<T> { /// The raw storage key. pub key: Vec<u8>, - _p: sp_std::marker::PhantomData<T>, + _p: core::marker::PhantomData<T>, } impl<T> From<Vec<u8>> for WellKnownKey<T> { diff --git a/polkadot/primitives/src/v7/signed.rs b/polkadot/primitives/src/v7/signed.rs index 62e4df2385038f02247ce41fc87a1f4243c73970..f819b379a30ae2dde68d215daea712c7c28ecbb2 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<Payload, RealPayload = Payload> { /// 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<RealPayload>, + real_payload: core::marker::PhantomData<RealPayload>, } impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> Signed<Payload, RealPayload> { @@ -163,7 +163,7 @@ impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> Signed<Payload, RealPa payload: claimed, validator_index: self.0.validator_index, signature: self.0.signature, - real_payload: sp_std::marker::PhantomData, + real_payload: core::marker::PhantomData, })) } else { Err((self, claimed)) @@ -191,7 +191,7 @@ impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> Signed<Payload, RealPa payload: converted, validator_index: self.0.validator_index, signature: self.0.signature, - real_payload: sp_std::marker::PhantomData, + real_payload: core::marker::PhantomData, })) } else { Err(converted) @@ -258,7 +258,7 @@ impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> UncheckedSigned<Payloa signature: self.signature.clone(), validator_index: self.validator_index, payload: (&self.payload).into(), - real_payload: sp_std::marker::PhantomData, + real_payload: core::marker::PhantomData, } } @@ -316,7 +316,7 @@ impl<Payload: EncodeAs<RealPayload>, RealPayload: Encode> UncheckedSigned<Payloa let data = Self::payload_data(&payload, context); let signature = public.sign(&data).unwrap(); - Self { payload, validator_index, signature, real_payload: sp_std::marker::PhantomData } + Self { payload, validator_index, signature, real_payload: core::marker::PhantomData } } /// Immutably access the signature. diff --git a/polkadot/primitives/src/v7/slashing.rs b/polkadot/primitives/src/v7/slashing.rs index ea06e960b5bc533e449e4f2460856227738dbc40..148bc1477ff88fd94565d7b834399500f6a1d17e 100644 --- a/polkadot/primitives/src/v7/slashing.rs +++ b/polkadot/primitives/src/v7/slashing.rs @@ -17,9 +17,9 @@ //! Primitives types used for dispute slashing. use crate::{CandidateHash, SessionIndex, ValidatorId, ValidatorIndex}; +use alloc::{collections::btree_map::BTreeMap, vec::Vec}; use codec::{Decode, Encode}; use scale_info::TypeInfo; -use sp_std::{collections::btree_map::BTreeMap, vec::Vec}; /// The kind of the dispute offence. #[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, TypeInfo, Debug)] diff --git a/polkadot/primitives/src/vstaging/mod.rs b/polkadot/primitives/src/vstaging/mod.rs index fecad783f7cbc7f2ea6bf6217d519b0a5abbcf11..27296213e6118c8216b15898d2fbb3bc29550b42 100644 --- a/polkadot/primitives/src/vstaging/mod.rs +++ b/polkadot/primitives/src/vstaging/mod.rs @@ -18,7 +18,6 @@ // Put any primitives used by staging APIs functions here use crate::v7::*; -use sp_std::prelude::*; use codec::{Decode, Encode}; use scale_info::TypeInfo; diff --git a/polkadot/runtime/common/Cargo.toml b/polkadot/runtime/common/Cargo.toml index 718f8b8b070996fb5266ef857e7ba6295edfa676..cda6f3240dd2e4e6460471372a5536fa8cc2307d 100644 --- a/polkadot/runtime/common/Cargo.toml +++ b/polkadot/runtime/common/Cargo.toml @@ -22,7 +22,6 @@ static_assertions = { workspace = true, default-features = 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 } @@ -111,7 +110,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", "xcm-builder/std", "xcm-executor/std", "xcm/std", diff --git a/polkadot/runtime/common/slot_range_helper/Cargo.toml b/polkadot/runtime/common/slot_range_helper/Cargo.toml index 6beca68f7678f3b575f68551b7283880aaf78915..02810b75283f8babda0de26fc91e16b6ac493669 100644 --- a/polkadot/runtime/common/slot_range_helper/Cargo.toml +++ b/polkadot/runtime/common/slot_range_helper/Cargo.toml @@ -13,9 +13,8 @@ workspace = true paste = { workspace = true, default-features = true } enumn = { workspace = true } codec = { features = ["derive"], workspace = true } -sp-std = { workspace = true } sp-runtime = { workspace = true } [features] default = ["std"] -std = ["codec/std", "sp-runtime/std", "sp-std/std"] +std = ["codec/std", "sp-runtime/std"] diff --git a/polkadot/runtime/common/slot_range_helper/src/lib.rs b/polkadot/runtime/common/slot_range_helper/src/lib.rs index f907390bc91b558d49f6aa29714fa5f90b1672ca..0dd893a284f3c657761d870f05dab40fa13b2d3d 100644 --- a/polkadot/runtime/common/slot_range_helper/src/lib.rs +++ b/polkadot/runtime/common/slot_range_helper/src/lib.rs @@ -19,10 +19,10 @@ #![cfg_attr(not(feature = "std"), no_std)] pub use codec::{Decode, Encode}; +pub use core::{ops::Add, result}; pub use enumn::N; pub use paste; pub use sp_runtime::traits::CheckedSub; -pub use sp_std::{ops::Add, result}; /// This macro generates a `SlotRange` enum of arbitrary length for use in the Slot Auction /// mechanism on Polkadot. diff --git a/polkadot/runtime/common/src/assigned_slots/migration.rs b/polkadot/runtime/common/src/assigned_slots/migration.rs index b52509bbdf498a7bc9b03be6b4432326d894211b..c13ee0c572dd6eab8c285da04caa76f7a5c8d38a 100644 --- a/polkadot/runtime/common/src/assigned_slots/migration.rs +++ b/polkadot/runtime/common/src/assigned_slots/migration.rs @@ -18,13 +18,13 @@ use super::{Config, MaxPermanentSlots, MaxTemporarySlots, Pallet, LOG_TARGET}; use frame_support::traits::{Get, GetStorageVersion, UncheckedOnRuntimeUpgrade}; #[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; pub mod v1 { use super::*; - pub struct VersionUncheckedMigrateToV1<T>(sp_std::marker::PhantomData<T>); + pub struct VersionUncheckedMigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/common/src/assigned_slots/mod.rs b/polkadot/runtime/common/src/assigned_slots/mod.rs index d0a531b8b6ca5ad995803edc8cbc45daa88176c2..dd39789e10cfdbb481615f728b6cd223ec64f037 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 19d82ae85d0035aea89b5d07f0f042be237da42e..78f20d918bab52b11eccc076070f67a76b95e3de 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<T> = <<T as Config>::Leaser as Leaser<BlockNumberFor<T>>>::Currency; type BalanceOf<T> = <<<T as Config>::Leaser as Leaser<BlockNumberFor<T>>>::Currency as Currency< diff --git a/polkadot/runtime/common/src/claims.rs b/polkadot/runtime/common/src/claims.rs index c12af215a04d7119c1052a09a6eb6bee7ac0acb3..162bf01c38432f95ba25216478205c4046448c98 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<T> = <<T as Config>::VestingSchedule as VestingSchedule< <T as frame_system::Config>::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 <T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>, { #[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 3afd6b3fbc94b5b30bad162cfcf8236a029b77da..0ee3872a366ea1baf90e44f61f6ac1662b022dfd 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<T>(sp_std::marker::PhantomData<T>); +pub struct MigrateToTrackInactiveV2<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToTrackInactiveV2<T> { fn on_runtime_upgrade() -> Weight { let on_chain_version = Pallet::<T>::on_chain_storage_version(); diff --git a/polkadot/runtime/common/src/crowdloan/mod.rs b/polkadot/runtime/common/src/crowdloan/mod.rs index 61d406aa681268d8ef0c66567faf7b74555a287d..8cf288197e3dd56085f96c928ae6a5b7f79a2a86 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<T> = <<T as Config>::Auctioneer as Auctioneer<BlockNumberFor<T>>>::Currency; type LeasePeriodOf<T> = <<T as Config>::Auctioneer as Auctioneer<BlockNumberFor<T>>>::LeasePeriod; @@ -832,16 +832,16 @@ impl<T: Config> Pallet<T> { impl<T: Config> crate::traits::OnSwap for Pallet<T> { fn on_swap(one: ParaId, other: ParaId) { - Funds::<T>::mutate(one, |x| Funds::<T>::mutate(other, |y| sp_std::mem::swap(x, y))) + Funds::<T>::mutate(one, |x| Funds::<T>::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<u8>) -> 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 7d02e24b5368126d22a8f75e1075a75c50fb7e87..126c886280e6ed713d81c93f5afedbb69b03a1b5 100644 --- a/polkadot/runtime/common/src/identity_migrator.rs +++ b/polkadot/runtime/common/src/identity_migrator.rs @@ -172,6 +172,7 @@ impl<AccountId> OnReapIdentity<AccountId> 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 709cc69cdbeab470b9de99b16ec4585e09df8fb9..9d61cd018731f1b1761c520e91f8a4b6521fd41a 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<R>(sp_std::marker::PhantomData<R>); +pub struct ToAuthor<R>(core::marker::PhantomData<R>); impl<R> OnUnbalanced<Credit<R::AccountId, pallet_balances::Pallet<R>>> for ToAuthor<R> where R: pallet_balances::Config + pallet_authorship::Config, @@ -44,7 +44,7 @@ where } } -pub struct DealWithFees<R>(sp_std::marker::PhantomData<R>); +pub struct DealWithFees<R>(core::marker::PhantomData<R>); impl<R> OnUnbalanced<Credit<R::AccountId, pallet_balances::Pallet<R>>> for DealWithFees<R> 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 052fb0389db40c086d2c13b3d30501e093ef5f90..7a689a517eaa2ab97cd827890a0ffeb60bb59bb6 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<Test>; type Block = frame_system::mocking::MockBlockU32<Test>; diff --git a/polkadot/runtime/common/src/lib.rs b/polkadot/runtime/common/src/lib.rs index 6e50384f68c9cf5972717a1cc60ad901b5f37dab..41e1cdbab8011bc1cb502c5d87f0214bddfc445a 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<T>(sp_std::marker::PhantomData<T>); +pub struct ParachainSessionKeyPlaceholder<T>(core::marker::PhantomData<T>); impl<T> sp_runtime::BoundToRuntimeAppPublic for ParachainSessionKeyPlaceholder<T> { type Public = ValidatorId; } @@ -198,7 +200,7 @@ impl<T: pallet_session::Config> OneSessionHandler<T::AccountId> /// A placeholder since there is currently no provided session key handler for parachain validator /// keys. -pub struct AssignmentSessionKeyPlaceholder<T>(sp_std::marker::PhantomData<T>); +pub struct AssignmentSessionKeyPlaceholder<T>(core::marker::PhantomData<T>); impl<T> sp_runtime::BoundToRuntimeAppPublic for AssignmentSessionKeyPlaceholder<T> { type Public = AssignmentId; } diff --git a/polkadot/runtime/common/src/mock.rs b/polkadot/runtime/common/src/mock.rs index 6534110cc21043510e5944d1407d28f9d219c067..54170b07fa62c63c226ee5bac8c095b5e479307f 100644 --- a/polkadot/runtime/common/src/mock.rs +++ b/polkadot/runtime/common/src/mock.rs @@ -37,7 +37,7 @@ thread_local! { static MANAGERS: RefCell<HashMap<ParaId, Vec<u8>>> = RefCell::new(HashMap::new()); } -pub struct TestRegistrar<T>(sp_std::marker::PhantomData<T>); +pub struct TestRegistrar<T>(core::marker::PhantomData<T>); impl<T: frame_system::Config> Registrar for TestRegistrar<T> { 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 18bb6bbfb559a23e44109230ad7fd87d0b2682ca..6b110d2ff5d5e03ba74bbd79fa835679d46d33a3 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<Account, Balance> { } pub struct VersionUncheckedMigrateToV1<T, UnlockParaIds>( - sp_std::marker::PhantomData<(T, UnlockParaIds)>, + core::marker::PhantomData<(T, UnlockParaIds)>, ); impl<T: Config, UnlockParaIds: Contains<ParaId>> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1<T, UnlockParaIds> diff --git a/polkadot/runtime/common/src/paras_registrar/mod.rs b/polkadot/runtime/common/src/paras_registrar/mod.rs index 606883b7119b4843005f0fb3f7bd7b783fd88ce5..07f02e92656120267272967d1d86ee3d9181da92 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, 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<Test>; type Block = frame_system::mocking::MockBlockU32<Test>; diff --git a/polkadot/runtime/common/src/paras_sudo_wrapper.rs b/polkadot/runtime/common/src/paras_sudo_wrapper.rs index 3ff8d4ac08e15d88be618d79e21f2c5d97627982..af93c70b4783f717a2adddd0f0f34365ae27d954 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 eb480e4efe1f82f657daaa03cd33d883a01d9f7d..d650548b8ac39a4059a7a9721e5926ae5ab528a9 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<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; diff --git a/polkadot/runtime/common/src/slots/mod.rs b/polkadot/runtime/common/src/slots/mod.rs index 747b7b5ca634ed0563061aea2d169624a2ed87ac..333f14c6608acb1d62df7fadbfe297741a39d6cd 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<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; @@ -309,7 +309,7 @@ impl<T: Config> Pallet<T> { // 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<T>)> { - let mut tracker = sp_std::collections::btree_map::BTreeMap::new(); + let mut tracker = alloc::collections::btree_map::BTreeMap::new(); Leases::<T>::get(para).into_iter().for_each(|lease| match lease { Some((who, amount)) => match tracker.get(&who) { Some(prev_amount) => @@ -329,7 +329,7 @@ impl<T: Config> Pallet<T> { impl<T: Config> crate::traits::OnSwap for Pallet<T> { fn on_swap(one: ParaId, other: ParaId) { - Leases::<T>::mutate(one, |x| Leases::<T>::mutate(other, |y| sp_std::mem::swap(x, y))) + Leases::<T>::mutate(one, |x| Leases::<T>::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 eadeac74fcdb63cab542ca080cd372b5fbd4f4fd..6e49abcee98b2778cbe2cce201d5daadf15d80f0 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 81aa34317bfd7a7f82340bc4a8c10760049fd690..b22e1703292067c56160260aa2494d4958e0c589 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 5858a0ac3ca76e32729efa30b244f3bfadaa2bdf..dace785a535b914b6da3ca322ea11cfe94f5dbfd 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<Id> PriceForMessageDelivery for NoPriceForMessageDelivery<Id> { } /// Implementation of [`PriceForMessageDelivery`] which returns a fixed price. -pub struct ConstantPrice<T>(sp_std::marker::PhantomData<T>); +pub struct ConstantPrice<T>(core::marker::PhantomData<T>); impl<T: Get<Assets>> PriceForMessageDelivery for ConstantPrice<T> { type Id = (); @@ -79,7 +80,7 @@ impl<T: Get<Assets>> PriceForMessageDelivery for ConstantPrice<T> { /// - `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<A, B, M, F>(sp_std::marker::PhantomData<(A, B, M, F)>); +pub struct ExponentialPrice<A, B, M, F>(core::marker::PhantomData<(A, B, M, F)>); impl<A: Get<AssetId>, B: Get<u128>, M: Get<u128>, F: FeeTracker> PriceForMessageDelivery for ExponentialPrice<A, B, M, F> { @@ -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 54c685effc1165f7528029f01717ee1ad6f3a298..3709e1eb697ea1a5941b307a4a8abd06238d3b57 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 6164d71f112a47bce0a91da044aa8d9166c8a8b7..479ec7a69c3aaf8a94b9da2a84f2c04f4fea7165 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 1339df9ff6879e6624823fe49cac55eb2854252a..979d5eda9afc645c1b343959a3bf65dc7f3e295c 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 82ba22a70f37b0e8fb5049fbcd6ca60c1eb5c8a1..7afdf49fe55165e87ab936fff3259317c020c1f1 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 e68ac2664b898b5594a19fa7a8626c2d3b257160..9ed007919b81be6f1f68e9f35ff6dfbc46bffc81 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 bab09eda52c2d630171bb790831152d945b718db..9b0cbcb2d7d698b14f818690b26f767d3a22b431 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 ba6951a146921f7f698c02bb49dcaffea76563e4..b0ebfe77a9665bf08ea62c44b1381866372c54bb 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 314be11adbeb79bab4fa0ce2d0b4f52fb5176ceb..03f63d7333b65adddd371168e85cdb19d95b10e2 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<T>(sp_std::marker::PhantomData<T>); + pub struct UncheckedMigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV1<T> { 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<Vec<u8>, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result<alloc::vec::Vec<u8>, sp_runtime::TryRuntimeError> { let n: u32 = v0::OnDemandQueue::<T>::get().len() as u32; log::info!( @@ -100,7 +100,7 @@ mod v1 { } #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> { + fn post_upgrade(state: alloc::vec::Vec<u8>) -> 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 03f05842bca498a26518bbeb0e8f957f2fa5783c..f045e957a6907b9e01be4d30c533c324f62fb907 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 a6074b305b4ebe9cd70880d15d4ae666ef0ac952..0bad4346cfd9d8efb42db2bd66c7d64c0213a803 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 51d586a77a1784c905469dc48ed58fd382a1186b..96367b971fed52c2de43f3f997101b107e11d1ec 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<T> = diff --git a/polkadot/runtime/parachains/src/assigner_parachains/tests.rs b/polkadot/runtime/parachains/src/assigner_parachains/tests.rs index 14cb1a8978602b6273243ec463dfa36eb7b7c80c..817e43a7138ddbe121e84ea6c02497e07b323469 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 c046526ba372b537d48fac8d7be65e97a6b846f9..ec07cca2107e9a7ae02f7f45ea1add1b0bf6199c 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<T: paras_inherent::Config> { fill_claimqueue: bool, /// Cores which should not be available when being populated with pending candidates. unavailable_cores: Vec<u32>, - _phantom: sp_std::marker::PhantomData<T>, + _phantom: core::marker::PhantomData<T>, } /// Paras inherent `enter` benchmark scenario. @@ -143,7 +143,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> { code_upgrade: None, fill_claimqueue: true, unavailable_cores: vec![], - _phantom: sp_std::marker::PhantomData::<T>, + _phantom: core::marker::PhantomData::<T>, } } diff --git a/polkadot/runtime/parachains/src/configuration.rs b/polkadot/runtime/parachains/src/configuration.rs index bffeab4a0d21b13d492550eeb0323624cc8c588c..d09962ef2b4412c3e583129c2ab14624062c5dff 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<BlockNumber> { impl<BlockNumber> HostConfiguration<BlockNumber> where - BlockNumber: Zero + PartialOrd + sp_std::fmt::Debug + Clone + From<u32>, + BlockNumber: Zero + PartialOrd + core::fmt::Debug + Clone + From<u32>, { /// Checks that this instance is consistent with the requirements on each individual member. /// @@ -1469,7 +1469,7 @@ impl<T: Config> Pallet<T> { /// 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<T, P>(sp_std::marker::PhantomData<(T, P)>); +pub struct ActiveConfigHrmpChannelSizeAndCapacityRatio<T, P>(core::marker::PhantomData<(T, P)>); impl<T: crate::hrmp::pallet::Config, P: Get<Percent>> Get<(u32, u32)> for ActiveConfigHrmpChannelSizeAndCapacityRatio<T, P> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v10.rs b/polkadot/runtime/parachains/src/configuration/migration/v10.rs index c53f58faaf03a8ca85d2d6ac3272425976e0f177..9375af88306fd804d079be38672f1527f4ccacd2 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<T>(sp_std::marker::PhantomData<T>); +pub struct VersionUncheckedMigrateToV10<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV10<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v11.rs b/polkadot/runtime/parachains/src/configuration/migration/v11.rs index 4d1bfc26196ca2ade0b904da2c9be4159b0a099e..4dce48fe52b0e37d954b3006cb69e9e190c8b3aa 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<T> = VersionedMigration< <T as frame_system::Config>::DbWeight, >; -pub struct UncheckedMigrateToV11<T>(sp_std::marker::PhantomData<T>); +pub struct UncheckedMigrateToV11<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV11<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v12.rs b/polkadot/runtime/parachains/src/configuration/migration/v12.rs index 126597ed845447c059eebb28b230e988db5ac77d..6b77655687f0dfd13bfdf3f425a4d744b9798cd3 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<BlockNumber> = configuration::HostConfiguration<BlockNumber>; @@ -68,7 +68,7 @@ pub type MigrateToV12<T> = VersionedMigration< <T as frame_system::Config>::DbWeight, >; -pub struct UncheckedMigrateToV12<T>(sp_std::marker::PhantomData<T>); +pub struct UncheckedMigrateToV12<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV12<T> { #[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 bec41d3ea0dc51ec83ecce67f7373751cd7e2432..468bf78692a12980d322233f51eb625720944e22 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<BlockNumber> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v7.rs b/polkadot/runtime/parachains/src/configuration/migration/v7.rs index 8fe4087cf9b170754e07f07175a3de1eac6ce216..9acd28d0f764e4f966fd48cbfd3e6fc9a5810200 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<T>(sp_std::marker::PhantomData<T>); +pub struct MigrateToV7<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV7<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v8.rs b/polkadot/runtime/parachains/src/configuration/migration/v8.rs index 0aa7f550b102afea143c762a70e2056f918d5bc8..81ced74bebb9770ff09fb50b42e9c89f213b6019 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<T>(sp_std::marker::PhantomData<T>); +pub struct MigrateToV8<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV8<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/configuration/migration/v9.rs b/polkadot/runtime/parachains/src/configuration/migration/v9.rs index 6afdd3cec29efbb8988cfab5a79c712553b7b8aa..dff5fdb17a697cf209ccffa07b808175cfab2f7b 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<T>(sp_std::marker::PhantomData<T>); +pub struct MigrateToV9<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV9<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> { diff --git a/polkadot/runtime/parachains/src/coretime/migration.rs b/polkadot/runtime/parachains/src/coretime/migration.rs index 3f82472da8aa4ed15d26230693a7ef7d3d586c79..4e75088675590e54fa6d8dc040732cc032cc0732 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<T, SendXcm, LegacyLease>( - sp_std::marker::PhantomData<(T, SendXcm, LegacyLease)>, + core::marker::PhantomData<(T, SendXcm, LegacyLease)>, ); impl<T: Config, SendXcm: xcm::v4::SendXcm, LegacyLease: GetLegacyLease<BlockNumberFor<T>>> diff --git a/polkadot/runtime/parachains/src/coretime/mod.rs b/polkadot/runtime/parachains/src/coretime/mod.rs index fc8a3c7d9d24b217d1de883c6cb3ed8b3f7be6e2..1c38b3989232b754491f9fe00a6eb49b7433b810 100644 --- a/polkadot/runtime/parachains/src/coretime/mod.rs +++ b/polkadot/runtime/parachains/src/coretime/mod.rs @@ -18,6 +18,8 @@ //! //! <https://github.com/polkadot-fellows/RFCs/blob/main/text/0005-coretime-interface.md> +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 4a0f2390b45dc87b1e4eb3425ee430e0499d3895..f86573dadf562fee7b4cb63190399cbe390a4865 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 e12edffb51b38d83e016d79dabe62c83ee20a098..dd32340c9f64f357913a99d6a50f166f9a9382f2 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<T: Config> = StorageMap<Pallet<T>, Twox64Concat, SessionIndex, Vec<u32>>; - pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> { 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 b50853ecc696c79d5d8b94cda6161f6d912c96f3..4b76fb47e1f8d5fff51e13274931514930ef5de7 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<KeyOwnerIdentification> SlashingOffence<KeyOwnerIdentification> { /// This type implements `SlashingHandler`. pub struct SlashValidatorsForDisputes<C> { - _phantom: sp_std::marker::PhantomData<C>, + _phantom: core::marker::PhantomData<C>, } impl<C> Default for SlashValidatorsForDisputes<C> { @@ -640,7 +642,7 @@ fn is_known_offence<T: Config>( /// When configured properly, should be instantiated with /// `T::KeyOwnerIdentification, Offences, ReportLongevity` parameters. pub struct SlashingReportHandler<I, R, L> { - _phantom: sp_std::marker::PhantomData<(I, R, L)>, + _phantom: core::marker::PhantomData<(I, R, L)>, } impl<I, R, L> Default for SlashingReportHandler<I, R, L> { diff --git a/polkadot/runtime/parachains/src/dmp.rs b/polkadot/runtime/parachains/src/dmp.rs index c0e1635ba1692c3f3d62a13bb686e95d3511bc0a..54e112d1b8b44206b8a121dd082c60718662e14a 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 e34e4a03e711c3592f66a303fb8a2c4d37b64db8..8b01a755c3c7bd75d558989fd593a44334c906b6 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<T: Config> { #[serde(skip)] - _config: sp_std::marker::PhantomData<T>, + _config: core::marker::PhantomData<T>, 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 a340d52643e05df356889a95186170c1e615480e..36a810d341c655cf9309b9b8fec87032a8bc7486 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<T>(sp_std::marker::PhantomData<T>); + pub struct VersionUncheckedMigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> { #[cfg(feature = "try-runtime")] diff --git a/polkadot/runtime/parachains/src/inclusion/mod.rs b/polkadot/runtime/parachains/src/inclusion/mod.rs index a86941a1a0b8e5d4f56eeb50ccf20a6dd81cc62c..281dc5d0c5f47ae56eac005ae8f04d0960e7f204 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 fd0f1c3c065118f81821b0f8587335537421135d..340f727097b58245d9fa9a2553f9e178544bcea1 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<T: Config> Pallet<T> { // 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 51110e89416c373efb1a5226a812ae6ab9f88431..f2995d770e716447a5ada5b816a255b3725b2982 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 9c23347ebb58bb93bf72e2d94a1f95defcea27b9..45576668f6d6267e414e656b411fc593e6f5450f 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 5202cba232d20a9f4303747f55c50ce144a0d68f..fd22929b08ff547398c7f731e9a823a780391a6c 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 0f3318612a77c7bc2ec831e2c7ac67c08eae0392..630b86132ab88681ed438f6a0cdd6e2d131c5522 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 0bf5fe783a0e7bc51e473240f87bcdb7692e5414..80443c7626e2b438ff754d140aa22f91bdc16805 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 8cffcbbbb024fd454f57ed89c7448ffc297e0977..3f0b8659b159977ec8e8544da4c5fc6a4cd6d4bf 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, 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 4c8b093451ed5ac1e917ab980539bc8277374d70..c5284ba1dd1f850d5fdabc7bfd782b488ea12cba 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 dac9e6e256d0ef60c6b18b51d48f44c65e1cae8f..2858c3f95de2602e5020646f69d58ef54a63d97a 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 <http://www.gnu.org/licenses/>. -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 8b527c09490d65c95d268e22d6be4a904d514e02..fe4eef16f02279badc275cd89652ff26435a8dff 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<T: Config> Pallet<T> { fn process_inherent_data( data: ParachainsInherentData<HeaderFor<T>>, context: ProcessInherentDataContext, - ) -> sp_std::result::Result< + ) -> core::result::Result< (ParachainsInherentData<HeaderFor<T>>, PostDispatchInfo), DispatchErrorWithPostInfo, > { @@ -762,7 +762,7 @@ pub(crate) fn apply_weight_limit<T: Config + inclusion::Config>( let mut chained_candidates: Vec<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 abf1c1a56b24b9ee27db011d4538d5864a10c556..0d5653eb729d6114abf6e3f5dcd334b8506fec0c 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<u32, u32>, @@ -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 5f45445b0ba2a29cddc3806b84a25cbdcb1ce77d..69ef2db756c217e022cb37b5a0eefeeabb938171 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<C>(sp_std::marker::PhantomData<C>); +pub struct RewardValidatorsWithEraPoints<C>(core::marker::PhantomData<C>); impl<C> RewardValidatorsWithEraPoints<C> where diff --git a/polkadot/runtime/parachains/src/runtime_api_impl/v10.rs b/polkadot/runtime/parachains/src/runtime_api_impl/v10.rs index 4417ec75abd67bb1ba50b616ceb137e42cf6a7f6..697890232211315af749a365c95fa8cc23425450 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<T: initializer::Config>() -> Vec<ValidatorId> { diff --git a/polkadot/runtime/parachains/src/runtime_api_impl/vstaging.rs b/polkadot/runtime/parachains/src/runtime_api_impl/vstaging.rs index f4e3db185fead7144e6cb0ae3455af98229d59f7..4aa381e33b1bc2246abd3c16044cc56290597b12 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<T: scheduler::Config>() -> BTreeMap<CoreIndex, VecDeque<ParaId>> { diff --git a/polkadot/runtime/parachains/src/scheduler.rs b/polkadot/runtime/parachains/src/scheduler.rs index d7fe5c06863c87413f988a972790c5d3482b513f..445583d929aba9a82322f8fb94a70d38632a4f8f 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<T: Config> Pallet<T> { .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<T: Config> Pallet<T> { fn push_occupied_cores_to_assignment_provider() { AvailabilityCores::<T>::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 84d7d4b567102f6757409d88018f2d4e3072644b..125f105ef70668c8ebacfdb9e2b267b9d00bfcbf 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<T>(sp_std::marker::PhantomData<T>); + pub struct UncheckedMigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV1<T> { fn on_runtime_upgrade() -> Weight { let mut weight: Weight = Weight::zero(); @@ -301,7 +302,7 @@ mod v2 { } /// Migration to V2 - pub struct UncheckedMigrateToV2<T>(sp_std::marker::PhantomData<T>); + pub struct UncheckedMigrateToV2<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV2<T> { fn on_runtime_upgrade() -> Weight { diff --git a/polkadot/runtime/parachains/src/scheduler/tests.rs b/polkadot/runtime/parachains/src/scheduler/tests.rs index 32811241e171cfd07af586bdf6b06b37df644603..f3866146e81121e7fe1ad85e09719df00a89a212 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 ff032f7e34d5efc130b5ce0859fd3160b6039d39..ea05c1aacaa946aa50bcb68e69930acbd60d79eb 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 417de1fa3fb0debeb8099d167859dc21e20329ca..154b7cfefc3aca68b3773b49194dba7038feccc5 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 4d6da8c9e3c1ba9047ebba784138869733f33ec7..d914bf8b666120fba1c3db2f85f3420427fb9186 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 cb2deffd7f6593ac69ea1fd7f10d5dfee9dc4577..3588e494438d066ffd925b2b2cc486431b8feab8 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<T: Clone>(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 c4fbd461a631849010e4d3de7ab98a7b743432fb..f93a3ad65754c7ac201841aca7098f2886da0cf8 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 1c70c94ce04840db1c25f525cca32fff8d99ffeb..67dcd6cd7a510d117eab9299793c7842db1b036e 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<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::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<sp_std::vec::Vec<u8>> { +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<alloc::vec::Vec<u8>> { 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 7b5c7b1fb4aca8b9e574734ca9bf21cf0bc5e527..a4440a1c6e0b986780454d6aaa1bce19ff5a85ad 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 <http://www.gnu.org/licenses/>. 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 ef629c7dad155b5b01426aca89631c13c75b1cad..5adffbd7422f9fc0f7812318bb2548fff6e9c0e0 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { Runtime::metadata_versions() } } @@ -2389,7 +2392,7 @@ sp_api::impl_runtime_apis! { } fn set_up_complex_asset_transfer( - ) -> Option<(Assets, u32, Location, Box<dyn FnOnce()>)> { + ) -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> { // 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 0677ba7fbb2b29afda7039ba8b396cb2d66131d8..ecfbff4fa0688486acebe0313d149d1d87cbab42 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 dbeca534add8259fdf77010296d0c6d557365204..7f573d4e3952e8b0cdfbd1253d8c02bf389d5bb5 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<T>(PhantomData<T>); diff --git a/polkadot/runtime/rococo/src/weights/xcm/mod.rs b/polkadot/runtime/rococo/src/weights/xcm/mod.rs index 12f3df897b1eedb6e722e8f4871eb631bd35aaa3..bd2b0fbb8c061519f99ac1b33b53bb3a387ece74 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 a66fceedae34158e70be869c1b4262fcde3d7a43..ac379b69e3f2ca99f22a7ed336b09b6193342fec 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 96392c026d5c9059ad55ff4a739f50c021eacbd7..a8a369a68e6691e88f05987986d27229843aef9d 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<u32> { + fn metadata_versions() -> Vec<u32> { Runtime::metadata_versions() } } diff --git a/polkadot/runtime/test-runtime/src/xcm_config.rs b/polkadot/runtime/test-runtime/src/xcm_config.rs index b1d86ff9a85e9fc6a9a5f361b933d78898715d49..b424b9a3ee55b4f3504cf3a72849cd5ad5dd09e4 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<A, F>(sp_std::marker::PhantomData<(A, F)>); +pub struct TestDeliveryPrice<A, F>(core::marker::PhantomData<(A, F)>); impl<A: Get<AssetId>, F: FeeTracker> PriceForMessageDelivery for TestDeliveryPrice<A, F> { type Id = F::Id; diff --git a/polkadot/runtime/westend/Cargo.toml b/polkadot/runtime/westend/Cargo.toml index 5a7805c05161be49ae94986b60101594422d4d89..9e739f4c7fe6c0de7358b5763532f761209333e7 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 d7ca677a7620e26aeb2f00e35ec23e67057c8293..11665953bd8e17b2f0368602b176a19046d44be9 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 <http://www.gnu.org/licenses/>. 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 0d7a8a6a4ac222e77886e5f7a939d23ca307a234..f0b16e731d9e564bbf00a9378c5247151d61ca2e 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { 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<Asset> = Some(( TokenLocation::get(), diff --git a/polkadot/runtime/westend/src/weights/xcm/mod.rs b/polkadot/runtime/westend/src/weights/xcm/mod.rs index 09e883a9f7af5820832e7db52a8eeba5148d3a48..cb5894ea51e3c5106e75e86bc35249f24e8a03b4 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 e7d00ac71038b4f02d5172584a398f185864f46c..23d6664bdafcbc147f63c3a99ce2d788277679b5 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 1177d094c6c38a1a3efe4f7bd76bde715d1a2ffd..b07bdfdca3d196095a45370a9b2d622dd2a1636a 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 d99da9184b5d8c7f2680b23140df1083d487b452..6ce49074a6e2b1fa02dd0f1fbe4f90db1058e560 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<u128> - >::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 760b21f93566e12b77a00f2c7b9b744f6db91d68..40a7da58a687c186664404e0a00734b457b60e51 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 a43f27bf47e7242308adc1b53d146508f14e36b2..4a12bb7f47c665ed6f302d5e665cf9c2b0e911a2 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 0cce7a3449389875a7658f20e4012640e13cd394..ed4b441d7c33c347cccda054b8bc7019b3d11388 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 da46a6a37c0654f6ef34daf7bbd37cd5b655ac45..d09c81bf434e2ce843b55fc5b05baee121e562c8 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 668f07c52ce35e8009d33abc3f1d021e07f85394..6451901279b166e116dd8dcf1d204da74db98d35 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, /// The default version to encode outgoing XCM messages with. pub safe_xcm_version: Option<XcmVersion>, } @@ -1438,8 +1441,8 @@ enum FeesHandling<T: Config> { Separate { local_xcm: Xcm<<T as Config>::RuntimeCall>, remote_xcm: Xcm<()> }, } -impl<T: Config> sp_std::fmt::Debug for FeesHandling<T> { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { +impl<T: Config> core::fmt::Debug for FeesHandling<T> { + 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<T: Config> Pallet<T> { 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 b157e6b5c3d5f27d206b73a1b040ca5d7944b8f2..0aec97ab410516c35860f397d41ede599768c5c6 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<T>(sp_std::marker::PhantomData<T>); + pub struct VersionUncheckedMigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> { 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<T>(sp_std::marker::PhantomData<T>); +pub struct MigrateToLatestXcmVersion<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToLatestXcmVersion<T> { fn on_runtime_upgrade() -> Weight { CurrentMigration::<T>::put(VersionMigrationStage::default()); diff --git a/polkadot/xcm/pallet-xcm/src/mock.rs b/polkadot/xcm/pallet-xcm/src/mock.rs index 2be6f301f85621489ab6986aaf300251fd239fbc..3941d104b81c6a5e4421841090c12282542af75f 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 <http://www.gnu.org/licenses/>. 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 d43506aa651b4d719c42b8633649936036b04741..7702e2f9be07db04aafcd911a7fbb9fb2cdfb957 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 520ce87448ea4f868fbb62130a7da45353d220b6..16ae05c20795e27a9aa6b4d2ec78d47b7665bbb2 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 11e9122f9a121b1b08db7a5aec2fd423d63c98cf..5d95005eb663097b8130cd01640d6dd29a4f2307 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 04b19eaa587009aa118e7c7d51ce69b159e4d948..d4ce2ca5b353c94b8d4e512236008eae9a6dd28e 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 99a736d6ac1f9dd197a6813cf377f35991638e9a..355d6ad85388cb1709139112384890354eb8da7a 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 d80c5d70deea8c00fbe32af758e8986cc8c6fa7a..16b7be7f3ba98432b75035e99dbc674dc9a26201 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<Asset, Location>` or //! `Contains<(Location, Vec<Asset>)>`. +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<T: Get<(AssetFilter, Location)>> ContainsPair<Asset, Location> for Case<T> /// 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<LocationFilter, AssetFilters>( - sp_std::marker::PhantomData<(LocationFilter, AssetFilters)>, + core::marker::PhantomData<(LocationFilter, AssetFilters)>, ); impl<LocationFilter: Contains<Location>, AssetFilters: Get<Vec<AssetFilter>>> Contains<(Location, Vec<Asset>)> for LocationWithAssetFilters<LocationFilter, AssetFilters> @@ -75,7 +76,7 @@ impl<LocationFilter: Contains<Location>, AssetFilters: Get<Vec<AssetFilter>>> pub struct AllAssets; impl Get<Vec<AssetFilter>> for AllAssets { fn get() -> Vec<AssetFilter> { - 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<AssetFilter> = sp_std::vec![ + pub OnlyAssetXOrAssetY: alloc::vec::Vec<AssetFilter> = alloc::vec![ Wild(AllOf { fun: WildFungible, id: AssetId(AssetXLocation::get()) }), Wild(AllOf { fun: WildFungible, id: AssetId(AssetYLocation::get()) }), ]; - pub OnlyAssetZ: sp_std::vec::Vec<AssetFilter> = sp_std::vec![ + pub OnlyAssetZ: alloc::vec::Vec<AssetFilter> = 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 45a0e2bdca2862c2142f3ecae17ae19ac6ec1839..25a705a39eb73906ca4c7ececfe4526e7450d712 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 88bbf01d9e1f8c35d2b884be6a0c5a43f24c1073..a259afc6e682565718b86210a746e39928b140ab 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<AssetId> AssetChecking<AssetId> 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<T>(sp_std::marker::PhantomData<T>); +pub struct LocalMint<T>(core::marker::PhantomData<T>); impl<AssetId, T: Contains<AssetId>> AssetChecking<AssetId> for LocalMint<T> { fn asset_checking(asset: &AssetId) -> Option<MintLocation> { match T::contains(asset) { @@ -113,7 +113,7 @@ impl<AssetId, T: Contains<AssetId>> AssetChecking<AssetId> for LocalMint<T> { /// Implementation of `AssetChecking` which subjects a given set of assets `T` to having their /// teleportations recorded with a `MintLocation::NonLocal`. -pub struct NonLocalMint<T>(sp_std::marker::PhantomData<T>); +pub struct NonLocalMint<T>(core::marker::PhantomData<T>); impl<AssetId, T: Contains<AssetId>> AssetChecking<AssetId> for NonLocalMint<T> { fn asset_checking(asset: &AssetId) -> Option<MintLocation> { match T::contains(asset) { @@ -126,7 +126,7 @@ impl<AssetId, T: Contains<AssetId>> AssetChecking<AssetId> for NonLocalMint<T> { /// 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<L, R>(sp_std::marker::PhantomData<(L, R)>); +pub struct DualMint<L, R>(core::marker::PhantomData<(L, R)>); impl<AssetId, L: Contains<AssetId>, R: Contains<AssetId>> AssetChecking<AssetId> for DualMint<L, R> { diff --git a/polkadot/xcm/xcm-builder/src/lib.rs b/polkadot/xcm/xcm-builder/src/lib.rs index cc06c298a418d56f6a70d58b5f24bf8ccb14db5d..c3495601cd87518d1dc472ba5713fa51dbfe30f5 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 f95258492381b387fd71c7186b74b0f09a0aea66..1d840e9c0dde45cd2bb47024b713656b91051392 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 <http://www.gnu.org/licenses/>. 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<UniversalLocation, AccountId> #[cfg(test)] mod tests { use super::*; + use alloc::vec; use polkadot_primitives::AccountId; + pub type ForeignChainAliasAccount<AccountId> = HashedDescription<AccountId, LegacyDescribeForeignChainAccount>; diff --git a/polkadot/xcm/xcm-builder/src/matches_location.rs b/polkadot/xcm/xcm-builder/src/matches_location.rs index b6c2807e6b29db302e2d1182729c5acb4426b24b..71c5ec1efd6f95cc177e931cd7e774d291f71fc2 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<T, L = Location>(sp_std::marker::PhantomData<(T, L)>); +pub struct StartsWith<T, L = Location>(core::marker::PhantomData<(T, L)>); impl<T: Get<L>, L: TryInto<Location> + Clone> Contains<L> for StartsWith<T, L> { fn contains(location: &L) -> bool { let latest_location: Location = @@ -42,7 +42,7 @@ impl<T: Get<InteriorLocation>> Contains<InteriorLocation> for StartsWith<T> { /// An implementation of `Contains` that checks for `Location` or /// `InteriorLocation` if starts with expected `GlobalConsensus(NetworkId)` provided as type /// `T`. -pub struct StartsWithExplicitGlobalConsensus<T>(sp_std::marker::PhantomData<T>); +pub struct StartsWithExplicitGlobalConsensus<T>(core::marker::PhantomData<T>); impl<T: Get<NetworkId>> Contains<Location> for StartsWithExplicitGlobalConsensus<T> { 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 e49fd18f88d806b09614696040fab29ead657ee2..095c50a5a25b006e44fdf3baf7fa911209b6dd5d 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 b69002eafc5b9945c9991a0fd3c981dd3d922338..8e6232ea64d271a9142a07adea573a59f4c17312 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 3fce953848ebdaf0021d84a333fdb00c346b5096..b111a05a4f1fc2a9c0559c42f672a9734fd110fe 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 bbf810463a7c5054b368207774c977a49e3232aa..d568adc3127ce0c83207e04c87a27294f45c34fa 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<Location, Location>`. +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 f64b5660f66748458b6eec7cc3eb02625525de14..6e73c0dae7b698e151b67763e03a3f6dc2ea45b8 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 35b624b041539e3d89fdb98a56d0910d5033417f..978c6870cdaf1e65ffc74adb175fd2e80ba53031 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<FixedLocationValue>(sp_std::marker::PhantomData<FixedLocationValue>); +pub struct FixedLocation<FixedLocationValue>(core::marker::PhantomData<FixedLocationValue>); impl<FixedLocationValue: Get<Location>, AssetKind: Into<AssetId>> TryConvert<AssetKind, LocatableAssetId> for FixedLocation<FixedLocationValue> { diff --git a/polkadot/xcm/xcm-builder/src/process_xcm_message.rs b/polkadot/xcm/xcm-builder/src/process_xcm_message.rs index ef8c71fc2495175c3db20d89688fb983e180776d..2e6f8c5fb566166f600bd9d9a7ef20f8a39fae40 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 543aef97c34095b06c8f4ef840d55f8a9eb0d49b..03ef780ef0325c24e4f53b1013e558a3e0d3990b 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<Inner>(sp_std::marker::PhantomData<Inner>); +pub struct EnsureDecodableXcm<Inner>(core::marker::PhantomData<Inner>); impl<Inner: SendXcm> SendXcm for EnsureDecodableXcm<Inner> { 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 3131dece37570ecda2650c9e03ba44e5346b5f43..37a49a1b3dc7e742c291e49274490dd20aa1ddee 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 f35c73bdb68572b326557b362d20ec888850691e..ac43d217ff3ff221becd89878e95772cf4000ded 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 16ce3d2cf8ffef68d1f218fb1082cee8dc122b4b..379baaf5e37678a712a6ee337993b37bcbc2ecf5 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 <http://www.gnu.org/licenses/>. 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 9820d535f7efdeab1097d8b305fb9f62a19a02f4..8aa9602fcc297e9a402f7df11188773466b6ac90 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<T>(sp_std::marker::PhantomData<T>); +pub struct NetworkExportTable<T>(core::marker::PhantomData<T>); impl<T: Get<Vec<NetworkExportTableItem>>> ExporterFor for NetworkExportTable<T> { fn exporter_for( network: &NetworkId, @@ -649,7 +650,7 @@ mod tests { pub PaymentForNetworkAAndParachain2000: Asset = (Location::parent(), 150).into(); - pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = sp_std::vec![ + pub BridgeTable: alloc::vec::Vec<NetworkExportTableItem> = 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 1efa42ce95601d34b1f28e69b3c3ce59685ce9af..7861fdcc2e579b54b03fe509956c9a46e3405c2c 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 <http://www.gnu.org/licenses/>. 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 582d596b78f1092397dc821dd9152f4295a350fd..0468b0a5410c416a0703502cc38a13dba2a79853 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 <http://www.gnu.org/licenses/>. 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 7d1fc48692f9ac5bbf7d022ef4e0e718a82d257f..cc966f91fe4db948c38a9d4faeff267aefc7e59c 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 4407752f7024273a28883b695d895bcd6a9e7d35..09e7535ebf81d09f07a119224dad42647d4bc366 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 <http://www.gnu.org/licenses/>. -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 aeeb24dcf81243f317a43886a8ddd314d6de6300..1daf5ae750cfbd0bb5a407eceb8d621023586fe0 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<Config: config::Config> XcmExecutor<Config> { /// Remove the registered error handler and return it. Do not refund its weight. fn take_error_handler(&mut self) -> Xcm<Config::RuntimeCall> { let mut r = Xcm::<Config::RuntimeCall>(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<Config: config::Config> XcmExecutor<Config> { /// Remove the registered appendix and return it. fn take_appendix(&mut self) -> Xcm<Config::RuntimeCall> { let mut r = Xcm::<Config::RuntimeCall>(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 b6270c529452133c011fef24b9ac63e057acb91a..b4e9f32983fd52f27eb66d31bb7098d780389de9 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 <http://www.gnu.org/licenses/>. -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 1efe138b8c2116ff50e385943d787817173d6b95..bc62ad655669756793327d23d3d24f5f2da1be9c 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 <http://www.gnu.org/licenses/>. +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 5d2412d6137552db68d30cf61b25b10521afd966..a4ed6014b4fc8bc423bbc5cceb20cee15fe7890f 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 2e3acf5960ec1c4759945927ab37d8af2a35d279..ec9ef70cc817e5a230ae843581fb736ce06770ee 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 <http://www.gnu.org/licenses/>. +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 45f3dc062a6d0a65b2c1b7e2007b4b5250f263bf..aa44aee4f9de39cd7bcda09e3ce3b4e294d8ee6d 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 <http://www.gnu.org/licenses/>. -use sp_std::result; +use core::result; use xcm::latest::prelude::*; pub trait MatchesFungible<Balance> { diff --git a/polkadot/xcm/xcm-executor/src/traits/transact_asset.rs b/polkadot/xcm/xcm-executor/src/traits/transact_asset.rs index eb85af0b80f30e489d3fd4e5189db0c94fa429b1..c2331f805b4bddd51493fa7d9ec8c384baa20f14 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 <http://www.gnu.org/licenses/>. 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 985dfcd0cf2d78cfdc773299c1432e115b6323f2..72de3e0f433b96ed1718be70e3c0feb20340453a 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 <http://www.gnu.org/licenses/>. 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 7d3f1a20b639a719db1fbc023dcc688eff6f2a52..748d5af68a1fdee6c62873370d33387d55a06e6f 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 d422664557e0eb94729a6876fc9001cf786d4b72..e5eeac013fee6e8b7222429dfd0ed93afa9384c9 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<AccountId>` implementation and a default /// `Ss58Prefix`. pub struct LocationToAccountHelper<AccountId, Conversion>( - sp_std::marker::PhantomData<(AccountId, Conversion)>, + core::marker::PhantomData<(AccountId, Conversion)>, ); impl<AccountId: Decode, Conversion: ConvertLocation<AccountId>> LocationToAccountHelper<AccountId, Conversion> diff --git a/polkadot/xcm/xcm-runtime-apis/src/dry_run.rs b/polkadot/xcm/xcm-runtime-apis/src/dry_run.rs index 9828acab402300a55abf2ece820cf8871c76a858..2a1a0daf0d5d5d0bae868e973df56f7e35b41592 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 572d4edf533865e66299eba7bd0d22a890547603..3445d42ecab3bda1a212e60f2be5583a31e04b58 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 7b3b86214b3a14d3886b8dec2928d564358e370f..b106836c1132b253acdc01e8b9fd63a7c4ff828b 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 e723e254635659de94c489363260da84e27b440e..c76b26fcd2a337545450da4d77cb0103c3e8eb8c 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 93c8302757cb061bc1f97d003ce8b7de2374448e..bfb455aba3f9302200d58bcd6b7c074d1053468f 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<RuntimeOrigin, Location> for ForeignCreators { fn try_origin( o: RuntimeOrigin, a: &Location, - ) -> sp_std::result::Result<Self::Success, RuntimeOrigin> { + ) -> core::result::Result<Self::Success, RuntimeOrigin> { let origin_location = pallet_xcm::EnsureXcm::<Everything>::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 11435868d4682ae4229b7939f2a8685316c7e296..616329a2f06b43f73d059a3471f49c2d7fa82e95 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 a6747a4789edf8065462b831893ebc8b0284dd18..59df394406ea00fd3a3d0edb5e78efe1475e77bc 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 96b47999fe952145b09faa93aaf2cefd5143acb9..bf7b0e15967c027738751cff3edaa27c29f41a0c 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 38ec56507113f561721887689a5f4540121e2403..98187e7391f3e2d316c53da6b52ebdaea97f85fc 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<AccountId, AssetBalance, AssetId> diff --git a/substrate/bin/node/runtime/src/impls.rs b/substrate/bin/node/runtime/src/impls.rs index dbe562857c99fcdd4730edd0aa5d985ab2e6dd51..6c121fad624b2c6be3b6a22813b6d56f57952526 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 fc87fea57ba2e8e667c36d5808e793630373076f..2d1f52066f8f38ee10df88bace8df9cb68bbef1c 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<u32> { + fn metadata_versions() -> alloc::vec::Vec<u32> { Runtime::metadata_versions() } } diff --git a/substrate/client/executor/runtime-test/Cargo.toml b/substrate/client/executor/runtime-test/Cargo.toml index 5f5e7eb46d623782916e55637dfd93e892cab6fe..d132f47ff877f3c05580326e832a72c34676f7da 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 40683fbb664aadb6daf68595befcc68881322f05..08a5e39dff2cfdca2a2f3629caf939e836ef3144 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 3fa583cf7aca1f6dab055e4d498982268f1be084..37b35fcb910327abef20968d4af973ecdd88412f 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 594cb505cd60ff97b8247f4a9d284c3b3b82139f..41ece6c9a27fef834eac8468731b90b6f8ed5b9d 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 7ad9961d9b89cfd28023e70934a2697cadaa6984..451b86b35ddef7fa96945888e9b885444171dc9d 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 ed771c7226ea9d9c43a94b906722f5379e7c0174..be65f49e6e4ea406cc742f153009fb8d22ca4fd5 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 149030b52c674a8007ea19f77ec1356fb44a49b3..75b949c19b3256d0276679662fb8b1fc8a81acc1 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 27d86bf6710b0c343e72f8c0b01494020bb4b0d3..4e867ece1bd274c7d1ddf2596c8790d726ccf517 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 0dc6cd5b1672ae02fcaf8b9a08fd51618bf981c5..97a676fde10d56e3a9e13e41c0ff5f89dd50a7ce 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 a7370f38bc4b0472c4baea94bffc0d26b3169efe..384e17c9f0aac59ade14dfb928ed9247afaa34a1 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<T: Config>(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 a655a9cb44525fe58bf07f283c0cf3cdf2c9fd42..58c15b47a3eb347c60042e522263507de9017e3b 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 91c18b2e79494eb39812c0aca9f33dfdf6710d60..5c05faa6aa88dba9bb5c55b58cd5a1de7054dac1 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 c5f68476b1d0a620425719877843b9a276a9f08e..b003fe482881dd27996d8f9392e66aab46c5b5a2 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<AssetKind> { diff --git a/substrate/frame/asset-conversion/src/lib.rs b/substrate/frame/asset-conversion/src/lib.rs index 62acb693efb1c1e36bf22ad0530649f796a0d5a7..a9dc30375e5a89672cda919d0ff75469f9c7bf4d 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 96c87020684fbf195b8d2cac1976c4884ea6d7cc..4aeb6a39e8241b0322bc1df82810c2c2c5afba01 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 69f8267a4f25fe2fa82113eb6d9673b05b4ab6aa..cfb013a73f5e802f9403e7a12c4aba1e3c70e8c6 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 d0b5dc777898898fa1e71b259ea018be11de8552..802b8b9f39d80d34a501db3fe3859afc0fb4d799 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 1b65bb953d77c0f4f75b14d74b1c84fefecf81aa..97cc04174a0c63d630ddfe0b2ebf669c85af56c2 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<T: Config<I>, I: 'static>(s: &mut bool) { let asset_id = default_asset_id::<T, I>(); Asset::<T, I>::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 1e4a9522759c35b868447c8a0960643d468e4c71..c218c4ddc952cc4f6ef3a7be652e7000660c1150 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<T: Config<I>, I: 'static> Pallet<T, I> { /// 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<T::AccountId>, + who: impl core::borrow::Borrow<T::AccountId>, ) -> Option<ExtraMutator<T, I>> { 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::AccountId>) -> T::Balance { + pub fn balance(id: T::AssetId, who: impl core::borrow::Borrow<T::AccountId>) -> 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<T::AccountId>, + who: impl core::borrow::Borrow<T::AccountId>, ) -> Option<T::Balance> { Account::<T, I>::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 30122f6d788ff868b6f077f3e0c4e7cd3b26915f..578fa08c4e63ed8cc7dfedea21608228e03c6415 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 6dbce717a8e8db6cd09af424d26b0f5557b8c650..b9b5b2388dfbe270508b713c315e8a029a27d92f 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 7e2f5fc74ab22cebf835c1924478067f8a2abc3b..033100630129697bbb0d0d2ae0179fbb6d35ea7b 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 dc0300dc1a5c95d2654dfa5a210e6efab26125f6..c3010f5c9c03bce4b2dedc22f522a5fd84128980 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 97582e7d2e9dbf110a1c22b5de6ad5e592acb980..f9d74592763875aa5ef46f9665d6759504555a62 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 3ca1444aaae9b61511a33ed6a9dc9075a2e8c864..f829578fb285132812f6ce341cf4f5efcb950101 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<T>(sp_std::marker::PhantomData<T>); +pub struct MinimumPeriodTimesTwo<T>(core::marker::PhantomData<T>); impl<T: pallet_timestamp::Config> Get<T::Moment> for MinimumPeriodTimesTwo<T> { fn get() -> T::Moment { @@ -119,7 +121,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet<T>(sp_std::marker::PhantomData<T>); + pub struct Pallet<T>(core::marker::PhantomData<T>); #[pallet::hooks] impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { @@ -362,7 +364,7 @@ impl<T: Config> FindAuthor<u32> for Pallet<T> { /// 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<T, Inner>(sp_std::marker::PhantomData<(T, Inner)>); +pub struct FindAccountFromAuthorIndex<T, Inner>(core::marker::PhantomData<(T, Inner)>); impl<T: Config, Inner: FindAuthor<u32>> FindAuthor<T::AuthorityId> for FindAccountFromAuthorIndex<T, Inner> diff --git a/substrate/frame/authority-discovery/Cargo.toml b/substrate/frame/authority-discovery/Cargo.toml index 79057d94107be2485c6bfb48ec9a20373b83e143..9d55a7fd5dcb83454396ee08d209f8d2930dfe6c 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 16f71960d693bec3de2babe446470e2db94bb8b9..220b39292b57598cdc1def77baef6874d7165c95 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<T: Config> { pub keys: Vec<AuthorityId>, #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -168,6 +170,7 @@ impl<T: Config> OneSessionHandler<T::AccountId> for Pallet<T> { 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 58292c0eba393d482740a7cd59a748b17658f8c4..8ecacca93e0ab50c7a3d5d5fdfe2a5af43f99f2f 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 d8f1baab23c8b11579c22a986dc65286f2e2508a..a0cca806e7863cef0259febfb3cba0cdeee4238f 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 68638798e796a0a0cf67fd428216fb5b8114e95d..3dfda3b618be3764557ff53ec57578ff0515d5e9 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 ed1df640583b26db4d07462618da92f324c59e4e..4be07bdae1f0154c2ca1331bbdd62b6540dae665 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<Offender: Clone> Offence<Offender> for EquivocationOffence<Offender> { /// - 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<T, R, P, L>(sp_std::marker::PhantomData<(T, R, P, L)>); +pub struct EquivocationReportSystem<T, R, P, L>(core::marker::PhantomData<(T, R, P, L)>); impl<T, R, P, L> OffenceReportSystem<Option<T::AccountId>, (EquivocationProof<HeaderFor<T>>, T::KeyOwnerProof)> diff --git a/substrate/frame/babe/src/lib.rs b/substrate/frame/babe/src/lib.rs index 9e16f1d09515688e0fc7226918d197dd86d9cb7e..3e33d5627c47b7b062af4431f913dd896e68d2bd 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<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -687,7 +689,7 @@ impl<T: Config> Pallet<T> { // Update the start blocks of the previous and new current epoch. EpochStart::<T>::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 = <frame_system::Pallet<T>>::block_number(); }); @@ -868,7 +870,7 @@ impl<T: Config> Pallet<T> { /// randomness. Returns the new randomness. fn randomness_change_epoch(next_epoch_index: u64) -> BabeRandomness { let this_randomness = NextRandomness::<T>::get(); - let segment_idx: u32 = SegmentIndex::<T>::mutate(|s| sp_std::mem::replace(s, 0)); + let segment_idx: u32 = SegmentIndex::<T>::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<T>(sp_std::marker::PhantomData<T>); + struct __OldNextEpochConfig<T>(core::marker::PhantomData<T>); impl<T: BabePalletPrefix> frame_support::traits::StorageInstance for __OldNextEpochConfig<T> { 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 bf57bd2af53cef42fda4c963b327f52aa08edb89..549c4334b55db2d28508b92b98e6a45aa3365921 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 9f7c22d99dad1edf798259b784e91f90fe339104..1f0584fa07e5b78f3dc5a433af5a753e36eeb1f8 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 0c3955c0d7b79882b4fa97fe18ba0988fcc7d2af..55f4c24835ea685868eede09977fe967fc4a7bcf 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 8e3d4cc1f012d7c5c8fa62c8eea903ea8fa522da..f6af1da5e7b78e9274add30b81e9cf25cf499df5 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<T: Config<I>, I: 'static> SortedListProvider<T::AccountId> for Pallet<T, I> let node = list::Node::<T, I>::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 e90530341a1552b61e8d0caca39b1e5c021c4367..696b64d40e9b91bb5483159b4e21ecd5f800aa18 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<T: Config<I>, I: 'static> List<T, I> { let start_node = Node::<T, I>::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<T: Config<I>, I: 'static> List<T, I> { 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<T: Config<I>, I: 'static> List<T, I> { 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<T: Config<I>, I: 'static> Bag<T, I> { /// Iterate over the nodes in this bag. pub(crate) fn iter(&self) -> impl Iterator<Item = Node<T, I>> { - 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<T: Config<I>, I: 'static> Bag<T, I> { #[cfg(feature = "std")] #[allow(dead_code)] pub fn std_iter(&self) -> impl Iterator<Item = Node<T, I>> { - 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 7df63a6a44c54ebaeae42a177ed0328766e53593..bfc70fef370a54853c7ab277c01e922dc0aa24fc 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<T: crate::Config<I>, I: 'static>(sp_std::marker::PhantomData<(T, I)>); +pub struct CheckCounterPrefix<T: crate::Config<I>, I: 'static>(core::marker::PhantomData<(T, I)>); impl<T: crate::Config<I>, I: 'static> OnRuntimeUpgrade for CheckCounterPrefix<T, I> { 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<T: crate::Config<I>, I: 'static = ()>(sp_std::marker::PhantomData<(T, I)>); +pub struct AddScore<T: crate::Config<I>, I: 'static = ()>(core::marker::PhantomData<(T, I)>); impl<T: crate::Config<I>, I: 'static> OnRuntimeUpgrade for AddScore<T, I> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> { diff --git a/substrate/frame/balances/Cargo.toml b/substrate/frame/balances/Cargo.toml index 5fa8fa84bf59e2401fba74f17f9c838f6cf3775a..85734dce9e9b2400b05e77202442bdb8e9ffb3b0 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 d5fe9934e239e9e4c513e9e021686eec3ca757c3..454aead1773f29e2ee2db0f1fad4711aa8b19b95 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 d01884293c0902ea66636877d1b3d65fbd74f5a1..0aaf618b303f4533e0ced1104d68d18b31327223 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::<sp_std::collections::btree_set::BTreeSet<_>>(); + .collect::<alloc::collections::btree_set::BTreeSet<_>>(); 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::AccountId>) -> T::Balance { + pub fn free_balance(who: impl core::borrow::Borrow<T::AccountId>) -> 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::AccountId>) -> T::Balance { + pub fn usable_balance(who: impl core::borrow::Borrow<T::AccountId>) -> T::Balance { <Self as fungible::Inspect<_>>::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::AccountId>, - ) -> T::Balance { + pub fn usable_balance_for_fees(who: impl core::borrow::Borrow<T::AccountId>) -> T::Balance { <Self as fungible::Inspect<_>>::reducible_balance(who.borrow(), Protect, Polite) } /// Get the reserved balance of an account. - pub fn reserved_balance(who: impl sp_std::borrow::Borrow<T::AccountId>) -> T::Balance { + pub fn reserved_balance(who: impl core::borrow::Borrow<T::AccountId>) -> T::Balance { Self::account(who.borrow()).reserved } diff --git a/substrate/frame/beefy-mmr/Cargo.toml b/substrate/frame/beefy-mmr/Cargo.toml index b46998a857426fb3edfa8affaea702cffc2f4732..11a7b281e87d9e3c1e49f304ae08f7206d34dffd 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 18ebc9d8f38a765153bbd2cde73265ee1e87f480..ec341cad2084a717b5e90fdf1921d62c05ea914e 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<T>(sp_std::marker::PhantomData<T>); +pub struct DepositBeefyDigest<T>(core::marker::PhantomData<T>); impl<T> pallet_mmr::primitives::OnNewRoot<sp_consensus_beefy::MmrRootHash> for DepositBeefyDigest<T> where diff --git a/substrate/frame/beefy/Cargo.toml b/substrate/frame/beefy/Cargo.toml index 8ce3a05985be7dfa383b91c187451f3a4753efd6..089b817e226f37878cfdd2fb00d231afea642d03 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 a1526e7811111366b6f4a3012529f7e81df0e5db..15345e6ae1997ccd0e768edd56afcecb11e21f35 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<T, R, P, L>(sp_std::marker::PhantomData<(T, R, P, L)>); +pub struct EquivocationReportSystem<T, R, P, L>(core::marker::PhantomData<(T, R, P, L)>); /// Equivocation evidence convenience alias. pub enum EquivocationEvidenceFor<T: Config> { diff --git a/substrate/frame/beefy/src/lib.rs b/substrate/frame/beefy/src/lib.rs index a49f5d28f455a99560b9fc445f1a64c471aa54cc..fd9a0027c6fc6f8fb34cea5c4e6ce0940530155b 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 a2c15951a596673edf2ab6d3485dbefb022e7acb..61bc706963bb6c457e17a4cbc68a81b557a9e8d5 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 4341f011fcbf9c323fbe9b5b7de7d1b86bc71c12..6a449fb597d5641c15d807e79d2ec9b96d2dc78e 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 7e6aa8e6bf605859fe3cc6bf0cd0b4bd3d56ccc1..bf3d406d0b2b04364646ac4051f73d7efcebe502 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<u8, _> = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec<u8, _> = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::<T>::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<u8, _> = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec<u8, _> = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::<T>::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<u8, _> = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec<u8, _> = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::<T>::put(&v); LargeValue2::<T>::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<u8, _> = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec<u8, _> = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::<T>::put(&v); LargeValue2::<T>::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<u8, _> = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec<u8, _> = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::<T>::put(&v); LargeValue2::<T>::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<u8, _> = sp_std::vec![0u8; l as usize].try_into().unwrap(); + let v: sp_runtime::BoundedVec<u8, _> = alloc::vec![0u8; l as usize].try_into().unwrap(); LargeValue::<T>::put(&v); LargeValue2::<T>::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::<T>::insert(i, sp_std::vec![0; i as usize]); - UnboundedMap2::<T>::insert(i, sp_std::vec![0; i as usize]); + UnboundedMap::<T>::insert(i, alloc::vec![0; i as usize]); + UnboundedMap2::<T>::insert(i, alloc::vec![0; i as usize]); #[block] { assert!(UnboundedMap::<T>::get(i).is_some()); @@ -333,7 +333,7 @@ mod benchmarks { })] fn storage_map_partial_unbounded_read(i: Linear<0, 1000>) { Map1M::<T>::insert(i, 0); - UnboundedMap::<T>::insert(i, sp_std::vec![0; i as usize]); + UnboundedMap::<T>::insert(i, alloc::vec![0; i as usize]); #[block] { assert!(Map1M::<T>::get(i).is_some()); @@ -346,7 +346,7 @@ mod benchmarks { })] fn storage_map_partial_unbounded_ignored_read(i: Linear<0, 1000>) { Map1M::<T>::insert(i, 0); - UnboundedMap::<T>::insert(i, sp_std::vec![0; i as usize]); + UnboundedMap::<T>::insert(i, alloc::vec![0; i as usize]); #[block] { assert!(Map1M::<T>::get(i).is_some()); @@ -379,7 +379,7 @@ mod benchmarks { #[benchmark] fn storage_iteration() { for i in 0..65000 { - UnboundedMapTwox::<T>::insert(i, sp_std::vec![0; 64]); + UnboundedMapTwox::<T>::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 eb02ccc983c09fd5084a174d07cdc10fd5ecac22..4cdbaec2305c129ee03e6323b0aea0e811b96efb 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<T>(_); diff --git a/substrate/frame/benchmarking/src/baseline.rs b/substrate/frame/benchmarking/src/baseline.rs index e76d5aed7b8d3539810ec7c7cd2f83acb51479eb..711d2123ca8316c7715a7a7fd5cc292bbb5e409a 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 d4ee0abbecce5be341881d73004c59bf71d9db97..625da2a24bd0ad1d9375bdffeaeca87b0beb9671 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 bcca5fe7c2f2a59fb81c6f4e52ee1f5e7f7c0da3..09011eadb03ae850ddb00a6c29c59ecc33315746 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 d6e1cf99ef73f33820fbea31c8f31a560ec487b6..ecffbd1a018fa067d7b7fa0013fc4d9aef49f460 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 bfa25f63ef33eb9cb724a7ca3aa25ec706046d98..ca362f7aa7efe20e4c78a29a2a7d3136ec548775 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 07778646237edc6f4f2fdb0151033dc8cd84aa5f..d687f9fdfa1048241e6a4547ce0d5fa5a9110b8d 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 4b242a1a577ced6599a8142acc8d85f8af0f93e2..cb9fa1f964b06fa56a27b3de31cf7cc88ac37d67 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 f53d95d919d40c6a1b0f53ab3e1ca85443bd8419..de93ba5c4ce7ac30ad5a090358d7da33ccb34ba9 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 c04bec2d12aea6bb38f94942c66965076058a5e8..7b89a6e3e76f5ead57e76c17a304080d2dc978d0 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 77c4883e4a433ffb0e0fb8c376b23bf109948769..7593a4e8da14ab7d63e97b59c4860253a6ca51fd 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 3c9ea4cdba4e74da1df2fe343bc8412da2fe5466..33df56c95f65dbcc7fdc4472971b632d7b9ab605 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 f92f8b22091ac992180fd3f44d93cffddd59061d..9c18e2c4ff0b33ce2357f8c1ba6860f2d56efc49 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 4cb380bae91d87e1ec32a96d88cfaa1b5fcd97a4..45c33c1bfa61545c0b02dfcd35f133ceef0c6e70 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] diff --git a/substrate/frame/broker/src/migration.rs b/substrate/frame/broker/src/migration.rs index 917f44a134cc17bb61ce6dfed0206a505a0f2d21..c2a243d6f0e8e571b7f52b4f7112348ed05ba998 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 f29651abff7b814791c446c29994e7617c619da1..6b1d2bbf7015dc8c1858678aaad9674177c9d638 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<Test>; diff --git a/substrate/frame/broker/src/nonfungible_impl.rs b/substrate/frame/broker/src/nonfungible_impl.rs index 80dcc175df539bbc9861fdaa30adfdab1bb40172..e272ecbe0081bcfe0dd97ec763fcfd77bb4f1ba4 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<T: Config> Inspect<T::AccountId> for Pallet<T> { type ItemId = u128; diff --git a/substrate/frame/broker/src/test_fungibles.rs b/substrate/frame/broker/src/test_fungibles.rs index d18bff1495331e96b699e708975f4942925354fb..b0a06fc1a326d837e49506726a211ca600230138 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<u8>), Vec<u8>> = Default::default(); diff --git a/substrate/frame/broker/src/tick_impls.rs b/substrate/frame/broker/src/tick_impls.rs index 3292faa4eb7e398bd603de6fa1108a1e5470f588..71a1286d73915dc554597abddc2e724a5cce98c4 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<T: Config> Pallet<T> { diff --git a/substrate/frame/child-bounties/Cargo.toml b/substrate/frame/child-bounties/Cargo.toml index d0072e3a476132fb7ea2eeef35d895dc2829dc80..9c979b41462c45e20704dbb1111de1f4796acd2b 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 947cfcfaa96a2daeb88c68c9cda501c42554fbe3..b1f6370f33405495f4becb317b5c0459966d6710 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 04a1f9799cb86e8831a849620b8288fc0692a9c8..911fd4c4c49f7118557dcc04dbe53600f4cbd1f7 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 6fc4bb7782987f6e32faaabea1e4e661822829bb..7d9a4c41c81292f941bcb3c6cbbb0628cd4f396a 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 d0009d02f68c2f0d26e5847221c85ede39e9e633..3544a8cddb45cadf022a2808f3c199651d5e6798 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<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> { 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 7df5d304c34afa9258492a121ca23feff0318de9..85d98206ea57b4570db87c5e556059d156b4db23 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 bfdf6dd97eaf17fc0601f78c7c179e411c3a143d..6e922c16c2982b8399978511b9dd5558ba2c0ce8 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 f35846ba32c31e0b260ffe428f459f0a14b9256b..3579b46ea6e9c858e73cfaa879104c550042a011 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 f91f8660cd315b4971eb60921d185f99c76ba9e3..84ea7de00a2f1d3a3e64404dede2cde1556d039a 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 5d73d825fca9a76d15742c7a44b32b11a95fed51..d87eaba734376accad18f278afcacfd1511af3c1 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<T>>; diff --git a/substrate/frame/contracts/src/benchmarking/code.rs b/substrate/frame/contracts/src/benchmarking/code.rs index 65bcf30683c05e83515815ae33ffe5d9c4aadb70..1473022b5537885ad2a068a6cf97b26e755811ef 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 80c7e863d2994020e5f79dc3364cddb25dc72890..612f929e8b196e30d5b60dfeed64582c4d8a49b5 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<T: Config>() -> BalanceOf<T> { #[benchmarks( where - <BalanceOf<T> as codec::HasCompact>::Type: Clone + Eq + PartialEq + sp_std::fmt::Debug + scale_info::TypeInfo + codec::Encode, + <BalanceOf<T> as codec::HasCompact>::Type: Clone + Eq + PartialEq + core::fmt::Debug + scale_info::TypeInfo + codec::Encode, T: Config + pallet_balances::Config, BalanceOf<T>: From<<pallet_balances::Pallet<T> as Currency<T::AccountId>>::Balance>, <pallet_balances::Pallet<T> as Currency<T::AccountId>>::Balance: From<BalanceOf<T>>, diff --git a/substrate/frame/contracts/src/chain_extension.rs b/substrate/frame/contracts/src/chain_extension.rs index f3a67fcb09a086cd44a890e749ca6f209a47db80..b9bb451fd734abf9b8cd15561cd89e08980836b2 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<T> = sp_std::result::Result<T, DispatchError>; +pub type Result<T> = core::result::Result<T, DispatchError>; /// 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 84a3f7dc2a1405626011fb1b4127ab834088e09c..0cc4844166f35de209546ec0bed6e6139eaa9951 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<T> = <T as frame_system::Config>::AccountId; pub type MomentOf<T> = <<T as Config>::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<Item = &Frame<T>> { - 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<Item = &mut Frame<T>> { - 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 33083c7ebe76a977ab760eec74c6a1e678289d19..ed00fdca62ff2c9f219fb211f4eb03976ced6a38 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 c633ba9c2d50d6bf31da965cd6cd4638d048fb6b..29ac74d0d50a972f746c9219bff7f8d2f277b1fa 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 7e84191910d9f244d8b3ec98439835f311fbfe10..6a67395174f5d002f3a9bc4b1a563000df271571 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<T: Config>(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::<T>::insert(hash, module); diff --git a/substrate/frame/contracts/src/migration/v10.rs b/substrate/frame/contracts/src/migration/v10.rs index 61632a1fd1bad99fd3f80972f2b1defddb6d4462..23e7fd238bb7c6310fb0f047ab5e42f2c7c58121 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 9b4316162ca62a9a9d4e1c3f9b1a912f97122293..bd128e22869f43d8002d155e4f665f7aa7628368 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 aad51a9edcab21ba408065ab5ddce75561f97f79..3c33591e435147abf2fbacc7013d2c40cadf33b2 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::<T>::insert(hash, code.clone()); diff --git a/substrate/frame/contracts/src/migration/v13.rs b/substrate/frame/contracts/src/migration/v13.rs index 6929bbce28e59f9032722b43b335a31da5cf485c..d1888b338dac74e87821d08b9b359841654e730e 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 017fd6d0c15b74cc8f4fe95d1faa23e91c3e6d5a..11336fe2e7d35828fbe2b548bc882273d44b8a03 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<<T as frame_system::Config>::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 3c700d1c0b021e1f4066d2c5993e39589924e6b7..11f07282d5614547713a863dd344d11ef4fc4b2f 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 74fbc997718d6fb6e13193c5735ea3aa074dfd79..3d5b2d2a85fcd4689279cedf376b65c5f15b9eff 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<T: Config>( diff --git a/substrate/frame/contracts/src/primitives.rs b/substrate/frame/contracts/src/primitives.rs index ab73b28e8c49ffc0076d0b0792b5750e41be74f3..622a69f529fb50f501fd53da826fc465d3915e2d 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 1e9739a1599eb8cc8137f2f0fabec8dd14d64b3a..23b5a2514eb141390b32c48670673615178ed1c0 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 7c55ce5d3f0c4acda7af2d35741a7b155933b11f..951cb25994e1f7b517fb93e7f4817c3bbf8d2a17 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<T> = Deposit<BalanceOf<T>>; diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index c20577a3f6458ef66886b6c1f29346ad31fb049c..3f608d90bea7eae90a803e7aefb41d0f7ec18a60 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<<Test as frame_system::Config>::AccountId> = None; } -pub struct EnsureAccount<T, A>(sp_std::marker::PhantomData<(T, A)>); +pub struct EnsureAccount<T, A>(core::marker::PhantomData<(T, A)>); impl<T: Config, A: sp_core::Get<Option<crate::AccountIdOf<T>>>> EnsureOrigin<<T as frame_system::Config>::RuntimeOrigin> for EnsureAccount<T, A> where diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index 0d65d696758d0f3af8a12df0623b853f73b193f2..2fef07f8b7a4c4d7b57d0011a965c7d1be61ae60 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 50eb6d625321abc0961ce4c1c0b66001dd00b1fa..93fe3080d22db712055d890883d78cea81fb5a9b 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<Vec<super::LoadingMode>> = RefCell::new(Vec::new()); } diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 5f50dbf391a2822d66a8930eac12bea4a45ccdd4..50b06de080cabb0bad66b20f951541db965b121b 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<T> = <T as frame_system::Config>::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::<TopicOf<E::T>>() as u32) + .checked_div(core::mem::size_of::<TopicOf<E::T>>() 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 b96809b8aeb4d2a1011c003471f3c918157e60a9..6184b0ffd6e67d4c47299b1372ebdc57273f16d2 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 8701ed7ebb074273b161a980ef0f6650d1ced11b..546ad5385355e23316c24ca19ee83dc07cf497b8 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 466fc70a619b649e4b1aade0002e506dde430a1e..be7f7f448070fe57d77df6e02d05745acdfa422b 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<T: Config<I>, I: 'static> Pallet<T, I> { ensure!(balance <= T::Currency::total_balance(&who), Error::<T, I>::InsufficientFunds); let votes = VotingFor::<T, I>::try_mutate(&who, &class, |voting| -> Result<u32, DispatchError> { - let old = sp_std::mem::replace( + let old = core::mem::replace( voting, Voting::Delegating(Delegating { balance, @@ -596,7 +597,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> { fn try_undelegate(who: T::AccountId, class: ClassOf<T, I>) -> Result<u32, DispatchError> { let votes = VotingFor::<T, I>::try_mutate(&who, &class, |voting| -> Result<u32, DispatchError> { - 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 2c45b54485bd95c5d0e6e97b114ea199b376444f..d6bbb678a14b3129e0ae75db0271d7f9c25f6875 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 5ae08f0de65f269ad71cf1e7679e5421be4fa3db..1c5b742ba12b16714b7c886d94b374c8d2dde5a3 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 44290402594a956e58250cf4086d4f0e9cc4400f..7ef6f9e11eb1129e8491d884ddcdac571a950a14 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 34461e062b35cc73c727e81fcdb9ab9081c2580c..adb8a4a091b8dcf473277763d992a632e3fb539a 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 5ed2562d6d019b9a85e3974005831861a3e37887..c61447e36280a93e0ce553116c8b868d606061a3 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 b8b5540a4b475be0a5a40ec2324b94f71d0da9c8..b1e27d1e79363c8beff890a578edda832ccb8349 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 0c1bcf0df0c5e3422367d64ec3c3d21e85f50e75..a7751e1d6c1ca1b7bf32da1d260e72c2729ad8e5 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 9f5649672d70e9e55ad84350d0be53bd4abb2b0f..f8df9dfe7b46c9c1730321d657bbd9b3e11617c8 100644 --- a/substrate/frame/delegated-staking/src/impls.rs +++ b/substrate/frame/delegated-staking/src/impls.rs @@ -139,7 +139,7 @@ impl<T: Config> OnStakingUpdate<T::AccountId, BalanceOf<T>> for Pallet<T> { fn on_slash( who: &T::AccountId, _slashed_active: BalanceOf<T>, - _slashed_unlocking: &sp_std::collections::btree_map::BTreeMap<EraIndex, BalanceOf<T>>, + _slashed_unlocking: &alloc::collections::btree_map::BTreeMap<EraIndex, BalanceOf<T>>, slashed_total: BalanceOf<T>, ) { <Agents<T>>::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 f16bb0d1dc08da50f7c936726b107c7ad35b3fc1..61809dcb54eeabf8a4ab46726b2c88db4baea2f8 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<T> = <<T as Config>::Currency as FunInspect<<T as frame_system::Config>::AccountId>>::Balance; @@ -779,7 +781,7 @@ impl<T: Config> Pallet<T> { } #[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<T: Config> Pallet<T> { diff --git a/substrate/frame/democracy/Cargo.toml b/substrate/frame/democracy/Cargo.toml index 6a44951e09c4bbf1a64ccff0b60459aba5865193..ce5ffa57d579882943411db7e043ebc73e9cb8c9 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 799d614c37f4a87a147c1d1e0c21febc1ad68cd3..ee36e9212f52b44b592247b6a3348a2ad54b45d8 100644 --- a/substrate/frame/democracy/src/benchmarking.rs +++ b/substrate/frame/democracy/src/benchmarking.rs @@ -85,8 +85,8 @@ fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) { // note a new preimage. fn note_preimage<T: Config>() -> 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 e3b4696f8b2af56301ac9f56cf297166c623186c..27bc36a756e4b36f3d6f3afdc2eb351063f6df56 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<T: Config> { #[serde(skip)] - _config: sp_std::marker::PhantomData<T>, + _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -1433,7 +1435,7 @@ impl<T: Config> Pallet<T> { 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<T: Config> Pallet<T> { fn try_undelegate(who: T::AccountId) -> Result<u32, DispatchError> { let votes = VotingOf::<T>::try_mutate(&who, |voting| -> Result<u32, DispatchError> { 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 1cb50a157b12bb5ea68fc870e870cda6536fd524..ca0e0f7a091aaacbf1dc3bce18915a67e8c1ad78 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<T: UnlockConfig> = StorageMap< /// The pallet should be made inoperable before this migration is run. /// /// (See also [`RemovePallet`][frame_support::migrations::RemovePallet]) -pub struct UnlockAndUnreserveAllFunds<T: UnlockConfig>(sp_std::marker::PhantomData<T>); +pub struct UnlockAndUnreserveAllFunds<T: UnlockConfig>(core::marker::PhantomData<T>); impl<T: UnlockConfig> UnlockAndUnreserveAllFunds<T> { /// 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<Vec<u8>, 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 b3fe9aa28e1ac4948761de52c0bec456f28e4618..779f7ecd570f060f29d53ebd05471eb37b531ff1 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 941d720f2c6ca869cb8fdae55a27f009ad56e95a..4d1f521d726e28a4092dcd324f07ccc38849e85a 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 a3f27fc18f07730ebbe9907ddd897a17ccb876e2..8269b2cb73be210c24925090d7c3a950519b9698 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 63b4c49cdfe47a882560d4cd076a4cb113b26b1d..9ce8b3890a62402b53c2b489b2cac8b39d90ec10 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::<SolutionVoterIndexOf<T::MinerConfig>>() <= size_of::<usize>()); @@ -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<T>(sp_std::marker::PhantomData<T>); +pub struct SnapshotWrapper<T>(core::marker::PhantomData<T>); impl<T: Config> SnapshotWrapper<T> { /// 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 156f1c02e27cd23e3e37014650fdff66115cd18f..73a2d878f150f82611d5b469b32a12d4c0210772 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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> { fn on_runtime_upgrade() -> Weight { let current = Pallet::<T>::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 ae830ed0382d8adfaf664e68548dfce6beddf9d0..fe07e477e1d5db3b071abd5c054e97d2dcb5cb9e 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 8b25815eca13ec72491bdb1cb9135a69c540001f..728ab93023895b2f8f74a3447cf008e66a17c9e4 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<T: Config> Pallet<T> { /// 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<T: MinerConfig>(sp_std::marker::PhantomData<T>); +pub struct Miner<T: MinerConfig>(core::marker::PhantomData<T>); impl<T: MinerConfig> Miner<T> { /// Same as [`Pallet::mine_solution`], but the input snapshot data must be given. pub fn mine_solution_with_snapshot<S>( @@ -505,7 +505,7 @@ impl<T: MinerConfig> Miner<T> { 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 bb1bdb31420565a104fb58b553b211411d7a3520..5c64f2a0bc20ff2226e0503fffe995a6ae8d97c0 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 012392ffc59d9644181902ac3f5afbb6d444868f..80fea6c5ca972090cc59bd556578f660f1072db1 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 ecf41ff9663bb94fb9feffa1991d6a90438d3952..dcfcb9c35cda070ef1d3876e4236ced121691881 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 4722680cfcc1cb9131f55d6002b666b28fb3d2ae..8cca0d459eac303028045c17f52694aa9140f782 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<T: Config>(frame_system::Pallet<T>); 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 78b226e52af6c2cec67706acb67dee280b818af3..d092483f9383927a845883c7614dc12894eb5bf6 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 17a256c228e287a2ad810cf37fd948d0d9f0abc0..16d5f17469b7eb0936e94161d53a331fbaf71ac5 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::<TokenStream2>(); @@ -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<u8> { + fn encode(&self) -> _fepsp::Vec<u8> { 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 161631ee83fa6562c47b6f09ad5962ee111fde28..de59df162c8ada6a7930d90b661fb8e226a6dbac 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<TokenStream2> { 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<TokenStream2> { 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<TokenStream2> { self, voter_at: impl Fn(Self::VoterIndex) -> Option<A>, target_at: impl Fn(Self::TargetIndex) -> Option<A>, - ) -> Result<_fepsp::sp_std::prelude::Vec<_feps::Assignment<A, #weight_type>>, _feps::Error> { - let mut #assignment_name: _fepsp::sp_std::prelude::Vec<_feps::Assignment<A, #weight_type>> = Default::default(); + ) -> Result<_fepsp::Vec<_feps::Assignment<A, #weight_type>>, _feps::Error> { + let mut #assignment_name: _fepsp::Vec<_feps::Assignment<A, #weight_type>> = Default::default(); #into_impl Ok(#assignment_name) } @@ -165,10 +165,10 @@ pub(crate) fn generate(def: crate::SolutionDef) -> Result<TokenStream2> { all_edges } - fn unique_targets(&self) -> _fepsp::sp_std::prelude::Vec<Self::TargetIndex> { + fn unique_targets(&self) -> _fepsp::Vec<Self::TargetIndex> { // 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<Self::TargetIndex> = 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<TokenStream2> { .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<Self, Self::Error> { 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::<Result<_fepsp::sp_std::prelude::Vec<(A, #per_thing)>, _feps::Error>>()?; + .collect::<Result<_fepsp::Vec<(A, #per_thing)>, _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 2e9ee3b8a48b581b5a5880bd24e9abd3ebd636ea..394f58a38442519dd27286bd74f3459e63b6a857 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<C> = 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<T> = sp_std::result::Result<T, &'static str>; + pub type Result<T> = core::result::Result<T, &'static str>; } /// 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<X>(sp_std::marker::PhantomData<X>); +pub struct NoElection<X>(core::marker::PhantomData<X>); impl<AccountId, BlockNumber, DataProvider, MaxWinners> ElectionProviderBase for NoElection<(AccountId, BlockNumber, DataProvider, MaxWinners)> @@ -486,7 +489,7 @@ where /// used on the implementing side of [`ElectionDataProvider`]. pub trait SortedListProvider<AccountId> { /// 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<AccountId, Accuracy, Balancing = ()>( - sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>, + core::marker::PhantomData<(AccountId, Accuracy, Balancing)>, ); impl<AccountId: IdentifierT, Accuracy: PerThing128, Balancing: Get<Option<BalancingConfig>>> @@ -642,7 +645,7 @@ impl<AccountId: IdentifierT, Accuracy: PerThing128, Balancing: Get<Option<Balanc /// A wrapper for [`sp_npos_elections::phragmms()`] that implements [`NposSolver`]. See the /// documentation of [`sp_npos_elections::phragmms()`] for more info. pub struct PhragMMS<AccountId, Accuracy, Balancing = ()>( - sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>, + core::marker::PhantomData<(AccountId, Accuracy, Balancing)>, ); impl<AccountId: IdentifierT, Accuracy: PerThing128, Balancing: Get<Option<BalancingConfig>>> diff --git a/substrate/frame/election-provider-support/src/onchain.rs b/substrate/frame/election-provider-support/src/onchain.rs index ee4f6992a085e677aeb8dc2cafbc5637c135ebfd..1063d5d35aee72b12dfdcec670f32ebae493dacb 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 43d183b338e297f675453c5ba361a3e0d409ab3d..84fd57992d343ca5a83f686e5021067b53171dbc 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 b53118b6b6fd2d070427615968fbfa43ad0bf920..6d1ecbd07350e7cdc9c92f74e71c771087d30803 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 c6eca40c47182321d5846d38f07408767fddd6f0..565ead4059d5fedda41240451e01d2bd17f48ad2 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 482766ee97f543081d520148ed6cdc37c7641945..ed4569aa25ee6813e0dd8ed98038436e2aad80cd 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<T: UnlockConfig> = StorageMap< /// The pallet should be made inoperable before this migration is run. /// /// (See also [`RemovePallet`][frame_support::migrations::RemovePallet]) -pub struct UnlockAndUnreserveAllFunds<T: UnlockConfig>(sp_std::marker::PhantomData<T>); +pub struct UnlockAndUnreserveAllFunds<T: UnlockConfig>(core::marker::PhantomData<T>); impl<T: UnlockConfig> UnlockAndUnreserveAllFunds<T> { /// 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<Vec<u8>, 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 b0092d6c07bb647f077fa336201e48f575ae9b9b..82f82f23e712f3304ae762c23fbb0eca96df3170 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<AccountId, Balance> { diff --git a/substrate/frame/elections-phragmen/src/migrations/v5.rs b/substrate/frame/elections-phragmen/src/migrations/v5.rs index 6e360aa8b8c15a21ccbb357d701da074c221fde9..150a4c4fa6c2c0830471281ada5c23fc611a8bd4 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 b34d9efc15b7fef9285eb7ecf741f677d47e472a..af547c7eeb21eba379e126ea9cbfc6b74a336061 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 12cadc969fd74288fc2ca99ac014fa98a603d56d..fea04cb447a0790ef99768dd034b59af9cb73105 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 505cd6f906de23bb5045834125201cc51c613217..d7095eb3c944ffb4532c7ec0efeaca3e6d95a4b3 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 8a0d14edbdbf386c64a675ad33885de632d753a3..81509c782a3fa092ca0cbf25c76a17b5d640ff7f 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 5b66c78e06283a2d9155dd76a653a7ca4649bbbf..ccdcd4968598d243ca4d236736402170db5e90bd 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::<Runtime>::remark { remark: vec![] }); + pub const SomeCall: RuntimeCall = RuntimeCall::System(frame_system::Call::<Runtime>::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 1dd033d7e071e29027109f624cbc613f542e9575..c3dd7f26f21d484298792c8cc5984ea966ae0273 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 15f1a4b5d6199c29158e1600ad825e15d04479bf..eb94c024280c7fa96e790e1719b84df263331e16 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 b3869dff94142de172340ce7f02b701389d1b5a5..f1f9fdb492d9cb6bd56a7be72a28af6160c575af 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 b7425b0c0846afc3e9488a490144a89e7b647301..442318565426ef4dde7cf8145c42bcecc0f11ee6 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 f8ccd1f04e47534857894a6a5a1c497d48eb446b..179a658de312d1540ff3ed1e477967768c94474d 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 0a90e896188ebe111baafd46b265d7e8d8790d9e..add014f6b34a96971eca3ed4f0570bea9a797565 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<T: Config> Pallet<T> { let body = response.body().collect::<Vec<u8>>(); // 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 e2c57a8c1e1abcb855a97db9590edc19c7bf881b..b665cbbb62aed3c38326881904ec685070e4b67f 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 a6cf020ce535d96cb81b9f93955bbbf795a62e34..2d524f2caa269fe00db41bd2db02ebee03c4fa3e 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 411537aa8c65f0c1462336cd6705a2a900bc230a..07c7199b932238b19ede0055503db8ec26965731 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 7b543d72c98404d84ba8f68b3d864176c4182fb9..55cf7cef9a7a85a2a2174e5f9b2cb48c38db2549 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<T: crate::Config>(sp_std::marker::PhantomData<T>); +pub struct InnerMigrateV0ToV1<T: crate::Config>(core::marker::PhantomData<T>); impl<T: crate::Config> UncheckedOnRuntimeUpgrade for InnerMigrateV0ToV1<T> { /// 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 d8a8c6869ab5f78b16a793e544face8866d24b8d..9542902bae64b09347de2b1b13a248d573bccaac 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 1ca62fd89943ec729af9a2c059b1b434fe274ce8..00695ceddf1977aaccfeec31db93c248c8391677 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 0f9741eec180d172c24434d587d723735551148c..78d9ea6fa4992d43f1ea72fbe1d39b85ec1dc48d 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 3028eaf318e0881c1b6f4d4ea6ac17adfe99a75f..1e7bac64e18fd68ddec72fe38eff5b67e2ca7c2e 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<usize, Vec<TryDecodeEntireStorageError>>, + res: Result<usize, alloc::vec::Vec<TryDecodeEntireStorageError>>, ) -> Result<(), TryRuntimeError> { match res { Ok(bytes) => { diff --git a/substrate/frame/fast-unstake/Cargo.toml b/substrate/frame/fast-unstake/Cargo.toml index 59676ad39951951c6046bb6de303ee7ec9c0b21f..2b188bad1dfa7b40dbc575930dc4c7b7d5a8ca3b 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 4828dcb9b42cb924c8b20363e2447b3c428ecf36..d01ff715ca4fccc8e8c32a35355f7ceeaadc79f6 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 f31c9c640260b2bccad684ce5aa23ef384847d43..41920907bd57b165dcfcd2668302b42310dfc52c 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 97ad86bfff42bf6ee1e258f5663d9bb53144373c..1a873534ac819022496305541bb5cfff90100a0a 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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> { fn on_runtime_upgrade() -> Weight { let current = Pallet::<T>::in_code_storage_version(); diff --git a/substrate/frame/fast-unstake/src/mock.rs b/substrate/frame/fast-unstake/src/mock.rs index 7ce7fee1410782a2166f7e696f2f0cad71746b40..757052e230a187ed9ce712a2b30bc5a5f2e9febb 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 3fb5720861fa875c87c7b338028d66208e42e220..2a2319ef61296a5781b9ff752d45da1aa7c4cbf6 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<T: Config>(sp_std::marker::PhantomData<T>); +pub struct MaxChecking<T: Config>(core::marker::PhantomData<T>); impl<T: Config> frame_support::traits::Get<u32> for MaxChecking<T> { fn get() -> u32 { T::Staking::bonding_duration() + 1 diff --git a/substrate/frame/glutton/Cargo.toml b/substrate/frame/glutton/Cargo.toml index 58faecde62939f50d6b901ec9a5f3fa32ee8eda6..5a73e8caef8ea5cad7760cb55edb9a597bd81574 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 5427173b486bab7dfbc830d6af130bf8bccf7e6a..c8d2981ebfef136eca81d62aad479c7c07ae8819 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<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] diff --git a/substrate/frame/grandpa/Cargo.toml b/substrate/frame/grandpa/Cargo.toml index e08af3a5e91b31a00b6fd8d6f5a9f7764e7c8993..e24f9a51db8428e5e978febde2bcbb5bcc6e74ff 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 16727f79a58d589182f5dbfbd01e9cf8674efabb..b213c1ceb7219f8ae4c860ba85c23ef1033dde93 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<Offender: Clone> Offence<Offender> for EquivocationOffence<Offender> { /// - 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<T, R, P, L>(sp_std::marker::PhantomData<(T, R, P, L)>); +pub struct EquivocationReportSystem<T, R, P, L>(core::marker::PhantomData<(T, R, P, L)>); impl<T, R, P, L> OffenceReportSystem< diff --git a/substrate/frame/grandpa/src/lib.rs b/substrate/frame/grandpa/src/lib.rs index 90bcd8721dfa1f6d091edc34da883c2172d9f6ca..4f69aeaef523671969e961b24b4b87b59115bae3 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<T: Config> { pub authorities: AuthorityList, #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] diff --git a/substrate/frame/grandpa/src/migrations/v5.rs b/substrate/frame/grandpa/src/migrations/v5.rs index a0865a3f2bf9a8b6be340065b8b4658c97d5050a..f1af0af42dd0a2ce9629a36416246eb70b453767 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 d0b796cd75d351ba2e5df0d791d932babad11c08..6794fbfbbf42bfe070cd548c46514a6f7f1a3490 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 957549b19f859d39377ca6281e51fb35cf039d8e..ab04000c2281bdab28e646aab3f5df04c7251e57 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 60e812c2238b26ac79b737f90bca5e4770aee500..c2107e92903856b7d0d5493dbd08c59c31adfff6 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 50d6de32ac61e7c8ee9d8aeeeace0b3a42dac65b..776a08f5e9e8a3b2cc15423d4677ab4792d98ed2 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 10f0db8c25d8f0ba1c0a50789870ada6caa4d2c6..45401d53e9e9006839ab55a1999e9ebc5637fad4 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<I: codec::Input>(input: &mut I) -> sp_std::result::Result<Self, codec::Error> { + fn decode<I: codec::Input>(input: &mut I) -> core::result::Result<Self, codec::Error> { let b = input.read_byte()?; Ok(match b { 0 => Data::None, @@ -295,7 +296,7 @@ impl< IdentityInfo: IdentityInformationProvider, > Decode for Registration<Balance, MaxJudgements, IdentityInfo> { - fn decode<I: codec::Input>(input: &mut I) -> sp_std::result::Result<Self, codec::Error> { + fn decode<I: codec::Input>(input: &mut I) -> core::result::Result<Self, codec::Error> { 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 85cbcb3941b17b8675049196d8d60ad201e40916..2cb03b57d6ca82d93140302a634343f58a35082a 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 f91a473e53d5389275974ed0e62c1d75d0daff54..ee2a8451d6fb7935f4ae06e34a9c9fde039722ca 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<BlockNumber> { SubmitTransaction, } -impl<BlockNumber: sp_std::fmt::Debug> sp_std::fmt::Debug for OffchainErr<BlockNumber> { - fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { +impl<BlockNumber: core::fmt::Debug> core::fmt::Debug for OffchainErr<BlockNumber> { + 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 754a2e672e6cfaec32ed0e44c9af54469fddbb04..6d3a5cda697359f190cc8ccaa5884518d760dbae 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 20c3863ff99b0743100c9d3354a9e5efb43ffc71..ea170481531264ab08fa744f2e294fc400383312 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 ff12d092cfb8d67f7d44ca5648a120bbd8507cb3..740d69365df3e4a4539dd6fed3d18aadc0b7bddc 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<T> = diff --git a/substrate/frame/insecure-randomness-collective-flip/Cargo.toml b/substrate/frame/insecure-randomness-collective-flip/Cargo.toml index 0da0d5373953b7703c095e86a9dbf2ec09fba2a6..977b9fdb6f60681b8a97207e2dbac0cbb9914cc2 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 34d1728e42ed0df444530cd4cdd6f039f2e12da4..0a33e54a825de6afb67d8320cbb4176abaf9569e 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 123b425b976f3b5b2842e748498513611dca5bc2..046bc0acbb6442d48bf84cbff7cc0cde10b65567 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 54a8edd38606d76bfa4780d05918d05a1d690ae9..0071b258fc45c0fc7539e0394d4c95104d2a94ce 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<T> = diff --git a/substrate/frame/membership/Cargo.toml b/substrate/frame/membership/Cargo.toml index 35b0eeaa7141985c31ab857931e300da050aafcd..0fc5ce02809e1809b2a1b8b3df623c66e99989bd 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 d5dad68e811b008a94fc4b1b1f67ff0e454ba8d2..e38a6ba5d931b332fbd6ac62b0557dd45fba4b20 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<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> { 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 27ba77e5a62a9c6d2c31639aac5824ab0e8383cc..b8a9b6065c6cdd6ae48ffb24ee6108ddbc4c8ebb 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 47a325db605d833443afd6568647528a0d54fe21..cacb33b504347461b3a45205bad1c9c9e999dc7d 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<T: frame_system::Config> { - _phantom: sp_std::marker::PhantomData<T>, + _phantom: core::marker::PhantomData<T>, } impl<T: frame_system::Config> LeafDataProvider for ParentNumberAndHash<T> { @@ -110,7 +112,7 @@ pub trait BlockHashProvider<BlockNumber, BlockHash> { /// Default implementation of BlockHashProvider using frame_system. pub struct DefaultBlockHashProvider<T: frame_system::Config> { - _phantom: sp_std::marker::PhantomData<T>, + _phantom: core::marker::PhantomData<T>, } impl<T: frame_system::Config> BlockHashProvider<BlockNumberFor<T>, T::Hash> @@ -302,7 +304,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> { fn node_temp_offchain_key( pos: NodeIndex, parent_hash: <T as frame_system::Config>::Hash, - ) -> sp_std::prelude::Vec<u8> { + ) -> Vec<u8> { NodesUtils::node_temp_offchain_key::<HeaderFor<T>>(&T::INDEXING_PREFIX, pos, parent_hash) } @@ -311,7 +313,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> { /// 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<u8> { + fn node_canon_offchain_key(pos: NodeIndex) -> Vec<u8> { 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 8a99f4d87deb02df9c86f449317a2d8a7baa484e..2b46357c50723dfa8299a42fab1c9030ad0077fa 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 e27440be35c45cdf4823f3cdb542f07197e302da..a390898014846077f4547a355909e074a2adcf5a 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<StorageType, T, I, L>(sp_std::marker::PhantomData<(StorageType, T, I, L)>); +pub struct Storage<StorageType, T, I, L>(core::marker::PhantomData<(StorageType, T, I, L)>); impl<StorageType, T, I, L> Default for Storage<StorageType, T, I, L> { fn default() -> Self { diff --git a/substrate/frame/message-queue/Cargo.toml b/substrate/frame/message-queue/Cargo.toml index 5ced1a4e08ff9a4d6fe328f7db76eef23f7c69f1..0c3bbb2c883c53212163a4ce4910b769e7262bd9 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 7e99bc058584504dfea69ebcd3463657e4379d83..8f0712acc5f51cae3dc1ad165eec54c3875b582e 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 ef3420d21be520f8056b1c1299e8369754186560..2dbffef7e5a242b1636313a76bba9fadcf3f9d28 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<F: FnOnce() -> R, R>(f: F) -> Result<R, ()> { } /// Provides a [`sp_core::Get`] to access the `MEL` of a [`codec::MaxEncodedLen`] type. -pub struct MaxEncodedLenOf<T>(sp_std::marker::PhantomData<T>); +pub struct MaxEncodedLenOf<T>(core::marker::PhantomData<T>); impl<T: MaxEncodedLen> Get<u32> for MaxEncodedLenOf<T> { fn get() -> u32 { T::max_encoded_len() as u32 @@ -1518,7 +1521,7 @@ impl<T: MaxEncodedLen> Get<u32> for MaxEncodedLenOf<T> { /// Calculates the maximum message length and exposed it through the [`codec::MaxEncodedLen`] trait. pub struct MaxMessageLen<Origin, Size, HeapSize>( - sp_std::marker::PhantomData<(Origin, Size, HeapSize)>, + core::marker::PhantomData<(Origin, Size, HeapSize)>, ); impl<Origin: MaxEncodedLen, Size: MaxEncodedLen + Into<u32>, HeapSize: Get<Size>> Get<u32> for MaxMessageLen<Origin, Size, HeapSize> @@ -1544,7 +1547,7 @@ pub type BookStateOf<T> = BookState<MessageOriginOf<T>>; /// 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<T, O>(sp_std::marker::PhantomData<(T, O)>); +pub struct IntoU32<T, O>(core::marker::PhantomData<(T, O)>); impl<T: Get<O>, O: Into<u32>> Get<u32> for IntoU32<T, O> { 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 66a242d5a18ff7f72dd08a4c0a0519c82f1cfbbc..26533cc7c330c00564d0a14a9898ca4568fffbcf 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<Test>; diff --git a/substrate/frame/message-queue/src/mock_helpers.rs b/substrate/frame/message-queue/src/mock_helpers.rs index 28395e27cdd2aaffcda2650fbc0988f764b03f92..873add776e2093977962a084e35b921a92ba7338 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 5a946d3aa05816ef258ef3ce47c65bbf2fdc08d2..5fbed74a4400704db6610ec54e3aba8dd234cdae 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 649bc314a12b5fb96816201028c98f5416e542a9..68041a57eaa2e8f673f5f9c9fb774027587c25cb 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 d230417d12e6c5691f3538c36c1c6b632544cec9..9d3b4d1193f21e8a0fd35463d161cc4df978146a 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<u8, ConstU32<256>>; diff --git a/substrate/frame/mixnet/Cargo.toml b/substrate/frame/mixnet/Cargo.toml index f3bea3d2914752930a4164b8c19ab6ce0c444018..a9980ac268bcbbaf451eef99af000c78ef6bdbd6 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 c7a5b624157b88610f6728fffc6f70daef59f9ad..c0505a4f010577cbb791d116526f119b603bbe76 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 329b2e8824e2449ae99ad55f9a6796fd35f1c044..c1571c6c0300abdfe2d73ac60b79ee42c1c89788 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 a83b78e316f500ddc9c615420c2ac627b90ee7e9..51c36773bdad34b4f1bf0f7760998de1fdcbc7fc 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 f0613581257e9418e38990e6f74a45065d076493..ca2e70cbe6cefe6b0ac5340ed1268daf3ae9590b 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 0b54acdab49ea7d66fe0f8646c29a254ecd84cbd..811b5fe1b3177ae82d1d20fc2969405067494028 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 cb269f464c48aea9555498c1bdf3f4d261c01895..5fa990ecebe66e5b48069cbc4f90f50f032f528a 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<T>(_); diff --git a/substrate/frame/nfts/Cargo.toml b/substrate/frame/nfts/Cargo.toml index a1eef3226ecf7ac1b7f5ae91fa471854691dd7fc..e3ffd971a2bb6dafad807fd4be56fd16d4441b22 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 731f5f5ae7767f918d5cd6f775f4a48c2cc7d6ac..4125aa1aab00b8a8bfe5aa29046a81ca9f98005e 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 816088f1b716adb25a83455ee35f0af8e961811f..87faa7909851ed0ec17634071a4f58594ebc5993 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<AccountId, CollectionId, ItemId> diff --git a/substrate/frame/nfts/src/benchmarking.rs b/substrate/frame/nfts/src/benchmarking.rs index 80860bc5a53c432685abd7144e92b85e0c697edf..bc81096b459dcce0d41bf8b8a6acb0ccc849a518 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 1ad523d664c7cf884d1a3da7368db776c311958a..2c4778c1444f7dd42e25aa00c77f73aca1f5beea 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<T: Config<I>, I: 'static> Pallet<T, I> { diff --git a/substrate/frame/nfts/src/features/metadata.rs b/substrate/frame/nfts/src/features/metadata.rs index 85edd294d50b7d82e578afc0014ce9890ffe903c..260061603e9cc3024b0599b5949094d41af4f443 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<T: Config<I>, I: 'static> Pallet<T, I> { diff --git a/substrate/frame/nfts/src/features/roles.rs b/substrate/frame/nfts/src/features/roles.rs index f6d2785fd9cb4094d8565489099097ece7b4377a..aa6394f70bfd4a5d69f2da24f7709bd8eb3918cd 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<T: Config<I>, I: 'static> Pallet<T, I> { /// 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 ee7f42cfc689c5852fcf8b2a35bdb0acb33d4b7e..c90655aadbfc643b546c5c415d3baa8ca4fdea95 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<T: Config<I>, I: 'static> Inspect<<T as SystemConfig>::AccountId> for Pallet<T, I> { type ItemId = T::ItemId; diff --git a/substrate/frame/nfts/src/lib.rs b/substrate/frame/nfts/src/lib.rs index 0406cac6e2c983da4e7ef3db9e4fd506c1803506..4e5493a3c755192752e2ed231605fe9a4cc6ec99 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 4d23aca64ceb1ca604cc69b0918e47bfb0ea0eea..e1b598ca4261c86328ef779d242508a66b8cee7f 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<Test> = <Test as frame_system::Config>::AccountId; diff --git a/substrate/frame/nfts/src/types.rs b/substrate/frame/nfts/src/types.rs index 5a9f6ae2f0e215341aba160fc24cd5eebe6dd682..1687a03520afe88c29831b94d6db23567d2ffce9 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 418c906e2b66cfae53d475ff0007336cbe93b5ea..fb6c25789b26d42cf406be0531239c2d83ea3373 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 f6a83b78d518126fcb423d9e3fce5331b1557a31..2c7ad651f990340c3a8ee13a0a3066d3abd94218 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 d815ea6ac115cc3bc3ddbf45d74a6f7c252e5455..016daa4cb78be7adc714d47132a7d335741a7530 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<A: TypedGet>(sp_std::marker::PhantomData<A>); +pub struct WithMaximumOf<A: TypedGet>(core::marker::PhantomData<A>); impl<A: TypedGet> Convert<Perquintill, A::Type> for WithMaximumOf<A> where A::Type: Clone + Unsigned + From<u64>, @@ -116,7 +118,7 @@ where } } -pub struct NoCounterpart<T>(sp_std::marker::PhantomData<T>); +pub struct NoCounterpart<T>(core::marker::PhantomData<T>); impl<T> FunInspect<T> for NoCounterpart<T> { 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<T> = <<T as Config>::Currency as FunInspect<<T as frame_system::Config>::AccountId>>::Balance; @@ -372,7 +374,7 @@ pub mod pallet { pub receipts_on_hold: Balance, } - pub struct OnEmptyQueueTotals<T>(sp_std::marker::PhantomData<T>); + pub struct OnEmptyQueueTotals<T>(core::marker::PhantomData<T>); impl<T: Config> Get<QueueTotalsTypeOf<T>> for OnEmptyQueueTotals<T> { fn get() -> QueueTotalsTypeOf<T> { BoundedVec::truncate_from(vec![ @@ -573,7 +575,7 @@ pub mod pallet { // queue is <Ordered: Lowest ... Highest><Fifo: Last ... First> 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 d16e9bc6ead6c3c4e17cd56e27ff504716725436..b56a76ce641aa20bf5e3b6f01bc664a3f383552f 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 a7967536079f9cf1c72940ff1cdc8847052e9318..7682b54ea0f242b9c09a72bd6f134aa584598350 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<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source; diff --git a/substrate/frame/nomination-pools/Cargo.toml b/substrate/frame/nomination-pools/Cargo.toml index 535d5252435f38d3dd85fd0d8c923b29c2e00f34..bfcc92edb7e2ea18c554bebdfa678b921986b46b 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 1516f0154b88f91153e1c4872a297b56eb1bcb7b..e73a208926ee547da736b7a1ce0e114db12ef18d 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 b8c978945e9ee18657e5307c0aebd1d4aaf742fd..2a455942511123327d1c6cb2826f46d4afea77ba 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 910cdf2e3dff6353d90a2ba138c4731b0b020a0f..feb73be716818b52ddfface317a4adba3f94b6cf 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 2b217e021455fddac8fc1c7efe5719901c7f1d9f..2f91e550bc05371bd01a2cb1a85040a6e39da12d 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 4809fbc0e9da08f3f8d84f662acec5ce5a4de6cd..4d571855e4fe8a967d80579c4f2b8fa521f43309 100644 --- a/substrate/frame/nomination-pools/src/adapter.rs +++ b/substrate/frame/nomination-pools/src/adapter.rs @@ -83,7 +83,7 @@ impl<T> Member<T> { /// [`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<Balance = Self::Balance, AccountId = Self::AccountId>; /// 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 641f2b1457727d75891c2604058f8140a282aa9b..472f0affcc7350e22d2898cdb9eea5f6dbed82c5 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<T: Config> { inner: BondedPoolInner<T>, } -impl<T: Config> sp_std::ops::Deref for BondedPool<T> { +impl<T: Config> core::ops::Deref for BondedPool<T> { type Target = BondedPoolInner<T>; fn deref(&self) -> &Self::Target { &self.inner } } -impl<T: Config> sp_std::ops::DerefMut for BondedPool<T> { +impl<T: Config> core::ops::DerefMut for BondedPool<T> { 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 a9222ea53d75fde59ac47ca0c6fd4d209aa3177b..d8697364a76c57658e94b9d019fe35f356145e3b 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<T>(sp_std::marker::PhantomData<T>); + pub struct TotalValueLockedSync<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for TotalValueLockedSync<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, 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<T, MaxPools>(sp_std::marker::PhantomData<(T, MaxPools)>); + pub struct DelegationStakeMigration<T, MaxPools>(core::marker::PhantomData<(T, MaxPools)>); impl<T: Config, MaxPools: Get<u32>> OnRuntimeUpgrade for DelegationStakeMigration<T, MaxPools> { fn on_runtime_upgrade() -> Weight { @@ -262,7 +262,7 @@ pub mod v8 { } } - pub struct VersionUncheckedMigrateV7ToV8<T>(sp_std::marker::PhantomData<T>); + pub struct VersionUncheckedMigrateV7ToV8<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV7ToV8<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> { @@ -341,7 +341,7 @@ pub(crate) mod v7 { pub type BondedPools<T: Config> = CountedStorageMap<Pallet<T>, Twox64Concat, PoolId, V7BondedPoolInner<T>>; - pub struct VersionUncheckedMigrateV6ToV7<T>(sp_std::marker::PhantomData<T>); + pub struct VersionUncheckedMigrateV6ToV7<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV6ToV7<T> { fn on_runtime_upgrade() -> Weight { let migrated = BondedPools::<T>::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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV6<T>(core::marker::PhantomData<T>); impl<T: Config> MigrateToV6<T> { 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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV5<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV5<T> { fn on_runtime_upgrade() -> Weight { let in_code = Pallet::<T>::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<T, U>(sp_std::marker::PhantomData<(T, U)>); + pub struct MigrateToV4<T, U>(core::marker::PhantomData<(T, U)>); #[allow(deprecated)] impl<T: Config, U: Get<Perbill>> OnRuntimeUpgrade for MigrateToV4<T, U> { 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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV3<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV3<T> { fn on_runtime_upgrade() -> Weight { let current = Pallet::<T>::in_code_storage_version(); @@ -845,7 +845,7 @@ pub mod v2 { /// Migrate the pool reward scheme to the new version, as per /// <https://github.com/paritytech/substrate/pull/11669.>. - pub struct MigrateToV2<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV2<T>(core::marker::PhantomData<T>); impl<T: Config> MigrateToV2<T> { 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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> { fn on_runtime_upgrade() -> Weight { let current = Pallet::<T>::in_code_storage_version(); diff --git a/substrate/frame/offences/Cargo.toml b/substrate/frame/offences/Cargo.toml index 51eb3e4f4381797202b8648e59a0378c56ae72e6..9cf5e911a9d3acbf87eb1fd665ab6814163920c4 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 037812b3ed114a0f5d7f8111ba83fe9da4ca9dd1..eb97eb3d4132af402e2e1e40fed4c5a9e4d8935a 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 9aa88f7a0d6d08e41d25c6b9e425fc71ba0f78d2..b16e5be653d1e7354ebe29e62304b1c6d065e80c 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 b08955a133297f356a5fa884394b3a88a7e28727..f696546d1f0a0b2934d6b14014c937d9a320be23 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 a328b2fee4e2e72d3254f0a0a8283951bf5a5fc2..ffea32a1f4703dc4a7074f44bc0986b97d126bac 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 199f47491369b8281e414076f35e43be823931c8..abf8acd94875d6da7e3bee281487b7869a4c30dd 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<T>(sp_std::marker::PhantomData<T>); + pub struct MigrateToV1<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> { diff --git a/substrate/frame/paged-list/Cargo.toml b/substrate/frame/paged-list/Cargo.toml index f5a3a2e5bae196736f9a07943fdc78a42436bba8..597bdd37f57fb5a0bdef24e7caf0f45502d06261 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 ddeed174f34bb5afac01d0ad839e2cd980b5764a..ed68dac63beb69ed68d5e9f85ba80e78d28c1e1a 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 eecc728cd62a1dcd29c4db1d48a642102421be9c..bbd889e2521803c69b4fc2dd344ab5d635ae240d 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<V> { /// The index of the page. index: PageIndex, /// The remaining values of the page, to be drained by [`Page::next`]. - values: sp_std::iter::Skip<sp_std::vec::IntoIter<V>>, + values: core::iter::Skip<alloc::vec::IntoIter<V>>, } impl<V: FullCodec> Page<V> { @@ -188,7 +188,7 @@ impl<V: FullCodec> Page<V> { ) -> Option<Self> { let key = page_key::<Prefix>(index); let values = sp_io::storage::get(&key) - .and_then(|raw| sp_std::vec::Vec::<V>::decode(&mut &raw[..]).ok())?; + .and_then(|raw| alloc::vec::Vec::<V>::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 b993347d24637a5ffa84c238eeb6fb75bbcb9d64..a97ba1172a503df2efb2f820ef8995f8ff9f4a65 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 ee572b189b231054c0bea0e429c7a4659e9aa301..425c4e81aa7b3e1e7123fa7be734b3ec29404f52 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 f2b76a7999d6c61827624b3b9ca6d9e55a0341d9..2d3bec16b818331e99a5072c15da55b45b7b521e 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 dd323a12b8f8479ba5d419243c9585f79ac0385a..30056fc6d9a492bd6b72e44d917af573758bab9d 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 a86109f892a4f5b84b6aa48e89bc869f521bf74c..e38483ee68c62404c50ee4facf7fb1fed6562b9c 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<T>(sp_std::marker::PhantomData<T>); + pub struct Migration<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for Migration<T> { #[cfg(feature = "try-runtime")] diff --git a/substrate/frame/proxy/Cargo.toml b/substrate/frame/proxy/Cargo.toml index 6b4251e1bcc57b8017a6bb76c99fc3aea94d6345..af2427da380a980f2501e4ffc741f5e6706dcfc2 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 e0d14163d21b2c7e1d54a12f3027544a310be7b2..4081af49c2435eefe00a62b988ab7ef3dab9b996 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 2b3fac5f59e4b1fd48f92bffc314cdbad5ec9c22..d681088165c8ffa583008f1ced8bcbf4fd5ffa9d 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<T> = <<T as Config>::CallHasher as Hash>::Output; diff --git a/substrate/frame/proxy/src/tests.rs b/substrate/frame/proxy/src/tests.rs index 3ed61fbedaaa93ca3bbf9976a7303195537ae671..3edb96026a82b07215569fe3dfa01200cb911ca0 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 be48d5cad4048b90e0b08971f6b005b125adaf59..dd9b466e0f919eb0957fcff7a623aacbe5a077f4 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 462f55a238d2a867f900e4653369e5fa9368d874..dc7f4aaca7735c2867e6a9dd3bde1250d1bd4417 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 53d5f0c6662d760534e87bf6962aca491fe4e617..e34cf3d8df7114099ee02da5731012a81e38f1d7 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 3b3a382fe6dcf8ccde7d4681b835674149896715..42493b435105c16fc1daa662eb745b1f7aae78a9 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 72f77336212dd6b8c7fb64d7b12a32fd0d9dfa44..b7639742a620271172460ef272a36d12aa902f9b 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 5673147c8e0055fcd445fffa6a29046b880e9e11..69be4df971bc47bde7d2cd367e03f241eba887b0 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 eb30fef7894b48a7a5f0685c76d96a88a0fdd43b..578486714d63626b5b456d5f59684db9e2272c87 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 47d43cc0600c076b6fce0e541e0f78c97649921e..67ac82787d31d78a859ed0158d7f6be2b1276aea 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::<T, I>(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::<T, I>(origin.clone()); diff --git a/substrate/frame/referenda/src/lib.rs b/substrate/frame/referenda/src/lib.rs index 0cdf450d3b6c98e942e3613210f31eb34098b008..e72dd7f11cbb2f8f17f32ec9d9b1768ee015ec2d 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 b3c583322cce384bae7e2a9340071d5af6b2f455..1039b288b2aecde8db69453f7883f41be349314a 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 44cf5ebc3b492a0c414716402308d1b5f22214bd..efc9917428c04304446b69c4b543a18e67e99496 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 831946834963f96748b683c01a9673bdb83b5e11..15b72b4748dd406da7bcb551ffe3be2a29e4fca6 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 8ca3cd395afb5063b6ac70e0c7b6412240e4faa2..eae8e0b83f5d235ad6aaf42e49e170e3706baa30 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 3c758b91d52fe851dd279a3e7e3bb3b9dd69ebe3..ab43b723e8a9b86d8720d181eb29f01346f3d169 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<Test>; type AccountId = u64; diff --git a/substrate/frame/root-testing/Cargo.toml b/substrate/frame/root-testing/Cargo.toml index 38d91c8104b902eeaf742ab7fa20540ae0d1d598..96d861362622559e6569f2fe61cde0a08de27d75 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 749c4bcdc7000d7d772433e92c327284b686d410..b704818f1adf02dad8900bc2eb28e5ec9272a56b 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 c9b72da2e649fa9f04c32d95fde2b3102b239185..9121f59ff4626f27ca1cc0dc0078432542b0a8e4 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 ecd03c47db6898a41ec5c09ea078b79797cb16ed..0eefca57849aa32211a323dd424117743e22d83a 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 d521ed9dd91b87ab46ccc19f0643f44d5a2013a6..285758afbe6db8b214fd788a180d760a01aed263 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<T>, + pub _phantom: core::marker::PhantomData<T>, } #[pallet::genesis_build] diff --git a/substrate/frame/scheduler/Cargo.toml b/substrate/frame/scheduler/Cargo.toml index 0a6b646fc8c3c41ac262758304e33a48a3a2b39d..29aaaec9aa408f1f26b193ddfcfdd32db3ba359d 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 884f78000384cf66696b22de40238bbd2e5bef95..d0a14fc73d64fdc47205810a29e5cb265784a009 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 d19a1e0001dd3aed98369b8691187b5cf8dcdfc7..3eecf6d6f9e884e5bf671d781d4918ad91619615 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 c2e956035a767031ceb64e4e0d42cebfb527e64d..a304689a120cccb8af21ab5922e8478e36f7848c 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 69ecd527eb7c9d4491400e6815ce17511f43f41a..132799ead62a7c0c0618fa481ade112b30b541b2 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 2bf70cbc574c8ff4e2f06abeaba51a6eecb88881..c4464bbbfac0448bf449c02e2d9966895942d2da 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<T, I> = <<T as Config<I>>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance; diff --git a/substrate/frame/session/Cargo.toml b/substrate/frame/session/Cargo.toml index c7b499548bdb4cce9d5fb7a08a2e45f8fe635e61..09bb93d8c1d09abf9d0b266efa6542163bc8ee9d 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 ba7f7acfd9919f58e5fd3e3e2e50534d118ffde4..9ca3549f681dc4747b02e86944ed78f75752e0ac 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 d86c5d9ad278ea9d914877c63d7a316eebf148c9..f08e10f0786903f54f9f5eeafb74ee09b58b9959 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 b08955a133297f356a5fa884394b3a88a7e28727..f696546d1f0a0b2934d6b14014c937d9a320be23 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 618497e3d54db378717561beb47070204af99ab6..fac580b49b3ab6c388e116af07fef1309dd8929e 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<T: Config> Pallet<T> { 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<ValidatorId, FullIdentification>: /// An `SessionManager` implementation that wraps an inner `I` and also /// sets the historical trie root of the ending session. -pub struct NoteHistoricalRoot<T, I>(sp_std::marker::PhantomData<(T, I)>); +pub struct NoteHistoricalRoot<T, I>(core::marker::PhantomData<(T, I)>); impl<T: Config, I: SessionManager<T::ValidatorId, T::FullIdentification>> NoteHistoricalRoot<T, I> { fn do_new_session(new_index: SessionIndex, is_genesis: bool) -> Option<Vec<T::ValidatorId>> { @@ -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 95f4d762949eeaa022a998b7d54693189a757c27..685a0be8e191edda97110f9f257b7fba170be5fe 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<T: Config> ValidatorSet<T> { /// Implement conversion into iterator for usage /// with [ProvingTrie](super::ProvingTrie::generate_for). -impl<T: Config> sp_std::iter::IntoIterator for ValidatorSet<T> { +impl<T: Config> core::iter::IntoIterator for ValidatorSet<T> { type Item = (T::ValidatorId, T::FullIdentification); - type IntoIter = sp_std::vec::IntoIter<Self::Item>; + type IntoIter = alloc::vec::IntoIter<Self::Item>; 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 97a7f02bd096e2ab65d2b0afa2e2004eec56ca8e..a9eb18474b86a68c429afcd1312d331d08b1f164 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 297385dfb426e5026cae9db478a074070019501d..06b25ec99a4cb62282e87eee1e42e7e87150eeb2 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 9506e98adf7d70004a3caf57adb9c0c1dd44d5f3..45f70dfa2582d782dddfb2ffdc5538668e8380a2 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<T: Config> frame_support::traits::DisabledValidators for Pallet<T> { /// 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<T, Inner>(sp_std::marker::PhantomData<(T, Inner)>); +pub struct FindAccountFromAuthorIndex<T, Inner>(core::marker::PhantomData<(T, Inner)>); impl<T: Config, Inner: FindAuthor<u32>> FindAuthor<T::ValidatorId> for FindAccountFromAuthorIndex<T, Inner> diff --git a/substrate/frame/society/Cargo.toml b/substrate/frame/society/Cargo.toml index 6582d47f194310250868fb8982685c3098197f33..b6fa70c42efc062291b32c29a322d7bdca36e0ec 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 20af6e35ada52136f4ad14459afc0eeb1d19ca45..8c3d2bf32ce73920ff23ad6bf85907f4c89bb220 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 5bce245f73f17e02d1301ee9242a356ad291b3ee..b4c5c88af3d6e9abbd66fe51d1b6438d32c43ca3 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<T>(sp_std::marker::PhantomData<T>); +pub struct EnsureFounder<T>(core::marker::PhantomData<T>); impl<T: Config> EnsureOrigin<<T as frame_system::Config>::RuntimeOrigin> for EnsureFounder<T> { type Success = T::AccountId; fn try_origin(o: T::RuntimeOrigin) -> Result<Self::Success, T::RuntimeOrigin> { diff --git a/substrate/frame/society/src/migrations.rs b/substrate/frame/society/src/migrations.rs index 7ded1f84f5823696e922a3ef98e4cce45191d21c..396ed787c784c5a73aaccbd90b3df3dcc6cb3b25 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 e09d8fc4fa1d4e6a86ea6931ccab10b9bca38651..3836e71cb00f25a74b989e53db39ae34a5949851 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 afae4652a4ef2ff954d1aa450ebbd453d095adbd..57eeec543634db348164f59fc9f29d090ff70d91 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 3ed33ffea4223847068ded561d9a6a4748843718..1f8580d7a3e67336776517809203a28b0973ebda 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<T: Config> ListScenario<T> { // 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 294918376d82ce5a8473a5353cea0dc5cdd1ba50..dc4b4fc326b819304d719aedbfbefcf3963ec0fd 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 053ecdef2b00b7bb900443153f63e64f51d89252..9e59cbd3d0cb8bc2b2b83c13f07d3951d21c095b 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<T: Config> StakingLedger<T> { // 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<Balance: Default> EraPayout<Balance> for () { /// Adaptor to turn a `PiecewiseLinear` curve definition into an `EraPayout` impl, used for /// backwards compatibility. -pub struct ConvertCurve<T>(sp_std::marker::PhantomData<T>); +pub struct ConvertCurve<T>(core::marker::PhantomData<T>); impl<Balance, T> EraPayout<Balance> for ConvertCurve<T> 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<T>(sp_std::marker::PhantomData<T>); +pub struct StashOf<T>(core::marker::PhantomData<T>); impl<T: Config> Convert<T::AccountId, Option<T::AccountId>> for StashOf<T> { fn convert(controller: T::AccountId) -> Option<T::AccountId> { @@ -987,7 +989,7 @@ impl<T: Config> Convert<T::AccountId, Option<T::AccountId>> for StashOf<T> { /// /// 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<T>(sp_std::marker::PhantomData<T>); +pub struct ExposureOf<T>(core::marker::PhantomData<T>); impl<T: Config> Convert<T::AccountId, Option<Exposure<T::AccountId, BalanceOf<T>>>> for ExposureOf<T> @@ -1000,7 +1002,7 @@ impl<T: Config> Convert<T::AccountId, Option<Exposure<T::AccountId, BalanceOf<T> /// Filter historical offences out and only allow those from the bonding period. pub struct FilterHistoricalOffences<T, R> { - _inner: sp_std::marker::PhantomData<(T, R)>, + _inner: core::marker::PhantomData<(T, R)>, } impl<T, Reporter, Offender, R, O> ReportOffence<Reporter, Offender, O> @@ -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<T>(sp_std::marker::PhantomData<T>); +pub struct EraInfo<T>(core::marker::PhantomData<T>); impl<T: Config> EraInfo<T> { /// 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 b2ddf77004f95ecf86df6d177cdb6af454947657..5c9cf861321317aadbef4bc985012dc97d1a8472 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<T>(sp_std::marker::PhantomData<T>); + pub struct VersionUncheckedMigrateV14ToV15<T>(core::marker::PhantomData<T>); impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV14ToV15<T> { fn on_runtime_upgrade() -> Weight { let mut migrated = v14::OffendingValidators::<T>::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<T>(sp_std::marker::PhantomData<T>); + pub struct InjectValidatorsIntoVoterList<T>(core::marker::PhantomData<T>); impl<T: Config> OnRuntimeUpgrade for InjectValidatorsIntoVoterList<T> { fn on_runtime_upgrade() -> Weight { if StorageVersion::<T>::get() == ObsoleteReleases::V8_0_0 { diff --git a/substrate/frame/staking/src/pallet/impls.rs b/substrate/frame/staking/src/pallet/impls.rs index 90374451a3a5266362699e6fc55e957a552ba157..b19a127d13c439dfdc0f68e2f12587b6c39ddebc 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<T: Config> ScoreProvider<T::AccountId> for Pallet<T> { 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<T>(sp_std::marker::PhantomData<T>); +pub struct UseValidatorsMap<T>(core::marker::PhantomData<T>); impl<T: Config> SortedListProvider<T::AccountId> for UseValidatorsMap<T> { type Score = BalanceOf<T>; type Error = (); @@ -1657,7 +1657,7 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseValidatorsMap<T> { /// 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<T>(sp_std::marker::PhantomData<T>); +pub struct UseNominatorsAndValidatorsMap<T>(core::marker::PhantomData<T>); impl<T: Config> SortedListProvider<T::AccountId> for UseNominatorsAndValidatorsMap<T> { type Error = (); type Score = VoteWeight; @@ -1995,7 +1995,7 @@ impl<T: Config> Pallet<T> { /// <https://github.com/paritytech/polkadot-sdk/issues/3245> 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<T: Config> Pallet<T> { /// = 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<T::AccountId, PagedExposureMetadata<BalanceOf<T>>> = diff --git a/substrate/frame/staking/src/pallet/mod.rs b/substrate/frame/staking/src/pallet/mod.rs index a76e47edf38039501fe0ac9d3434e13b3fdafe4c..79f9d298ada788ff7ee4278bfb4290eaf44e3c10 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<u64> + TypeInfo diff --git a/substrate/frame/staking/src/slashing.rs b/substrate/frame/staking/src/slashing.rs index 1fe608cd3358bb8d7ab113ee96d720df4998c759..9bc8197c50b3ec29f8a308128383ce50dba95a77 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<T>, slash_of: &'a mut BalanceOf<T>, reward_proportion: Perbill, - _marker: sp_std::marker::PhantomData<T>, + _marker: core::marker::PhantomData<T>, } // 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<T>, 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 d4938ea43ebe2800b3894a21e17f93e45d591ff5..65aaa5f09de4e8476f961574946f9dcb1f4f4d8d 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 825b03b8ecaac159e1332a2e73eb5441601f0bf2..c35e5e8a06c6fa3e124e3c3a4331c28833607009 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 8bb4079715e2a99298239160f04d3bc967633c8c..db8d10dabfdef3cf1d7a69c01bdc05d3885b20df 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 22ad640d3bd23d96c43d764dfaadddc3a5b687f3..3fe5abb81031345904b38d1a006a5fa208fb4a84 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<T> = <<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance; @@ -169,11 +172,11 @@ pub mod pallet { pub(crate) child_items: u32, #[codec(skip)] - pub(crate) _ph: sp_std::marker::PhantomData<T>, + pub(crate) _ph: core::marker::PhantomData<T>, } - impl<Size: Get<u32>> sp_std::fmt::Debug for Progress<Size> { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + impl<Size: Get<u32>> core::fmt::Debug for Progress<Size> { + 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<T: Config> sp_std::fmt::Debug for MigrationTask<T> { - fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + impl<T: Config> core::fmt::Debug for MigrationTask<T> { + 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 233b7255fc5dbc0e617c53c427252431052cf891..000e5033d8f1979f81ffc71f99ada7adc1bef55d 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 c68dac2d297227f337d765c1cb3a361ad0a36322..6a7f577ab0869cbf5762ad2d8edd4e015a9b8242 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<T>(sp_std::marker::PhantomData<T>); + pub struct Pallet<T>(core::marker::PhantomData<T>); #[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 5d5d09d692342746557c3a80190ff6257de37a53..1a94753728b248dbce2a5448adf1ed3647b9c312 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 e64233fe7480a9d82c9c07709dd9b403544bff6a..dee7d09c9d0c63426fb70fbc45188034d48bae38 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 e90286e5a7c6bae73794bae7efd5fda4a496bb25..fb7eaf7894806bf816be381c430da95378078961 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 63b68e694307ecb4ee3986118f780df1ae49f609..07296e90b64859975f164d75cfc056ab63b0c860 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 da483fa6cf0b6aaa724792f724482e88027fa696..c5fe8440d21bebc68347c0d09dab313628e0ccbf 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 0e76f9a92469a73d3a616da454dc46ded5034afc..daef1b171617fbbd87ea13fc73989bd4b01738a2 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<u32> { + pub fn metadata_versions() -> #scrate::__private::Vec<u32> { #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 83049919d01c34f05ce7be6725ab8bc60731f47b..4a14853c04eec327ddcdf403819301cb58f71d39 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<Box<dyn Fn(&<#runtime as #system_path::Config>::RuntimeCall) -> bool>>, + filter: #scrate::__private::Rc<#scrate::__private::Box<dyn Fn(&<#runtime as #system_path::Config>::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("<wasm:stripped>") } } #[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<Self>) { @@ -252,7 +252,7 @@ pub fn expand_outer_origin( impl TryFrom<OriginCaller> 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<RuntimeOrigin> for #scrate::__private::sp_std::result::Result<#system_path::Origin<#runtime>, RuntimeOrigin> { + impl From<RuntimeOrigin> 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<RuntimeOrigin> for #scrate::__private::sp_std::result::Result<#pallet_origin, RuntimeOrigin> { + impl From<RuntimeOrigin> 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 1505d158895f0fa172884eef6aa748f44734e042..17042c2487803eb102ac1c4db4470b9ee232d766 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<P: 'static>() -> Option<usize> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>(); + let type_id = core::any::TypeId::of::<P>(); #( #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<P: 'static>() -> Option<&'static str> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>(); + let type_id = core::any::TypeId::of::<P>(); #( #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<P: 'static>() -> Option<[u8; 16]> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>(); + let type_id = core::any::TypeId::of::<P>(); #( #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<P: 'static>() -> Option<&'static str> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>(); + let type_id = core::any::TypeId::of::<P>(); #( #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<P: 'static>() -> Option<#scrate::traits::CrateVersion> { - let type_id = #scrate::__private::sp_std::any::TypeId::of::<P>(); + let type_id = core::any::TypeId::of::<P>(); #( #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 d7fbb5a718973c9d2a9ed9f32ab384536265f3d6..a36df790bd2987ba422d04fa4d36d3b74dcc5c76 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 ec19f889a9f20a57e5b0096f9873623baa06d59f..e2c72ee921c4609875ed1300cf345f32f9c44ec8 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 b921d66ff9e73895fef8e1e0985fc205446b60e8..05478ee3908416f4fe67ac142428f7dd1c039bf6 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 3623b595268d081ee7b5750a5431f208383f8517..d7b1ca14f574b4aa9fd9ca49bab576c582e72b74 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<u8>, #frame_support::sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result<#frame_support::__private::Vec<u8>, #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<u8>) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> { + fn post_upgrade(state: #frame_support::__private::Vec<u8>) -> 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 7cdf6bde9de87d0bd4eed70de93173bc9bf4e3ff..7ebc4bb2e9dc28c825a91e99b4feaf3ed6e0bcd8 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<TrackedStorageKey> { - use #frame_support::__private::sp_std::vec; + fn whitelisted_storage_keys() -> #frame_support::__private::Vec<TrackedStorageKey> { + 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 3cc8a843e3b1669aa054040a49101ee4ae8d3f5f..267b0f2dd3ba43960fd4711e3feb0bc245a04587 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<usize, #frame_support::__private::sp_std::vec::Vec<#frame_support::traits::TryDecodeEntireStorageError>> { + fn try_decode_entire_state() -> Result<usize, #frame_support::__private::Vec<#frame_support::traits::TryDecodeEntireStorageError>> { let pallet_name = <<T as #frame_system::Config>::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 6697e5c822a31b1ef719f03b47eb1ae32169fd03..7201c352d92cd062a2066fa33b4f8224516ae79b 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::<Vec<_>>(); - 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 9f143628404734d5510de9e5997deec2a63644ea..7df91ae777d7f5974d5d4ba283048bd3a454ea96 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<Task<T>>; + type Enumeration = alloc::vec::IntoIter<Task<T>>; 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 3cdfb06cb6eaa65c71777688421d5ef28a77fb11..f34ab1cef5436ffd6fccfff628a94d149a9ed5f5 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 4a313551aca634b88bed7d0f989943f7075a5050..351ba3a15efcc9db4ce684190aa53268f068813b 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<T> { } impl OneOrMany<DispatchClass> for DispatchClass { - type Iter = sp_std::iter::Once<DispatchClass>; + type Iter = core::iter::Once<DispatchClass>; fn into_iter(self) -> Self::Iter { - sp_std::iter::once(self) + core::iter::once(self) } } impl<'a> OneOrMany<DispatchClass> for &'a [DispatchClass] { - type Iter = sp_std::iter::Cloned<sp_std::slice::Iter<'a, DispatchClass>>; + type Iter = core::iter::Cloned<core::slice::Iter<'a, DispatchClass>>; 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 254302c8f14d2db1987353155ab7cacde65a5bb3..b34c6bdada3d484b00745dd02154af849c124c0a 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<TypeId, Box<dyn Any>>); @@ -158,7 +158,7 @@ pub fn with_context<T: 'static, R>(callback: impl FnOnce(&mut Value<T>) -> R) -> if value.is_none() { log::error!( "Failed to downcast value for type {} in dispatch context!", - sp_std::any::type_name::<T>(), + core::any::type_name::<T>(), ); } diff --git a/substrate/frame/support/src/genesis_builder_helper.rs b/substrate/frame/support/src/genesis_builder_helper.rs index 7389c5a787d76d01ec759658da28857bc85ff08f..662ea2cb1862dd003c1c5a5d3979ececb096f3b1 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<GC: BuildGenesisConfig>(json: Vec<u8>) -> BuildResult { /// to [`sp_genesis_builder::GenesisBuilder::get_preset`]. pub fn get_preset<GC>( name: &Option<PresetId>, - preset_for_name: impl FnOnce(&sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>>, + preset_for_name: impl FnOnce(&sp_genesis_builder::PresetId) -> Option<alloc::vec::Vec<u8>>, ) -> Option<Vec<u8>> where GC: BuildGenesisConfig + Default, diff --git a/substrate/frame/support/src/hash.rs b/substrate/frame/support/src/hash.rs index 9c48f4b187ad3666ed5fc44229656c35b84e0a81..a09890560c644797dcf831ebf32550f039b4d882 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 94f4b9dd4bdcc214de7ec1b02db3e06dc87d3383..3ad8c5fabaa2c320be0155d69354734be39618a8 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 fa018d743653f2131944d188af7b0dd74057f143..7f74614695640dfd07771f689bb93971199baf10 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<T>(sp_std::marker::PhantomData<T>); +/// pub struct VersionUncheckedMigrateV5ToV6<T>(core::marker::PhantomData<T>); /// impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV5ToV6<T> { /// // `UncheckedOnRuntimeUpgrade` implementation... /// } @@ -102,7 +103,7 @@ pub struct VersionedMigration<const FROM: u16, const TO: u16, Inner, Pallet, Wei #[derive(Encode, Decode)] pub enum VersionedPostUpgradeData { /// The migration ran, inner vec contains pre_upgrade data. - MigrationExecuted(sp_std::vec::Vec<u8>), + MigrationExecuted(alloc::vec::Vec<u8>), /// 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_std::vec::Vec<u8>, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result<alloc::vec::Vec<u8>, 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<u8>, + versioned_post_upgrade_data_bytes: alloc::vec::Vec<u8>, ) -> Result<(), sp_runtime::TryRuntimeError> { use codec::DecodeAll; match <VersionedPostUpgradeData>::decode_all(&mut &versioned_post_upgrade_data_bytes[..]) @@ -339,7 +340,7 @@ impl<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>> frame_support::traits } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<sp_std::vec::Vec<u8>, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result<alloc::vec::Vec<u8>, sp_runtime::TryRuntimeError> { use crate::storage::unhashed::contains_prefixed_key; let hashed_prefix = twox_128(P::get().as_bytes()); @@ -350,11 +351,11 @@ impl<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>> 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<u8>) -> Result<(), sp_runtime::TryRuntimeError> { + fn post_upgrade(_state: alloc::vec::Vec<u8>) -> 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<P: Get<&'static str>, S: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>> } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result<sp_std::vec::Vec<u8>, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result<alloc::vec::Vec<u8>, 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<P: Get<&'static str>, S: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>> } #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: sp_std::vec::Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> { + fn post_upgrade(_state: alloc::vec::Vec<u8>) -> 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 91196be9e802c2eb9016abbcf86bfc0fb7fcb934..d3560dd5f0d4d566e6ed3dbacb9f148ad8ad4ed7 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<K, V, S> StorageDecodeLength for BoundedBTreeMap<K, V, S> {} 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<Prefix, BoundedBTreeMap<u32, (), ConstU32<7>>>; diff --git a/substrate/frame/support/src/storage/bounded_btree_set.rs b/substrate/frame/support/src/storage/bounded_btree_set.rs index cf801eb47874f048966aab8adb8a8b3eef5c14f6..70ab2304cab0176f69e6a4d08cc5b4b3915f5eb3 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<T, S> StorageDecodeNonDedupLength for BoundedBTreeSet<T, S> {} 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<Prefix, BoundedBTreeSet<u32, ConstU32<7>>>; diff --git a/substrate/frame/support/src/storage/child.rs b/substrate/frame/support/src/storage/child.rs index 76e6f4ee4023ec08c8c080929f5aba8f3bfd7509..5ebba269365851b488b8af4eacc3d498c874c2b2 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<T: Decode + Sized>(child_info: &ChildInfo, key: &[u8]) -> Option<T> { diff --git a/substrate/frame/support/src/storage/generator/double_map.rs b/substrate/frame/support/src/storage/generator/double_map.rs index a4c1f58203e3caf0cd200d0daf5b7b7aeba36702..b68f3fa495ff9a63cf4e17ec2f9e0e263257e2ed 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 257aa7e7bcf9a4f1d79b2242b5e09f4c0c8be601..b41f9c7171670363111419f4e150bd5653099f5c 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<K, V, Hasher> { prefix: Vec<u8>, previous_key: Vec<u8>, drain: bool, - _phantom: ::sp_std::marker::PhantomData<(K, V, Hasher)>, + _phantom: ::core::marker::PhantomData<(K, V, Hasher)>, } impl<K: Decode + Sized, V: Decode + Sized, Hasher: ReversibleStorageHasher> 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 dd6d622852db161cbe686115663e00a6bd9cd4b0..b0b1bda24bb7409264e66568ad4eea442a2fe9f6 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 4b49ad3eb38d434a897ed2b1020156e541b02a96..0466583a27955665090c33e6527caa9182abf90f 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 6633adce8ff655aa7d5e3df0b63be77a645812f7..d823eb98879949ea53cf36c0695f12a06d3b039a 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<T, HashFn, R>(hash: &HashFn, key: &[u8]) -> Option<T> diff --git a/substrate/frame/support/src/storage/migration.rs b/substrate/frame/support/src/storage/migration.rs index 252625cf4f7d02aa82418ca50b45334c53692766..1dd690c3ed67b9b7f69db9534cdbace481c845a1 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<T> { prefix: Vec<u8>, previous_key: Vec<u8>, drain: bool, - _phantom: ::sp_std::marker::PhantomData<T>, + _phantom: ::core::marker::PhantomData<T>, } impl<T> StorageIterator<T> { @@ -95,7 +95,7 @@ pub struct StorageKeyIterator<K, T, H: ReversibleStorageHasher> { prefix: Vec<u8>, previous_key: Vec<u8>, drain: bool, - _phantom: ::sp_std::marker::PhantomData<(K, T, H)>, + _phantom: ::core::marker::PhantomData<(K, T, H)>, } impl<K, T, H: ReversibleStorageHasher> StorageKeyIterator<K, T, H> { diff --git a/substrate/frame/support/src/storage/mod.rs b/substrate/frame/support/src/storage/mod.rs index f7d7447482d06ccd64e59c3b8e49aec18696fdee..7fb991d377923a936abf808ca07627ca9fbead3f 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 c4d40fa99a35cef9a05d55b71f27de1717a72cee..23201e58db5b70157188409808c5c51d0358026d 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<u8>, + storage_root: alloc::vec::Vec<u8>, 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 529b2f387c71cc86b52f648f8630bd9f2339dd69..0d1e5582f841b853f0f7a1726fe5a018756abb75 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<u8>) -> Self::Iterator; @@ -40,7 +40,7 @@ mod private { } } - impl<T: codec::Decode> StreamIter for sp_std::collections::btree_set::BTreeSet<T> { + impl<T: codec::Decode> StreamIter for alloc::collections::btree_set::BTreeSet<T> { type Iterator = ScaleContainerStreamIter<T>; fn stream_iter(key: Vec<u8>) -> Self::Iterator { @@ -49,7 +49,7 @@ mod private { } impl<K: codec::Decode, V: codec::Decode> StreamIter - for sp_std::collections::btree_map::BTreeMap<K, V> + for alloc::collections::btree_map::BTreeMap<K, V> { type Iterator = ScaleContainerStreamIter<(K, V)>; @@ -116,14 +116,14 @@ impl<T: private::StreamIter + codec::FullCodec, StorageValue: super::StorageValu /// A streaming iterator implementation for SCALE container types. /// /// SCALE container types follow the same type of encoding `Compact<u32>(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<T> { - marker: sp_std::marker::PhantomData<T>, + marker: core::marker::PhantomData<T>, input: StorageInput, length: u32, read: u32, @@ -156,7 +156,7 @@ impl<T> ScaleContainerStreamIter<T> { 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<T> ScaleContainerStreamIter<T> { let mut input = StorageInput::new(key); let length = if input.exists() { codec::Compact::<u32>::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<T: codec::Decode> sp_std::iter::Iterator for ScaleContainerStreamIter<T> { +impl<T: codec::Decode> core::iter::Iterator for ScaleContainerStreamIter<T> { type Item = T; fn next(&mut self) -> Option<T> { @@ -235,7 +235,7 @@ impl StorageInput { /// /// - `key`: The storage key of the storage item that this input will read. fn new(key: Vec<u8>) -> 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 0444e269928ab68e6da1ebada37425d77bdcc288..9adcb33ae07434010b3a63fa09112ab71d69f17b 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 51cde93f28c01d8dab45da49fddb0b5eeb1c54d1..13c1b10be39c47dfe4792b9f91cf84944f2867ae 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 2a7af7a984633ebcb79572e30595359758b50154..3d227feb902f304f8596f20bc288487e272316cc 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 90cf09dd1d341eefc9280c3a086ff6c311248141..b9b497b61d949be4cf7933cc56b3111e91917f1c 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<U> + EncodeLikeTuple<U>, U: Encode> EncodeLikeTuple<U> /// 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<Vec<u8>>; + fn to_encoded_iter(&self) -> alloc::vec::IntoIter<Vec<u8>>; } #[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<Vec<u8>> { + fn to_encoded_iter(&self) -> alloc::vec::IntoIter<Vec<u8>> { [for_tuples!( #(self.Tuple.encode()),* )].to_vec().into_iter() } } impl<T: TupleToEncodedIter> TupleToEncodedIter for &T { - fn to_encoded_iter(&self) -> sp_std::vec::IntoIter<Vec<u8>> { + fn to_encoded_iter(&self) -> alloc::vec::IntoIter<Vec<u8>> { (*self).to_encoded_iter() } } @@ -223,7 +223,7 @@ impl<T: TupleToEncodedIter> TupleToEncodedIter for &T { impl<'a, T: EncodeLike<U> + TupleToEncodedIter, U: Encode> TupleToEncodedIter for codec::Ref<'a, T, U> { - fn to_encoded_iter(&self) -> sp_std::vec::IntoIter<Vec<u8>> { + fn to_encoded_iter(&self) -> alloc::vec::IntoIter<Vec<u8>> { 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 b79a6ae9b8482090c3f3ebe42b7b23aa8824b657..b70026eea50e130cb2fd7c7dc743aec744b8e5d8 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 631410f425d17a169f16cd0380a3ffa3f22f6611..b063e11621d61a7481c5a3dd409321bd76e33597 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<Value, PalletError>`. -pub struct ResultQuery<Error>(sp_std::marker::PhantomData<Error>); +pub struct ResultQuery<Error>(core::marker::PhantomData<Error>); impl<Value, Error, OnEmpty> QueryKindTrait<Value, OnEmpty> for ResultQuery<Error> 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 253f02a14f0796f7ecba7e81af8e5be7b7ec0e42..c3dfd5b3e48c9dc742499e5b9c7de032d7066d72 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 a2d93a6a165ffca205f1597dfa0952c9c4900313..9cc985b36d8c60aa1969286912ca46c6ae446827 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 776c7d0f3c3a8d761d7c048e292d590056b374c3..7f9bc93d7d818ff5f025617e721c3f79587347cb 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<T: Decode + Sized>(key: &[u8]) -> Option<T> { diff --git a/substrate/frame/support/src/traits/dynamic_params.rs b/substrate/frame/support/src/traits/dynamic_params.rs index 32dae6799eaf7c9061851896ada9fe4e8a1a3e0d..3ef298fc5a5a092b06f886cab0ad3e7d1fdca670 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<PS, KV>(sp_std::marker::PhantomData<(PS, KV)>); +pub struct ParameterStoreAdapter<PS, KV>(core::marker::PhantomData<(PS, KV)>); impl<PS, KV> ParameterStore<KV> for ParameterStoreAdapter<PS, KV> where diff --git a/substrate/frame/support/src/traits/filter.rs b/substrate/frame/support/src/traits/filter.rs index 44f9f136cfc2a14c05d0f2a938530d8b2b597515..ff62449847d2542da9ca1fc1c32e780d06a5fb11 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<T>: Contains<T> { @@ -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 1a687cade79f5973a8b2816d0cba40ef250c4b3a..012a74d0ae92f1dcc9c3797f62d2ffc9d137485c 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 53de84ab22455f2d778c1fd64ba94c348c685db0..89b6b6cdfad954ea70c88b41cb2be95ff6a5add2 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<T> { diff --git a/substrate/frame/support/src/traits/messages.rs b/substrate/frame/support/src/traits/messages.rs index 3f8d80f5c6baf150db06b6ca24b7f4e69de81539..d28716237119e8972b7069a806a82cbca0c26169 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 8bda4186bc967b29a6342ea96dd0a1cdc5072438..1e46470a3911ff840baff2230a8d9af753363757 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<sp_std::cmp::Ordering> { +impl PartialOrd for CrateVersion { + fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> { Some(<Self as Ord>::cmp(self, other)) } } @@ -248,7 +249,7 @@ impl PartialEq<u16> for StorageVersion { } impl PartialOrd<u16> for StorageVersion { - fn partial_cmp(&self, other: &u16) -> Option<sp_std::cmp::Ordering> { + fn partial_cmp(&self, other: &u16) -> Option<core::cmp::Ordering> { Some(self.0.cmp(other)) } } diff --git a/substrate/frame/support/src/traits/misc.rs b/substrate/frame/support/src/traits/misc.rs index bc7407a7be6248f25866a78f3b95bb0107ff19ae..7c8c22d1ae5a3f49906b71890758608857332534 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<u32>` to access `VARIANT_COUNT` from `trait pub trait VariantCount {`. -pub struct VariantCountOf<T: VariantCount>(sp_std::marker::PhantomData<T>); +pub struct VariantCountOf<T: VariantCount>(core::marker::PhantomData<T>); impl<T: VariantCount> Get<u32> for VariantCountOf<T> { fn get() -> u32 { T::VARIANT_COUNT @@ -190,10 +191,10 @@ pub trait DefensiveOption<T> { /// Defensively transform this option to a result, mapping `None` to the return value of an /// error closure. - fn defensive_ok_or_else<E: sp_std::fmt::Debug, F: FnOnce() -> E>(self, err: F) -> Result<T, E>; + fn defensive_ok_or_else<E: core::fmt::Debug, F: FnOnce() -> E>(self, err: F) -> Result<T, E>; /// Defensively transform this option to a result, mapping `None` to a default value. - fn defensive_ok_or<E: sp_std::fmt::Debug>(self, err: E) -> Result<T, E>; + fn defensive_ok_or<E: core::fmt::Debug>(self, err: E) -> Result<T, E>; /// Exactly the same as `map`, but it prints the appropriate warnings if the value being mapped /// is `None`. @@ -252,7 +253,7 @@ impl<T> Defensive<T> for Option<T> { } } -impl<T, E: sp_std::fmt::Debug> Defensive<T> for Result<T, E> { +impl<T, E: core::fmt::Debug> Defensive<T> for Result<T, E> { fn defensive_unwrap_or(self, or: T) -> T { match self { Ok(inner) => inner, @@ -307,7 +308,7 @@ impl<T, E: sp_std::fmt::Debug> Defensive<T> for Result<T, E> { } } -impl<T, E: sp_std::fmt::Debug> DefensiveResult<T, E> for Result<T, E> { +impl<T, E: core::fmt::Debug> DefensiveResult<T, E> for Result<T, E> { fn defensive_map_err<F, O: FnOnce(E) -> F>(self, o: O) -> Result<T, F> { self.map_err(|e| { defensive!(e); @@ -357,7 +358,7 @@ impl<T> DefensiveOption<T> for Option<T> { ) } - fn defensive_ok_or_else<E: sp_std::fmt::Debug, F: FnOnce() -> E>(self, err: F) -> Result<T, E> { + fn defensive_ok_or_else<E: core::fmt::Debug, F: FnOnce() -> E>(self, err: F) -> Result<T, E> { self.ok_or_else(|| { let err_value = err(); defensive!(err_value); @@ -365,7 +366,7 @@ impl<T> DefensiveOption<T> for Option<T> { }) } - fn defensive_ok_or<E: sp_std::fmt::Debug>(self, err: E) -> Result<T, E> { + fn defensive_ok_or<E: core::fmt::Debug>(self, err: E) -> Result<T, E> { self.ok_or_else(|| { defensive!(err); err @@ -416,11 +417,11 @@ impl<T: Saturating + CheckedAdd + CheckedMul + CheckedSub + One> 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<T> { impl<T> DefensiveMin<T> for T where - T: sp_std::cmp::PartialOrd<T>, + T: PartialOrd<T>, { fn defensive_min(self, other: T) -> Self { if self <= other { @@ -574,7 +575,7 @@ pub trait DefensiveMax<T> { impl<T> DefensiveMax<T> for T where - T: sp_std::cmp::PartialOrd<T>, + T: PartialOrd<T>, { fn defensive_max(self, other: T) -> Self { if self >= other { @@ -1050,7 +1051,7 @@ impl<T: TypeInfo + 'static> TypeInfo for WrapperOpaque<T> { #[derive(Debug, Eq, PartialEq, Default, Clone)] pub struct WrapperKeepOpaque<T> { data: Vec<u8>, - _phantom: sp_std::marker::PhantomData<T>, + _phantom: core::marker::PhantomData<T>, } impl<T: Decode> WrapperKeepOpaque<T> { @@ -1073,7 +1074,7 @@ impl<T: Decode> WrapperKeepOpaque<T> { /// Create from the given encoded `data`. pub fn from_encoded(data: Vec<u8>) -> Self { - Self { data, _phantom: sp_std::marker::PhantomData } + Self { data, _phantom: core::marker::PhantomData } } } @@ -1100,7 +1101,7 @@ impl<T: Encode> Encode for WrapperKeepOpaque<T> { impl<T: Decode> Decode for WrapperKeepOpaque<T> { fn decode<I: Input>(input: &mut I) -> Result<Self, codec::Error> { - Ok(Self { data: Vec::<u8>::decode(input)?, _phantom: sp_std::marker::PhantomData }) + Ok(Self { data: Vec::<u8>::decode(input)?, _phantom: core::marker::PhantomData }) } fn skip<I: Input>(input: &mut I) -> Result<(), codec::Error> { @@ -1212,8 +1213,8 @@ pub trait AccountTouch<AssetId, AccountId> { #[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 647af029c16dce07f998e34c30cb076f6a670d4c..80020d8d00809af048334d8614e8d7f8953c6525 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<u8, ConstU32<128>>; @@ -37,7 +37,7 @@ pub enum Bounded<T, H: Hash> { /// 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<T> }, + Legacy { hash: H::Output, dummy: core::marker::PhantomData<T> }, /// 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<T, H: Hash> Bounded<T, H> { { 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<T, H: Hash> Bounded<T, H> { /// Constructs a `Legacy` bounded item. #[deprecated = "This API is only for transitioning to Scheduler v3 API"] pub fn from_legacy_hash(hash: impl Into<H::Output>) -> 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 f41c73fe69a8883d8d2ee8bb7ffcdf72bc2e5ba2..a302e28d4ce24fe4c6c1b7cc7a4fcb79d0e107c2 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<BlockNumber, Call, RuntimeOrigin> { /// 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<BlockNumber, Call, RuntimeOrigin> { /// 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<BlockNumber, Call, Origin> { /// 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 875ff56bea19e3c9f5770365833092da58fca6f4..22fb28e4c0e795e676b56d1b0a43834cf9e7b46b 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 42b837e55970def3c4d99f3c5f3cc9ca5dacaaf3..0b5d0c082509d1ca61c83b6ceaf05f8ab54918ac 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 ff8b0c6eea838e8ec3cd5869190bf741ca140d65..60ea9a71805fcfb9068561dc23a073d3f6271e4b 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<AccountId>: ReservableCurrency<AccountId> { /// /// All "anonymous" operations are then implemented as their named counterparts with the given `Id`. pub struct WithName<NamedReservable, Id, AccountId>( - sp_std::marker::PhantomData<(NamedReservable, Id, AccountId)>, + core::marker::PhantomData<(NamedReservable, Id, AccountId)>, ); impl< NamedReservable: NamedReservableCurrency<AccountId>, diff --git a/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs b/substrate/frame/support/src/traits/tokens/fungible/imbalance.rs index 020dffe28c85b7a0f1bb213173342e4dd9e907d7..41907b2aa009d42aceae6b5eb3b69fd4a2fc9989 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<B: Balance, OnDrop: HandleImbalanceDrop<B>, 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<B: Balance, OnDrop: HandleImbalanceDrop<B>, 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<B: Balance, OnDrop: HandleImbalanceDrop<B>, 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<B: Balance, OnDrop: HandleImbalanceDrop<B>, 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<B, OppositeOnDrop, OnDrop>, ) -> SameOrOther<Self, Imbalance<B, OppositeOnDrop, OnDrop>> { 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 2aa53d622dbff7280cb4f2b742f490249c73ca69..c9f366911a8b62932ffbbb757d13e72a31b3c718 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<AccountId>, A: Get<<F as fungibles::Inspect<AccountId>>::AssetId>, AccountId, ->(sp_std::marker::PhantomData<(F, A, AccountId)>); +>(core::marker::PhantomData<(F, A, AccountId)>); impl< F: fungibles::Inspect<AccountId>, @@ -361,7 +361,7 @@ impl< } pub struct ConvertImbalanceDropHandler<AccountId, Balance, AssetIdType, AssetId, Handler>( - 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 a113cb01c982dd8f35c9ab28ead961a65219cd71..f40e494b930d5f836c47b2700d4ff58b336c7fea 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 c46614be4734c659d50619fde3734a34be14783e..54a04444649d2715938d7e6a60400527dc952ceb 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 63791b05223701ae8c689f00c4769cb510c6e208..3adbbdda31431ee1f7b8e7646825bee1964131f7 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<AssetId: Ord> Convert<NativeOrWithId<AssetId>, 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<Left, Right, Criterion, AssetKind, AccountId>( - 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<Balance>, diff --git a/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs b/substrate/frame/support/src/traits/tokens/fungibles/imbalance.rs index bb0d83721a481e11f80f1ae9fa75292528f7c8a0..c3b213cc8fc86eae3c2d9704e369b307211c84d4 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<Self, (Self, Self)> { 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 ab722426dadf6fa759340ac12609e58c1139ff02..27f663e57509568846601ee260ba0d4190c24f37 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<AccountId>: super::Inspect<AccountId> { // 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 946c4756cff6035a7619cf859cb1d71d520b4298..3985da7856d75f424050310985893736b4b38c56 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 f4259a78f0a25ae15c7413be07df0bc299342122..77047150e00cee0481eaf555e001bfe1a73be431 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<Left, Right, Criterion, AssetKind, AccountId>( - 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 ecb8de8841f91ca65a05eca687da5eaa8164a4a2..4bf9af3fbb18693a745b69d97c8286eb80993bba 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 03e821b161b694a554effc51c09292ea6df718c2..eec892cc31154c30b282101845c345efeeafe3f6 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<B, PositiveImbalance: Imbalance<B>> { 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 59a582389ba61f3eb65fbc7f3710b1edba0a56ab..d79ae562ec6765d008072b1be87385640f65182d 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<Balance, Imbalance, Target1, Target2, const PART1: u32, const PART2: u32>( diff --git a/substrate/frame/support/src/traits/tokens/misc.rs b/substrate/frame/support/src/traits/tokens/misc.rs index e1ff1e058ae7aabd8ce9e0725b51f292c406a1a5..9fa1df862097f48e9555f27ad097b84e9ee30021 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<Rank, AccountId, Balance> { } /// Adapter for a rank-to-salary `Convert` implementation into a `GetSalary` implementation. -pub struct ConvertRank<C>(sp_std::marker::PhantomData<C>); +pub struct ConvertRank<C>(core::marker::PhantomData<C>); impl<A, R, B, C: Convert<R, B>> GetSalary<R, A, B> for ConvertRank<C> { 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 e3fc84f1d57b2cf1d47a01a81eb13478a6e8830b..249f84b22759317f928a7fa7b76106c813f049a9 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<AccountId> { @@ -125,7 +125,7 @@ pub struct ItemOf< F: nonfungibles::Inspect<AccountId>, A: Get<<F as nonfungibles::Inspect<AccountId>>::CollectionId>, AccountId, ->(sp_std::marker::PhantomData<(F, A, AccountId)>); +>(core::marker::PhantomData<(F, A, AccountId)>); impl< F: nonfungibles::Inspect<AccountId>, diff --git a/substrate/frame/support/src/traits/tokens/nonfungible_v2.rs b/substrate/frame/support/src/traits/tokens/nonfungible_v2.rs index 05f76e2859d2ead6b998d0c63304e2fa818db7a2..5775162e34ed0e0e07c36ee610ccf2cf7da2b6bd 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<AccountId> { @@ -207,7 +207,7 @@ pub struct ItemOf< F: nonfungibles::Inspect<AccountId>, A: Get<<F as nonfungibles::Inspect<AccountId>>::CollectionId>, AccountId, ->(sp_std::marker::PhantomData<(F, A, AccountId)>); +>(core::marker::PhantomData<(F, A, AccountId)>); impl< F: nonfungibles::Inspect<AccountId>, diff --git a/substrate/frame/support/src/traits/tokens/nonfungibles.rs b/substrate/frame/support/src/traits/tokens/nonfungibles.rs index 615e79c29c85f4ccef502e2e50a0ecfd56a3c909..22358cf806fb1af2a8fe0f952145216e8a431dbe 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<AccountId> { diff --git a/substrate/frame/support/src/traits/tokens/nonfungibles_v2.rs b/substrate/frame/support/src/traits/tokens/nonfungibles_v2.rs index c0209b6d5123dbefb8e813d11f6478b00c9e82bb..edf1c2b8023df0a2683cf999615667372d0af9da 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<AccountId> { diff --git a/substrate/frame/support/src/traits/tokens/pay.rs b/substrate/frame/support/src/traits/tokens/pay.rs index 62d7a056a3f1bfcf950897ce48598c9b9f67fbc6..5a7ed4d6aa130ebc87399ecd8d7f19a805d95966 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 d5dc93fcf28fe32046c8895aad8775911937c681..8dbeecd8e860eeaaacbaf4edb5a6f098e9d19d39 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("<invalid>"), - &sp_std::str::from_utf8(&self.info.storage_name).unwrap_or("<invalid>"), + &alloc::str::from_utf8(&self.info.pallet_name).unwrap_or("<invalid>"), + &alloc::str::from_utf8(&self.info.storage_name).unwrap_or("<invalid>"), 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 c1bf1feb19e54fe3c94abfb242e9f2321d43d0df..09c33c01440677e14eacbd92063f7ffafb267c71 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("<invalid?>")) + .map(|x| alloc::str::from_utf8(x).unwrap_or("<invalid?>")) .collect::<Vec<_>>(), ), 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<Self, Self::Err> { match s { @@ -153,9 +153,7 @@ pub trait TryState<BlockNumber> { #[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<BlockNumber: Clone + sp_std::fmt::Debug + AtLeast32BitUnsigned> TryState<BlockNumber> - for Tuple -{ +impl<BlockNumber: Clone + core::fmt::Debug + AtLeast32BitUnsigned> TryState<BlockNumber> 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<BlockNumber: Clone + sp_std::fmt::Debug + AtLeast32BitUnsigned> TryState<Bl } else { log::warn!( "Pallet {:?} not found", - sp_std::str::from_utf8(pallet_name).unwrap_or_default() + alloc::str::from_utf8(pallet_name).unwrap_or_default() ); } }); diff --git a/substrate/frame/support/src/traits/validation.rs b/substrate/frame/support/src/traits/validation.rs index 4b099b2c766fe967f9720f027e3544809a266cfa..8a80df75f642c7888e086f99b1424d182951f96b 100644 --- a/substrate/frame/support/src/traits/validation.rs +++ b/substrate/frame/support/src/traits/validation.rs @@ -18,13 +18,13 @@ //! Traits for dealing with validation and validators. use crate::{dispatch::Parameter, weights::Weight}; +use alloc::{vec, vec::Vec}; use codec::{Codec, Decode, MaxEncodedLen}; use sp_runtime::{ traits::{Convert, Zero}, BoundToRuntimeAppPublic, ConsensusEngineId, Permill, RuntimeAppPublic, }; use sp_staking::SessionIndex; -use sp_std::prelude::*; /// A trait for online node inspection in a session. /// diff --git a/substrate/frame/support/src/traits/voting.rs b/substrate/frame/support/src/traits/voting.rs index f18d4ed4e90b33425a16a753cddf57630a8da91f..958ef5dce6c1caafdddb9e2337bf5cbbadb9a9c6 100644 --- a/substrate/frame/support/src/traits/voting.rs +++ b/substrate/frame/support/src/traits/voting.rs @@ -19,10 +19,10 @@ //! votes. use crate::dispatch::Parameter; +use alloc::vec::Vec; use codec::{HasCompact, MaxEncodedLen}; use sp_arithmetic::Perbill; use sp_runtime::{traits::Member, DispatchError}; -use sp_std::prelude::*; pub trait VoteTally<Votes, Class> { /// Initializes a new tally. @@ -74,7 +74,7 @@ impl<Tally, Moment, Class> PollStatus<Tally, Moment, Class> { } } -pub struct ClassCountOf<P, T>(sp_std::marker::PhantomData<(P, T)>); +pub struct ClassCountOf<P, T>(core::marker::PhantomData<(P, T)>); impl<T, P: Polling<T>> sp_runtime::traits::Get<u32> for ClassCountOf<P, T> { 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 697e14ae1d38893428f19f41aec441c19cfd1711..82ac1d2c7475bb9761d3d4891f3ed11dd296b7cf 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 a8a723375033a48e10e3f7f2941bb025991ac869..b080740b0a4b1116e5f69790d3795a14befdf34b 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<T>(sp_std::marker::PhantomData<T>); +pub struct TestRandomness<T>(core::marker::PhantomData<T>); impl<Output: codec::Decode + Default, T> frame_support::traits::Randomness<Output, BlockNumberFor<T>> for TestRandomness<T> diff --git a/substrate/frame/support/test/tests/issue2219.rs b/substrate/frame/support/test/tests/issue2219.rs index 20c2773406ff111ebd03d08a89924ddf30cccdba..7a2138d056a09a5373ae5beead9d0d7a1fd67c0e 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<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] diff --git a/substrate/frame/support/test/tests/origin.rs b/substrate/frame/support/test/tests/origin.rs index 4f14bda184c867b54aa10246a995943835abf375..e6dd0cfc0e31596a868b5e0958b98af8a59e7b52 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -135,7 +135,7 @@ pub mod module { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index c441d4c371af0926a0508025ae5473c77fb98346..6f8af949cc313f8826d06b8934ba13b7993d0693 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<SomeType1> + SomeAssociation1 + From<SomeType4>, { #[serde(skip)] - _config: sp_std::marker::PhantomData<T>, + _config: core::marker::PhantomData<T>, _myfield: u32, } diff --git a/substrate/frame/support/test/tests/pallet_instance.rs b/substrate/frame/support/test/tests/pallet_instance.rs index dfe4caa476d3b9e1fa2a1024adb48eea5cdf9be9..09a49617044da4a24b3adc4607a8c0c4b144f6e8 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<T: Config<I>, 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 1f4d9110a24fc4e8f18fec0f1d7e2b714f920fa4..06c2b5b7071c1357b3b6bfb1b699662fc10f0c20 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -251,7 +251,7 @@ pub mod module3 { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[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 6330a138e2f2a66a5b763ecd57d1c742fa092465..4233db21e2031baf136bed1e6317bf244d3b21b8 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -251,7 +251,7 @@ pub mod module3 { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[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 c83dd6b71de9b3c72ee8c3f9b00cd81fecb0dfde..58c9e4ce93b58453f942e872fccd3a48a6c997f9 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<T: Config> { #[serde(skip)] - _config: sp_std::marker::PhantomData<T>, + _config: core::marker::PhantomData<T>, } #[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<T: Config, const S: u32>(sp_std::marker::PhantomData<T>); +struct SomeUnversionedMigration<T: Config, const S: u32>(core::marker::PhantomData<T>); parameter_types! { const UpgradeReads: u64 = 4; diff --git a/substrate/frame/system/benchmarking/Cargo.toml b/substrate/frame/system/benchmarking/Cargo.toml index 47a6721b93f585bf3b5c0f6a777327ade4f38be6..dec68d20b69954d3d3c4eb7a7af2b9d724169b50 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 c1631b0a2e334e985c9b0ab8a87f1a318548dab1..0fb592f3dbba7c2ce137c05d6b5e51c825ba61e8 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<T: Config>(System<T>); 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 e55038aeb9551f1bbee2f38371b1e0c63371cce5..f66d20ac8aed928521f6021cded6cd9c93110f49 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 76a711a823e7d7a4b1092d9220b846584b21603f..000ec56da64f3f96eaf521ed6510b17020ce81fe 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<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>); +pub struct CheckGenesis<T: Config + Send + Sync>(core::marker::PhantomData<T>); -impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckGenesis<T> { +impl<T: Config + Send + Sync> core::fmt::Debug for CheckGenesis<T> { #[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<T: Config + Send + Sync> sp_std::fmt::Debug for CheckGenesis<T> { impl<T: Config + Send + Sync> CheckGenesis<T> { /// 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 31fdbba5950e21ceecb8b29ae50934d52f194903..6666c4812fbc383e48b6e11b6b8c5c286d126c5d 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<T: Config + Send + Sync>(pub Era, sp_std::marker::PhantomData<T>); +pub struct CheckMortality<T: Config + Send + Sync>(pub Era, core::marker::PhantomData<T>); impl<T: Config + Send + Sync> CheckMortality<T> { /// 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<T: Config + Send + Sync> sp_std::fmt::Debug for CheckMortality<T> { +impl<T: Config + Send + Sync> core::fmt::Debug for CheckMortality<T> { #[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 92eed60fc66b53dec19a86c1fac20f1af8ff4d7b..06dc2bf177ac9500ab492cb585a8cbb7589397d6 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<T>(PhantomData<T>); -impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckNonZeroSender<T> { +impl<T: Config + Send + Sync> core::fmt::Debug for CheckNonZeroSender<T> { #[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<T: Config + Send + Sync> sp_std::fmt::Debug for CheckNonZeroSender<T> { impl<T: Config + Send + Sync> CheckNonZeroSender<T> { /// 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 894ab72eb593b02324e5fabc37a4035efecaac5e..3535870d1b5959186c25e94615a59b41b9e5be87 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<T: Config> CheckNonce<T> { } } -impl<T: Config> sp_std::fmt::Debug for CheckNonce<T> { +impl<T: Config> core::fmt::Debug for CheckNonce<T> { #[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 24d5ef9cafb17b0dd8c1ac02fc127f7068cf6cca..ee7e6f2efd001a981c56f840bf089718b6d823f3 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<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>); +pub struct CheckSpecVersion<T: Config + Send + Sync>(core::marker::PhantomData<T>); -impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckSpecVersion<T> { +impl<T: Config + Send + Sync> core::fmt::Debug for CheckSpecVersion<T> { #[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<T: Config + Send + Sync> sp_std::fmt::Debug for CheckSpecVersion<T> { impl<T: Config + Send + Sync> CheckSpecVersion<T> { /// 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 3f9d6a1903fe1d08d05266a46625aeacba3c273c..15983c2cd088b3b0deeeccf21a679d648da9be42 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<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>); +pub struct CheckTxVersion<T: Config + Send + Sync>(core::marker::PhantomData<T>); -impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckTxVersion<T> { +impl<T: Config + Send + Sync> core::fmt::Debug for CheckTxVersion<T> { #[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<T: Config + Send + Sync> sp_std::fmt::Debug for CheckTxVersion<T> { impl<T: Config + Send + Sync> CheckTxVersion<T> { /// 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 d4705f200efddacd18149651acf8ed431ca722a8..22da2a5b9872545e53f33481a5595e57e91cc8e3 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<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>); +pub struct CheckWeight<T: Config + Send + Sync>(core::marker::PhantomData<T>); impl<T: Config + Send + Sync> CheckWeight<T> 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<T: Config + Send + Sync> sp_std::fmt::Debug for CheckWeight<T> { +impl<T: Config + Send + Sync> core::fmt::Debug for CheckWeight<T> { #[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 { <Test as crate::Config>::BlockWeights::get() diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 84d00a1e917ec033d4fe534f932236db76569625..0c6ff2cb8ddbaf0c1f2634eca4cfa0d6853721b1 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<C: Get<u32>>(sp_std::marker::PhantomData<C>); + pub struct TestBlockHashCount<C: Get<u32>>(core::marker::PhantomData<C>); impl<I: From<u32>, C: Get<u32>> Get<I> for TestBlockHashCount<C> { 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<T: Config> { #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } #[pallet::genesis_build] @@ -1153,7 +1156,7 @@ impl From<sp_version::RuntimeVersion> for LastRuntimeUpgradeInfo { } /// Ensure the origin is Root. -pub struct EnsureRoot<AccountId>(sp_std::marker::PhantomData<AccountId>); +pub struct EnsureRoot<AccountId>(core::marker::PhantomData<AccountId>); impl<O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId> EnsureOrigin<O> for EnsureRoot<AccountId> { @@ -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<AccountId, Success>( - sp_std::marker::PhantomData<(AccountId, Success)>, + core::marker::PhantomData<(AccountId, Success)>, ); impl< O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, @@ -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<Ensure, AccountId, Success>( - 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<AccountId>(sp_std::marker::PhantomData<AccountId>); +pub struct EnsureSigned<AccountId>(core::marker::PhantomData<AccountId>); impl<O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId: Decode> EnsureOrigin<O> for EnsureSigned<AccountId> { @@ -1259,7 +1262,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { } /// Ensure the origin is `Signed` origin from the given `AccountId`. -pub struct EnsureSignedBy<Who, AccountId>(sp_std::marker::PhantomData<(Who, AccountId)>); +pub struct EnsureSignedBy<Who, AccountId>(core::marker::PhantomData<(Who, AccountId)>); impl< O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, Who: SortedMembers<AccountId>, @@ -1291,7 +1294,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { } /// Ensure the origin is `None`. i.e. unsigned transaction. -pub struct EnsureNone<AccountId>(sp_std::marker::PhantomData<AccountId>); +pub struct EnsureNone<AccountId>(core::marker::PhantomData<AccountId>); impl<O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId> EnsureOrigin<O> for EnsureNone<AccountId> { @@ -1316,7 +1319,7 @@ impl_ensure_origin_with_arg_ignoring_arg! { } /// Always fail. -pub struct EnsureNever<Success>(sp_std::marker::PhantomData<Success>); +pub struct EnsureNever<Success>(core::marker::PhantomData<Success>); impl<O, Success> EnsureOrigin<O> for EnsureNever<Success> { type Success = Success; fn try_origin(o: O) -> Result<Self::Success, O> { @@ -1906,7 +1909,7 @@ impl<T: Config> Pallet<T> { /// 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<Item = Box<EventRecord<T::RuntimeEvent, T::Hash>>> { + ) -> impl Iterator<Item = Box<EventRecord<T::RuntimeEvent, T::Hash>>> { Events::<T>::stream_iter() } diff --git a/substrate/frame/system/src/migrations/mod.rs b/substrate/frame/system/src/migrations/mod.rs index 945bbc53955257266f9023c790f9a7a87d2f8a55..7c69843d73f10d4e9b17d66807fa0c7e92232e36 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 a64b326196403cb87e0970c061ac09e42136d4e1..1f72ea2d37452c88742b427ea621658a20b43a3a 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<T: SendTransactionTypes<OverarchingCall>, OverarchingCall> { - _phantom: sp_std::marker::PhantomData<(T, OverarchingCall)>, + _phantom: core::marker::PhantomData<(T, OverarchingCall)>, } impl<T, LocalCall> SubmitTransaction<T, LocalCall> @@ -115,7 +115,7 @@ where #[derive(RuntimeDebug)] pub struct Signer<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>, X = ForAny> { accounts: Option<Vec<T::Public>>, - _phantom: sp_std::marker::PhantomData<(X, C)>, + _phantom: core::marker::PhantomData<(X, C)>, } impl<T: SigningTypes, C: AppCrypto<T::Public, T::Signature>, X> Default for Signer<T, C, X> { diff --git a/substrate/frame/timestamp/Cargo.toml b/substrate/frame/timestamp/Cargo.toml index 2da6e2d5a95d222853e7eeca372c770de84f77ea..25aecea7b79eaaf9600cf08e784cc4119b0d8215 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 6a22ab1cd5ef8fde0d94791e82750f46629a2340..ca495c5e24efb7302add9b04c7d27c8b7dd14628 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<T: Config> UnixTime for Pallet<T> { // now is duration since unix epoch in millisecond as documented in // `sp_timestamp::InherentDataProvider`. let now = Now::<T>::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::<u64>()) } } diff --git a/substrate/frame/tips/Cargo.toml b/substrate/frame/tips/Cargo.toml index abebaa19aedaea145ad31be7d6af4abc46aad4dd..bec2ce0a47b8b610f557138965bcb4e52d1fb1df 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 a75aed89d0b44866aee5453743f8865894660dc3..67bcdfa0685e5f606654dee3f68a527385cf35e6 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 16cb1a80e812bd43dbcf60c353210a650a4d59d0..afc424309bf4d54332572e7b3b6e9bbcded1eaa1 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<T: UnlockConfig<I>, 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<T: UnlockConfig<I>, I: 'static>(sp_std::marker::PhantomData<(T, I)>); +pub struct UnreserveDeposits<T: UnlockConfig<I>, I: 'static>(core::marker::PhantomData<(T, I)>); impl<T: UnlockConfig<I>, I: 'static> UnreserveDeposits<T, I> { /// 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_std::vec::Vec<u8>, sp_runtime::TryRuntimeError> { + fn pre_upgrade() -> Result<alloc::vec::Vec<u8>, 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<u8>, + account_reserved_before_bytes: alloc::vec::Vec<u8>, ) -> Result<(), sp_runtime::TryRuntimeError> { use codec::Decode; diff --git a/substrate/frame/transaction-payment/Cargo.toml b/substrate/frame/transaction-payment/Cargo.toml index 3e890a8f7b69f53b80376b78bb014a8c57726301..c405ea1e9439060973523fbfe494ff38657df2a6 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 02ce212deb6a7b4982996945f1604ccd03ed4f29..b87d780b96721d3cd805326ba59a980a3274dbbf 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 ed0ed56e6e074b49db7abf6d43ddb9305d7fb616..538d88bfacfaa6d5138ff7fca33e9b45cf1ee56c 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<T: Config> sp_std::fmt::Debug for ChargeAssetTxPayment<T> { +impl<T: Config> core::fmt::Debug for ChargeAssetTxPayment<T> { #[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<ChargeAssetIdOf<T>>, ); - 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 f2f2c57bb376d9b81d04f3e39a77d27c0652be20..0ef3fb1111439e0020bc4797fb0cd85ed71521b7 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<T: Config> { diff --git a/substrate/frame/transaction-payment/asset-tx-payment/Cargo.toml b/substrate/frame/transaction-payment/asset-tx-payment/Cargo.toml index 1b92ecf53c0266606b3653911e305c4f069c1b72..ec8fb38dda390c4d3535541228d3fe3e02785a49 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 753fae747a37ec914abb439fc3829c4caca9a448..97f1116993fc166dd6036ae88a790eaf3cb8e34f 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<T: Config> sp_std::fmt::Debug for ChargeAssetTxPayment<T> { +impl<T: Config> core::fmt::Debug for ChargeAssetTxPayment<T> { #[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<ChargeAssetIdOf<T>>, ); - 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 717114ab6bd03c786266d1b54fe25fa171c47d19..2486474bad45b7ad9a293491631acfbc3ef4e47f 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<T: Config> { diff --git a/substrate/frame/transaction-payment/skip-feeless-payment/Cargo.toml b/substrate/frame/transaction-payment/skip-feeless-payment/Cargo.toml index 7265979cedc0c3737df51a24718e9b19d6cf57e9..b5bc7719def607bd54cc9013f4f89889e03f5430 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 682fb320356166bdd16b068b156e3315344b3a44..3ab38743bafdd8b4e8f86bb1f5f0ad902f83ffd4 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<T, S>(pub S, sp_std::marker::PhantomData<T>); +pub struct SkipCheckIfFeeless<T, S>(pub S, core::marker::PhantomData<T>); // Make this extension "invisible" from the outside (ie metadata type information) impl<T, S: StaticTypeInfo> TypeInfo for SkipCheckIfFeeless<T, S> { @@ -87,20 +87,20 @@ impl<T, S: StaticTypeInfo> TypeInfo for SkipCheckIfFeeless<T, S> { } } -impl<T, S: Encode> sp_std::fmt::Debug for SkipCheckIfFeeless<T, S> { +impl<T, S: Encode> core::fmt::Debug for SkipCheckIfFeeless<T, S> { #[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<T, S> From<S> for SkipCheckIfFeeless<T, S> { 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 4ddeae11fcab4cf071d17e00e6d77b4d0c4c27fe..d6d600f24e77cf840db1fae796fc8edad2133f91 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 0e440ee4e9ff5f503086a0e5c139a89fdf01a5be..69fad6e0e32483f9301e30bd4c833ec120cc7226 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<T> = <<T as Config>::OnChargeTransaction as OnChargeTransaction<T /// /// More info can be found at: /// <https://research.web3.foundation/en/latest/polkadot/overview/2-token-economics.html> -pub struct TargetedFeeAdjustment<T, S, V, M, X>(sp_std::marker::PhantomData<(T, S, V, M, X)>); +pub struct TargetedFeeAdjustment<T, S, V, M, X>(core::marker::PhantomData<(T, S, V, M, X)>); /// Something that can convert the current multiplier to the next one. pub trait MultiplierUpdate: Convert<Multiplier, Multiplier> { @@ -264,7 +263,7 @@ where } /// A struct to make the fee multiplier a constant -pub struct ConstFeeMultiplier<M: Get<Multiplier>>(sp_std::marker::PhantomData<M>); +pub struct ConstFeeMultiplier<M: Get<Multiplier>>(core::marker::PhantomData<M>); impl<M: Get<Multiplier>> MultiplierUpdate for ConstFeeMultiplier<M> { fn min() -> Multiplier { @@ -406,7 +405,7 @@ pub mod pallet { pub struct GenesisConfig<T: Config> { pub multiplier: Multiplier, #[serde(skip)] - pub _config: sp_std::marker::PhantomData<T>, + pub _config: core::marker::PhantomData<T>, } impl<T: Config> Default for GenesisConfig<T> { @@ -806,13 +805,13 @@ where } } -impl<T: Config> sp_std::fmt::Debug for ChargeTransactionPayment<T> { +impl<T: Config> core::fmt::Debug for ChargeTransactionPayment<T> { #[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 <<T as Config>::OnChargeTransaction as OnChargeTransaction<T>>::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 25cecc58a63ab092822d61bb32259a7a846b230a..67c7311d0cab5bf8e8e4f83ac874a49279e42d14 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 3bb97e0cd01562c439028f373339398b6ef4e2f1..e57ee1e729c4d05fb713053c98a693368e5dce3e 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 8d485d9f3cac2de9f5a738dbe5490f2fb5232bce..f360e9847a1e1f9ef57b12f3aa77f62c13d8d4ca 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 6e58ee3e585abd5362bfd5f19d9a616c1b4d7ee7..68f24526300d8539bb1865520dbc6d7b06dc2cf0 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 33e74b0a4aa282699e2a278ab6359b22df563c39..2727ab809320c6eac7f53d82563910b871380ef2 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 b437e5ef137e3e72bf39c10223a94a67dc31b91c..3954489a2d156696efe0173aea74ec0583c16ae9 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<T: Config<I>, 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 16e815975b5440000a0bc0808205e2323865adaa..228d96095ac926a92a428f68851b65cd647c9116 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 fbb71513c6ae7e59595a8b06a39c62d5db2ebecf..861a85881f2dd9d9d5adb3eafeba809677d8ba42 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 126c0837949d56553baf5e1a073ab082df3c4dad..95ae250eff7b54d680aea1dce819f950b8bcefec 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 5904b5ed316285c38526bdab47b9cb53048faec7..68f7a0312554d59fc2570393548dfa5a9e6f4a3e 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 d41d322bb63f1a9e72915549107f673a340c039d..2b1794aa60fe7ea2cc650c8828784c0ec260a22c 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 80d02f1362189d34491975918b5d14ce28bc3ab0..a8a83010c51ff895ba3631dba238b44d669144cf 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 0ae055a98d8c8bd551106cf4ef3c47503e41a83c..8e4af723f80333d736214bf79a88948b986eb78a 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<T: Config<I>, I: 'static> Inspect<<T as SystemConfig>::AccountId> for Pallet<T, I> { type ItemId = T::ItemId; diff --git a/substrate/frame/uniques/src/lib.rs b/substrate/frame/uniques/src/lib.rs index 2291d19de2bfb6941c78614558254de19e75680a..dc27c335623406e21e811c0af8ed2e626908637c 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 5dfe43c96888dfb634012a460a4b9314da2a2497..a8428c420b3e5fd7b9104f0e622baa2175bf0e20 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::<Test>::iter().map(|x| x.0).collect(); diff --git a/substrate/frame/utility/Cargo.toml b/substrate/frame/utility/Cargo.toml index 0ccdac6be6236ef68f528f5c24f8904a7dba1670..f08232de9cd6d10139e86d9ea7bff9c2bfc9d36a 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 78911fd310e857222d5ff46b661838cda79597d9..467055ecd800daad6ee827343dbd2f6d1094bcae 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 7f963e3637d6fcb606591c46e9511280ee776879..3ce5b4ff86496d48ffa60d953b86d56880ec65c5 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::<<T as Config>::RuntimeCall>() as u32 + + let call_size = ((core::mem::size_of::<<T as Config>::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::<<T as Config>::RuntimeCall>() as u32 <= CALL_ALIGN, + core::mem::size_of::<<T as Config>::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 3aca5683465cd39e6873cb123135312b8c3ca74b..64c26174cfdfd0a4fb2e0094973f2ac66897933e 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 3868f1a8592e95c69aa2fd09b8a201b869016fba..bfc10efeed796bdf85d42c48bcb3c41ffa8ce8e0 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 6fe82312b637d550bfe164c62155bb9261e75801..33fa5d0df882c7f018d9c7bffbec4661e5b558c8 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 922f9124d913a1b81c9142f9822635753eec728c..c48a15f2163185dd6ac63cf64ab2839f94df3281 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 7fb5632fc00247648be3238775735d0b2fdc2241..cbe6ee4becd0acb5d51cc09b7794973d8f79f9af 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: <T as Config>::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: <T as Config>::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 44551abd10715e0e4dd23d9667b2786f8ae850a1..de16c2c2da883e20a62ffd807ef7739df9b46439 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 f8cbad8e31f02d38ee5a218d107968f634420a67..d6c64a0ada28bb668f648b092268edcf81b513df 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 cd8da8ba2374e142835967c8f304c62b1d0bf250..d254bf20601fe12a7c960ae2381c5d7a75c70d67 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<u32>; + fn metadata_versions() -> alloc::vec::Vec<u32>; } } diff --git a/substrate/primitives/application-crypto/Cargo.toml b/substrate/primitives/application-crypto/Cargo.toml index fbf9def20fce7468ced3036c107cbbaac9e2593b..c0508d377f8b4950d734a1ea09d339fd77be9b0c 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 fc7383815d7021a6abe93da2bbbeb723d91f4d2e..0e21e5d3bce31ba0cd62987377cbaa60fc1230a4 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 3bd01de139c9496d35b143ddeb07de1285154946..9d346ea618343dde42526a7d2c9389965463840c 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 439b51dc604509788bd16b25aea2dbf6201471bd..94d5288584ccb89d111f62f14fb140495d8b3714 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 8dee73095fb2e2fcbeb968edef2aad667112767a..443d214d67729f47b081ba9a13e20cfa407dc5f0 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 addefe7daf6431415f1c06727b88edd1b3bd9158..6769de4e47c349f0b5736573144ae0f9f50bea5f 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 2355f1ba527d5227a804fc30ae2deccc44df2152..37949d7c41ded368fc33a5b33d8e11df6dd4f6f5 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 d411cc253c0d84fd0bd7f366a7dec86f4c9acc91..ba6f0e3ae6b37ad6627f5fc19718f268115ec09a 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 0b59abf272dc7761f08c8604db33762b07e31584..1789d9b96fd82e51e73e4e2d0ba8c0e173b6802d 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<T: sp_std::hash::Hash> MaybeHash for T {} +pub trait MaybeHash: core::hash::Hash {} +impl<T: core::hash::Hash> 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 a0d80fc9b504984121c990d9053d67383ad9c57b..4a9d5ba234bab98e0cd56fd7cbdcfdd4fec840e1 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 d44f3c0c87c40dd447ca0e3123b74f9464408666..bbe31b7553bd2b2304384934bdf9ee1928d63aa1 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::<String>()) + write!(f, "{s}\n{i}^", i = core::iter::repeat(" ").take(pos).collect::<String>()) } } diff --git a/substrate/primitives/core/src/bandersnatch.rs b/substrate/primitives/core/src/bandersnatch.rs index 71ee2da5383489a42f1c3a961089b031e2764964..25bf4657030fbcddcc75a419941a247759e0f9d5 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 bb04babb3f180f3728c3a0e8159b725aeb7a2d47..a86f67844da2addb4c5596689268c469039a50a2 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 b13899fff5176eb76defa5ef32f840ad2c8c0ceb..fd7fe776720400ba3e4ad9fa1859ca5dc168a8bb 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<Self, Self::Err> { @@ -786,7 +784,7 @@ pub struct SecretUri { pub junctions: Vec<DeriveJunction>, } -impl sp_std::str::FromStr for SecretUri { +impl alloc::str::FromStr for SecretUri { type Err = SecretStringError; fn from_str(s: &str) -> Result<Self, Self::Err> { @@ -925,7 +923,7 @@ pub trait Pair: CryptoType + Sized { s: &str, password_override: Option<&str>, ) -> Result<(Self, Option<Self::Seed>), 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 ee5f3482f743a6a63b3465c75fcdb6d2d82ab6e7..e5130e6d50079f3b9c8e8797f89e1c04e636679b 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<const N: usize, SubTag> Public for PublicBytes<N, SubTag> where Self: CryptoType {} - impl<const N: usize, SubTag> sp_std::fmt::Debug for PublicBytes<N, SubTag> + impl<const N: usize, SubTag> core::fmt::Debug for PublicBytes<N, SubTag> 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<const N: usize, SubTag> sp_std::fmt::Debug for SignatureBytes<N, SubTag> + impl<const N: usize, SubTag> core::fmt::Debug for SignatureBytes<N, SubTag> 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 9cba8cc3d352a0b60317f570827015f4c11d5313..d11811ff2af65be517b69b7fadb454b7fd65432e 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 269b6bfcd8dcefc961aa10b1384d4cfe0bfdfd19..401f9a39d5673f78d7e2a22d023d62873d293ad7 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 72bb24a186e54dbfb4deecd105065dc2b63d332d..1902b8cca958a3aa45403e7a3173cb96023faebf 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<u8> { +impl AsBytesRef for alloc::vec::Vec<u8> { fn as_bytes_ref(&self) -> &[u8] { self } diff --git a/substrate/primitives/core/src/lib.rs b/substrate/primitives/core/src/lib.rs index 78ec92e4be98db3ac12aaba165fdcdfa596375e3..46503921453def0995c33597186e310478896741 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<Self, Self::Err> { @@ -156,7 +159,7 @@ impl OpaqueMetadata { } } -impl sp_std::ops::Deref for OpaqueMetadata { +impl Deref for OpaqueMetadata { type Target = Vec<u8>; 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 cef495dfaacdcf3c0ba58610819b758d2d4fd6c6..9be86e85d58783553c0d05503bd5ab951d241e32 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 260e86b6ff9c4d759fd3794c6a91cc77aebd8dc0..57bc5b006197bb875f6e44dfc2dfea20738b3878 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 54b9a98db3d2ca2b69af5ab77701e4e8c0b70a83..48780f2ccff939c36097d0b2d4289215c8a82026 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 6b58ea70b8e5ef3a31fc1b9b468e43b544d21343..923efc3b87646a4322134c5b6ab576bfb10c83af 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 67e822ba7e248ed2b07614b85dca4e1c72e8c3e3..b39a06ed2115ab9ec51736d291534af445f08aa4 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 0d05dd9aa51e20b076f293946077a5b40c7418a2..d0eb382cdc566b79643c42ea680e3d66978f037e 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<TokenStream> { impl TryFrom<u8> for #ident { type Error = (); - fn try_from(inner: u8) -> #crate_::sp_std::result::Result<Self, ()> { + fn try_from(inner: u8) -> core::result::Result<Self, ()> { 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 3530b62662a53c53afa14667a77fb7c1c609c582..daf5725e7f51147a6286bfe0398e4f5799c26a5a 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<const N: usize> IntoPreallocatedFFIValue for [u8; N] { } } -impl<T: codec::Codec, E: codec::Codec> PassBy for sp_std::result::Result<T, E> { +impl<T: codec::Codec, E: codec::Codec> PassBy for core::result::Result<T, E> { type PassBy = Codec<Self>; } diff --git a/substrate/primitives/runtime-interface/src/lib.rs b/substrate/primitives/runtime-interface/src/lib.rs index f6ef27789b36f08a6a5e7a58035304cab345737e..d6dcb69958af493185a3fd819e76701b57d79d54 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 103e9c16220542d5a9be5d85301bd45f7906e5e9..dce0b8e4bddb733df47dd83fa96423c85f3e2a53 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 759ab99ceacc1ac393d9ae51c6aca3d65dd14f9f..77e77c707d9e66796a6042465dcc28c8af608773 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 2b3fc728f6ff46cc1332e413d8dee965f6ec7e3d..545f1ff4a115e1b3a381e5b3c85d74f19f41fbd0 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 05146e880cb16571d7eb56c61d8f6c318436d74a..8ed79c7c8dcf728094bc47cb7a58fc3eee93f585 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 d7db0f91a482110f6e9da53e0417657aaf579058..c639576a28670845fc265a0c78d1c9cd50544144 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 df1f5645f04827873fdee3e984f851d40b836c25..499b7c5f5836d21d67f8eb58c0ee41644a119180 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<u8> { - let mut tmp = Vec::with_capacity(sp_std::mem::size_of::<Self>()); + let mut tmp = Vec::with_capacity(core::mem::size_of::<Self>()); // 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 046909b9a38d732a80f5178d228090fe10939c8d..d313d23395a0fa1b655dccaf94e30cacc1ac5c2a 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<Self::Item>; + type IntoIter = alloc::vec::IntoIter<Self::Item>; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() @@ -508,11 +513,11 @@ impl From<DispatchError> 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<T> = sp_std::result::Result<T, DispatchErrorWithPostInfo<T>>; +pub type DispatchResultWithInfo<T> = core::result::Result<T, DispatchErrorWithPostInfo<T>>; /// 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 c435606312e43ab0772ac71dd06f62489b416248..4382405a8ebc67bf8975cb35b99d18b7b213dd2b 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 bacc0073825bb1412f63f07f0c92ddcbc81e080f..79899164540259ac2093012f9f40de161d9c7d6f 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 6f1e738eb0e7ab1e9841d56519e3d3cb7c20c40c..79984b13567250fe7c513c84f28e1276d1cc7ec8 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 607ae59db632f7d5044d48cae4dab4b78d24ad41..71aacf07a762e2fe0886bedae28b408079781ed4 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<u8>` 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 d023aa045dbe09e492bac2c8a8150d620348c37e..25ef15eaf56effe93f56e51b093626ce68679918 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<T> TryMorph<T> for Identity { } /// Implementation of `Morph` which converts between types using `Into`. -pub struct MorphInto<T>(sp_std::marker::PhantomData<T>); +pub struct MorphInto<T>(core::marker::PhantomData<T>); impl<T, A: Into<T>> Morph<A> for MorphInto<T> { type Outcome = T; fn morph(a: A) -> T { @@ -331,7 +331,7 @@ impl<T, A: Into<T>> Morph<A> for MorphInto<T> { } /// Implementation of `TryMorph` which attempts to convert between types using `TryInto`. -pub struct TryMorphInto<T>(sp_std::marker::PhantomData<T>); +pub struct TryMorphInto<T>(core::marker::PhantomData<T>); impl<T, A: TryInto<T>> TryMorph<A> for TryMorphInto<T> { type Outcome = T; fn try_morph(a: A) -> Result<T, ()> { @@ -692,7 +692,7 @@ impl<A, B> MaybeEquivalence<A, B> 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<T>(sp_std::marker::PhantomData<T>); +pub struct ConvertToValue<T>(core::marker::PhantomData<T>); impl<X, Y, T: Get<Y>> Convert<X, Y> for ConvertToValue<T> { fn convert(_: X) -> Y { T::get() @@ -934,17 +934,17 @@ impl<T: Default + Eq + PartialEq> Clear for T { pub trait SimpleBitOps: Sized + Clear - + sp_std::ops::BitOr<Self, Output = Self> - + sp_std::ops::BitXor<Self, Output = Self> - + sp_std::ops::BitAnd<Self, Output = Self> + + core::ops::BitOr<Self, Output = Self> + + core::ops::BitXor<Self, Output = Self> + + core::ops::BitAnd<Self, Output = Self> { } impl< T: Sized + Clear - + sp_std::ops::BitOr<Self, Output = Self> - + sp_std::ops::BitXor<Self, Output = Self> - + sp_std::ops::BitAnd<Self, Output = Self>, + + core::ops::BitOr<Self, Output = Self> + + core::ops::BitXor<Self, Output = Self> + + core::ops::BitAnd<Self, Output = Self>, > 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<T> 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<SignedExtensionMetadata> { - sp_std::vec![SignedExtensionMetadata { + alloc::vec![SignedExtensionMetadata { identifier: Self::IDENTIFIER, ty: scale_info::meta_type::<Self>(), additional_signed: scale_info::meta_type::<Self::AdditionalSigned>() @@ -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<u8>>) -> $crate::sp_std::vec::Vec<u8> { + pub fn generate(seed: Option<$crate::Vec<u8>>) -> $crate::Vec<u8> { 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<u8>, $crate::KeyTypeId)> { + ) -> $crate::Vec<($crate::Vec<u8>, $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<u8>, $crate::KeyTypeId)>> { + ) -> Option<$crate::Vec<($crate::Vec<u8>, $crate::KeyTypeId)>> { <Self as $crate::codec::Decode>::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 836948493823cb4d137ce90721788e9a78a8ac99..ffff94e17461e88a842b1926e1fc92a4c86336b0 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 789c507742f779983b478ccd8bc9ff87a87d7165..55dea364eef4d7089859583005ca3ed7192b2c41 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<T: GetNativeVersion> GetNativeVersion for std::sync::Arc<T> { #[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 a13441302e4df119584c056b7e2e62552d7328d6..d1a3eaa2daa921b8092cf58a2118122ea1228260 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 8c7867f4cc8cd1ec8b8435ec3c038e45da1a5700..08ad537ecdd1487586f919bcce63fa259946e738 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 012ad1d097bfaccbb5968662641888616da274b9..f53871bb185025682eddaab519c8cefbab5011f4 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 936ecd1bd388f35c45f6ec7350576b48f5641c56..9de95ac9569516fc30b4b4f20d268391662ebd8d 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;