Skip to content

Conversation

@Dinonard
Copy link
Contributor

@Dinonard Dinonard commented Jul 16, 2025

Pull Request Summary

Introduces safe mode & tx pause support for Astar.

@Dinonard Dinonard added the runtime This PR/Issue is related to the topic “runtime”. label Jul 16, 2025
@Dinonard Dinonard marked this pull request as ready for review July 17, 2025 07:01
Copy link
Contributor

@ashutoshvarma ashutoshvarma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!
Do we want to add integration tests for it?

ipapandinas
ipapandinas previously approved these changes Jul 17, 2025
Copy link
Contributor

@ipapandinas ipapandinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for opening issue #1503

ashutoshvarma
ashutoshvarma previously approved these changes Jul 18, 2025
Copy link
Contributor

@ashutoshvarma ashutoshvarma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

| RuntimeCall::TechnicalCommittee(_)
| RuntimeCall::Sudo(_)
| RuntimeCall::Democracy(
pallet_democracy::Call::external_propose_majority { .. }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need vote?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've thought about that but decided to exclude it since it's not a privileged action.

In a recent exploit scenario, the problematic account could have voted to put funds into locked state, which would be problematic for us. This is why it's blocked.

Rest of the whitelisted calls are all privileged ones, that require collective agreement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ermalkaleci I've allowed Vote and added a comprehensive integration test to demonstrate the full flow of how recovery would go.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dinonard we may want to allow proxy as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dinonard do we need to allow oracle?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preimage as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multisig?

Copy link
Contributor Author

@Dinonard Dinonard Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For preimage, sure, makes sense if we want to run referendum.
Multisig can also be alloed, since the embedded calls will be filtered again.

For oracle, I'm not sure.
We can allow them, but keep the option to block those calls using tx-pause I guess.

EDIT: added, thanks for the suggestion

@Dinonard
Copy link
Contributor Author

/bench astar

@github-actions
Copy link

Benchmark job failed.
Please check https://github.com/AstarNetwork/Astar/actions/runs/16436860112.

@Dinonard
Copy link
Contributor Author

/bench astar pallet_inflation

@github-actions
Copy link

Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/16437771685.
Please wait for a while.
Branch: feat/safe-mode-tx-pause-astar
SHA: efd96e1

@github-actions
Copy link

Benchmarks have been finished.
You can download artifacts if exists https://github.com/AstarNetwork/Astar/actions/runs/16437771685.

PierreOssun
PierreOssun previously approved these changes Jul 22, 2025
Copy link
Contributor

@PierreOssun PierreOssun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

| b"Council"
| b"TechnicalCommittee"
| b"Sudo"
| b"TxPause"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, but wanted to add it here for completeness, irrelevant of the implementation details.

I could remove it.

Copy link
Contributor

@ipapandinas ipapandinas Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation, I don't have a strong opinion, we can keep it

)
| RuntimeCall::Proxy(_)
| RuntimeCall::TxPause(_)
| RuntimeCall::SafeMode(_) => true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// Now use main council to extend safe mode
let safe_mode_extend_call = RuntimeCall::SafeMode(pallet_safe_mode::Call::force_extend {});
propose_vote_and_close!(Council, safe_mode_extend_call, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to check the correct extension against the configuration param? This can be done by reading enteredUntil storage value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to avoid checking pallet's implementation details.
If duration doesn't properly work, it's not something for integration tests to discover IMO.

type RuntimeCall = RuntimeCall;
type PauseOrigin = EnsureRootOrHalfTechCommitteeOrTwoThirdCouncil;
type UnpauseOrigin = EnsureRootOrHalfTechCommitteeOrTwoThirdCouncil;
type WhitelistedCalls = TxPauseWhitelistedCalls;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I've added tx_pause into Shibuya, I didn't specified whitelisting on purpose, reference: #1388 (comment)

In fact, I've just removed the TxPauseWhitelistedCalls type and its Contains trait implementation. tx-pause is more granular, we should be able to pause any call in an emergency.

But I guess you're adding it now on purpose to avoid being stuck?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked this, but thanks for the reminder.

I've added it since Pierre commented it, and avoiding being stuck just came as an extra reason later.

ipapandinas
ipapandinas previously approved these changes Jul 22, 2025
Copy link
Contributor

@ipapandinas ipapandinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Dinonard
Copy link
Contributor Author

@ermalkaleci @ashutoshvarma can you please also check & think about more possible problematic scenarios?

@Dinonard Dinonard dismissed stale reviews from ipapandinas and PierreOssun via 3896ab0 July 28, 2025 08:13
@github-actions
Copy link

Code Coverage

Package Line Rate Branch Rate Health
pallets/dapp-staking/src/benchmarking 95% 0%
pallets/dapp-staking/src/test 0% 0%
pallets/vesting-mbm/src 87% 0%
primitives/src 54% 0%
pallets/unified-accounts/src 79% 0%
precompiles/dapp-staking/src 89% 0%
pallets/astar-xcm-benchmarks/src 86% 0%
precompiles/dispatch-lockdrop/src 83% 0%
precompiles/sr25519/src 56% 0%
chain-extensions/unified-accounts/src 0% 0%
precompiles/unified-accounts/src 100% 0%
pallets/static-price-provider/src 91% 0%
pallets/xc-asset-config/src 62% 0%
pallets/astar-xcm-benchmarks/src/fungible 100% 0%
precompiles/xcm/src 69% 0%
chain-extensions/types/unified-accounts/src 0% 0%
pallets/ethereum-checked/src 76% 0%
chain-extensions/types/assets/src 0% 0%
pallets/dapp-staking/src 80% 0%
precompiles/dapp-staking/src/test 0% 0%
pallets/dynamic-evm-base-fee/src 85% 0%
pallets/astar-xcm-benchmarks/src/generic 100% 0%
pallets/inflation/src 84% 0%
precompiles/substrate-ecdsa/src 67% 0%
pallets/collator-selection/src 89% 0%
primitives/src/xcm 64% 0%
pallets/price-aggregator/src 75% 0%
pallets/collective-proxy/src 94% 0%
pallets/dapp-staking/rpc/runtime-api/src 0% 0%
pallets/democracy-mbm/src 30% 0%
chain-extensions/pallet-assets/src 54% 0%
precompiles/assets-erc20/src 77% 0%
Summary 74% (3791 / 5116) 0% (0 / 0)

Minimum allowed line rate is 50%

Copy link
Contributor

@ermalkaleci ermalkaleci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Dinonard
Copy link
Contributor Author

Merging it since I got approval from everyone, at least once 🙂

@Dinonard Dinonard merged commit 85bb686 into master Jul 28, 2025
7 of 8 checks passed
@Dinonard Dinonard deleted the feat/safe-mode-tx-pause-astar branch July 28, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

runtime This PR/Issue is related to the topic “runtime”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants