Add Pump and PumpSwap state-preparation templates - #3
Conversation
| CRITICAL: Always set fetchBeforeUse: true so the fields you do not override keep | ||
| their live values. |
There was a problem hiding this comment.
The new partial-account templates require fetchBeforeUse: true to retain unexposed live fields, but override instances still default it to false. Omitting it can silently skip an absent account or combine edited fields with stale local state, so this correctness precondition should be encoded in template behavior rather than only model-facing prose.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/core/src/scenarios/protocols/pump/v1/overrides.yaml
Line: 51-52
Comment:
**Live fetch remains advisory**
The new partial-account templates require `fetchBeforeUse: true` to retain unexposed live fields, but override instances still default it to false. Omitting it can silently skip an absent account or combine edited fields with stale local state, so this correctness precondition should be encoded in template behavior rather than only model-facing prose.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Forcing it in the template would be wrong here: the same template needs fetchBeforeUse=true on a first-touch override but false on a follow-up that builds on state an earlier override already prepared, so the correct value depends on the override's position in the scenario, not the template. Softened the wording — it now keeps true as the default and calls out false as the narrow exception, instead of the misleading "always".
There was a problem hiding this comment.
That's a fair point — the override's position in the scenario chain is context the template genuinely can't know at definition time, so encoding true unconditionally would break the follow-up case. The revised wording (default true, narrow false exception) is the right level of guidance here.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.
813b034 to
5cd0bd1
Compare
Give every field of the pump-global, pump-amm-pool-state and pump-amm-global-config templates a label and description (they were bare name lists), and add a field reference to both pump READMEs. Expose Global.withdraw_authority so a migrate can be driven on a fork. Trim the bonding-curve llmContext of its redundant worked example and the niche cost formula.
Adds pump.fun support to scenario state prep. A coin lives on two programs - the Pump
bonding curve, then the PumpSwap AMM after it graduates - so this covers both.
Heads up on the size: ~14k of the diff is the two vendored IDL files.
Five templates:
You can reset a curve to launch state, mark one complete, or shift a pool's price through
virtual_quote_reserves. The token pickers only show pump.fun coins.
Tests: PDA derivation checked against the addresses in pump-public-docs; apply-path tests
run real mainnet account snapshots through and confirm only the fields we touch change,
byte for byte; MCP tests make sure junk mints get rejected early.
Greptile Summary
Adds bundled Pump and PumpSwap IDLs and five state-preparation templates for bonding curves, canonical or directly addressed pools, and global configuration.
u16seed support usage for canonical PumpSwap pool derivation.Confidence Score: 4/5
The PR appears safe to merge, with a non-blocking concern that the new partial-account templates can silently misapply or skip state when callers omit live fetching.
The PDA derivations, IDL field types, token validation, and byte-preserving apply paths are well covered; the remaining concern is that a correctness-critical live-fetch precondition is documented but not encoded in the template behavior.
Files Needing Attention: crates/core/src/scenarios/protocols/pump/v1/overrides.yaml, crates/core/src/scenarios/protocols/pump-amm/v1/overrides.yaml
Important Files Changed
fetchBeforeUseprecondition.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR M[Pump coin mint] --> B[Pump bonding-curve PDA] B -->|complete and migrate| A[Pump pool-authority PDA] A --> P[Canonical PumpSwap pool PDA] B --> BG[Pump Global] P --> AG[PumpSwap GlobalConfig] B --> O[Scenario field overrides] P --> O BG --> O AG --> OPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "Add Pump and PumpSwap state-preparation ..." | Re-trigger Greptile