fix: KEEP-456 route superfluid grant-flow-operator through CFAv1Forwarder#1167
Merged
Conversation
…rder
Routes the action via the canonical CFAv1Forwarder
(updateFlowOperatorPermissions(token, operator, perms, allowance)) instead
of the SuperToken's convenience proxy. The proxy depends on each SuperToken
implementation including a thin delegate into CFA; on Sepolia's stubbed
fUSDCx test token the proxy is missing entirely and even view methods
revert. Routing through the forwarder works for any registered SuperToken.
The previous on-chain test masked the bug: it tolerated any non-ABI revert
("expected when calling write ops from an unfunded test address"), so the
contract's silent revert read as a passing test. Strengthened to assert
positive simulation success against the forwarder.
Renames grant-flow-operator-quirky.json to grant-flow-operator.json -- the
routing was the quirk -- and updates the fixture's _protocolMeta to
cfaForwarder. Also drops the now-unused 3-arg updateFlowOperatorPermissions
from the SuperToken ABI and updates the unit-test ABI/slug counts.
- Action description: "manage your flows of this SuperToken" reads awkwardly now that token is a runtime input; reword to "of a SuperToken". - Lift TEST_OPERATOR to module scope alongside TEST_ADDRESS with a comment explaining why it has to differ (CFA rejects sender == flowOperator on self-grant; estimateGas runs from TEST_ADDRESS). - Note in the on-chain test that the CI-side regression guard for the cfaForwarder routing lives in the unit-test layer (since this file is gated on INTEGRATION_TEST_RPC_URL and skipped in CI). Future contributors should know which test is doing the load-bearing work. No behaviour change.
🧹 PR Environment Cleaned UpThe PR environment has been successfully deleted. Deleted Resources:
All resources have been cleaned up and will no longer incur costs. |
ℹ️ No PR Environment to Clean UpNo PR environment was found for this PR. This is expected if:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Routes the
superfluid/grant-flow-operatoraction via the canonicalCFAv1Forwarderinstead of the SuperToken's convenience proxy. The proxy is missing entirely on Sepolia's stubbedfUSDCxtest token (even view methods revert), and silently relies on every real-deployment SuperToken implementing the thin delegate. The forwarder is the canonical entry point and works for any registered SuperToken.Also strengthens the on-chain test from "tolerate any non-ABI revert" to assert positive simulation success -- the loose assertion masked the routing bug for months.
Closes KEEP-456.
Why this matters
The bug surfaced while smoke-testing the KEEP-438
khCLI patch end-to-end against prod. Of the four superfluid workflow fixtures, three ran to completion on Sepolia (get-net-flow,create-pool,wrap) butgrant-flow-operatorreverted at the contract layer with no revert reason -- masquerading as the "quirky" behavior implied by the fixture filename.Reproduction (Sepolia mainnet RPC, sender
0xB367...):0xb598...d443B(current routing)updateFlowOperatorPermissions(0x...0001, 1, 0)0xb598...d443Bpermissionsin{1,3,7}andflowRateAllowancein{0, 1000000}0xb598...d443BCONSTANT_OUTFLOW_NFT()0xcfA132E353cB4E398080B9700609bb008eceB125updateFlowOperatorPermissions(token, 0x...0001, 1, 0)trueThis Sepolia fUSDCx implementation is stripped/stubbed and doesn't expose CFA agreement methods. The bug is invisible on mainnets where SuperTokens have full implementations -- but routing through the forwarder is the right design regardless: it's what Superfluid's docs recommend, it works on every registered SuperToken (no per-implementation dependency), and it matches the sibling
create-flow/update-flow/delete-flowactions which already route throughcfaForwarder.What changed
protocols/superfluid.tsupdateFlowOperatorPermissions(token, flowOperator, perms, flowRateAllowance)toCFA_FORWARDER_ABI; removed unused 3-arg fromSUPER_TOKEN_ABI; rerouted action tocfaForwarderwithtokenas first inputtests/integration/fixtures/superfluid-workflows/grant-flow-operator.json-quirky.json(the routing was the quirk);contractAddress->token;_protocolMeta.contractKey->cfaForwardertests/integration/protocol-superfluid-onchain.test.tsexpect(msg).not.toMatch(ENCODING_ERROR_RE)with strictexpect(msg).toBe("")(forwards must simulate cleanly). Pinned routing in test name and inline comment so the bug can't regress silently.tests/unit/superfluid-protocol.test.tsgrant-flow-operatorinto its own describe block with newcontract === "cfaForwarder"and 4-input-order assertionsNo address-map changes -- forwarders use
sameOnAllChains()and Superfluid pins identical addresses across every chain inSUPERFLUID_CHAIN_IDS.Test plan
pnpm test tests/unit/superfluid-protocol.test.ts-- 41/41 passpnpm test tests/integration/protocol-superfluid-workflow-fixtures.test.ts-- 21/21 passINTEGRATION_TEST_RPC_URL=... pnpm test tests/integration/protocol-superfluid-onchain.test.ts-- 17/17 pass; thegrant-flow-operatortest now asserts positive simulation successpnpm exec biome checkclean on touched filespnpm type-check-- no errors introduced (pre-existing@/lib/credential-map/@/lib/step-registryerrors unrelated to this change, verified by stash + re-run)w6uj17db1zm3x2764v69p) after deploy and confirm it succeeds on-chain end-to-end (transaction hash, gas used, no revert)Coverage note
The on-chain test file's "every declared action has at least one dispatch test" coverage assertion (line 358) ensures we can't ship a new action without a dispatch test. However, this PR's strengthened assertion exposes a wider opportunity: the existing pattern of
expect(msg).not.toMatch(ENCODING_ERROR_RE)tolerates contract reverts as long as the calldata isn't ABI-mangled. That pattern hid the grant-flow-operator routing bug. Worth a follow-up to convert the other dispatch tests to positive-simulation assertions where the inputs allow it.Out of scope
create-flow,update-flow,delete-flow) -- they already route throughcfaForwarder, so unaffected.