Skip to content

fix(mock-amm): prevent mainnet initialization of test-only AMM - #65

Merged
Junman140 merged 3 commits into
Pi-Defi-world:mainfrom
akintewe:fix/mock-amm-mainnet-guard
Aug 19, 2026
Merged

fix(mock-amm): prevent mainnet initialization of test-only AMM#65
Junman140 merged 3 commits into
Pi-Defi-world:mainfrom
akintewe:fix/mock-amm-mainnet-guard

Conversation

@akintewe

Copy link
Copy Markdown
Contributor

Summary

  • mock-amm is documented as test-only but had no runtime check preventing it from being initialized on the public Stellar network.
  • MockAmm::initialize now compares env.ledger().network_id() against the known Stellar mainnet passphrase hash and rejects the call with Error::MainnetNotSupported if it matches, so any mainnet initialization attempt fails on-chain.
  • scripts/deploy_mainnet.sh previously had a DEPLOY_AMM=true flag that would upload, deploy, and initialize mock-amm on mainnet. That path is now rejected up front in require_mainnet_inputs, and the associated dead deployment code has been removed from the script.

Test plan

  • No test changes included per task instructions.

closes #24

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f32bf5a7-a356-4575-a244-41bbebed0da3


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…t-guard

# Conflicts:
#	Stellar-contracts-v1/mock-amm/src/lib.rs
@Junman140
Junman140 merged commit a4173bb into Pi-Defi-world:main Aug 19, 2026
3 checks passed
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.

Issue 24 — Nothing prevents mock-amm from being deployed to mainnet

2 participants