Skip to content

test(pallet): add tests for challenges, checkpoints, replicas, events, and runtime API#146

Merged
mudigal merged 4 commits into
devfrom
test/pallet-coverage-improvement
Jun 10, 2026
Merged

test(pallet): add tests for challenges, checkpoints, replicas, events, and runtime API#146
mudigal merged 4 commits into
devfrom
test/pallet-coverage-improvement

Conversation

@mudigal

@mudigal mudigal commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

#144

Split from #139 (PR 2 of 4). Independent of the other PRs — pallet-only changes.

Add comprehensive test coverage for the storage-provider pallet:

  • Challenge tests: cost-split boundary conditions, offchain challenge flows
  • Checkpoint tests: scheduling, fallback, leader election, missed checkpoint handling
  • Misc tests: event emission, remove_slashed, multiaddr validation
  • Replica tests: full replica sync lifecycle
  • Runtime API tests: provider/bucket/agreement query coverage

PR stack

# PR Base Description
1 #145 dev Refactor + CI
2 This PR dev Pallet tests (independent)
3 test/provider-node-http-tests #145 HTTP integration tests
4 test/coordinator-and-fs-pallet-tests PR 3 Coordinator + FS tests

Test plan

  • cargo test -p pallet-storage-provider passes
  • No runtime or production code changes — pure test additions

…, and runtime API

Add comprehensive test coverage for the storage-provider pallet:

- Challenge tests: cost-split boundary conditions, offchain challenge flows
- Checkpoint tests: scheduling, fallback, leader election, missed checkpoint handling
- Miscellaneous: event emission, remove_slashed, multiaddr validation
- Replica tests: full replica sync lifecycle
- Runtime API tests: provider/bucket/agreement query coverage
- Add `run_to_block` warning comment in mock.rs

@ilchu ilchu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mostly nits and ergonomics here as well, but pretty much LGTM.

Comment thread pallet/src/mock.rs Outdated
Comment thread pallet/src/mock.rs Outdated
mudigal and others added 3 commits June 9, 2026 13:29
Address review feedback on PR #146:
- Include StorageProvider::on_finalize in run_to_block (guarded by
  block > 1 to skip genesis), matching real runtime behavior
- Remove respond_to_challenge_fails_expired test (unreachable scenario
  since on_finalize now auto-slashes expired challenges)
- Replace manual on_finalize(101) calls in 3 slash tests with
  run_to_block(102)
- Remove redundant #[allow(dead_code)] on mock helpers
…ech/web3-storage into test/pallet-coverage-improvement
@mudigal mudigal enabled auto-merge (squash) June 9, 2026 15:07
@mudigal mudigal merged commit 7b54653 into dev Jun 10, 2026
32 checks passed
@mudigal mudigal deleted the test/pallet-coverage-improvement branch June 10, 2026 04:58
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.

2 participants