Skip to content

fix: restore GelatoAutomation contract (#46)#122

Open
RonTuretzky wants to merge 2 commits into
RonTuretzky/104-zero-voterfrom
RonTuretzky/105-gelato
Open

fix: restore GelatoAutomation contract (#46)#122
RonTuretzky wants to merge 2 commits into
RonTuretzky/104-zero-voterfrom
RonTuretzky/105-gelato

Conversation

@RonTuretzky
Copy link
Copy Markdown
Contributor

Summary

  • Restore commented-out GelatoAutomation with full Gelato resolver pattern
  • Implement checker() and execute() with proper NatSpec
  • Add 6 BTT-named Gelato test functions to AutomationBase.t.sol
  • All 19 automation tests pass

Closes #46
Supersedes #105

Stack: PR 5 of 10 (0.0.2) — stacked on #121

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.sol with checker() + execute(bytes) entrypoints built on AbstractAutomation.
  • Add Gelato-focused tests to test/automation/AutomationBase.t.sol and 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);
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
execPayload = canExec ? getAutomationData() : new bytes(0);
execPayload = canExec ? abi.encodeCall(this.execute, ("")) : new bytes(0);

Copilot uses AI. Check for mistakes.
Comment on lines +145 to +153
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);
}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@RonTuretzky RonTuretzky force-pushed the RonTuretzky/104-zero-voter branch from c43ae09 to 4e3c4a2 Compare April 16, 2026 01:27
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.
@RonTuretzky RonTuretzky force-pushed the RonTuretzky/105-gelato branch from dd85570 to 57dbd1a Compare April 16, 2026 01:27
/// @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().
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Needs ref to gelato docs

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.

2 participants