Skip to content

extend_instance_ttl is triplicated byte-for-byte across all three contracts with unexplained magic numbers, unlike extend_ttl which #60 already centralized #321

Description

@abayomicornelius

Overview

Issue #60 centralized extend_ttl/require_admin/require_oracle into mergefi_common — confirmed genuinely done (contracts/{escrow,milestones,maintenance-pool}/src/lib.rs all call mergefi_common::extend_ttl/require_admin/require_oracle). But each contract still has its own private, byte-identical extend_instance_ttl helper:

fn extend_instance_ttl(env: &Env) {
    env.storage().instance().extend_ttl(100_000, 500_000);
}

(contracts/escrow/src/lib.rs:750-752, contracts/milestones/src/lib.rs:853-855, contracts/maintenance-pool/src/lib.rs:517-519), each with its own copy of the doc comment explaining what instance storage holds. This is exactly the kind of triplication #60/#162/#163 were filed to eliminate, just for a function those issues didn't happen to name.

Requirements

Add a shared extend_instance_ttl(env: &Env) to mergefi_common (parallel to extend_ttl), and have all three contracts call it instead of their own private copies.

Acceptance Criteria

  • Shared helper added to contracts/common/src/lib.rs
  • All three contracts' private copies removed, replaced with calls to the shared version
  • cargo test --workspace passes

Additional Notes

Verified via grep -n "fn extend_instance_ttl" contracts/*/src/lib.rs — three separate, byte-identical definitions. Cross-reference: #60 (closed, correctly centralized extend_ttl but not this function).

Activity

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programarchitectureArchitecture/design issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions