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

Integrate tx-pause and safe-mode pallets #1364

Open
5 tasks
Dinonard opened this issue Sep 17, 2024 · 4 comments
Open
5 tasks

Integrate tx-pause and safe-mode pallets #1364

Dinonard opened this issue Sep 17, 2024 · 4 comments
Labels
good first issue Good for newcomers project Issue is part of an ongoing project

Comments

@Dinonard
Copy link
Member

Dinonard commented Sep 17, 2024

Overview

This task involves the integration of tx-pause and safe-mode features for the Shibuya runtime (later deployment to Shiden and Astar).
These pallets enable fine-grained control over transaction execution and emergency maintenance functionalities, contributing to enhanced runtime stability and security.

Integration Steps

  • Install Dependencies
  • Add pallets to Shibuya runtime
  • Update frame_system BaseCallFilter
  • Define whitelisted calls for each pallet using dedicated structs
/// Calls that can bypass the tx-pause pallet.
/// We always allow system calls and timestamp since it is required for block production
pub struct TxPauseWhitelistedCalls;
impl Contains<pallet_tx_pause::RuntimeCallNameOf<Runtime>> for TxPauseWhitelistedCalls {
	fn contains(full_name: &pallet_tx_pause::RuntimeCallNameOf<Runtime>) -> bool {
		matches!(full_name.0.as_slice(), b"System" | b"Timestamp" | b"TxPause")
	}
}

/// Calls that can bypass the safe-mode pallet.
pub struct SafeModeWhitelistedCalls;
impl Contains<RuntimeCall> for SafeModeWhitelistedCalls {
	fn contains(call: &RuntimeCall) -> bool {
		match call {
			RuntimeCall::System(_) | RuntimeCall::SafeMode(_) | RuntimeCall::TxPause(_) => true,
			_ => false,
		}
	}
}
  • Configure origins (e.g. pub type EmergencyAuthority = EitherOfDiverse<MoreThanHalfCouncil, EnsureRootOrAllTechnicalCommittee>; )

Links

https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/safe-mode
https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/tx-pause

@Dinonard Dinonard added the project Issue is part of an ongoing project label Sep 17, 2024
@ipapandinas ipapandinas changed the title tx-pause & safe mode integration Integrate tx-pause and safe-mode pallets Oct 30, 2024
@ipapandinas ipapandinas added the good first issue Good for newcomers label Oct 30, 2024
@sylvaincormier
Copy link

Hi.
I was directed here from morekudos.com.
I think I have solved this issue or at least hopefully contributed to solving this issue.
Here is a diff since I cannot push my branch to your repository.
diff.txt
Please advise on next steps and or needed fixes. (There must be something missing)
Thank you

@ipapandinas
Copy link
Contributor

@sylvaincormier Thanks for your interest in contributing to this issue!

Could you please fork this repository and open a pull request from your fork main branch, including your suggested changes, to this repo main branch? This will allow me to start the review process 🙂

@sylvaincormier
Copy link

sylvaincormier commented Nov 7, 2024

HI I was not aware I had to do this:
Check list
added or updated unit tests
updated Astar official documentation
added OnRuntimeUpgrade hook for pthxrecompile revert code registration
added benchmarks & weights for any modified runtime logics.

Please cancel the request and I will do this
thx

@ipapandinas
Copy link
Contributor

this is a generic checklist, not all items are relevant, I'll mention missing ones in the PR review

@ipapandinas ipapandinas linked a pull request Nov 7, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers project Issue is part of an ongoing project
Projects
None yet
Development

No branches or pull requests

3 participants