[Refactor] Timestamp-based deployment metadata & automated governance tracking#186
Merged
clement-ux merged 7 commits intoclement/refactor-deploymentfrom Feb 17, 2026
Conversation
Replace the manual `proposalExecuted` flag and `maxDeploymentFiles` limit with timestamp-based metadata (tsDeployment, proposalId, tsGovernance) in the deployment JSON. This enables DeployManager to deterministically replay deployments for any historical fork block by filtering on timestamps. Key changes: - Execution struct now carries proposalId, tsDeployment, tsGovernance - Resolver stores per-script governance metadata mappings - DeployManager iterates all scripts, skipping completed ones via _canSkipDeployFile() instead of limiting to last N files - _preDeployment() filters future deployments and adjusts governance timestamps for historical forks - AbstractDeployScript splits contract storage from execution recording and removes proposalExecuted() virtual function - All 20 deploy scripts cleaned of proposalExecuted overrides - Added missing 013_UpgradeOETHARMScript entry to deployments-1.json Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…IGIN_IMPL in deployments
Constructor logs are not printed on test failure, making debugging difficult. Moving initialization to setUp() ensures all logs are visible when a smoke test fails.
* Add automated governance metadata updates for deployments JSON Add a standalone Foundry script and CI workflow that automatically fills in proposalId and tsGovernance in build/deployments-1.json after governance proposals are submitted and executed on-chain. - script/UpdateGovernanceMetadata.s.sol: core script handling two cases - Case A (proposalId == 0): finds proposalId via buildGovernanceProposal() - Case B (tsGovernance == 0): finds execution timestamp via FFI + cast logs - script/deploy/helpers/find_execution_timestamp.sh: FFI helper querying ProposalExecuted events - .github/workflows/update-deployments.yml: CI job running every 6 hours - Makefile: add update-deployments target - AbstractDeployScript: add buildGovernanceProposal() external entry point * Run forge fmt * Rename find_execution_timestamp.sh to find_gov_prop_execution_timestamp.sh
naddison36
pushed a commit
that referenced
this pull request
Feb 23, 2026
* Add checkout action to all job steps in main.yml * Update smoke test step to build before running tests * Fix formatting of _preDeployment function declaration * Move to forge 1.9.7 for comparison * Migrate initalization into contructor. * Hide RPC key * Refactor deployment state handling for improved clarity and error management * Add validation for governance proposal description to enhance clarity * [Refactor] Timestamp-based deployment metadata & automated governance tracking (#186) * Replace proposalExecuted with timestamp-based deployment metadata Replace the manual `proposalExecuted` flag and `maxDeploymentFiles` limit with timestamp-based metadata (tsDeployment, proposalId, tsGovernance) in the deployment JSON. This enables DeployManager to deterministically replay deployments for any historical fork block by filtering on timestamps. Key changes: - Execution struct now carries proposalId, tsDeployment, tsGovernance - Resolver stores per-script governance metadata mappings - DeployManager iterates all scripts, skipping completed ones via _canSkipDeployFile() instead of limiting to last N files - _preDeployment() filters future deployments and adjusts governance timestamps for historical forks - AbstractDeployScript splits contract storage from execution recording and removes proposalExecuted() virtual function - All 20 deploy scripts cleaned of proposalExecuted overrides - Added missing 013_UpgradeOETHARMScript entry to deployments-1.json Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update proposal IDs and timestamps for deployment scripts * Add new implementations for MORPHO_MARKET_ORIGIN and MORPHO_MARKET_ORIGIN_IMPL in deployments * Refactor smoke tests to use setUp() instead of constructor Constructor logs are not printed on test failure, making debugging difficult. Moving initialization to setUp() ensures all logs are visible when a smoke test fails. * [Refactor] Add automated governance metadata updates (#187) * Add automated governance metadata updates for deployments JSON Add a standalone Foundry script and CI workflow that automatically fills in proposalId and tsGovernance in build/deployments-1.json after governance proposals are submitted and executed on-chain. - script/UpdateGovernanceMetadata.s.sol: core script handling two cases - Case A (proposalId == 0): finds proposalId via buildGovernanceProposal() - Case B (tsGovernance == 0): finds execution timestamp via FFI + cast logs - script/deploy/helpers/find_execution_timestamp.sh: FFI helper querying ProposalExecuted events - .github/workflows/update-deployments.yml: CI job running every 6 hours - Makefile: add update-deployments target - AbstractDeployScript: add buildGovernanceProposal() external entry point * Run forge fmt * Rename find_execution_timestamp.sh to find_gov_prop_execution_timestamp.sh * chore: update deployment schedule to run every hour * chore: remove HOLESKY_URL from environment example --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * [Refactor] Update governance handling and remove unused contract references * [Refactor] Add deployment script for MorphoMarket and update related tests; remove obsolete Lido upgrade script * [Refactor] Add new deployment scripts for MorphoMarket and Pendle adaptor; remove obsolete Pendle adaptor script * [Refactor] Add MorphoMarket Lido deployment details and update proposal IDs in deployments-1.json * [Refactor] Update resolver method calls from implementations() to resolve() for consistency and clarity * [Refactor] Remove obsolete Benchmark smoke test contract * [Refactor] Rewrite deployment framework README with comprehensive documentation Expand from ~210 lines to ~690 lines covering architecture overview, core concepts (Resolver, State, sentinels, alphabetical JSON decoding), full execution flow with decision tables, governance lifecycle, automated metadata tracking, JSON schema, script creation guide, test integration, CI integration, and design patterns. * [Refactor] Remove obsolete deploy-holesky Makefile target * [Refactor] Add step-by-step deployment guide and rename README to ARCHITECTURE Add HOW_TO_DEPLOY.md as a linear walkthrough for new team members covering setup, script writing, testing, simulation, deployment, and troubleshooting. Rename README.md to ARCHITECTURE.md to clarify its role as a technical reference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [Refactor] Move governance automation scripts to script/automation/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [Refactor] Rename HOW_TO_DEPLOY.md to README.md for GitHub auto-rendering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
Replaces the manual
proposalExecutedboolean with a timestamp-based metadata system, enabling historical fork replays, automated governance tracking, and removing the need for developers to manually update deployment scripts after governance passes.Deployment Metadata Format
The
Executionstruct inDeploymentTypes.solwas redesigned from{name, timestamp}to:All entries in
build/deployments-1.jsonandbuild/deployments-146.jsonmigrated to this format with actual on-chain proposal IDs and execution timestamps filled in.Resolver Changes
Three new mappings added for O(1) lookups:
proposalIds,tsDeployments,tsGovernances. TheaddExecution()signature updated to accept all four metadata fields.DeployManager Rewrite
maxDeploymentFiles— now iterates ALL files, using new_canSkipDeployFile()to efficiently skip completed scripts without compilationproposalId == 1(no governance) ortsGovernance != 0 && tsGovernance <= block.timestamp(governance executed)_preDeployment()filters historical forks: entries withtsDeployment > block.timestampare excluded, entries withtsGovernance > block.timestampare reset to pending_postDeployment()serializes the three new fields instead of singletimestampAbstractDeployScript Changes
proposalExecuted()virtual function_storeDeployedContract()into_storeContracts()(persists addresses) and_recordExecution()(records metadata)_recordExecution()must be called after_buildGovernanceProposal()— usesgovProposal.actions.lengthto determine sentinel valuesbuildGovernanceProposal()for external proposal ID computation (used by UpdateGovernanceMetadata)Removed
proposalExecutedfrom All ScriptsThe
bool public override proposalExecuted = true/falsedeclaration removed from all 19 deployment scripts (14 mainnet + 5 Sonic). Metadata now lives in the JSON files and is automatically maintained.Automated Governance Metadata Updates
script/UpdateGovernanceMetadata.s.sol— Standalone script that auto-fills pending governance metadata:proposalId == 0): Deploys script artifact viavm.deployCode(), callsbuildGovernanceProposal()to compute expected proposal ID, verifies it exists on-chainproposalId > 1 && tsGovernance == 0): Uses FFI to queryProposalExecutedevents and find execution timestampfind_gov_prop_execution_timestamp.sh— Bash helper usingcast logs/cast find-block/cast blockto locate proposal execution timestamps.github/workflows/update-deployments.yml— CI job running every hour (+ manual trigger), auto-commits updatedbuild/deployments-*.jsonMakefile— Newupdate-deploymentstarget for local executionSmoke Test Refactor
constructor()tosetUp()so logs are visible on test failurefunction setUp() public overridewithsuper.setUp()callOther Changes
017_UpgradeLidoARMScript.s.solfixed to useresolver.implementations("LIDO_ARM_IMPL")in governance proposal (works when called externally by UpdateGovernanceMetadata)MORPHO_MARKET_ORIGINandMORPHO_MARKET_ORIGIN_IMPL013_UpgradeOETHARMScriptOETH_ARM_IMPLimplementation addressTest plan
make test-smokepasses withMAINNET_URLmake simulatereplays deployment history successfullymake simulatewithFORK_BLOCK_NUMBER_MAINNETset to a historical block replays correctlymake update-deploymentsresolves pending governance metadata on mainnet forkupdate-deployments.ymltriggers and auto-commits correctly