Skip to content

fix(solana): require upgrade authority for lvr amm bootstrap#135

Draft
rndrntwrk wants to merge 2 commits into
mainfrom
security/lvr-amm-bootstrap-authority
Draft

fix(solana): require upgrade authority for lvr amm bootstrap#135
rndrntwrk wants to merge 2 commits into
mainfrom
security/lvr-amm-bootstrap-authority

Conversation

@rndrntwrk

Copy link
Copy Markdown
Collaborator

Summary

Fixes the Solana lvr_amm bootstrap authority gap by making the program upgrade authority the only signer that can initialize the admin/config PDAs.

This is scoped to enoomian/staging and is intentionally separated from the dynamic-liquidity mitigation so review can evaluate the bootstrap authority change independently.

Why

lvr_amm previously allowed first-caller-wins initialization for the admin/config accounts. That creates a staging/prod bootstrap takeover risk: any funded signer could initialize the canonical PDAs before the intended deployer and permanently set hostile treasury/authority values.

The expected authority model is the same operational standard used by the other Solana programs: initialization must be tied to the deployed program's upgrade authority, not whichever wallet reaches the endpoint first.

Changes

  • Adds UnauthorizedInitializer to the end of PredictionMarketError to avoid shifting existing Anchor error codes.
  • Requires program and program_data accounts for initialize and initialize_config.
  • Verifies the passed ProgramData account belongs to the active lvr_amm program.
  • Verifies the signer matches program_data.upgrade_authority_address.
  • Updates Solana test helpers and generated IDL/type mirrors for anchor/app/keeper consumers.
  • Adds a regression test proving a non-upgrade-authority signer cannot initialize config.

Validation

  • anchor build
  • ANCHOR_MANUAL_TEST_SKIP_BUILD=1 bun run test tests/lvr_amm_security.anchor.ts tests/lvr_amm_authoritative_settlement.ts

Targeted localnet result:

  • lvr_amm security: 8 passing
  • lvr_amm authoritative settlement: 5 passing

Rollout Notes

Already-initialized deployments are not affected at runtime. Fresh deployments and migrations must pass the program and programData accounts when calling initialize / initialize_config.

This PR should merge into enoomian/staging first for staging validation before promotion into any broader release path.

The bootstrap-authority change in `programs/lvr_amm/src/instructions/{init,init_config}.rs`
adds the `program` and `programData` accounts to the `Initialize` /
`InitializeConfig` instruction discriminators. Anchor regenerates the IDL
on every build, and the `Solana Program Build Gate` CI step requires the
regenerated IDL to be committed across every downstream consumer that
mirrors the canonical IDL.

This commit propagates the regenerated IDL into:
  - packages/hyperbet-avax/keeper/src/idl
  - packages/hyperbet-bsc/{app,keeper}/src/idl
  - packages/hyperbet-evm/keeper/src/idl
  - packages/hyperbet-ui/src/idl
  - packages/market-maker-bot/src/idl

Mechanical sync only — generated by `bun run --cwd packages/hyperbet-solana/anchor build`
through the existing `sync-anchor-artifacts` script. No runtime behavior
change; the bootstrap-authority enforcement remains in
`packages/hyperbet-solana/anchor/programs/lvr_amm/src/instructions/*.rs`.
@rndrntwrk rndrntwrk force-pushed the security/lvr-amm-bootstrap-authority branch from 7745caf to f54ef97 Compare May 1, 2026 02:19
@rndrntwrk rndrntwrk changed the base branch from enoomian/staging to main May 1, 2026 02:19
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