Skip to content

Add Pump and PumpSwap state-preparation templates - #3

Draft
92Infinitus92 wants to merge 2 commits into
developfrom
feat/pump-protocol
Draft

Add Pump and PumpSwap state-preparation templates#3
92Infinitus92 wants to merge 2 commits into
developfrom
feat/pump-protocol

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Bonding curve (by mint) + Pump global config
  • PumpSwap pool (by address or derived from the mint) + global config

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.

  • Registers both protocols in the default template registry.
  • Adds nested PDA and u16 seed support usage for canonical PumpSwap pool derivation.
  • Expands verified-token options without collapsing duplicate symbols and scopes Pump selectors to pump-suffixed mints.
  • Adds MCP validation and account-materialization coverage using mainnet account snapshots.

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

Filename Overview
crates/core/src/scenarios/protocols/pump/v1/overrides.yaml Defines bonding-curve and global templates correctly, but their partial updates depend on an unenforced fetchBeforeUse precondition.
crates/core/src/scenarios/protocols/pump-amm/v1/overrides.yaml Defines direct and canonical pool templates with verified PDA seeds, while sharing the advisory-only live-fetch requirement.
crates/types/src/scenarios.rs Adds address-suffix filtering and preserves duplicate-symbol tokens by assigning mint-address option IDs.
crates/types/src/verified_tokens.rs Introduces a complete token vector while retaining the legacy symbol-indexed map.
crates/mcp/src/surfpool/mod.rs Correctly enforces exact base58 mint matching and rejects non-string constant values before scenario submission.
crates/core/src/scenarios/registry.rs Registers all five templates and verifies singleton, bonding-curve, nested authority, and canonical pool derivations.
crates/core/src/surfnet/locker.rs Adds byte-exact materialization tests confirming that Pump account tails and untouched fields remain unchanged.

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 --> O
Loading

Fix All in Claude Code Fix All in Codex Fix All in Cursor

Prompt To Fix All With AI
### Issue 1
crates/core/src/scenarios/protocols/pump/v1/overrides.yaml:51-52
**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.

Reviews (1): Last reviewed commit: "Add Pump and PumpSwap state-preparation ..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@92Infinitus92 92Infinitus92 self-assigned this Aug 10, 2026
@92Infinitus92

Copy link
Copy Markdown
Collaborator Author

@greptileai

Comment on lines +51 to +52
CRITICAL: Always set fetchBeforeUse: true so the fields you do not override keep
their live values.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 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.

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.

Fix in Claude Code Fix in Codex Fix in Cursor

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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".

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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.
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