refactor(workflows): replace permission setting with executeWithSig
#121
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.
Description
This PR refactors workflow contracts to use the
executeWithSig
function fromIPAccount
, and enables direct calls to core protocol functions on behalf of the IP owner. This eliminates the need to grant extended permissions to workflow contracts via the protocol access controller, which enhances the security of periphery contracts by ensuring permissions are limited to the duration of a single workflow function call.KeyChanges:
PermissionHelper
, the library contract previously used for setting permissions for periphery contracts.MetadataHelper
to leverageexecuteWithSig
for invoking core protocol functions, removing reliance on permission setting.LicensingHelper
to support registering and attaching PIL terms usingexecuteWithSig
.DerivativeWorkflows
to account for whetherexecuteWithSig
is used. This makes sure proper handling of minting fees and license tokens depending on whethermsg.sender
of the core protocol function is the workflow contract or the IP account.executeWithSig
for core protocol functions that require IP account permissions.mintAndRegisterIpAndAttachLicenseAndAddToGroup
inGroupingWorkflows
still sets permissions through the access controller because theipId
is not known at the time of the function call. There are no known security issues for this approach.Test Plan
The tests are updated to reflect these changes and all tests pass locally.
Related Issue
executeWithSig
for Direct Function Calls #110Notes
This PR include API changes, and requires updates to downstream integrations.