Skip to content

Fix CI (forge-std), refresh docs, enforce fmt, assert ERC20 returns - #9

Merged
oliv3rdrt merged 6 commits into
mainfrom
chore/refresh-docs-and-ci
Jul 13, 2026
Merged

Fix CI (forge-std), refresh docs, enforce fmt, assert ERC20 returns#9
oliv3rdrt merged 6 commits into
mainfrom
chore/refresh-docs-and-ci

Conversation

@oliv3rdrt

@oliv3rdrt oliv3rdrt commented Jul 13, 2026

Copy link
Copy Markdown
Owner

A batch of small improvements. Notably, CI had been failing on every run (including main): lib/ was gitignored and forge-std was vendored as untracked files, so CI had no forge-std and every forge build failed. This is now green.

fix: track forge-std as a submodule. Stop gitignoring lib/ and pin forge-std as a submodule at v1.16.1 (the version already in use, so gas and tests are unchanged). The existing submodules: recursive checkout now provides it, so CI builds for the first time.

docs: refresh the README. It still described three contracts and 13 tests; the repo now has seven contracts and 51 tests, and the invariant handler lives in test/VaultInvariant.t.sol (the referenced VaultHandler.sol never existed). Updated the intro, the contract table, and the handler note.

ci: enforce formatting. Added a forge fmt --check step and formatted the three files it flagged. The gas step stays informational (forge snapshot): fuzz-test gas depends on the fuzzer's random inputs, whose sequence differs across foundry versions, so --check can't be enforced reliably without also pinning the exact foundry version. The evm_version is now pinned explicitly.

test: assert ERC20 transfer return values. The success-path transfer/transferFrom calls in Token.t.sol ignored the returned bool (flagged by forge lint), leaving the documented returns (bool) behaviour untested. Wrapped those in assertTrue. The three vm.expectRevert calls are left as is, since a reverting call has no return value to check.

Verified locally and in CI: forge fmt --check clean, forge build OK, forge test 51 passed.

The README still described three contracts and 13 tests. The repo now has
seven contracts and 51 tests, and the invariant handler lives in
test/VaultInvariant.t.sol, not the VaultHandler.sol the README referenced.
Update the intro, the contract table and the handler note to match.
Add a 'forge fmt --check' step and format the sources it flagged, so style
stays consistent. Change the gas step from 'forge snapshot' (which just
regenerated the file and discarded it) to 'forge snapshot --check', so a gas
regression against the committed .gas-snapshot fails the build.
The Token transfer/transferFrom calls on the success paths ignored the bool
return value, which forge lint flags (erc20-unchecked-transfer) and which left
the documented 'returns (bool)' behaviour untested. Assert the return where the
call is expected to succeed. Regenerate the gas snapshot accordingly.
lib/ was gitignored and forge-std was vendored as plain (untracked) files, so
CI had no forge-std to build against and every run failed at 'forge build' with
'forge-std/Test.sol not found'. Track forge-std as a submodule pinned to v1.16.1
(the version already in use, so gas and tests are unchanged) and stop ignoring
lib/, so the existing 'submodules: recursive' checkout provides it.
The gas snapshot check failed in CI because fuzz-test gas depends on the random
inputs, which differ per run. Pin the fuzz seed and the evm version so the gas
figures are a deterministic function of the (already pinned) solc bytecode and
the inputs, which makes 'forge snapshot --check' stable across runs and CI.
Fuzz-test gas depends on the fuzzer's random inputs, and the input sequence for
a given seed differs across foundry versions, so 'forge snapshot --check' fails
in CI even with a pinned seed unless the exact foundry version is pinned too.
That is too brittle to be worth it here. Run 'forge snapshot' for a gas report
in the logs without failing the build, and drop the seed pin so the fuzzer
explores different inputs across runs again. The evm version stays pinned.
@oliv3rdrt oliv3rdrt changed the title Refresh docs, enforce CI formatting and gas baseline, assert ERC20 returns Fix CI (forge-std), refresh docs, enforce fmt, assert ERC20 returns Jul 13, 2026
@oliv3rdrt
oliv3rdrt merged commit ac9ee40 into main Jul 13, 2026
1 check passed
@oliv3rdrt
oliv3rdrt deleted the chore/refresh-docs-and-ci branch July 13, 2026 10:47
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.

1 participant