Skip to content

Commit 2bb552b

Browse files
committed
Use Alice as sudo account, update signing key to Alice & Bob, remove signing_key_proof_of_ownership, and decrease challenge period/unlocking period/domain runtime upgrade delay
Signed-off-by: linning <linningde25@gmail.com>
1 parent eb871d1 commit 2bb552b

File tree

8 files changed

+33
-38
lines changed

8 files changed

+33
-38
lines changed

crates/pallet-domains/src/lib.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,18 +1348,12 @@ mod pallet {
13481348
domain_id: DomainId,
13491349
amount: BalanceOf<T>,
13501350
config: OperatorConfig<BalanceOf<T>>,
1351-
signing_key_proof_of_ownership: OperatorSignature,
13521351
) -> DispatchResult {
13531352
let owner = ensure_signed(origin)?;
13541353

1355-
let (operator_id, current_epoch_index) = do_register_operator::<T>(
1356-
owner,
1357-
domain_id,
1358-
amount,
1359-
config,
1360-
Some(signing_key_proof_of_ownership),
1361-
)
1362-
.map_err(Error::<T>::from)?;
1354+
let (operator_id, current_epoch_index) =
1355+
do_register_operator::<T>(owner, domain_id, amount, config, None)
1356+
.map_err(Error::<T>::from)?;
13631357

13641358
Self::deposit_event(Event::OperatorRegistered {
13651359
operator_id,

crates/pallet-domains/src/staking.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ pub(crate) mod tests {
14431443
domain_id,
14441444
operator_stake,
14451445
operator_config.clone(),
1446-
signature,
1446+
// signature,
14471447
);
14481448
assert_ok!(res);
14491449

@@ -1487,7 +1487,7 @@ pub(crate) mod tests {
14871487
domain_id,
14881488
Default::default(),
14891489
operator_config,
1490-
OperatorSignature::unchecked_from([1u8; 64]),
1490+
// OperatorSignature::unchecked_from([1u8; 64]),
14911491
);
14921492
assert_err!(
14931493
res,
@@ -1520,7 +1520,7 @@ pub(crate) mod tests {
15201520
domain_id,
15211521
Default::default(),
15221522
operator_config,
1523-
signature,
1523+
// signature,
15241524
);
15251525
assert_err!(
15261526
res,
@@ -1595,7 +1595,7 @@ pub(crate) mod tests {
15951595
domain_id,
15961596
operator_stake,
15971597
operator_config.clone(),
1598-
signature.clone(),
1598+
// signature.clone(),
15991599
);
16001600
assert_err!(
16011601
res,
@@ -1614,7 +1614,7 @@ pub(crate) mod tests {
16141614
domain_id,
16151615
operator_stake,
16161616
operator_config,
1617-
signature,
1617+
// signature,
16181618
);
16191619
assert_err!(
16201620
res,

crates/subspace-malicious-operator/src/malicious_bundle_producer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ where
360360
minimum_nominator_stake: Balance::MAX,
361361
nomination_tax: Default::default(),
362362
},
363-
signing_key_proof_of_ownership: signature,
363+
// signing_key_proof_of_ownership: signature,
364364
};
365365
self.submit_consensus_extrinsic(Some(nonce), call.into())
366366
}

crates/subspace-node/src/chain_spec.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ pub fn devnet_config_compiled() -> Result<GenericChainSpec, String> {
247247
properties
248248
})
249249
.with_genesis_config({
250-
let sudo_account =
251-
AccountId::from_ss58check("5CXTmJEusve5ixyJufqHThmy4qUrrm6FyLCR7QfE4bbyMTNC")
252-
.expect("Wrong root account address");
250+
let sudo_account = get_account_id_from_seed("Alice");
253251

254252
let mut balances = vec![(sudo_account.clone(), Balance::MAX / 2)];
255253
let vesting_schedules = TOKEN_GRANTS
@@ -314,10 +312,10 @@ pub fn devnet_config_compiled() -> Result<GenericChainSpec, String> {
314312
permissioned_action_allowed_by: PermissionedActionAllowedBy::Accounts(vec![
315313
sudo_account.clone(),
316314
]),
317-
genesis_domains: vec![auto_id_chain_spec::get_genesis_domain(
318-
SpecId::DevNet,
319-
sudo_account,
320-
)?],
315+
genesis_domains: vec![
316+
evm_chain_spec::get_genesis_domain(SpecId::DevNet, sudo_account.clone())?,
317+
auto_id_chain_spec::get_genesis_domain(SpecId::DevNet, sudo_account)?,
318+
],
321319
},
322320
CouncilDemocracyConfigParams::<BlockNumber>::fast_params(),
323321
)?)

crates/subspace-node/src/domain/auto_id_chain_spec.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ fn get_operator_params(
160160
},
161161
SpecId::DevNet => GenesisOperatorParams {
162162
operator_allow_list: OperatorAllowList::Anyone,
163-
operator_signing_key: OperatorPublicKey::unchecked_from(hex!(
164-
"18df97b9335e11f239f8f3f8041819d42f27b60845cf209416fdba8de15f4b7c"
165-
)),
163+
operator_signing_key: get_public_key_from_seed::<OperatorPublicKey>("Bob"),
166164
},
167165
}
168166
}

crates/subspace-node/src/domain/evm_chain_spec.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ pub fn get_testnet_endowed_accounts_by_spec_id(spec_id: SpecId) -> Vec<(MultiAcc
129129
.into_iter()
130130
.map(|acc| (AccountId20Converter::convert(acc), 1_000_000 * SSC))
131131
.collect(),
132-
SpecId::DevNet | SpecId::Gemini => vec![],
132+
SpecId::DevNet => {
133+
let alith_account = get_dev_accounts()[0].clone();
134+
vec![(
135+
AccountId20Converter::convert(alith_account),
136+
1_000_000 * SSC,
137+
)]
138+
}
139+
SpecId::Gemini => vec![],
133140
}
134141
}
135142

@@ -188,9 +195,7 @@ fn get_operator_params(
188195
},
189196
SpecId::DevNet => GenesisOperatorParams {
190197
operator_allow_list: OperatorAllowList::Anyone,
191-
operator_signing_key: OperatorPublicKey::unchecked_from(hex!(
192-
"aa3b05b4d649666723e099cf3bafc2f2c04160ebe0e16ddc82f72d6ed97c4b6b"
193-
)),
198+
operator_signing_key: get_public_key_from_seed::<OperatorPublicKey>("Alice"),
194199
},
195200
}
196201
}

crates/subspace-runtime/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ parameter_types! {
742742
pub const InitialDomainTxRange: u64 = INITIAL_DOMAIN_TX_RANGE;
743743
pub const DomainTxRangeAdjustmentInterval: u64 = TX_RANGE_ADJUSTMENT_INTERVAL_BLOCKS;
744744
/// Runtime upgrade is delayed for 1 day at 6 sec block time.
745-
pub const DomainRuntimeUpgradeDelay: BlockNumber = 14_400;
745+
pub const DomainRuntimeUpgradeDelay: BlockNumber = 100;
746746
/// Minimum operator stake to become an operator.
747747
// TODO: this value should be properly updated before mainnet
748748
pub const MinOperatorStake: Balance = 100 * SSC;
@@ -756,8 +756,8 @@ parameter_types! {
756756
pub const MaxBundlesPerBlock: u32 = 10;
757757
pub const DomainInstantiationDeposit: Balance = 100 * SSC;
758758
pub const MaxDomainNameLength: u32 = 32;
759-
pub const BlockTreePruningDepth: u32 = 14_400;
760-
pub const StakeWithdrawalLockingPeriod: DomainNumber = 14_400;
759+
pub const BlockTreePruningDepth: u32 = 100;
760+
pub const StakeWithdrawalLockingPeriod: DomainNumber = 100;
761761
// TODO: revisit these. For now epoch every 10 mins for a 6 second block and only 100 number of staking
762762
// operations allowed within each epoch.
763763
pub const StakeEpochDuration: DomainNumber = 100;

domains/client/domain-operator/src/tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4514,12 +4514,12 @@ async fn test_bad_receipt_chain() {
45144514
minimum_nominator_stake: Balance::MAX,
45154515
nomination_tax: Default::default(),
45164516
},
4517-
signing_key_proof_of_ownership: OperatorSignature::from(
4518-
OperatorSigningKeyProofOfOwnershipData {
4519-
operator_owner: Sr25519Alice.to_account_id(),
4520-
}
4521-
.using_encoded(|e| Sr25519Keyring::Charlie.sign(e)),
4522-
),
4517+
// signing_key_proof_of_ownership: OperatorSignature::from(
4518+
// OperatorSigningKeyProofOfOwnershipData {
4519+
// operator_owner: Sr25519Alice.to_account_id(),
4520+
// }
4521+
// .using_encoded(|e| Sr25519Keyring::Charlie.sign(e)),
4522+
// ),
45234523
})
45244524
.await
45254525
.unwrap();

0 commit comments

Comments
 (0)