Skip to content

Reject create_vault when a milestone due_date is in the past in accountability_vault #356

@1nonlypiece

Description

@1nonlypiece

Reject create_vault when a milestone due_date is in the past in accountability_vault

Description

create_vault in contracts/accountability_vault/src/lib.rs validates that end_timestamp is in the future and that each milestone.due_date <= end_timestamp, but does not reject a milestone whose due_date is already in the past relative to env.ledger().timestamp(). Such a milestone can never be checked in, guaranteeing a slash. Add the lower-bound validation and a failing-case test.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Add due_date > env.ledger().timestamp() validation in create_vault
  • Return the existing InvalidDeadline error code in contracts/accountability_vault/src/lib.rs
  • Add a past-due-date rejection test in contracts/accountability_vault/src/test.rs
  • Note the rule in contracts/README.md

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b bug/reject-past-due-milestone
  • Implement changes
    • Modify contracts/accountability_vault/src/lib.rs
    • Add a test in contracts/accountability_vault/src/test.rs
    • Update contracts/README.md
    • Add boundary comments
  • Test and commit
    • Run tests, cover edge cases
    • Include test output and notes

Example commit message

fix: reject past milestone due dates in create_vault

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't workingcontractssorobanStellar Soroban

    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