Skip to content

fix(sdk): sync AppController ABI with deployed v1.5.1 (add containerPolicy)#167

Open
mcclurejt wants to merge 1 commit into
masterfrom
mcclurejt/fix/appcontroller-abi-sync
Open

fix(sdk): sync AppController ABI with deployed v1.5.1 (add containerPolicy)#167
mcclurejt wants to merge 1 commit into
masterfrom
mcclurejt/fix/appcontroller-abi-sync

Conversation

@mcclurejt

Copy link
Copy Markdown
Contributor

Problem

Every ecloud compute app deploy / upgrade against sepolia-dev failed at gas estimation with:

EstimateGasExecutionError: Execution reverted for an unknown reason.

Root cause

The bundled AppController.json ABI was stale relative to the deployed v1.5.1 contract. The on-chain Release struct gained a 4th field:

struct Release {
    IReleaseManagerTypes.Release rmsRelease;
    bytes publicEnv;
    bytes encryptedEnv;
    ContainerPolicy containerPolicy;   // ← added in v1.5.1, missing from CLI ABI
}

A function selector is keccak256 of its signature, so the extra struct field changes the selector:

Function CLI ABI (3-field) Deployed v1.5.1 (4-field)
upgradeApp 0xd80a956b 0xe71ad404
createApp 0xbe946ec5 0x5e92a19f
createAppWithIsolatedBilling 0xb7fe2169

The CLI encoded calls with the old selectors, the AppController dispatcher found no match, and the call reverted with empty return data — which viem renders as the "unknown reason" error above.

How it was confirmed

  • Forked Sepolia (anvil) and traced the call: revert at 255 gas with no sub-calls → a dispatcher miss, not a logic revert.
  • Scanned deployed bytecode for PUSH4 selectors: 0xd80a956b absent, 0xe71ad404 present.
  • Diffed the bundled ABI against the authoritative compiled v1.5.1 ABI (eigenx-contracts @ 3ecd745).

Fix

  • Replace the bundled ABI with the authoritative compiled v1.5.1 ABI. This also:
    • restores the missing pendingReleaseBlockNumber field in the AppConfig return tuple (a latent decode bug that broke getAppsByDeveloper/getAppsByCreator for any developer with a pending upgrade), and
    • adds the createEmptyApp / createEmptyAppWithIsolatedBilling / confirmUpgrade / getAppPendingReleaseBlockNumber / getBillingAccount entries.
  • Add a ContainerPolicy type and EMPTY_CONTAINER_POLICY constant; add containerPolicy to the Release type; set it at both Release construction sites (prepare.ts, prebuilt.ts) and pass it through the deploy + upgrade encoders (caller.ts).

containerPolicy is only emitted on the AppUpgraded/AppCreated release event and consumed off-chain — the AppController does not read it. An empty policy therefore preserves the CLI's existing behavior (no container arg/cmd/env overrides, no restart policy).

Verification

  • tsc --noEmit clean; SDK builds; prettier clean.
  • SDK tests pass (23/23). The 3 failing CLI src tests are pre-existing — reproduced on pristine master with these changes stashed.
  • End-to-end on real Sepolia (sepolia-dev): rebuilt the CLI, ran compute app upgrade. Gas estimation now succeeds (~0.001873 ETH), and the upgrade tx mines with status 1, emitting ReleasePublished (releaseId 7) + AppUpgraded.

Follow-up (not in this PR)

There is no ABI-sync mechanism — ABIs are hand-copied from the contracts repo, which is how this drift happened. Worth adding a make sync-abis that pulls from eigenx-contracts/out/ to prevent recurrence.

…olicy)

The bundled AppController ABI was stale relative to the deployed v1.5.1
contract. The on-chain `Release` struct gained a 4th field,
`ContainerPolicy containerPolicy`, but the CLI's ABI still described the
3-field struct. This shifted the computed function selector for
`upgradeApp`/`createApp`/`createAppWithIsolatedBilling` (e.g. upgradeApp
0xd80a956b vs deployed 0xe71ad404), so the AppController dispatcher found
no match and reverted with empty data — surfaced as
"EstimateGasExecutionError: execution reverted for an unknown reason"
during gas estimation. Every app deploy/upgrade was broken.

Fixes:
- Replace the bundled ABI with the authoritative compiled v1.5.1 ABI.
  This also restores the missing `pendingReleaseBlockNumber` field in the
  AppConfig return tuple (a latent decode bug in getApps*) and adds the
  createEmptyApp/confirmUpgrade/getBillingAccount entries.
- Add a ContainerPolicy type and EMPTY_CONTAINER_POLICY to the Release
  type, set at both Release construction sites, and pass it through the
  deploy + upgrade encoders. containerPolicy is only emitted on the
  release event and consumed off-chain, so an empty policy preserves the
  CLI's existing behavior.

Verified end-to-end against sepolia-dev: gas estimation now succeeds and
an upgrade tx mines with status 1, emitting ReleasePublished + AppUpgraded.
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