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

Update SDK to v1.5.0 #202

Merged
merged 13 commits into from
Apr 16, 2024
788 changes: 474 additions & 314 deletions Cargo.lock

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions Cargo.toml

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub fn new_partial(
executor,
backend,
genesis_block_builder,
false,
)?;
let client = Arc::new(client);

Expand Down Expand Up @@ -118,19 +119,19 @@ pub fn new_partial(

let slot_duration = sc_consensus_aura::slot_duration(&*client)?;

let import_queue =
sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(ImportQueueParams {
let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(
ImportQueueParams {
block_import: grandpa_block_import.clone(),
justification_import: Some(Box::new(grandpa_block_import.clone())),
client: client.clone(),
create_inherent_data_providers: move |_, ()| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();

let slot =
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
);
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*timestamp,
slot_duration,
);

Ok((slot, timestamp))
},
Expand All @@ -139,7 +140,8 @@ pub fn new_partial(
check_for_equivocation: Default::default(),
telemetry: telemetry.as_ref().map(|x| x.handle()),
compatibility_mode: Default::default(),
})?;
},
)?;

Ok(sc_service::PartialComponents {
client,
Expand Down Expand Up @@ -177,9 +179,9 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
&config.chain_spec,
);

net_config.add_notification_protocol(sc_consensus_grandpa::grandpa_peers_set_config(
grandpa_protocol_name.clone(),
));
let (grandpa_protocol_config, grandpa_notification_service) =
sc_consensus_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone());
net_config.add_notification_protocol(grandpa_protocol_config);

let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
Expand Down Expand Up @@ -324,6 +326,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
link: grandpa_link,
network,
sync: Arc::new(sync_service),
notification_service: grandpa_notification_service,
voting_rule: sc_consensus_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry,
shared_voter_state: SharedVoterState::empty(),
Expand Down
7 changes: 4 additions & 3 deletions parachain-node/src/dev_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use sc_consensus_manual_seal::consensus::aura::AuraConsensusDataProvider;
pub use sc_executor::NativeElseWasmExecutor;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sp_runtime::traits::Header as _;
use std::{sync::Arc, time::Duration};
use tuxedo_core::{genesis::TuxedoGenesisBlockBuilder, types::OpaqueBlock as Block};

Expand Down Expand Up @@ -75,6 +76,7 @@ pub fn new_partial(
executor,
backend,
genesis_block_builder,
false,
)?;
let client = Arc::new(client);

Expand Down Expand Up @@ -196,17 +198,16 @@ pub fn new_dev(config: Configuration) -> Result<TaskManager, ServiceError> {
.block;

let mocked_parachain = {
use sp_api::{BlockT, HeaderT};

MockValidationDataInherentDataProvider {
current_para_block: parent_block.header().number() + 1,
current_para_block: parent_block.header.number() + 1,
relay_offset: 1000,
relay_blocks_per_para_block: 2,
para_blocks_per_relay_epoch: 10,
relay_randomness_config: (),
xcm_config: Default::default(),
raw_downward_messages: Default::default(),
raw_horizontal_messages: Default::default(),
additional_key_values: None,
}
};

Expand Down
1 change: 1 addition & 0 deletions parachain-node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub fn new_partial(
executor,
backend,
genesis_block_builder,
false,
)?;
let client = Arc::new(client);

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.77"
components = [ "rustfmt", "clippy" ]
components = [ "rustfmt", "clippy", "rust-src" ]
profile = "minimal"
targets = [ "wasm32-unknown-unknown" ]
2 changes: 0 additions & 2 deletions tuxedo-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ aggregator = { path = "aggregator" }
derive-no-bound = { path = "no_bound" }

# Substrate
sp-api = { default_features = false, workspace = true }
sp-core = { default_features = false, workspace = true }
sp-debug-derive = { features = [ "force-debug" ], default_features = false, workspace = true }
sp-inherents = { default_features = false, workspace = true }
Expand Down Expand Up @@ -47,7 +46,6 @@ std = [
"sp-core/std",
"sp-std/std",
"serde/std",
"sp-api/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-io/std",
Expand Down
11 changes: 5 additions & 6 deletions tuxedo-core/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ use crate::{
};
use log::debug;
use parity_scale_codec::{Decode, Encode};
use sp_api::{BlockT, HashT, HeaderT, TransactionValidity};
use sp_core::H256;
use sp_inherents::{CheckInherentsResult, InherentData};
use sp_runtime::{
traits::{BlakeTwo256, Extrinsic},
traits::{BlakeTwo256, Block as BlockT, Extrinsic, Hash as HashT, Header as HeaderT},
transaction_validity::{
InvalidTransaction, TransactionLongevity, TransactionSource, TransactionValidityError,
ValidTransaction,
InvalidTransaction, TransactionLongevity, TransactionSource, TransactionValidity,
TransactionValidityError, ValidTransaction,
},
ApplyExtrinsicResult, StateVersion,
};
Expand Down Expand Up @@ -159,7 +158,7 @@ where
requires: missing_inputs,
provides,
priority: 0,
longevity: TransactionLongevity::max_value(),
longevity: TransactionLongevity::MAX,
propagate: true,
});
}
Expand All @@ -182,7 +181,7 @@ where
requires: Vec::new(),
provides,
priority: 0,
longevity: TransactionLongevity::max_value(),
longevity: TransactionLongevity::MAX,
propagate: true,
})
}
Expand Down
2 changes: 1 addition & 1 deletion tuxedo-core/src/genesis/config_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
ConstraintChecker, Verifier, EXTRINSIC_KEY, HEIGHT_KEY,
};
use parity_scale_codec::Encode;
use sp_api::HashT;
use sp_runtime::traits::Hash as HashT;
use sp_std::vec::Vec;

pub struct TuxedoGenesisConfigBuilder<V, C>(sp_std::marker::PhantomData<(V, C)>);
Expand Down
4 changes: 2 additions & 2 deletions tuxedo-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
use sp_core::H256;
use sp_runtime::traits::{BlakeTwo256, Extrinsic};
use sp_runtime::traits::{BlakeTwo256, Extrinsic, Hash as HashT};
use sp_std::vec::Vec;

// All Tuxedo chains use the same BlakeTwo256 hash.
pub type Hash = BlakeTwo256;
/// Opaque block hash type.
pub type OpaqueHash = <Hash as sp_api::HashT>::Output;
pub type OpaqueHash = <Hash as HashT>::Output;
/// All Tuxedo chains use the same u32 BlockNumber.
pub type BlockNumber = u32;
/// Because all tuxedo chains use the same Blocknumber and Hash types,
Expand Down
2 changes: 1 addition & 1 deletion tuxedo-parachain-core/src/validate_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use polkadot_parachain_primitives::primitives::{
};
use tuxedo_core::{
types::{Block, Header, Transaction},
ConstraintChecker, Executive, Verifier,
Executive, Verifier,
};

use parity_scale_codec::Encode;
Expand Down
1 change: 0 additions & 1 deletion wallet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod amoeba;
mod cli;
mod keystore;
mod money;
mod output_filter;
mod parachain;
mod rpc;
mod sync;
Expand Down
137 changes: 0 additions & 137 deletions wallet/src/output_filter.rs

This file was deleted.

4 changes: 2 additions & 2 deletions wardrobe/money/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ impl<const ID: u8> SimpleConstraintChecker for MoneyConstraintChecker<ID> {
// Priority is based on how many token are burned
// Type stuff is kinda ugly. Maybe division would be better?
let burned = total_input_value - total_output_value;
Ok(if burned < u64::max_value() as u128 {
Ok(if burned < u64::MAX as u128 {
burned as u64
} else {
u64::max_value()
u64::MAX
})
}
Self::Mint => {
Expand Down
Loading