fix: restore GelatoAutomation contract (#46)#122
Conversation
There was a problem hiding this comment.
Pull request overview
Restores the GelatoAutomation provider implementation alongside the existing Chainlink automation flow, and expands the automation test suite to cover Gelato-style resolver/execution behavior.
Changes:
- Re-introduce
src/implementation/automation/GelatoAutomation.solwithchecker()+execute(bytes)entrypoints built onAbstractAutomation. - Add Gelato-focused tests to
test/automation/AutomationBase.t.soland update the test tree snapshot. - Validate basic readiness gating, execution behavior, and revert behavior in the automation layer.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/implementation/automation/GelatoAutomation.sol | Restores Gelato automation contract with checker() and execute() wired to AbstractAutomation. |
| test/automation/AutomationBase.t.sol | Adds Gelato checker/execute test cases alongside existing Chainlink automation tests. |
| test/automation/AutomationBase.tree | Updates the test outline to include new Gelato sections/tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// @return execPayload The calldata to execute | ||
| function checker() external view returns (bool canExec, bytes memory execPayload) { | ||
| canExec = isDistributionReady(); | ||
| execPayload = canExec ? getAutomationData() : new bytes(0); |
There was a problem hiding this comment.
checker() returns getAutomationData(), which (via AbstractAutomation) encodes a call to executeDistribution(). At the same time this contract introduces a Gelato-specific execute(bytes) entrypoint. This creates two possible execution entrypoints for Gelato (and the returned payload won’t call execute(bytes)), which is confusing for integrators and makes it easy to configure a Gelato task incorrectly. Consider either (a) overriding getAutomationData() / building execPayload to encode execute(bytes) (e.g., execute("")) so the resolver and executor entrypoint are consistent, or (b) removing execute(bytes) and documenting that Gelato should call executeDistribution() directly.
| execPayload = canExec ? getAutomationData() : new bytes(0); | |
| execPayload = canExec ? abi.encodeCall(this.execute, ("")) : new bytes(0); |
| function test_WhenCheckingGelatoChecker_ShouldReturnTrueWhenReady() public { | ||
| // Advance blocks | ||
| vm.roll(block.number + 101); | ||
|
|
||
| // Now should be ready | ||
| (bool canExec, bytes memory execPayload) = gelatoAutomation.checker(); | ||
| assertTrue(canExec); | ||
| assertGt(execPayload.length, 0); | ||
| } |
There was a problem hiding this comment.
The Gelato tests only assert execPayload.length > 0 and then call gelatoAutomation.execute("") directly. If Gelato is configured to use the resolver payload as the actual calldata to call (typical execCall(calldata) flow), these tests won’t catch an incorrect selector/encoding in execPayload. It would be stronger to assert execPayload equals the expected encoding (currently executeDistribution() via getAutomationData()) and to actually execute the returned payload via a low-level call to address(gelatoAutomation).call(execPayload) and assert it succeeds + emits the expected event.
c43ae09 to
4e3c4a2
Compare
Uncomment and implement GelatoAutomation with Gelato resolver pattern: - checker() returns distribution readiness + encoded payload - execute() triggers distribution (no auth - DM enforces controls) Add 6 BTT-named test functions for Gelato automation coverage.
dd85570 to
57dbd1a
Compare
| /// @notice Gelato-compatible execution function | ||
| /// @dev Called by Gelato executors when checker returns true. | ||
| /// No auth guard is needed here — DistributionManager.claimAndDistribute() | ||
| /// enforces its own readiness checks via isDistributionReady(). |
There was a problem hiding this comment.
Needs ref to gelato docs
Summary
checker()andexecute()with proper NatSpecCloses #46
Supersedes #105
Stack: PR 5 of 10 (0.0.2) — stacked on #121