Skip to content

Add CI checks for formatting, solhint, and tests#178

Merged
kbizikav merged 1 commit intomainfrom
chore/add-ci-checks
Mar 18, 2026
Merged

Add CI checks for formatting, solhint, and tests#178
kbizikav merged 1 commit intomainfrom
chore/add-ci-checks

Conversation

@Akira-Taniguchi
Copy link
Contributor

@Akira-Taniguchi Akira-Taniguchi commented Mar 18, 2026

Summary

  • add a GitHub Actions CI workflow that runs format, solhint, and hardhat test checks on pushes and pull requests targeting main
  • add check-mode npm scripts for Prettier and solhint so CI can validate without mutating files
  • exclude generated and local-only files from Prettier checks
  • fix the time-dependent Claim.getAllocationInfo test so the new test job passes reliably

CI Changes

  • add .github/workflows/ci.yml to run on pushes to main and pull requests targeting main
  • run npm ci, npm run format:check, npm run solhint:check, and npx hardhat test
  • add format:check using prettier --check
  • add solhint:check using solhint --max-warnings 0

Ignore / Scope Adjustments

  • keep contracts/verifiers/PlonkVerifier.sol out of format checks because it is generated
  • keep .claude/ and docs/index.md out of Prettier checks to avoid CI noise from local/generated files
  • preserve the existing local autofix flow by keeping format and solhint:fix for write-mode usage

Included Fix From #177

The branch also includes the Claim.getAllocationInfo test fix from #177 so the new CI test job is green on this PR.

Background

The failing claim test was asserting a fixed allocationPerPeriod value for period 0.

Claim initializes startTimestamp from the current block timestamp, and AllocationLib computes rewards from the elapsed days since GENESIS_TIMESTAMP. Because the reward schedule halves across phases, the expected allocation changes over time.

That made the test date-dependent: it passed when the fixed value matched the active reward phase, then started failing once the schedule moved to the next phase. The contract logic itself remained consistent with the allocation schedule.

Test Fix

  • derive the expected allocation from getAllocationConstants() instead of comparing against a stale literal
  • mirror the allocation-per-period calculation in the test helper so the expectation follows the contract's reward schedule
  • keep the production contract unchanged because the issue was in the test expectation, not in Claim or AllocationLib

Closes #175
Closes #174

Testing

  • npm run format:check
  • npm run solhint:check
  • npm test

@kbizikav kbizikav merged commit db2c90c into main Mar 18, 2026
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.

chore: add CI for solhint, format, and test bug: Claim.getAllocationInfo unit test failure

2 participants