Skip to content

Commit bde23f5

Browse files
authored
Merge branch 'develop' into dependabot/npm_and_yarn/scripts/cli/shelljs-0.8.5
2 parents 4e07c46 + f7a0781 commit bde23f5

File tree

22 files changed

+312
-743
lines changed

22 files changed

+312
-743
lines changed

Cargo.lock

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polymesh"
3-
version = "4.1.0"
3+
version = "4.1.1"
44
authors = ["Polymath"]
55
build = "build.rs"
66
edition = "2018"

pallets/bridge/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,11 @@ decl_module! {
415415
///
416416
/// ## Errors
417417
/// - `BadAdmin` if `origin` is not `Self::admin()` account.
418-
#[weight = (500_000_000, DispatchClass::Operational, Pays::Yes)]
418+
#[weight =(
419+
500_000_000 + 7_000_000 * u64::try_from(exempted.len()).unwrap_or_default(),
420+
DispatchClass::Operational,
421+
Pays::Yes
422+
)]
419423
pub fn change_bridge_exempted(origin, exempted: Vec<(IdentityId, bool)>) -> DispatchResult {
420424
Self::base_change_bridge_exempted(origin, exempted)
421425
}

pallets/relayer/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ decl_module! {
127127
/// - `AuthorizationError::Expired` if `auth_id` the authorization has expired.
128128
/// - `AuthorizationError::BadType` if `auth_id` was not a `AddRelayerPayingKey` authorization.
129129
/// - `NotAuthorizedForUserKey` if `origin` is not authorized to accept the authorization for the `user_key`.
130-
/// - `NotAuthorizedForPayingKey` if the authorization was created by a signer that isn't authorized by the `paying_key`.
130+
/// - `NotAuthorizedForPayingKey` if the authorization was created an identity different from the `paying_key`'s identity.
131131
/// - `UserKeyCddMissing` if the `user_key` is not attached to a CDD'd identity.
132132
/// - `PayingKeyCddMissing` if the `paying_key` is not attached to a CDD'd identity.
133133
/// - `UnauthorizedCaller` if `origin` is not authorized to call this extrinsic.
@@ -238,15 +238,18 @@ impl<T: Config> Module<T> {
238238
}
239239

240240
fn base_accept_paying_key(origin: T::Origin, auth_id: u64) -> DispatchResult {
241-
let user_key = ensure_signed(origin)?;
241+
let caller_key = ensure_signed(origin)?;
242242
let user_did =
243-
<Identity<T>>::get_identity(&user_key).ok_or(Error::<T>::UserKeyCddMissing)?;
244-
let signer = Signatory::Account(user_key);
243+
<Identity<T>>::get_identity(&caller_key).ok_or(Error::<T>::UserKeyCddMissing)?;
244+
let signer = Signatory::Account(caller_key.clone());
245245

246246
<Identity<T>>::accept_auth_with(&signer, auth_id, |data, auth_by| -> DispatchResult {
247247
let (user_key, paying_key, polyx_limit) =
248248
extract_auth!(data, AddRelayerPayingKey(user_key, paying_key, polyx_limit));
249249

250+
// Allow: `origin == user_key`.
251+
ensure!(user_key == caller_key, Error::<T>::NotAuthorizedForUserKey);
252+
250253
Self::auth_accept_paying_key(
251254
user_did,
252255
auth_by,

pallets/runtime/ci/src/fee_details.rs

Lines changed: 0 additions & 178 deletions
This file was deleted.

pallets/runtime/ci/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
33
#![recursion_limit = "256"]
44

5-
pub mod fee_details;
6-
pub mod runtime;
7-
pub use fee_details::CddHandler;
85
pub mod constants;
6+
pub mod runtime;
97
#[cfg(feature = "std")]
108
pub use pallet_staking::StakerStatus;
119

pallets/runtime/ci/src/runtime.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#![allow(clippy::not_unsafe_ptr_arg_deref)]
22

3-
use crate::{constants::time::*, fee_details::CddHandler};
3+
use crate::constants::time::*;
44
use codec::Encode;
55

66
#[cfg(feature = "migration-dry-run")]
77
use frame_support::traits::OnRuntimeUpgrade;
88

9+
use core::convert::TryFrom;
910
use frame_support::{
1011
construct_runtime, parameter_types,
1112
traits::{tokens::imbalance::SplitTwoWays, KeyOwnerProofSystem},
@@ -61,7 +62,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
6162
// and set impl_version to 0. If only runtime
6263
// implementation changes and behavior does not, then leave spec_version as
6364
// is and increment impl_version.
64-
spec_version: 3002,
65+
spec_version: 3010,
6566
impl_version: 0,
6667
apis: RUNTIME_API_VERSIONS,
6768
transaction_version: 2,
@@ -196,6 +197,18 @@ parameter_types! {
196197

197198
polymesh_runtime_common::misc_pallet_impls!();
198199

200+
type CddHandler = polymesh_runtime_common::fee_details::DevCddHandler<Runtime>;
201+
202+
impl<'a> TryFrom<&'a Call> for &'a pallet_test_utils::Call<Runtime> {
203+
type Error = ();
204+
fn try_from(call: &'a Call) -> Result<&'a pallet_test_utils::Call<Runtime>, ()> {
205+
match call {
206+
Call::TestUtils(x) => Ok(x),
207+
_ => Err(()),
208+
}
209+
}
210+
}
211+
199212
impl polymesh_common_utilities::traits::identity::Config for Runtime {
200213
type Event = Event;
201214
type Proposal = Call;

pallets/runtime/common/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ polymesh-primitives = { path = "../../../primitives", default-features = false }
1010

1111
pallet-asset = { path = "../../asset", default-features = false }
1212
pallet-balances = { path = "../../balances", default-features = false }
13+
pallet-bridge = { path = "../../bridge", default-features = false }
1314
pallet-committee = { path = "../../committee", default-features = false }
1415
pallet-compliance-manager = { path = "../../compliance-manager", default-features = false }
1516
#pallet-contracts = { version = "4.0.0-dev", default-features = false }
1617
pallet-identity = { path = "../../identity", default-features = false }
1718
pallet-multisig = { path = "../../multisig", default-features = false}
1819
pallet-portfolio = { path = "../../portfolio", default-features = false }
20+
pallet-relayer = { path = "../../relayer", default-features = false }
21+
pallet-test-utils = { path = "../../test-utils", default-features = false }
1922

2023
# RPC
2124
pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-features = false}

0 commit comments

Comments
 (0)