-
Notifications
You must be signed in to change notification settings - Fork 0
Update platform adapter references to dynamically fetch current value #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: oz-audit-fixes
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,19 +73,20 @@ abstract contract BaseTreasury is Initializable, ICampaignTreasury, CampaignAcce | |
| */ | ||
| error TreasuryCampaignInfoIsPaused(); | ||
|
|
||
| function __BaseContract_init(bytes32 platformHash, address infoAddress, address trustedForwarder_) internal { | ||
| function __BaseContract_init(bytes32 platformHash, address infoAddress) internal { | ||
| __CampaignAccessChecker_init(infoAddress); | ||
| PLATFORM_HASH = platformHash; | ||
| PLATFORM_FEE_PERCENT = INFO.getPlatformFeePercent(platformHash); | ||
| _trustedForwarder = trustedForwarder_; | ||
| } | ||
|
|
||
| /** | ||
| * @dev Override _msgSender to support ERC-2771 meta-transactions. | ||
| * When called by the trusted forwarder (adapter), extracts the actual sender from calldata. | ||
| * The adapter address is read dynamically from GlobalParams via CampaignInfo so that | ||
| * adapter rotations take effect immediately for all deployed treasuries. | ||
| */ | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| assembly { | ||
| sender := shr(96, calldataload(sub(calldatasize(), 20))) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deploy()now hard-codesinitialize(bytes32,address), but implementations approved before this change still exposeinitialize(bytes32,address,address). After upgradingTreasuryFactory, any existingimplementationIdthat still points to the old initializer will consistently fail withTreasuryFactoryTreasuryInitializationFailed, which can halt treasury creation until every stored implementation is replaced and re-approved.Useful? React with 👍 / 👎.