Skip to content

Add FeeManager fee-config commit-reveal scheme to prevent front-run fee changes #675

Description

@greatest0fallt1me

Description

Admin fee changes in fees.rs apply immediately on the next block, letting an admin front-run their own change against pending bets. Add a two-step commit-reveal: admin commits a hash of the new fee config first, then after a minimum delay reveals it. Bets in the delay window are settled under the old config.

Requirements and Context

  • Commit stores BytesN<32> hash and the committed_at ledger
  • Reveal verifies preimage and applies after min_delay_ledgers
  • Re-commit overwrites pending commit
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feature/fee-config-commit-reveal
  2. Implement changes
    • contracts/predictify-hybrid/src/fees.rs
    • contracts/predictify-hybrid/src/tests/fee_config_commit_reveal_tests.rs
  3. Test and commit
    • cargo test -p predictify-hybrid fee_config_commit_reveal
    • Cover edge cases
    • Include test output and notes in the PR

Example commit message

feat: add commit-reveal scheme for FeeConfigManager updates

Acceptance Criteria

  • Reveal without commit fails
  • Reveal before delay fails
  • Mismatched preimage fails with specific error

Guidelines

  • Validate auth, overflow, and storage TTL/archival
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

GRANTFOX OSSGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programrustRust implementationsecuritySecurity hardeningsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions