Skip to content

feat: SEP-12 storage keys, yield pause guard, anchorpoint admin tests staking metadata admin gate#688

Open
amanosiadnan-cmyk wants to merge 1 commit into
ceejaylaboratory:mainfrom
amanosiadnan-cmyk:feat/storage
Open

feat: SEP-12 storage keys, yield pause guard, anchorpoint admin tests staking metadata admin gate#688
amanosiadnan-cmyk wants to merge 1 commit into
ceejaylaboratory:mainfrom
amanosiadnan-cmyk:feat/storage

Conversation

@amanosiadnan-cmyk

@amanosiadnan-cmyk amanosiadnan-cmyk commented Jun 27, 2026

Copy link
Copy Markdown

PR description
Summary
This PR closes four related issues across the backend SEP-12 upload flow and three Soroban contracts. It adds deterministic storage key generation, verifies pause protection on yield deposits, adds admin role security tests for the anchorpoint contract, and restricts staking contract metadata updates to the admin.

Changes
[#557] SEP-12 — Deterministic storage key generation
Added generateStorageKey() in backend/src/utils/storage-key.ts with format {account}/{fieldName}/{uploadId}.
Updated upload-store.service.ts to compute the storage key at record creation (no post-create mutation).
Simplified sep12.controller.ts upload-url and upload-confirm flows to use the persisted key directly (removed fallback recompute and KEY_PREFIX hack).
Added unit tests in backend/src/utils/storage-key.test.ts for determinism, uniqueness, and path format.

[#565] Yield contract — Pause check on deposit
Confirmed deposit_rewards already checks the security registry pause flag before processing.
Added test_pause_deposit_rewards with a MockRegistry to assert deposits panic with "contract is paused" when the registry is paused.

[#570] Anchorpoint contract — Admin role security tests
Added contracts/anchorpoint/src/tests/admin_tests.rs covering:
Auth required for update_oracle and set_fee (success with auth, panic without).
Cooldown enforcement after admin actions.
Per-action cooldown independence (SetFee vs UpdateOracle, AddAsset).
24-hour cooldown on UpdateAdmin.

[#580] Staking contract — Metadata updates restricted to admin
Added ContractMetadata struct and ContractMeta storage key.
Initialized empty metadata in initialize().
Added update_contract_meta() (admin-only via require_auth + stored admin check) and get_contract_meta().
Added tests: admin can update metadata; non-admin panics with "only admin can update contract metadata".
Test plan

npx jest backend/src/utils/storage-key.test.ts — 3 tests passing

cargo test --manifest-path contracts/Cargo.toml -p anchorpoint -p yield-distribution -p staking — 23 tests passing

Full npm run test:backend (requires full backend test suite / coverage thresholds)

Full cargo test --manifest-path contracts/Cargo.toml (governance crate has pre-existing compile errors unrelated to this PR)
Closes #557 — [SEP-12] Implement Deterministic Storage Key Generation
closes #565 — Add Check for Pause State in Yield Contract Deposit
closes #570 — Write Security Test Cases for anchorpoint Contract Roles
closes #580 — Verify Contract Metadata Updates are Restricted to Admin

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@amanosiadnan-cmyk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant