Skip to content

Conversation

@kaze-cow
Copy link
Collaborator

@kaze-cow kaze-cow commented Oct 27, 2025

Description

Make tool changes and formatting fixes to allow downstream PR's CI to pass.

Context

In detail:

  • Run forge fmt across codebase
  • Fix Solver.runBatch() to check call success (was a compiler warning)
  • Update foundry.toml optimize to optimizer (new name for new version)
  • Configure test workflow with proper RPC URL
  • Add pull request template

Testing Instructions

Confirm the CI is passing (verifies forge fmt was run as expected)
Confirm foundry changes make sense
Confirm Pull request template is the same as previous that it was copied from https://github.com/cowprotocol/token-lz/blob/main/.github/pull_request_template.md

@kaze-cow kaze-cow self-assigned this Oct 27, 2025
@claude
Copy link

claude bot commented Oct 27, 2025

Claude finished @kaze-cow's task —— View job


Code Review Summary

I've completed a comprehensive review of this PR focusing on code quality, security, performance, testing, and documentation.


Overview

This PR successfully combines formatting changes with critical infrastructure improvements to enable passing CI for downstream PRs. The changes are well-executed with only minor observations.

Key Changes Reviewed

✅ Formatting (Commit: 61051cd)

  • Clean forge fmt application across all Solidity files
  • Line length compliance (120 chars)
  • Consistent code style

✅ Bug Fix (test/helpers/CowBaseTest.sol:27-28)

  • Added error handling to Solver.runBatch()
  • Prevents silent call failures in test scenarios
  • Critical improvement for test reliability

✅ Configuration Updates

  • foundry.toml: Fixed optimizeoptimizer for newer Foundry versions
  • .github/workflows/test.yml: Pinned Foundry to v1.4.3 for reproducibility

✅ Documentation

  • Added PR template from cowprotocol/token-lz
  • Improves PR consistency and quality

Review Findings

Code Quality: ✅ Excellent

  • Clean formatting throughout
  • Proper error handling added
  • No code smells detected

Security: ✅ No Issues

  • The Solver contract is test-only infrastructure
  • Error handling improvement reduces risk of masked failures
  • No security vulnerabilities introduced

Performance: ✅ No Concerns

  • Formatting changes have no performance impact
  • Optimizer configuration properly set
  • Test infrastructure changes are appropriate

Testing: ⚠️ Minor Observation

  • Tests depend on FORK_RPC_URL environment variable
  • Current workflow uses secrets.RPC_URL_1
  • Ensure the secret exists and is properly configured

Documentation: ✅ Good

  • PR description clearly explains changes
  • PR template will improve future documentation

Recommendations

  1. Commit Message (Addressed in previous discussion): The current PR title/description now accurately reflects the mixed scope

  2. CI Secret Verification: Confirm secrets.RPC_URL_1 is configured in repository settings

  3. Optional Enhancement: Consider adding call index to the Solver error message for easier debugging:

    require(success, string.concat("Solver: call ", vm.toString(i), " failed"));

Final Assessment

Approval Recommendation:APPROVED

This PR is ready to merge. It achieves its stated goal of enabling passing CI for downstream PRs through:

  • Proper code formatting
  • Critical bug fix in test infrastructure
  • Updated build configuration
  • Improved developer experience

The changes are clean, well-scoped, and will improve the reliability of the test suite.


Comment on lines +27 to +28
(bool success,) = targets[i].call(datas[i]);
require(success, "Solver: call failed");
Copy link

Choose a reason for hiding this comment

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

Functional Change Detected ⚠️

This is not just a formatting change - it adds proper error handling to the call() function.

Before:

targets[i].call(datas[i]);

After:

(bool success,) = targets[i].call(datas[i]);
require(success, "Solver: call failed");

Impact:

  • Good change: Prevents silent failures in the batch execution
  • ⚠️ Process issue: Should be in a separate PR/commit from formatting changes

Suggestion: Either:

  1. Keep this change and update the PR description to mention the bug fix
  2. Revert this change and submit it in a dedicated bug fix PR

This fix is important for correctness, but mixing it with formatting changes makes it harder to review and track in git history.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@claude yep, that makes sense. This PR had a bit of a scope expansion as the purpose is mostly to ensure down stream PRs are able to have a passing CI. can you suggest a commit message/title that would be more appropriate with this in mind?

Copy link

@claude claude bot Oct 27, 2025

Choose a reason for hiding this comment

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

Claude finished @kaze-cow's task —— View job


Suggesting appropriate commit message and PR title

  • Review all changes in the PR to understand full scope
  • Suggest appropriate commit message and PR title options
  • Post final recommendations

Analysis

This PR contains two commits with different scopes:

  1. Commit 1 (61051cd): Pure formatting via forge fmt
  2. Commit 2 (6b12785): "foundry fixes" - includes:
    • Bug fix: Adding error handling to Solver.runBatch()
    • Formatting adjustments (line length compliance)
    • CI configuration updates (foundry.toml + workflow changes)

Recommendations

Since you have two separate commits, you have a couple of options:

Option A: Keep the two-commit structure (Recommended)

This is the cleanest approach and provides good git history:

Commit 1 (already good):

chore: `forge fmt`

Commit 2 - Rename from "foundry fixes" to:

fix: add error handling to Solver and configure CI

- Add require() check to Solver.runBatch() to catch call failures
- Update foundry.toml line length from 100 to 120
- Configure GitHub Actions to use correct RPC URL

This ensures downstream PRs can pass CI.

Option B: Single descriptive commit message

If you squash the commits, use:

chore: format code and fix CI configuration

- Run `forge fmt` across codebase
- Fix Solver.runBatch() to check call success
- Update foundry.toml line length to 120
- Configure test workflow with proper RPC URL

Enables passing CI for downstream PRs.

PR Title Update

Current: chore: forge fmt

Suggested:

chore: format code and fix CI for downstream PRs

or

chore: apply formatting and CI fixes

Why This Matters

The bug fix (adding require(success, "Solver: call failed")) is a functional change that improves test reliability, not just cosmetic formatting. Documenting it properly helps:

  • Future code reviewers understand the change
  • Git blame show the intention behind the fix
  • Downstream PR authors understand what changed

@kaze-cow kaze-cow changed the title chore: forge fmt chore: format code and fix CI configuration Oct 27, 2025
out = "out"
libs = ["lib"]
optimize = true
optimizer = true
Copy link

Choose a reason for hiding this comment

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

Configuration Update

Good catch updating optimize to optimizer. This is the correct configuration key for newer Foundry versions.

Verification Recommendation:
Consider verifying the optimizer is actually enabled by checking the compiled contract bytecode size or running:

forge build --sizes

This ensures the optimizer is working as expected after the configuration change.

function runBatch(address[] memory targets, bytes[] memory datas) external {
for (uint256 i = 0; i < targets.length; i++) {
targets[i].call(datas[i]);
(bool success,) = targets[i].call(datas[i]);
Copy link

Choose a reason for hiding this comment

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

Critical Bug Fix

Excellent improvement adding proper error handling! This fixes a silent failure bug.

Before: Call failures were silently ignored
After: Call failures now revert with a descriptive error message

Why this matters:

  1. Debugging: Failed calls will now provide clear error messages
  2. Test reliability: Tests will catch solver execution failures instead of passing silently
  3. Production safety: In a real solver scenario, you'd want to know immediately if any call fails

Minor Suggestion:
Consider adding which call index failed for better debugging:

require(success, string.concat("Solver: call ", vm.toString(i), " failed"));

This would make it easier to identify which specific call in the batch failed when multiple calls are involved.

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.4.3
Copy link

Choose a reason for hiding this comment

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

Foundry Version Pinning

Good practice pinning the Foundry version to v1.4.3. This ensures:

  • Reproducible builds: CI will use the same version consistently
  • Compatibility: Matches the optimizer config change in foundry.toml
  • Stability: Prevents unexpected breaks from new Foundry releases

Note: Remember to periodically update this version to benefit from bug fixes and new features. Consider adding a comment in the file noting why this specific version was chosen.

Provide clear, step-by-step instructions for verifying this change locally.
Assume the reviewer has no prior context about your setup.

This section reinforces the scope of the PR by outlining what should be tested and what the expected outcomes are.
Copy link

Choose a reason for hiding this comment

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

PR Template Addition

Good addition of a PR template to standardize pull request descriptions. The template includes all essential sections:

  • Description (what & why)
  • Context (background & motivation)
  • Out of Scope (prevents scope creep)
  • Testing Instructions (verification steps)

Verification Status:
✅ Template structure matches the source from cowprotocol/token-lz
✅ Content is well-organized and clear
✅ Encourages thorough PR descriptions

This will help maintain consistent PR quality across the repository.

@kaze-cow kaze-cow requested a review from a team October 27, 2025 08:17
// SPDX-License-Identifier: UNLICENSED
// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.8.0. SEE SOURCE BELOW. !!
pragma solidity ^0.8;
pragma experimental ABIEncoderV2;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note: this file is actually removed in subsequent PRs, so dont dig too deep in this

@carlos-cow carlos-cow merged commit 5103d02 into master Nov 4, 2025
17 checks passed
@carlos-cow carlos-cow deleted the chore/fmt-master branch November 4, 2025 21:38
@kaze-cow kaze-cow restored the chore/fmt-master branch November 9, 2025 18:27
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.

3 participants