Skip to content

Update platform adapter references to dynamically fetch current value#46

Open
adnanhq wants to merge 1 commit intooz-audit-fixesfrom
oz-fix-issue-41
Open

Update platform adapter references to dynamically fetch current value#46
adnanhq wants to merge 1 commit intooz-audit-fixesfrom
oz-fix-issue-41

Conversation

@adnanhq
Copy link
Contributor

@adnanhq adnanhq commented Mar 4, 2026

Changes

  • Add getPlatformAdapter to CampaignInfo – New getter that returns the platform adapter from GlobalParams (same pattern as getPlatformAdminAddress).
  • Add getPlatformAdapter to ICampaignInfo – Interface definition for the new getter.
  • Use dynamic adapter lookup in BaseTreasury._msgSender – Replace cached _trustedForwarder with INFO.getPlatformAdapter(PLATFORM_HASH) so adapter changes in GlobalParams apply to all treasuries.
  • Use dynamic adapter lookup in BasePaymentTreasury._msgSender – Same change as in BaseTreasury.
  • Stop passing adapter in TreasuryFactory.deploy – Treasury initialize now takes only platformHash and infoAddress; adapter is resolved at runtime via CampaignInfo.

@adnanhq adnanhq self-assigned this Mar 4, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +122 to 123
abi.encodeWithSignature("initialize(bytes32,address)", platformHash, infoAddress)
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant