KeeperHub / KeeperHub/keeperhub

runAllowancePreflightCheck cannot see any protocol write node, so 130 write actions are invisible to it

Open
#2,366 2 comments 0 reactions 0 assignees View on GitHub
accepted enhancement
Dominant language
TypeScript
Stars
24
Forks
93
Avg merge
1d 8h
Merged PRs (30d)
266

Description

## Reason

`runAllowancePreflightCheck` reads the method from `cfg.abiFunction` (`lib/mcp/validate-workflow.ts`). A protocol node has no such field: its config is `actionType: "/"` plus a `_protocolMeta` blob. `isWriteActionType` does not match one either, because the `protocol-write` string is the `stepImportPath` at `lib/protocol-registry.ts:505`, not the config value.

So the warning is reachable only from `web3/write-contract` and `web3/batch-write-contract`, and all 130 write actions across the 24 registered protocols are unchecked.

## Plan

Resolve the method per node type: `cfg.abiFunction` for raw web3 nodes, `_protocolMeta.functionName` for protocol nodes, gated on that blob's own `actionType === "write"`.

Do not widen `isWriteActionType`; `lib/mcp/action-type.ts:23-32` says why.

Then widen `ALLOWANCE_SPEND_METHODS` past the current three, including only names whose every use in the catalogue is allowance-consuming and whose standard ERC-20 / ERC-4626 / ERC-721 meaning agrees.

## Scope

Ships and is correct with #2110 and the approve-warning seam absent. Warnings only: `valid` is computed from `errors`, so nothing here can flip a workflow to invalid.

Found by @cgair while implementing #2110, which is being split into three independently shippable seams. Baseline pinned by `tests/unit/validate-workflow-seed-workflows.test.ts`, which passes today because the seed corpus contains no `web3/write-contract` or `web3/batch-write-contract` nodes.

Contributor guide

Open the contributing guide

Research direction

Start in lib/mcp/validate-workflow.ts, then read lib/protocol-registry.ts:505 and lib/mcp/action-type.ts:23-32 to understand node configuration and write-action matching. Run tests/unit/validate-workflow-seed-workflows.test.ts and inspect the protocol catalogue and allowance method list. Done means protocol write nodes receive the intended allowance warnings without changing workflow validity or widening isWriteActionType.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.