[Refactor] Timestamp-based deployment metadata & automated governance tracking#186
Open
clement-ux wants to merge 7 commits intoclement/refactor-deploymentfrom
Open
[Refactor] Timestamp-based deployment metadata & automated governance tracking#186clement-ux wants to merge 7 commits intoclement/refactor-deploymentfrom
clement-ux wants to merge 7 commits intoclement/refactor-deploymentfrom
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
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