Skip to content

Regression tests for PC -> BC authorize_account scenarios#497

Open
x3c41a wants to merge 8 commits into
mainfrom
ndk/test-pc-authorize-account-490
Open

Regression tests for PC -> BC authorize_account scenarios#497
x3c41a wants to merge 8 commits into
mainfrom
ndk/test-pc-authorize-account-490

Conversation

@x3c41a
Copy link
Copy Markdown
Contributor

@x3c41a x3c41a commented May 6, 2026

People Chain sends an XCM Transact(authorize_account) to Bulletin Chain to grant a user a storage allowance. Bulletin Chain had no tests for this path. So a change to the pallet, the XCM config, or the call filters could break it without anyone noticing.

Adds 14 tests that send those messages from a simulated People Chain and check what happens on Bulletin Chain. Each scenario lives in its own file under runtimes/bulletin-paseo/tests/pc_xcm_integration/:

authorize_semantics.rs

  • one user, single grant from People Chain, fresh state
  • two users' allowances on Bulletin Chain are independent
  • two grants from People Chain in one period add up on Bulletin Chain; expiry stays where it was
  • after expiry, the next grant resets the counters on Bulletin Chain and replaces the limits

origin_rejections.rs

  • a relay chain origin, an OriginKind::SovereignAccount from People Chain, and a random local origin all fail to authorize on Bulletin Chain
  • bytes: 0 is rejected on Bulletin Chain

safe_call_filter.rs

  • Bulletin Chain's SafeCallFilter blocks store over XCM, including inside Utility::batch; a batch of only authorize_account calls still goes through

refresh.rs

  • refresh_account_authorization from People Chain only extends expiry on Bulletin Chain; allowances and consumed counters do not change
  • refresh_account_authorization fails on Bulletin Chain without a prior authorize

end_to_end.rs

  • People Chain calls authorize_account, then the user submits a signed store on Bulletin Chain, then a signed renew

Closes #490

Drives XcmExecutor::prepare_and_execute with messages shaped the way
People Chain sends them (sibling parachain origin, OriginKind::Xcm,
unpaid execution + Transact). Covers:

- additive allowances within an unexpired window vs replace-after-expiry
- origin/barrier rejections (relay chain, OriginKind::SovereignAccount,
  random local origin)
- SafeCallFilter (store blocked, batch with store entirely blocked, batch
  of authorize calls allowed)
- bad inputs (bytes: 0)
- refresh_account_authorization extends only expiration; fails without prior
- end-to-end: PC authorize -> signed store -> signed renew
- sibling sovereign account does not gain authorization as a side effect

Closes #490
@x3c41a x3c41a changed the title tests: PC -> BC authorize_account integration scenarios Regression tests for PC -> BC authorize_account scenarios May 6, 2026
@x3c41a x3c41a requested review from bkontur and franciscoaguirre May 6, 2026 12:23
@bkontur
Copy link
Copy Markdown
Collaborator

bkontur commented May 6, 2026

just an idea, it would be cool to extract most relevant to the bulletin-pallets-common as a conformance tests and just reuse for Fellows or between runtimes, but can be done later for sure

@x3c41a
Copy link
Copy Markdown
Contributor Author

x3c41a commented May 7, 2026

just an idea, it would be cool to extract most relevant to the bulletin-pallets-common as a conformance tests and just reuse for Fellows or between runtimes, but can be done later for sure

added in #501 @bkontur

Copy link
Copy Markdown
Contributor

@franciscoaguirre franciscoaguirre left a comment

Choose a reason for hiding this comment

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

Please go through the comments and make sure someone reading this code months from now will be able to understand them. Don't leave unnecessary comments that say the same thing the code is saying. Prefer comments saying WHY than HOW. Also handle the result from xcm execution

Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
Comment thread runtimes/bulletin-paseo/tests/tests.rs Outdated
x3c41a added 4 commits May 8, 2026 19:15
- Move pc_xcm_integration to its own file
- Extract shared helpers into tests/common/mod.rs
- Make execute_from return Result<(), InstructionError> via ensure_complete
- Use submodules instead of comment dividers (origin_rejections,
  safe_call_filter, authorize_semantics, refresh, end_to_end)
- Strip 'Scenario N' prefixes and unnecessary comments
- Drop the sibling-sovereign side-effect test (no mechanism for it)
- Document the XCM Outcome::Complete + inner-dispatch-failure semantics
  on the origin/bad-input tests
The previous name described the implementation (two ok unwraps) instead
of the intent (assert that an extrinsic was both validly applied and
successfully dispatched). Renamed across both paseo and westend tests.
Each submodule now lives in its own file under tests/pc_xcm_integration/.
The parent file keeps the shared helpers and declares the submodules via
#[path] attributes (each tests/<name>.rs binary's submodule resolution
defaults to the same directory, so #[path] is needed to point at the
subdirectory).

- authorize_semantics.rs: happy path, additivity, replacement, scoping
- safe_call_filter.rs: store and batch-with-store filter
- origin_rejections.rs: relay/sovereign/local rejections, zero bytes
- refresh.rs: extends-only and missing-prior cases
- end_to_end.rs: PC authorize -> signed store -> signed renew
@x3c41a x3c41a requested a review from franciscoaguirre May 11, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Testing] Design excesive testing scenarios for PC -> BC authorize_account integration

3 participants