Update platform adapter references to dynamically fetch current value#46
Update platform adapter references to dynamically fetch current value#46adnanhq wants to merge 1 commit intooz-audit-fixesfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd1f755328
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| abi.encodeWithSignature("initialize(bytes32,address)", platformHash, infoAddress) | ||
| ); |
There was a problem hiding this comment.
Keep deploy compatible with previously approved implementations
deploy() now hard-codes initialize(bytes32,address), but implementations approved before this change still expose initialize(bytes32,address,address). After upgrading TreasuryFactory, any existing implementationId that still points to the old initializer will consistently fail with TreasuryFactoryTreasuryInitializationFailed, which can halt treasury creation until every stored implementation is replaced and re-approved.
Useful? React with 👍 / 👎.
| */ | ||
| function _msgSender() internal view virtual override returns (address sender) { | ||
| if (msg.sender == _trustedForwarder && msg.data.length >= 20) { | ||
| if (msg.sender == INFO.getPlatformAdapter(PLATFORM_HASH) && msg.data.length >= 20) { |
There was a problem hiding this comment.
Guard adapter lookup for legacy CampaignInfo compatibility
_msgSender() now unconditionally calls INFO.getPlatformAdapter(PLATFORM_HASH) before falling back to msg.sender. If infoAddress points to a CampaignInfo deployment that predates this new interface method, that external call reverts and all treasury entrypoints that rely on _msgSender() fail, making newly deployed treasuries unusable for those existing campaigns.
Useful? React with 👍 / 👎.
Changes
getPlatformAdaptertoCampaignInfo– New getter that returns the platform adapter from GlobalParams (same pattern asgetPlatformAdminAddress).getPlatformAdaptertoICampaignInfo– Interface definition for the new getter.BaseTreasury._msgSender– Replace cached_trustedForwarderwithINFO.getPlatformAdapter(PLATFORM_HASH)so adapter changes in GlobalParams apply to all treasuries.BasePaymentTreasury._msgSender– Same change as inBaseTreasury.TreasuryFactory.deploy– Treasuryinitializenow takes onlyplatformHashandinfoAddress; adapter is resolved at runtime via CampaignInfo.