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

Mainnet: liberated runtime (drop sudo pallet) #4478

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 2 additions & 7 deletions .github/workflows/deploy-playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ on:
description: 'Scenario name to run after chain stats'
required: false
default: 'setupNewChainMultiStorage'
sudoSuri:
description: 'SURI of sudo account - must be different than treasury'
required: false
default: '//Alice'
treasurySuri:
description: 'SURI of treasury account - must be different than sudo'
description: 'SURI of treasury account'
required: false
default: '//Bob'
default: '//Alice'
initialBalances:
description: 'JSON string or http URL to override initial balances and vesting config'
default: ''
Expand Down Expand Up @@ -104,7 +100,6 @@ jobs:
stack_name=${{ env.STACK_NAME }} \
runtime_profile=${{ github.event.inputs.runtimeProfile }} \
ssh_pub_key='${{ github.event.inputs.sshPubKey }}' \
sudo_suri='${{ github.event.inputs.sudoSuri }}' \
treasury_suri='${{ github.event.inputs.treasurySuri }}' \
initial_balances='${{ github.event.inputs.initialBalances }}' \
init_chain_scenario='${{ github.event.inputs.chainSetupScenario }}'"
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/run-network-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
scenario: ['full', 'setupNewChain', 'setupNewChainMultiStorage', 'bonding', 'carthageNPoSSwitch']
scenario: ['full']
include:
- scenario: 'setupNewChain'
no_storage: 'true'
- scenario: 'setupNewChainMultiStorage'
- scenario: 'full'
no_storage: 'true'
steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 3 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ['Joystream contributors']
build = 'build.rs'
edition = '2018'
name = 'joystream-node'
version = '8.0.0'
version = '8.2.0'
default-run = "joystream-node"

[[bin]]
Expand Down
26 changes: 2 additions & 24 deletions bin/node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ use node_runtime::{
constants::currency::{DOLLARS, MIN_NOMINATOR_BOND, MIN_VALIDATOR_BOND},
wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, Block, ContentConfig,
ExistentialDeposit, GrandpaConfig, ImOnlineConfig, MaxNominations, ProjectTokenConfig,
SessionConfig, SessionKeys, StakerStatus, StakingConfig, StorageConfig, SudoConfig,
SystemConfig, TransactionPaymentConfig, VestingConfig,
SessionConfig, SessionKeys, StakerStatus, StakingConfig, StorageConfig, SystemConfig,
TransactionPaymentConfig, VestingConfig,
};
pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sc_chain_spec::ChainSpecExtension;
Expand Down Expand Up @@ -173,7 +173,6 @@ pub fn testnet_genesis(
AuthorityDiscoveryId,
)>,
initial_nominators: Vec<AccountId>,
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
mut genesis_balances: Vec<(AccountId, Balance)>,
vesting_accounts: Vec<(AccountId, BlockNumber, BlockNumber, Balance)>,
Expand Down Expand Up @@ -247,20 +246,6 @@ pub fn testnet_genesis(
genesis_balances.push((account.clone(), endowment));
}
});

if !funded.contains(&root_key) {
funded.push(root_key.clone());
genesis_balances.push((root_key.clone(), endowment));
}
}

// Make sure sudo is in initial balances sufficient funds
if !genesis_balances
.iter()
.cloned()
.any(|(account, _)| account == root_key)
{
println!("# WARNING - root_key is not assigned an initial balance");
}

// stakers: all validators and nominators.
Expand Down Expand Up @@ -327,9 +312,6 @@ pub fn testnet_genesis(
max_nominator_count: Some(20_000),
..Default::default()
},
sudo: SudoConfig {
key: Some(root_key),
},
babe: BabeConfig {
authorities: vec![],
epoch_config: Some(node_runtime::BABE_GENESIS_EPOCH_CONFIG),
Expand Down Expand Up @@ -361,7 +343,6 @@ fn development_config_genesis() -> GenesisConfig {
get_account_id_from_seed::<sr25519::Public>("//Bob"),
get_account_id_from_seed::<sr25519::Public>("//Charlie"),
],
get_account_id_from_seed::<sr25519::Public>("//Alice"),
development_endowed_accounts(),
vec![],
vec![],
Expand Down Expand Up @@ -395,7 +376,6 @@ fn local_testnet_genesis() -> GenesisConfig {
authority_keys_from_seed("//Bob"),
],
vec![],
get_account_id_from_seed::<sr25519::Public>("//Alice"),
development_endowed_accounts(),
vec![],
vec![],
Expand Down Expand Up @@ -426,7 +406,6 @@ fn prod_test_config_genesis() -> GenesisConfig {
true,
vec![authority_keys_from_seed("//Alice")],
vec![],
get_account_id_from_seed::<sr25519::Public>("//Alice"),
development_endowed_accounts(),
vec![],
vec![],
Expand Down Expand Up @@ -464,7 +443,6 @@ pub(crate) mod tests {
true,
vec![authority_keys_from_seed("//Alice")],
vec![],
get_account_id_from_seed::<sr25519::Public>("//Alice"),
development_endowed_accounts(),
vec![],
vec![],
Expand Down
2 changes: 1 addition & 1 deletion bin/utils/chain-spec-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ['Joystream contributors']
build = 'build.rs'
edition = '2018'
name = 'chain-spec-builder'
version = '8.0.0'
version = '8.2.0'

[dependencies]
enum-utils = "0.1.2"
Expand Down
53 changes: 9 additions & 44 deletions bin/utils/chain-spec-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ impl Into<ChainType> for ChainDeployment {
#[derive(Parser)]
#[clap(rename_all = "kebab-case")]
enum ChainSpecBuilder {
/// Create a new chain spec with the given authority seeds, endowed and sudo
/// accounts.
/// Create a new chain spec with the given authority seeds, and endowed accounts.
New {
/// Authorities. Comma separated list. If list has single item it is
/// considered a seed. The stash,controller and session keys will be derived from this seed.
Expand All @@ -80,9 +79,6 @@ enum ChainSpecBuilder {
/// authorities. Same account used as stash and controller.
#[clap(long, short)]
nominator_accounts: Vec<String>,
/// Sudo account address (SS58 format).
#[clap(long, short)]
sudo_account: String,
/// The path where the chain spec should be saved.
#[clap(long, short, default_value = "./chain_spec.json")]
chain_spec_path: PathBuf,
Expand All @@ -100,7 +96,7 @@ enum ChainSpecBuilder {
/// Deployment type: dev, local, staging, live
#[structopt(long, short, default_value = "live")]
deployment: String,
/// Endow authorities, nominators, and sudo account. Initial balances
/// Endow authorities, and nominators. Initial balances
/// overrides endowed amount.
#[structopt(long, short)]
fund_accounts: bool,
Expand Down Expand Up @@ -180,11 +176,11 @@ impl ChainSpecBuilder {
/// Returns wether to fund accounts or not
fn fund_accounts(&self) -> bool {
match self {
// Authorities, Nominators, Sudo Key and endowed accounts by default
// Authorities, Nominators, and endowed accounts by default
// will not be endowed, unless explicitly selected.
ChainSpecBuilder::New { fund_accounts, .. } => *fund_accounts,
// When generating new authorities, nominators, endowed account,
// and sudo_key we will always try to endow them.
// we will always try to endow them.
ChainSpecBuilder::Generate { .. } => true,
}
}
Expand Down Expand Up @@ -220,7 +216,6 @@ fn genesis_constructor(
)>,
nominator_accounts: &[AccountId],
endowed_accounts: &[AccountId],
sudo_account: &AccountId,
initial_balances_path: &Option<PathBuf>,
fund_accounts: bool,
) -> chain_spec::GenesisConfig {
Expand Down Expand Up @@ -253,7 +248,6 @@ fn genesis_constructor(
fund_accounts,
authorities,
nominator_accounts.to_vec(),
sudo_account.clone(),
endowed_accounts.to_vec(),
genesis_balances,
vesting_accounts,
Expand All @@ -269,7 +263,6 @@ fn generate_chain_spec(
authorities: Vec<String>,
nominator_accounts: Vec<String>,
endowed_accounts: Vec<String>,
sudo_account: String,
initial_balances_path: Option<PathBuf>,
fund_accounts: bool,
) -> Result<String, String> {
Expand Down Expand Up @@ -316,8 +309,6 @@ fn generate_chain_spec(
.map(parse_account)
.collect::<Result<Vec<_>, String>>()?;

let sudo_account = parse_account(sudo_account)?;

let telemetry_endpoints = Some(
TelemetryEndpoints::new(vec![(TELEMETRY_URL.to_string(), 0)])
.expect("Staging telemetry url is valid; qed"),
Expand All @@ -333,7 +324,6 @@ fn generate_chain_spec(
authorities.clone(),
&nominator_accounts,
&endowed_accounts,
&sudo_account,
&initial_balances_path,
fund_accounts,
)
Expand Down Expand Up @@ -379,12 +369,7 @@ fn generate_authority_keys_and_store(seeds: &[String], keystore_path: &Path) ->
Ok(())
}

fn print_seeds(
authority_seeds: &[String],
nominator_seeds: &[String],
endowed_seeds: &[String],
sudo_seed: &str,
) {
fn print_seeds(authority_seeds: &[String], nominator_seeds: &[String], endowed_seeds: &[String]) {
println!("# Authority seeds");

for (n, seed) in authority_seeds.iter().enumerate() {
Expand All @@ -410,10 +395,6 @@ fn print_seeds(

println!();
}

println!("# Sudo seed");
println!("sudo={}", sudo_seed);
println!();
}

#[async_std::main]
Expand All @@ -433,7 +414,7 @@ async fn main() -> Result<(), String> {
let deployment = builder.chain_deployment();
let fund_accounts = builder.fund_accounts();

let (authorities, nominator_accounts, endowed_accounts, sudo_account) = match builder {
let (authorities, nominator_accounts, endowed_accounts) = match builder {
ChainSpecBuilder::Generate {
authorities,
nominators,
Expand All @@ -454,17 +435,8 @@ async fn main() -> Result<(), String> {
let authority_seeds = (0..authorities).map(|_| rand_seed()).collect::<Vec<_>>();
let nominator_seeds = (0..nominators).map(|_| rand_seed()).collect::<Vec<_>>();
let endowed_seeds = (0..endowed).map(|_| rand_seed()).collect::<Vec<_>>();
let sudo_seed = rand_seed();

print_seeds(
&authority_seeds,
&nominator_seeds,
&endowed_seeds,
&sudo_seed,
);

let sudo_account =
chain_spec::get_account_id_from_seed::<sr25519::Public>(&sudo_seed).to_ss58check();
print_seeds(&authority_seeds, &nominator_seeds, &endowed_seeds);

if let Some(keystore_path) = keystore_path {
generate_authority_keys_and_store(&authority_seeds, &keystore_path)?;
Expand All @@ -484,17 +456,11 @@ async fn main() -> Result<(), String> {
})
.collect();

(
authority_seeds,
nominator_accounts,
endowed_accounts,
sudo_account,
)
(authority_seeds, nominator_accounts, endowed_accounts)
}
ChainSpecBuilder::New {
authorities,
nominator_accounts,
sudo_account,
keystore_path,
..
} => {
Expand All @@ -509,7 +475,7 @@ async fn main() -> Result<(), String> {
}
}

(authorities, nominator_accounts, vec![], sudo_account)
(authorities, nominator_accounts, vec![])
}
};

Expand All @@ -518,7 +484,6 @@ async fn main() -> Result<(), String> {
authorities,
nominator_accounts,
endowed_accounts,
sudo_account,
initial_balances_path,
fund_accounts,
)?;
Expand Down
2 changes: 1 addition & 1 deletion chain-metadata.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@apollo/client": "^3.3.13",
"@ffprobe-installer/ffprobe": "^1.4.1",
"@joystream/metadata-protobuf": "^2.5.0",
"@joystream/types": "^0.20.5",
"@joystream/types": "^0.20.6",
"@oclif/command": "^1.5.19",
"@oclif/config": "^1.14.0",
"@oclif/plugin-autocomplete": "^0.2.0",
Expand Down
1 change: 0 additions & 1 deletion devops/ansible/deploy-playground-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
INIT_CHAIN_SCENARIO: '{{ init_chain_scenario }}'
BALANCE_CREDIT: 1000000000000000
BALANCE_LOCKED: 1000000000000000
SUDO_ACCOUNT_URI: '{{ sudo_suri }}'
TREASURY_ACCOUNT_URI: '{{ treasury_suri }}'
INITIAL_BALANCES: '{{ initial_balances }}'
SKIP_NODE: 'true'
Expand Down
Loading