ChainSafe / ChainSafe/forest

Add test coverage for StateMinerCreationDeposit network activation and calculation

Open
#7,503 3 comments 0 reactions 1 assignee Claimed by @0xDevNinja View on GitHub
Type: Task
Dominant language
Rust
Stars
697
Forks
200
Avg merge
1d 5h
Merged PRs (30d)
65

Description

## Summary

Add focused test coverage for `Filecoin.StateMinerCreationDeposit` and the related initial-pledge refactoring.

## Rationale

The RPC calculation is required for Curio miner integration. Existing API parity and snapshot tests verify the RPC wiring. Add deterministic calculation tests to verify network-version activation and network-specific behavior.

## Affected areas

- `src/rpc/methods/state.rs`
- RPC/API comparison tests in `src/tool/subcommands/api_cmd/`
- Test fixtures or vectors used by builtin-actors or Lotus, if compatible and available

## Required work

- Add tests for the pre-V27 behavior, where `Filecoin.StateMinerCreationDeposit` returns zero.
- Add tests at and after the V27 activation epoch.
- Cover mainnet and calibnet network configuration and their applicable activation epochs.
- Verify the creation-deposit result derives from one-tenth of minimum consensus power.
- Prefer authoritative vectors or fixtures from Lotus or builtin-actors when they can be imported or reproduced without changing production behavior.
- Keep the current API parity and snapshot tests. Add unit or integration tests that validate calculation inputs and outputs directly.

## Acceptance criteria

- The test suite covers pre-activation, activation-boundary, and post-activation cases.
- The suite covers both mainnet and calibnet configuration paths.
- Expected token amounts are asserted from deterministic fixtures or authoritative vectors.
- If Lotus or builtin-actors vectors cannot be used, document the reason in the test or issue discussion and use equivalent deterministic fixtures.

## Backlinks

- Originating PR: https://github.com/ChainSafe/forest/pull/7495
- Requesting comment: https://github.com/ChainSafe/forest/pull/7495#issuecomment-5329314817
- Requested by: @LesnyRumcajs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.