Skip to content

Commit

Permalink
Remove sudo from mainnet (#983)
Browse files Browse the repository at this point in the history
## Describe your changes

Removes sudo from mainnet
  • Loading branch information
Gauthamastro authored Aug 20, 2024
2 parents 2179466 + 7c9a579 commit a29298b
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 39 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

9 changes: 6 additions & 3 deletions check-all-ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

cargo fmt --check --features on-chain-release-build || exit
cargo fmt --check || exit
RUSTFLAGS="-D warnings" cargo build --features on-chain-release-build || exit
RUSTFLAGS="-D warnings" cargo build --features try-runtime || exit
cargo build --features runtime-benchmarks || exit
Expand All @@ -30,5 +30,8 @@ RUSTFLAGS="-D warnings" cargo test --workspace || exit
# https://forum.polkadot.network/t/polkadot-generic-ledger-app/4295/26
# https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/guides/enable_metadata_hash/index.html
# https://hackmd.io/@ePxWAFa1TbKm0U5Ym3IqgQ/rJdgmf6b0?utm_source=preview-mode&utm_medium=rec
# 0x0e63268eeeddda8e033ade1cc670411d3215fd81be44bdec564932d599d5aee8
# https://www.notion.so/polkadex/Listing-on-Polkadex-Orderbook-3e49fcf22d52474da86dfa65135615e9#b225838c59fa4820a61365e276fd4684
# 0xe7770f52f5d0ee108ded585ebe7c0d0b6ec65ea22739d7608d6c75c271dbdc3a - runtime upgrade preimage
# https://www.notion.so/polkadex/Listing-on-Polkadex-Orderbook-3e49fcf22d52474da86dfa65135615e9#b225838c59fa4820a61365e276fd4684
# https://wiki.polkadot.network/docs/learn/learn-governance
# https://substrate.stackexchange.com/questions/6423/fasttrack-proposal-execution-fails-with-proposalmissing-but-is-stored-in-democ

3 changes: 1 addition & 2 deletions nodes/mainnet/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use itertools::Itertools;
use node_polkadex_runtime::{
constants::currency::PDEX, wasm_binary_unwrap, BabeConfig, BalancesConfig, CouncilConfig,
IndicesConfig, OrmlVestingConfig, PDEXMigrationConfig, RuntimeGenesisConfig, SessionConfig,
SessionKeys, StakerStatus, StakingConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
SessionKeys, StakerStatus, StakingConfig, SystemConfig, TechnicalCommitteeConfig,
};
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use polkadex_primitives::Block;
Expand Down Expand Up @@ -482,7 +482,6 @@ pub fn testnet_genesis(
phantom: Default::default(),
},
democracy: Default::default(),
sudo: SudoConfig { key: Some(root_key) },
babe: BabeConfig {
authorities: Default::default(),
epoch_config: Some(node_polkadex_runtime::BABE_GENESIS_EPOCH_CONFIG),
Expand Down
11 changes: 1 addition & 10 deletions pallets/pdex-migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ frame-benchmarking = { workspace = true, default-features = false, optional = tr
frame-system = { workspace = true, default-features = false }

pallet-balances = { workspace = true, default-features = false }
pallet-sudo = { workspace = true, default-features = false }
sp-runtime = { workspace = true, default-features = false }

[dev-dependencies]
Expand All @@ -27,15 +26,7 @@ sp-io = { workspace = true }

[features]
default = ["std"]
std = [
"parity-scale-codec/std",
"scale-info/std",
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"pallet-sudo/std",
"sp-runtime/std",
]
std = ["parity-scale-codec/std", "scale-info/std", "frame-support/std", "frame-system/std", "pallet-balances/std", "sp-runtime/std"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
Expand Down
2 changes: 1 addition & 1 deletion pallets/pdex-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub mod pallet {
/// Configure the pallet by specifying the parameters and types on which it depends.
#[pallet::config]
/// Configure the pallet by specifying the parameters and types on which it depends.
pub trait Config: frame_system::Config + pallet_balances::Config + pallet_sudo::Config {
pub trait Config: frame_system::Config + pallet_balances::Config {
/// Because this pallet emits events, it depends on the runtime's definition of an
/// event.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
Expand Down
10 changes: 0 additions & 10 deletions pallets/pdex-migration/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type Balance = u128;
frame_support::construct_runtime!(
pub enum Test {
System: frame_system,
Sudo: pallet_sudo,
Balances: pallet_balances,
PDEXMigration: pdex_migration,
}
Expand Down Expand Up @@ -96,22 +95,13 @@ impl pdex_migration::Config for Test {
type MaxRelayers = MaxRelayers;
type LockPeriod = LockPeriod;
}
impl pallet_sudo::Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = ();
}

// Build genesis storage according to the mock Runtime.
pub fn new_test_ext() -> sp_io::TestExternalities {
let alice = 1u64;
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
pallet_balances::GenesisConfig::<Test>::default()
.assimilate_storage(&mut t)
.unwrap();
pallet_sudo::GenesisConfig::<Test> { key: Some(alice) }
.assimilate_storage(&mut t)
.unwrap();
pdex_migration::GenesisConfig::<Test>::default()
.assimilate_storage(&mut t)
.unwrap();
Expand Down
3 changes: 0 additions & 3 deletions runtimes/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pallet-session = { default-features = false, workspace = true }
pallet-staking = { default-features = false, workspace = true }
pallet-multisig = { default-features = false, workspace = true }
pallet-staking-reward-curve = { workspace = true }
pallet-sudo = { default-features = false, workspace = true }
pallet-utility = { default-features = false, workspace = true }
pallet-timestamp = { default-features = false, workspace = true }
pallet-transaction-payment = { default-features = false, workspace = true }
Expand Down Expand Up @@ -153,7 +152,6 @@ std = [
"pallet-session/std",
"pallet-staking/std",
"pallet-multisig/std",
"pallet-sudo/std",
"pallet-utility/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
Expand Down Expand Up @@ -257,7 +255,6 @@ try-runtime = [
"pallet-membership/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-treasury/try-runtime",
"pallet-sudo/try-runtime",
"pallet-im-online/try-runtime",
"pallet-authority-discovery/try-runtime",
"pallet-offences/try-runtime",
Expand Down
8 changes: 0 additions & 8 deletions runtimes/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,12 +1012,6 @@ impl pallet_democracy::Config for Runtime {
type Slash = Treasury;
}

impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = ();
}

parameter_types! {
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::MAX;
/// We prioritize im-online heartbeats over election solution submission.
Expand Down Expand Up @@ -1481,7 +1475,6 @@ construct_runtime!(
TechnicalMembership: pallet_membership::<Instance1> = 14,
Grandpa: pallet_grandpa = 15,
Treasury: pallet_treasury = 16,
Sudo: pallet_sudo = 17,
ImOnline: pallet_im_online = 18,
AuthorityDiscovery: pallet_authority_discovery = 19,
Offences: pallet_offences = 20,
Expand Down Expand Up @@ -1533,7 +1526,6 @@ construct_runtime!(
TechnicalMembership: pallet_membership::<Instance1> = 14,
Grandpa: pallet_grandpa = 15,
Treasury: pallet_treasury = 16,
Sudo: pallet_sudo = 17,
ImOnline: pallet_im_online = 18,
AuthorityDiscovery: pallet_authority_discovery = 19,
Offences: pallet_offences = 20,
Expand Down

0 comments on commit a29298b

Please sign in to comment.