Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove sp-std #3008

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cb90ee2
to alloc
gilescope Jan 17, 2024
11b232a
to core
gilescope Jan 17, 2024
d2ed91d
use alloc/core rather than sp_std
gilescope Jan 21, 2024
4816c29
remove sp-std crate
gilescope Jan 21, 2024
3f3a2bf
Merge branch 'master' into giles-sp-std
gilescope Jan 21, 2024
3988e7c
removing more references
gilescope Jan 21, 2024
1320532
use alloc
gilescope Jan 22, 2024
64013d6
remove unused imports
gilescope Jan 22, 2024
a8ec937
loose ends
gilescope Jan 24, 2024
bfe4861
Merge branch 'master' into giles-sp-std
gilescope Jan 24, 2024
3a32261
additional
gilescope Jan 24, 2024
a3ec9ab
Merge branch 'master' into giles-sp-std
gilescope Jan 24, 2024
84375ae
usings
gilescope Jan 25, 2024
8f5c2d2
Merge branch 'master' into giles-sp-std
gilescope Jan 25, 2024
60cc270
taplo
gilescope Jan 26, 2024
4dab1e6
fix build
gilescope Jan 26, 2024
6beda90
more fixes
gilescope Jan 28, 2024
0eff69f
Merge branch 'master' into giles-sp-std
gilescope Jan 28, 2024
82ccf11
cargo fmt
gilescope Jan 28, 2024
4f90297
a few more
gilescope Jan 29, 2024
fc7b2e0
fix doc tests
gilescope Jan 29, 2024
cffdb4a
fix doctests
gilescope Jan 30, 2024
977e89a
Merge branch 'master' into giles-sp-std
gilescope Jan 31, 2024
f6af23c
fix
gilescope Feb 1, 2024
27dee4d
Merge branch 'master' into giles-sp-std
gilescope Feb 2, 2024
9fb3c97
add alloc
gilescope Feb 4, 2024
93569a0
Merge branch 'master' into giles-sp-std
gilescope Feb 4, 2024
441a65f
reduce diff
gilescope Feb 4, 2024
3aa3c64
reduce diff
gilescope Feb 8, 2024
0a53cfe
Merge branch 'master' into giles-sp-std
gilescope Feb 8, 2024
ee5598e
remove sp-std
gilescope Feb 8, 2024
43d372c
Merge branch 'master' into giles-sp-std
gilescope Mar 18, 2024
0f2dc63
removing sp-std
gilescope Mar 18, 2024
9efa51d
Merge branch 'master' into giles-sp-std
gilescope Mar 19, 2024
bba43fc
merge master
gilescope Mar 19, 2024
a538ec1
missing import
gilescope Mar 19, 2024
5d92cb5
alloc::fmt -> core::fmt
gilescope Mar 19, 2024
3617e4b
cargo fmt
gilescope Mar 19, 2024
aa3e2f0
remove warnings
gilescope Mar 26, 2024
d5d1fe5
Merge branch 'master' into giles-sp-std
gilescope May 5, 2024
4646ce2
fixup
gilescope May 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
240 changes: 6 additions & 234 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ members = [
"substrate/primitives/staking",
"substrate/primitives/state-machine",
"substrate/primitives/statement-store",
"substrate/primitives/std",
"substrate/primitives/storage",
"substrate/primitives/test-primitives",
"substrate/primitives/timestamp",
Expand Down
2 changes: 0 additions & 2 deletions bridges/bin/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ sp-api = { path = "../../../substrate/primitives/api", default-features = false
sp-core = { path = "../../../substrate/primitives/core", default-features = false }
sp-io = { path = "../../../substrate/primitives/io", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
sp-trie = { path = "../../../substrate/primitives/trie", default-features = false }

# Polkadot dependencies
Expand Down Expand Up @@ -80,7 +79,6 @@ std = [
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"sp-trie/std",
"xcm-builder/std",
"xcm/std",
Expand Down
4 changes: 3 additions & 1 deletion bridges/bin/runtime-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

use crate::messages_call_ext::MessagesCallSubType;
use pallet_bridge_grandpa::CallSubType as GrandpaCallSubType;
use pallet_bridge_parachains::CallSubType as ParachainsCallSubtype;
Expand Down Expand Up @@ -112,7 +114,7 @@ macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
type AdditionalSigned = ();
type Pre = ();

fn additional_signed(&self) -> sp_std::result::Result<
fn additional_signed(&self) -> core::result::Result<
(),
sp_runtime::transaction_validity::TransactionValidityError,
> {
Expand Down
5 changes: 3 additions & 2 deletions bridges/bin/runtime-common/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

pub use bp_runtime::{RangeInclusiveExt, UnderlyingChainOf, UnderlyingChainProvider};

use alloc::vec::Vec;
use bp_header_chain::HeaderChain;
use bp_messages::{
source_chain::TargetHeaderChain,
Expand All @@ -31,11 +32,11 @@ use bp_messages::{
};
use bp_runtime::{Chain, RawStorageProof, Size, StorageProofChecker};
use codec::{Decode, Encode};
use core::{marker::PhantomData};
use frame_support::{traits::Get, weights::Weight};
use hash_db::Hasher;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
use sp_std::{convert::TryFrom, marker::PhantomData, vec::Vec};

/// Bidirectional message bridge.
pub trait MessageBridge {
Expand Down Expand Up @@ -340,7 +341,7 @@ pub mod target {

struct StorageProofCheckerAdapter<H: Hasher, B> {
storage: StorageProofChecker<H>,
_dummy: sp_std::marker::PhantomData<B>,
_dummy: core::marker::PhantomData<B>,
}

impl<H: Hasher, B: MessageBridge> StorageProofCheckerAdapter<H, B> {
Expand Down
3 changes: 2 additions & 1 deletion bridges/bin/runtime-common/src/messages_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

//! Helpers for implementing various message-related runtime API methods.

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use bp_messages::{
InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails,
};
use sp_std::vec::Vec;

/// Implementation of the `To*OutboundLaneApi::message_details`.
pub fn outbound_message_details<Runtime, MessagesPalletInstance>(
Expand Down
2 changes: 1 addition & 1 deletion bridges/bin/runtime-common/src/messages_benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ use crate::{
},
};

use alloc::vec;
use bp_messages::MessagePayload;
use bp_polkadot_core::parachains::ParaHash;
use bp_runtime::{Chain, Parachain, StorageProofSize, UnderlyingChainOf};
use codec::Encode;
use frame_support::weights::Weight;
use pallet_bridge_messages::benchmarking::{MessageDeliveryProofParams, MessageProofParams};
use sp_runtime::traits::{Header, Zero};
use sp_std::prelude::*;
use xcm::latest::prelude::*;

/// Prepare inbound bridge message according to given message proof parameters.
Expand Down
6 changes: 3 additions & 3 deletions bridges/bin/runtime-common/src/messages_call_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ use crate::messages::{
};
use bp_messages::{target_chain::MessageDispatch, InboundLaneData, LaneId, MessageNonce};
use bp_runtime::OwnedBridgeModule;
use core::ops::RangeInclusive;
use frame_support::{
dispatch::CallableCallFor,
traits::{Get, IsSubType},
};
use pallet_bridge_messages::{Config, Pallet};
use sp_runtime::{transaction_validity::TransactionValidity, RuntimeDebug};
use sp_std::ops::RangeInclusive;

/// Generic info about a messages delivery/confirmation proof.
#[derive(PartialEq, RuntimeDebug)]
Expand Down Expand Up @@ -137,7 +137,7 @@ impl CallInfo {

/// Helper struct that provides methods for working with a call supported by `CallInfo`.
pub struct CallHelper<T: Config<I>, I: 'static> {
_phantom_data: sp_std::marker::PhantomData<(T, I)>,
_phantom_data: core::marker::PhantomData<(T, I)>,
}

impl<T: Config<I>, I: 'static> CallHelper<T, I> {
Expand Down Expand Up @@ -368,7 +368,7 @@ mod tests {
},
};
use bp_messages::{DeliveredMessages, UnrewardedRelayer, UnrewardedRelayersState};
use sp_std::ops::RangeInclusive;
use core::ops::RangeInclusive;

fn fill_unrewarded_relayers() {
let mut inbound_lane_state =
Expand Down
6 changes: 4 additions & 2 deletions bridges/bin/runtime-common/src/messages_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@

use crate::messages::{AccountIdOf, BridgedChain, HashOf, HasherOf, MessageBridge, ThisChain};

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use bp_messages::{
storage_keys, InboundLaneData, LaneId, MessageKey, MessageNonce, MessagePayload,
OutboundLaneData,
};
use bp_runtime::{record_all_trie_keys, RawStorageProof, StorageProofSize};
use codec::Encode;
use sp_std::{ops::RangeInclusive, prelude::*};
use core::ops::RangeInclusive;
use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};

/// Simple and correct message data encode function.
Expand Down Expand Up @@ -142,7 +144,7 @@ pub fn grow_trie_leaf_value(mut value: Vec<u8>, size: StorageProofSize) -> Vec<u
match size {
StorageProofSize::Minimal(_) => (),
StorageProofSize::HasLargeLeaf(size) if size as usize > value.len() => {
value.extend(sp_std::iter::repeat(42u8).take(size as usize - value.len()));
value.extend(core::iter::repeat(42u8).take(size as usize - value.len()));
},
StorageProofSize::HasLargeLeaf(_) => (),
}
Expand Down
14 changes: 7 additions & 7 deletions bridges/bin/runtime-common/src/messages_xcm_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ use bp_runtime::messages::MessageDispatchResult;
pub use bp_xcm_bridge_hub::XcmAsPlainPayload;
use bp_xcm_bridge_hub_router::XcmChannelStatusProvider;
use codec::{Decode, Encode};
use core::{fmt::Debug, marker::PhantomData};
use frame_support::{traits::Get, weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
use pallet_bridge_messages::{
Config as MessagesConfig, OutboundLanesCongestedSignals, WeightInfoExt as MessagesPalletWeights,
};
use scale_info::TypeInfo;
use sp_runtime::SaturatedConversion;
use sp_std::{fmt::Debug, marker::PhantomData};
use xcm::prelude::*;
use xcm_builder::{DispatchBlob, DispatchBlobError};

Expand All @@ -55,7 +55,7 @@ pub enum XcmBlobMessageDispatchResult {
///
/// It needs to be used at the target bridge hub.
pub struct XcmBlobMessageDispatch<DispatchBlob, Weights, Channel> {
_marker: sp_std::marker::PhantomData<(DispatchBlob, Weights, Channel)>,
_marker: core::marker::PhantomData<(DispatchBlob, Weights, Channel)>,
}

impl<
Expand Down Expand Up @@ -166,12 +166,12 @@ pub trait XcmBlobHauler {
///
/// It needs to be used at the source bridge hub.
pub struct XcmBlobHaulerAdapter<XcmBlobHauler, Lanes>(
sp_std::marker::PhantomData<(XcmBlobHauler, Lanes)>,
core::marker::PhantomData<(XcmBlobHauler, Lanes)>,
);

impl<
H: XcmBlobHauler,
Lanes: Get<sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))>>,
Lanes: Get<alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))>>,
> OnMessagesDelivered for XcmBlobHaulerAdapter<H, Lanes>
{
fn on_messages_delivered(lane: LaneId, enqueued_messages: MessageNonce) {
Expand Down Expand Up @@ -316,7 +316,7 @@ impl<H: XcmBlobHauler> LocalXcmQueueManager<H> {
/// configured XCM version between the destination `dest` and the bridge hub location provided as
/// `Get<Location>`.
pub struct XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>(
sp_std::marker::PhantomData<(Version, RemoteBridge)>,
core::marker::PhantomData<(Version, RemoteBridge)>,
);
impl<Version: GetVersion, RemoteBridge: Get<Location>> GetVersion
for XcmVersionOfDestAndRemoteBridge<Version, RemoteBridge>
Expand All @@ -326,7 +326,7 @@ impl<Version: GetVersion, RemoteBridge: Get<Location>> GetVersion
let bridge_hub_version = Version::get_version_for(&RemoteBridge::get());

match (dest_version, bridge_hub_version) {
(Some(dv), Some(bhv)) => Some(sp_std::cmp::min(dv, bhv)),
(Some(dv), Some(bhv)) => Some(core::cmp::min(dv, bhv)),
(Some(dv), None) => Some(dv),
(None, Some(bhv)) => Some(bhv),
(None, None) => None,
Expand All @@ -348,7 +348,7 @@ mod tests {
location: Location::new(1, [Parachain(1000)]),
lane: TEST_LANE_ID,
};
pub TestLanes: sp_std::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = sp_std::vec![
pub TestLanes: alloc::vec::Vec<(SenderAndLane, (NetworkId, InteriorLocation))> = alloc::vec![
(TestSenderAndLane::get(), (NetworkId::ByGenesis([0; 32]), InteriorLocation::Here))
];
pub DummyXcmMessage: Xcm<()> = Xcm::new();
Expand Down
3 changes: 2 additions & 1 deletion bridges/bin/runtime-common/src/parachains_benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ use crate::{
messages_generation::grow_trie_leaf_value,
};

#[cfg(not(feature = "std"))]
use alloc::{vec, vec::Vec};
use bp_parachains::parachain_head_storage_key_at_source;
use bp_polkadot_core::parachains::{ParaHash, ParaHead, ParaHeadsProof, ParaId};
use bp_runtime::{record_all_trie_keys, StorageProofSize};
use codec::Encode;
use frame_support::traits::Get;
use pallet_bridge_parachains::{RelayBlockHash, RelayBlockHasher, RelayBlockNumber};
use sp_std::prelude::*;
use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};

/// Prepare proof of messages for the `receive_messages_proof` call.
Expand Down
6 changes: 4 additions & 2 deletions bridges/bin/runtime-common/src/refund_relayer_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
use crate::messages_call_ext::{
CallHelper as MessagesCallHelper, CallInfo as MessagesCallInfo, MessagesCallSubType,
};
#[cfg(not(feature = "std"))]
use alloc::{vec, vec::Vec};
use bp_messages::{LaneId, MessageNonce};
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_runtime::{Chain, Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider};
use codec::{Codec, Decode, Encode};
use core::marker::PhantomData;
use frame_support::{
dispatch::{CallableCallFor, DispatchInfo, PostDispatchInfo},
traits::IsSubType,
Expand Down Expand Up @@ -54,7 +57,6 @@ use sp_runtime::{
},
DispatchResult, FixedPointOperand, RuntimeDebug,
};
use sp_std::{marker::PhantomData, vec, vec::Vec};

type AccountIdOf<R> = <R as frame_system::Config>::AccountId;
// without this typedef rustfmt fails with internal err
Expand Down Expand Up @@ -241,7 +243,7 @@ pub enum RelayerAccountAction<AccountId, Reward> {

/// Everything common among our refund signed extensions.
pub trait RefundSignedExtension:
'static + Clone + Codec + sp_std::fmt::Debug + Default + Eq + PartialEq + Send + Sync + TypeInfo
'static + Clone + Codec + core::fmt::Debug + Default + Eq + PartialEq + Send + Sync + TypeInfo
where
<Self::Runtime as GrandpaConfig<Self::GrandpaInstance>>::BridgedChain:
Chain<BlockNumber = RelayBlockNumber>,
Expand Down
2 changes: 0 additions & 2 deletions bridges/chains/chain-bridge-hub-cumulus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ bp-runtime = { path = "../../primitives/runtime", default-features = false }
frame-system = { path = "../../../substrate/frame/system", default-features = false }
frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }

# Polkadot Dependencies
polkadot-primitives = { path = "../../../polkadot/primitives", default-features = false }
Expand All @@ -37,5 +36,4 @@ std = [
"frame-system/std",
"polkadot-primitives/std",
"sp-api/std",
"sp-std/std",
]
2 changes: 1 addition & 1 deletion bridges/chains/chain-bridge-hub-cumulus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ use bp_polkadot_core::SuffixedCommonSignedExtension;
use bp_runtime::extensions::{
BridgeRejectObsoleteHeadersAndMessages, RefundBridgedParachainMessagesSchema,
};
use core::time::Duration;
use frame_support::{
dispatch::DispatchClass,
parameter_types,
sp_runtime::{MultiAddress, MultiSigner},
weights::constants,
};
use frame_system::limits;
use sp_std::time::Duration;

/// Average block interval in Cumulus-based parachains.
///
Expand Down
2 changes: 0 additions & 2 deletions bridges/chains/chain-bridge-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ bp-messages = { path = "../../primitives/messages", default-features = false }
frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }

[features]
default = ["std"]
Expand All @@ -33,5 +32,4 @@ std = [
"frame-support/std",
"sp-api/std",
"sp-runtime/std",
"sp-std/std",
]
2 changes: 2 additions & 0 deletions bridges/chains/chain-bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{
Expand Down
2 changes: 0 additions & 2 deletions bridges/chains/chain-bridge-hub-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ bp-messages = { path = "../../primitives/messages", default-features = false }
frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }

[features]
default = ["std"]
Expand All @@ -34,5 +33,4 @@ std = [
"frame-support/std",
"sp-api/std",
"sp-runtime/std",
"sp-std/std",
]
2 changes: 2 additions & 0 deletions bridges/chains/chain-bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{
Expand Down
2 changes: 0 additions & 2 deletions bridges/chains/chain-bridge-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ bp-messages = { path = "../../primitives/messages", default-features = false }
frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }

[features]
default = ["std"]
Expand All @@ -33,5 +32,4 @@ std = [
"frame-support/std",
"sp-api/std",
"sp-runtime/std",
"sp-std/std",
]
2 changes: 2 additions & 0 deletions bridges/chains/chain-bridge-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{
Expand Down
2 changes: 0 additions & 2 deletions bridges/chains/chain-bridge-hub-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ bp-messages = { path = "../../primitives/messages", default-features = false }
frame-support = { path = "../../../substrate/frame/support", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }

[features]
default = ["std"]
Expand All @@ -34,5 +33,4 @@ std = [
"frame-support/std",
"sp-api/std",
"sp-runtime/std",
"sp-std/std",
]
2 changes: 2 additions & 0 deletions bridges/chains/chain-bridge-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub use bp_bridge_hub_cumulus::*;
use bp_messages::*;
use bp_runtime::{
Expand Down
Loading