Skip to content

Commit

Permalink
Update Rust version
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Feb 29, 2024
1 parent 1fd384b commit d7b5a8b
Show file tree
Hide file tree
Showing 97 changed files with 435 additions and 427 deletions.
199 changes: 25 additions & 174 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile-bootstrap-node
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2024-01-19
ARG RUSTC_VERSION=nightly-2024-02-29
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-bootstrap-node.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2024-01-19
ARG RUSTC_VERSION=nightly-2024-02-29
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-farmer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2024-01-19
ARG RUSTC_VERSION=nightly-2024-02-29
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-farmer.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2024-01-19
ARG RUSTC_VERSION=nightly-2024-02-29
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-node
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2024-01-19
ARG RUSTC_VERSION=nightly-2024-02-29
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-node.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2024-01-19
ARG RUSTC_VERSION=nightly-2024-02-29
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-runtime
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04

ARG RUSTC_VERSION=nightly-2024-01-19
ARG RUSTC_VERSION=nightly-2024-02-29
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
Expand Down
5 changes: 3 additions & 2 deletions crates/pallet-domains/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! Benchmarking for `pallet-domains`.
extern crate alloc;

use super::*;
use crate::alloc::borrow::ToOwned;
use crate::domain_registry::DomainConfig;
use crate::staking::{do_reward_operators, OperatorConfig, OperatorStatus};
use crate::staking_epoch::{do_finalize_domain_current_epoch, do_finalize_domain_epoch_staking};
Expand All @@ -17,7 +18,7 @@ use sp_domains::{
dummy_opaque_bundle, DomainId, ExecutionReceipt, OperatorAllowList, OperatorId,
OperatorPublicKey, RuntimeType,
};
use sp_runtime::traits::{BlockNumberProvider, CheckedAdd, One, SaturatedConversion, Zero};
use sp_runtime::traits::{BlockNumberProvider, CheckedAdd, One, Zero};

const SEED: u32 = 0;

Expand Down
7 changes: 5 additions & 2 deletions crates/pallet-domains/src/block_tree.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
//! Domain block tree
#[cfg(not(feature = "std"))]
extern crate alloc;

use crate::{
BalanceOf, BlockTree, BlockTreeNodes, Config, ConsensusBlockHash, DomainBlockNumberFor,
DomainHashingFor, ExecutionInbox, ExecutionReceiptOf, HeadReceiptExtended, HeadReceiptNumber,
InboxedBundleAuthor, LatestConfirmedDomainBlock, Pallet, ReceiptHashFor,
};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Decode, Encode};
use frame_support::{ensure, PalletError};
use scale_info::TypeInfo;
Expand All @@ -17,7 +22,6 @@ use sp_domains::{
use sp_runtime::traits::{BlockNumberProvider, CheckedSub, One, Saturating, Zero};
use sp_std::cmp::Ordering;
use sp_std::collections::btree_map::BTreeMap;
use sp_std::vec::Vec;

/// Block tree specific errors
#[derive(TypeInfo, Encode, Decode, PalletError, Debug, PartialEq)]
Expand Down Expand Up @@ -511,7 +515,6 @@ mod tests {
use frame_support::{assert_err, assert_ok};
use sp_core::H256;
use sp_domains::{BundleDigest, InboxedBundle, InvalidBundleType};
use sp_runtime::traits::BlockNumberProvider;

#[test]
fn test_genesis_receipt() {
Expand Down
9 changes: 6 additions & 3 deletions crates/pallet-domains/src/domain_registry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Domain registry for domains
#[cfg(not(feature = "std"))]
extern crate alloc;

use crate::block_tree::import_genesis_receipt;
use crate::pallet::{DomainStakingSummary, NextEVMChainId};
use crate::runtime_registry::DomainRuntimeInfo;
Expand All @@ -8,7 +11,10 @@ use crate::{
BalanceOf, Config, DomainHashingFor, DomainRegistry, ExecutionReceiptOf, HoldIdentifier,
NextDomainId, RuntimeRegistry,
};
#[cfg(not(feature = "std"))]
use alloc::string::String;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Decode, Encode};
use domain_runtime_primitives::MultiAccountId;
use frame_support::traits::fungible::{Inspect, Mutate, MutateHold};
Expand All @@ -26,7 +32,6 @@ use sp_runtime::traits::{CheckedAdd, Zero};
use sp_runtime::DigestItem;
use sp_std::collections::btree_map::BTreeMap;
use sp_std::collections::btree_set::BTreeSet;
use sp_std::vec::Vec;

/// Domain registry specific errors
#[derive(TypeInfo, Encode, Decode, PalletError, Debug, PartialEq)]
Expand Down Expand Up @@ -299,7 +304,6 @@ pub(crate) fn do_update_domain_allow_list<T: Config>(
#[cfg(test)]
mod tests {
use super::*;
use crate::pallet::{DomainRegistry, NextDomainId, RuntimeRegistry};
use crate::runtime_registry::RuntimeObject;
use crate::tests::{new_test_ext, Test};
use domain_runtime_primitives::{AccountId20, AccountId20Converter};
Expand All @@ -308,7 +312,6 @@ mod tests {
use hex_literal::hex;
use sp_domains::storage::RawGenesis;
use sp_runtime::traits::Convert;
use sp_std::collections::btree_set::BTreeSet;
use sp_std::vec;
use sp_version::RuntimeVersion;
use subspace_runtime_primitives::SSC;
Expand Down
14 changes: 9 additions & 5 deletions crates/pallet-domains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ extern crate alloc;

use crate::block_tree::verify_execution_receipt;
use crate::staking::OperatorStatus;
#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
use alloc::collections::btree_map::BTreeMap;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Decode, Encode};
use frame_support::ensure;
use frame_support::pallet_prelude::StorageVersion;
Expand Down Expand Up @@ -64,9 +69,6 @@ use sp_domains_fraud_proof::verification::{
};
use sp_runtime::traits::{Hash, Header, One, Zero};
use sp_runtime::{RuntimeAppPublic, SaturatedConversion, Saturating};
use sp_std::boxed::Box;
use sp_std::collections::btree_map::BTreeMap;
use sp_std::vec::Vec;
pub use staking::OperatorConfig;
use subspace_core_primitives::{BlockHash, SlotNumber, U256};
use subspace_runtime_primitives::Balance;
Expand Down Expand Up @@ -153,7 +155,10 @@ mod pallet {
BalanceOf, BlockSlot, DomainBlockNumberFor, ElectionVerificationParams, HoldIdentifier,
NominatorId, OpaqueBundleOf, ReceiptHashFor, STORAGE_VERSION,
};
#[cfg(not(feature = "std"))]
use alloc::string::String;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::FullCodec;
use domain_runtime_primitives::EVMChainId;
use frame_support::pallet_prelude::*;
Expand Down Expand Up @@ -181,7 +186,6 @@ mod pallet {
use sp_std::collections::btree_set::BTreeSet;
use sp_std::fmt::Debug;
use sp_std::vec;
use sp_std::vec::Vec;
use subspace_core_primitives::U256;
use subspace_runtime_primitives::StorageFee;

Expand Down Expand Up @@ -609,7 +613,7 @@ mod pallet {
InvalidExtrinsicRoot,
/// This bundle duplicated with an already submitted bundle
DuplicatedBundle,
/// Invalid proof of time in the proof of election
/// Invalid proof of time in the proof of election
InvalidProofOfTime,
/// The bundle is built on a slot in the future
SlotInTheFuture,
Expand Down
7 changes: 6 additions & 1 deletion crates/pallet-domains/src/runtime_registry.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
//! Runtime registry for domains
#[cfg(not(feature = "std"))]
extern crate alloc;

use crate::pallet::{NextRuntimeId, RuntimeRegistry, ScheduledRuntimeUpgrades};
use crate::{BalanceOf, Config, Event};
#[cfg(not(feature = "std"))]
use alloc::string::String;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Decode, Encode};
use domain_runtime_primitives::{AccountId20, EVMChainId, MultiAccountId, TryConvertBack};
use frame_support::PalletError;
Expand All @@ -15,7 +21,6 @@ use sp_domains::{DomainId, DomainsDigestItem, RuntimeId, RuntimeType};
use sp_runtime::traits::{CheckedAdd, Get, Zero};
use sp_runtime::DigestItem;
use sp_std::vec;
use sp_std::vec::Vec;
use sp_version::RuntimeVersion;

/// Runtime specific errors
Expand Down
5 changes: 4 additions & 1 deletion crates/pallet-domains/src/staking.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Staking for domains
#[cfg(not(feature = "std"))]
extern crate alloc;

use crate::bundle_storage_fund::{self, deposit_reserve_for_storage_fund};
use crate::pallet::{
Deposits, DomainRegistry, DomainStakingSummary, NextOperatorId, NominatorCount,
Expand All @@ -23,7 +26,6 @@ use sp_runtime::{Perbill, Percent, Saturating};
use sp_std::collections::btree_map::BTreeMap;
use sp_std::collections::btree_set::BTreeSet;
use sp_std::collections::vec_deque::VecDeque;
use sp_std::iter::Iterator;
use sp_std::vec::IntoIter;

/// A nominators deposit.
Expand Down Expand Up @@ -1264,6 +1266,7 @@ pub(crate) mod tests {

type Balances = pallet_balances::Pallet<Test>;
type Domains = crate::Pallet<Test>;

const STORAGE_FEE_RESERVE: Perbill = Perbill::from_percent(20);

pub(crate) fn register_operator(
Expand Down
16 changes: 7 additions & 9 deletions crates/pallet-feeds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ frame-support = { version = "4.0.0-dev", default-features = false, git = "https:
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-std = { version = "8.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" }

Expand All @@ -28,13 +27,12 @@ sp-io = { version = "23.0.0", default-features = false, git = "https://github.co
[features]
default = ["std"]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"subspace-core-primitives/std",
"codec/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
"subspace-core-primitives/std",
]
try-runtime = ["frame-support/try-runtime"]
9 changes: 7 additions & 2 deletions crates/pallet-feeds/src/feed_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@

//! Defines FeedProcessor and its types
#[cfg(not(feature = "std"))]
extern crate alloc;

use crate::CallObject;
#[cfg(not(feature = "std"))]
use alloc::vec;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Compact, CompactLen, Decode, Encode};
use sp_runtime::{DispatchError, DispatchResult};
use sp_std::vec;
use sp_std::vec::Vec;
use subspace_core_primitives::Blake3Hash;

/// Holds the offset to some portion of data within/or the object
Expand Down
12 changes: 8 additions & 4 deletions crates/pallet-feeds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@
#![forbid(unsafe_code)]
#![warn(rust_2018_idioms, missing_debug_implementations)]

#[cfg(not(feature = "std"))]
extern crate alloc;

#[cfg(not(feature = "std"))]
use alloc::vec;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use core::mem;
pub use pallet::*;
use sp_std::vec;
use sp_std::vec::Vec;
use subspace_core_primitives::{crypto, Blake3Hash};

pub mod feed_processor;
Expand All @@ -38,7 +43,6 @@ mod pallet {
use frame_system::pallet_prelude::*;
use sp_runtime::traits::{CheckedAdd, Hash, One, StaticLookup};
use sp_runtime::ArithmeticError;
use sp_std::prelude::*;

#[pallet::config]
pub trait Config: frame_system::Config {
Expand Down Expand Up @@ -119,7 +123,7 @@ mod pallet {

/// `pallet-feeds` events
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pallet::generate_deposit(pub (super) fn deposit_event)]
pub enum Event<T: Config> {
/// New object was added.
ObjectSubmitted {
Expand Down
6 changes: 5 additions & 1 deletion crates/pallet-grandpa-finality-verifier/src/chain.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#[cfg(not(feature = "std"))]
extern crate alloc;

use crate::grandpa::GrandpaJustification;
use crate::{Config, EncodedBlockHash, EncodedBlockNumber, Error};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::Decode;
use frame_support::Parameter;
use num_traits::AsPrimitive;
Expand All @@ -10,7 +15,6 @@ use sp_runtime::traits::{
};
use sp_std::hash::Hash;
use sp_std::str::FromStr;
use sp_std::vec::Vec;

pub(crate) type OpaqueExtrinsic = Vec<u8>;
pub type SignedBlock<Header> = generic::SignedBlock<generic::Block<Header, OpaqueExtrinsic>>;
Expand Down
6 changes: 5 additions & 1 deletion crates/pallet-grandpa-finality-verifier/src/grandpa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(not(feature = "std"))]
extern crate alloc;

// GRANDPA verification is mostly taken from Parity's bridges https://github.com/paritytech/parity-bridges-common/tree/master/primitives/header-chain
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Decode, Encode};
use finality_grandpa::voter_set::VoterSet;
use scale_info::TypeInfo;
Expand All @@ -26,7 +31,6 @@ use sp_runtime::traits::Header as HeaderT;
use sp_std::collections::btree_map::BTreeMap;
use sp_std::collections::btree_set::BTreeSet;
use sp_std::prelude::*;
use sp_std::vec::Vec;

/// A GRANDPA Justification is a proof that a given header was finalized
/// at a certain height and with a certain set of authorities.
Expand Down
9 changes: 6 additions & 3 deletions crates/pallet-grandpa-finality-verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@
#![cfg_attr(not(feature = "std"), no_std)]

mod grandpa;

pub mod chain;
mod grandpa;
#[cfg(test)]
mod tests;

#[cfg(not(feature = "std"))]
extern crate alloc;

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use codec::{Decode, Encode};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_consensus_grandpa::SetId;
use sp_std::fmt::Debug;
use sp_std::vec::Vec;

// Re-export in crate namespace for `construct_runtime!`
pub use pallet::*;
Expand Down
Loading

0 comments on commit d7b5a8b

Please sign in to comment.