refactor: extract shared admin and TTL utilities into a new mergefi-c… - #62
Merged
Merged
Conversation
|
@ABEEGOLD is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Good one |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #60
Extract
extend_ttlandrequire_adminintomergefi-commoncrate (#60)Overview
This PR resolves #60 by addressing the structural triplication of
extend_ttlandrequire_adminacross themergefi-escrow,mergefi-milestones, andmergefi-maintenance-poolcontracts.By extracting these heavily duplicated, identical components into a shared
mergefi-commondependency, this PR sets up the critical structural prerequisite for applying the TTL extension bounds and admin-rotation fixes securely, exactly once, across all contracts rather than risking incomplete application via copy-pasting.Changes Made
mergefi-common: Added a new shared Rust crate to the workspace specifically for cross-contract logic.extend_ttlandrequire_admininto the common crate.AdminKeyTrait Parameterization: Designed a minimalmergefi_common::AdminKeytrait and implemented it for each contract's distinctDataKeyenum, mapping their respectiveAdminvariants seamlessly.lib.rsforescrow,milestones, andmaintenance-poolto use the parameterizedmergefi-commonimplementations. The original wrapper functions are kept as transparent pass-throughs to minimize diff noise and cleanly integrate without breaking local error mapping.mergefi-commonin the workspace root and injected it as a dependency for all three contracts.Verification
As mandated by the "proof of behavioral equivalence" requirements:
cargo test --workspace).Note on Sequencing
This PR provides the groundwork for the upcoming batch of security fixes (instance-storage-TTL, admin/treasury-rotation, and #11's fixed-threshold). Please merge this extraction first, so the subsequent fixes only have to be written against the shared
mergefi-commonimplementations rather than duplicated three times.