Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
4a6d68d
update to 0.9.40
Ad96el May 5, 2023
fa6b054
no warnings. two errors
Ad96el May 5, 2023
8ddacc2
service file fix
Ad96el May 8, 2023
e649737
chore: finished v0.9.40
Ad96el May 8, 2023
c699de5
version 0.9.41
Ad96el May 9, 2023
d461d2e
intermediate state
Ad96el May 9, 2023
11983e8
compiling
Ad96el May 12, 2023
d0c6a86
With metadata runtime api
Ad96el May 16, 2023
b2f69ca
With metadata runtime api
Ad96el May 17, 2023
7337c8a
working tests
Ad96el May 17, 2023
771a420
first draft
Ad96el May 23, 2023
6986d47
merge develop into chore/polkadot-0.9.41
Ad96el May 23, 2023
601a580
first draft
Ad96el May 23, 2023
633beb2
fmt
Ad96el May 23, 2023
88a10cc
2 errors
Ad96el May 26, 2023
e2542e0
resolved merge conflicts
Ad96el May 26, 2023
3e1e296
merge develop into chore/polkadot-0.9.42
Ad96el May 26, 2023
b9e23a2
with working tests
Ad96el May 26, 2023
b47d04a
working and finished
Ad96el May 30, 2023
cfb846c
tests
Ad96el May 31, 2023
737f675
refactor
Ad96el May 31, 2023
9a565ed
refactor
Ad96el May 31, 2023
206a8da
refactor pallet-did-lookup
Ad96el May 31, 2023
4786f95
remove reservableCurrency
Ad96el May 31, 2023
f18bc38
update weights
Ad96el May 31, 2023
861b7c1
refactor files
Ad96el May 31, 2023
8d121e9
intermediate state
Ad96el Jun 1, 2023
5f67e2f
sharing is caring
Ad96el Jun 1, 2023
fa11d9d
improved HFidentifier plus comments
Ad96el Jun 1, 2023
8409c16
Quick fix
ntn-x2 Jun 1, 2023
2da9f8a
staking pallet failing
Ad96el Jun 1, 2023
fa6c821
working !
Ad96el Jun 1, 2023
ed9400e
migration for staking pallet
Ad96el Jun 1, 2023
c4fae0b
migration for staking pallet
Ad96el Jun 1, 2023
9ab1ffd
delegation
Ad96el Jun 1, 2023
df4c9e1
pre post function update
Ad96el Jun 1, 2023
de58a27
logic error
Ad96el Jun 2, 2023
e33a563
other migration approach for the staking pallet
Ad96el Jun 2, 2023
2ec1e5a
no errors
Ad96el Jun 2, 2023
eed3df0
renaming
Ad96el Jun 2, 2023
ccc25a7
fixed tests
Ad96el Jun 3, 2023
dd74a5b
remove not used function
Ad96el Jun 3, 2023
e912064
remove trait
Ad96el Jun 3, 2023
0e15d56
remove free_balance and reserved_balance
Ad96el Jun 3, 2023
d84796e
intermediate state
Ad96el Jun 12, 2023
fa21854
good intermediate state
Ad96el Jun 15, 2023
41365fe
get rid of HFIdentifier
Ad96el Jun 15, 2023
fc55e3b
clippy
Ad96el Jun 15, 2023
1dbd9c8
with ctypes
Ad96el Jun 19, 2023
3adc85c
finished
Ad96el Jun 19, 2023
93404ba
improved
Ad96el Jun 19, 2023
2291665
tests
Ad96el Jun 19, 2023
3fb0f48
inflation
Ad96el Jun 20, 2023
49dabb3
staking
Ad96el Jun 20, 2023
4eaab78
debug log
Ad96el Jun 20, 2023
eed5bd0
remove result
Ad96el Jun 20, 2023
a76654a
tests
Ad96el Jun 20, 2023
fc4b401
updated support without traits
Ad96el Jun 21, 2023
1bcf94f
unreserve does not return the unreserve balance
Ad96el Jun 21, 2023
9eb6c81
changed migration with storageversion
Ad96el Jun 21, 2023
d561bc1
Merge branch 'develop' into chore/polkadot-2.9.42
Ad96el Jun 21, 2023
10d9414
removed comments from cargo toml
Ad96el Jun 21, 2023
37bd50d
updated switch reserves to hold
Ad96el Jun 21, 2023
08d31e5
improved error message
Ad96el Jun 21, 2023
cd051b5
Make the attestation pallet compile
ntn-x2 Jun 22, 2023
39b82df
update StorageDepositCollector
Ad96el Jun 22, 2023
5abb95b
add comment for new xcm matcher
Ad96el Jun 22, 2023
88c48f0
remove unnecessary storage put line
Ad96el Jun 23, 2023
f46eb0c
improved log message for no migration
Ad96el Jun 23, 2023
65601c0
removed crate from migration
Ad96el Jun 23, 2023
bce5342
updated did lookup
Ad96el Jun 23, 2023
06dea88
no unwrap
Ad96el Jun 23, 2023
16a1263
refactor: renamed function has_user_holds
Ad96el Jun 23, 2023
1f612ed
moved staking id to migration file
Ad96el Jun 23, 2023
7576f90
replace ensure with assert
Ad96el Jun 23, 2023
cbc649d
remove ensure for assert
Ad96el Jun 23, 2023
ed0fc93
let trait handle all deposit actions
Ad96el Jun 26, 2023
2ae8611
use into instead of from
Ad96el Jun 26, 2023
fe07f7d
rename dust handler
Ad96el Jun 26, 2023
f1efce4
add error message
Ad96el Jun 26, 2023
a30a157
add treasury in feature
Ad96el Jun 26, 2023
0e50b28
remove unnecessary migration
Ad96el Jun 26, 2023
fb8f661
typo
Ad96el Jun 26, 2023
1993e94
benchmark
Ad96el Jun 26, 2023
e5966d6
updated weights for migration
Ad96el Jun 26, 2023
692ec43
remove crate from migration
Ad96el Jun 26, 2023
782c37d
updated weights for staking
Ad96el Jun 26, 2023
38982fa
refactor: change order in attestation
Ad96el Jul 3, 2023
7c49528
debug_assert for remaining balance
Ad96el Jul 3, 2023
ce5debe
updated post updates
Ad96el Jul 3, 2023
68aa397
improved free_deposit
Ad96el Jul 3, 2023
4f1d80c
remove artefact
Ad96el Jul 3, 2023
31d2d86
merge develop into chore/polkadot-0.9.42
Ad96el Jul 3, 2023
6520dc2
typos
Ad96el Jul 10, 2023
45a2be7
no unwrap
Ad96el Jul 10, 2023
e0edef0
freeze reason
Ad96el Jul 10, 2023
7201f7f
less ensure
Ad96el Jul 10, 2023
bbbd93e
update cargo toml
Ad96el Jul 10, 2023
f4a1479
update migration
Ad96el Jul 10, 2023
be9f2e5
update weights function
Ad96el Jul 10, 2023
f9b4fb7
revert: less ensure
Ad96el Jul 10, 2023
1de9ed9
other precision and preservation
Ad96el Jul 11, 2023
7ab63bb
merge develop into chore/polkadot-0.9.42
Ad96el Jul 11, 2023
faf9f53
license
Ad96el Jul 11, 2023
873b4fb
mod order
Ad96el Jul 11, 2023
b2fe45e
use ==
Ad96el Jul 11, 2023
bf1e429
Merge branch 'develop' into chore/polkadot-0.9.42
Ad96el Jul 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,236 changes: 754 additions & 482 deletions Cargo.lock

Large diffs are not rendered by default.

204 changes: 102 additions & 102 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nodes/parachain/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#![allow(clippy::derive_partial_eq_without_eq)]

use cumulus_primitives_core::ParaId;
use polkadot_primitives::v2::LOWEST_PUBLIC_ID;
use polkadot_primitives::v4::LOWEST_PUBLIC_ID;
use runtime_common::{AccountId, AccountPublic};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::Properties;
Expand Down
21 changes: 9 additions & 12 deletions nodes/parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use sc_network_sync::SyncingService;
use sc_service::{Configuration, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::ConstructRuntimeApi;
use sp_keystore::SyncCryptoStorePtr;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::BlakeTwo256;
use std::{sync::Arc, time::Duration};
use substrate_prometheus_endpoint::Registry;
Expand Down Expand Up @@ -146,12 +146,7 @@ where
})
.transpose()?;

let executor = sc_executor::NativeElseWasmExecutor::<Executor>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
config.runtime_cache_size,
);
let executor = sc_service::new_native_or_wasm_executor(config);

let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
Expand Down Expand Up @@ -278,7 +273,7 @@ where
Arc<dyn RelayChainInterface>,
Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi, Executor>>>,
Arc<SyncingService<Block>>,
SyncCryptoStorePtr,
KeystorePtr,
bool,
ParaId,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
Expand Down Expand Up @@ -342,7 +337,7 @@ where
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
config: parachain_config,
keystore: params.keystore_container.sync_keystore(),
keystore: params.keystore_container.keystore(),
backend: backend.clone(),
network: network.clone(),
system_rpc_tx,
Expand Down Expand Up @@ -383,8 +378,8 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service,
params.keystore_container.sync_keystore(),
sync_service.clone(),
params.keystore_container.keystore(),
force_authoring,
id,
)?;
Expand All @@ -397,6 +392,7 @@ where
client: client.clone(),
task_manager: &mut task_manager,
relay_chain_interface,
sync_service: sync_service.clone(),
spawner,
parachain_consensus,
import_queue: import_queue_service,
Expand All @@ -413,6 +409,7 @@ where
task_manager: &mut task_manager,
para_id: id,
relay_chain_interface,
sync_service,
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
Expand Down Expand Up @@ -523,7 +520,7 @@ fn build_consensus<RE, API>(
relay_chain_interface: Arc<dyn RelayChainInterface>,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient<API, RE>>>,
sync_oracle: Arc<SyncingService<Block>>,
keystore: SyncCryptoStorePtr,
keystore: KeystorePtr,
force_authoring: bool,
id: ParaId,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>
Expand Down
38 changes: 5 additions & 33 deletions nodes/standalone/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use sc_client_api::BlockBackend;
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
use sc_consensus_grandpa::SharedVoterState;
pub use sc_executor::NativeElseWasmExecutor;
use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sp_consensus_aura::ed25519::AuthorityPair as AuraPair;
Expand Down Expand Up @@ -65,10 +64,6 @@ type PartialComponents = sc_service::PartialComponents<
>;

pub fn new_partial(config: &Configuration) -> Result<PartialComponents, ServiceError> {
if config.keystore_remote.is_some() {
return Err(ServiceError::Other("Remote Keystores are not supported.".to_string()));
}

let telemetry = config
.telemetry_endpoints
.clone()
Expand All @@ -80,12 +75,7 @@ pub fn new_partial(config: &Configuration) -> Result<PartialComponents, ServiceE
})
.transpose()?;

let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
config.runtime_cache_size,
);
let executor = sc_service::new_native_or_wasm_executor(config);

let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
Expand Down Expand Up @@ -151,37 +141,19 @@ pub fn new_partial(config: &Configuration) -> Result<PartialComponents, ServiceE
})
}

fn remote_keystore(_url: &str) -> Result<Arc<LocalKeystore>, &'static str> {
// FIXME: here would the concrete keystore be built,
// must return a concrete type (NOT `LocalKeystore`) that
// implements `CryptoStore` and `SyncCryptoStore`
Err("Remote Keystore not supported.")
}

/// Builds a new service for a full client.
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let sc_service::PartialComponents {
client,
backend,
mut task_manager,
import_queue,
mut keystore_container,
keystore_container,
select_chain,
transaction_pool,
other: (block_import, grandpa_link, mut telemetry),
} = new_partial(&config)?;

if let Some(url) = &config.keystore_remote {
match remote_keystore(url) {
Ok(k) => keystore_container.set_remote_keystore(k),
Err(e) => {
return Err(ServiceError::Other(format!(
"Error hooking up remote keystore for {}: {}",
url, e
)))
}
};
}
let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name(
&client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"),
&config.chain_spec,
Expand Down Expand Up @@ -239,7 +211,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
network: network.clone(),
client: client.clone(),
sync_service: sync.clone(),
keystore: keystore_container.sync_keystore(),
keystore: keystore_container.keystore(),
task_manager: &mut task_manager,
transaction_pool: transaction_pool.clone(),
rpc_builder: rpc_extensions_builder,
Expand Down Expand Up @@ -279,7 +251,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
},
force_authoring,
backoff_authoring_blocks,
keystore: keystore_container.sync_keystore(),
keystore: keystore_container.keystore(),
sync_oracle: sync.clone(),
justification_sync_link: sync.clone(),
block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32),
Expand All @@ -299,7 +271,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore = if role.is_authority() {
Some(keystore_container.sync_keystore())
Some(keystore_container.keystore())
} else {
None
};
Expand Down
3 changes: 2 additions & 1 deletion pallets/attestation/src/attestations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// If you feel like getting in touch with us, you can do so at info@botlabs.org
use kilt_support::deposit::Deposit;

use kilt_support::Deposit;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;

Expand Down
27 changes: 14 additions & 13 deletions pallets/attestation/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// If you feel like getting in touch with us, you can do so at info@botlabs.org

use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite};
use frame_support::traits::{Currency, Get};
use frame_support::traits::{fungible::Mutate, Get};
use frame_system::RawOrigin;
use sp_runtime::traits::Hash;

Expand All @@ -34,7 +34,8 @@ benchmarks! {
T: core::fmt::Debug,
<T as Config>::EnsureOrigin: GenerateBenchmarkOrigin<T::RuntimeOrigin, T::AccountId, T::AttesterId>,
T: ctype::Config<CtypeCreatorId = T::AttesterId>,
T::BlockNumber: From<u64>
T::BlockNumber: From<u64>,
<T as Config>::Currency: Mutate<T::AccountId>
}

add {
Expand All @@ -47,7 +48,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::make_free_balance_be(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester.clone());
}: _<T::RuntimeOrigin>(origin, claim_hash, ctype_hash, None)
Expand All @@ -58,7 +59,7 @@ benchmarks! {
attester,
authorization_id: None,
revoked: false,
deposit: kilt_support::deposit::Deposit {
deposit: kilt_support::Deposit {
owner: sender,
amount: <T as Config>::Deposit::get(),
}
Expand All @@ -75,7 +76,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::make_free_balance_be(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester.clone());
Pallet::<T>::add(origin.clone(), claim_hash, ctype_hash, None)?;
Expand All @@ -87,7 +88,7 @@ benchmarks! {
attester,
authorization_id: None,
revoked: true,
deposit: kilt_support::deposit::Deposit {
deposit: kilt_support::Deposit {
owner: sender,
amount: <T as Config>::Deposit::get(),
}
Expand All @@ -104,7 +105,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::make_free_balance_be(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester.clone());
Pallet::<T>::add(origin, claim_hash, ctype_hash, None)?;
Expand All @@ -124,7 +125,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::make_free_balance_be(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester);
Pallet::<T>::add(origin, claim_hash, ctype_hash, None)?;
Expand All @@ -145,8 +146,8 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::make_free_balance_be(&deposit_owner_old, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::make_free_balance_be(&deposit_owner_new, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&deposit_owner_old, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&deposit_owner_new, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());

let origin = <T as Config>::EnsureOrigin::generate_origin(deposit_owner_old, attester.clone());
Pallet::<T>::add(origin, claim_hash, ctype_hash, None)?;
Expand All @@ -158,7 +159,7 @@ benchmarks! {
attester,
authorization_id: None,
revoked: false,
deposit: kilt_support::deposit::Deposit {
deposit: kilt_support::Deposit {
owner: deposit_owner_new,
amount: <T as Config>::Deposit::get(),
}
Expand All @@ -175,7 +176,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::make_free_balance_be(&deposit_owner, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&deposit_owner, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());

let origin = <T as Config>::EnsureOrigin::generate_origin(deposit_owner.clone(), attester.clone());
Pallet::<T>::add(origin, claim_hash, ctype_hash, None).expect("claim should be added");
Expand All @@ -188,7 +189,7 @@ benchmarks! {
attester,
authorization_id: None,
revoked: false,
deposit: kilt_support::deposit::Deposit {
deposit: kilt_support::Deposit {
owner: deposit_owner,
amount: <T as Config>::Deposit::get(),
}
Expand Down
Loading