The function signature for assigning a permission to a role was function setRolePermission(uint8 role, bytes32 permissionId, bool hasPermission). This worked nicely because it means the policy does not need to know about the PermissionData struct. The issue was that this made it complicated for offchain infrastructure to derive the (target, selector, strategy) tuple that's the pre-image of the permissionId.
We decided to change it to function setRolePermission(uint8 role, PermissionData memory permissionData, bool hasPermission) to address this concern.
Modifications:
Updated setRolePermission and _setRolePermission to accept a permissionData parameter
Update RolePermissionAssigned event to emit both the permissionId and the permissionData tuple
Pass the bootstrapPermissionData instead of bootstrapPermissionID to the policy initialization
Update the deployLlamaInstance.json input file to pass a permissionDataInput struct instead of the permission hash.
Update the test suite to reflect this change
Add a test using recordLogs to ensure event data is emitted correctly
Result:
Offchain infrastructure will be able to easily maintain mappings between (target, selector, strategy) tuples and permissionIds
Motivation:
The function signature for assigning a permission to a role was
function setRolePermission(uint8 role, bytes32 permissionId, bool hasPermission)
. This worked nicely because it means the policy does not need to know about thePermissionData
struct. The issue was that this made it complicated for offchain infrastructure to derive the(target, selector, strategy)
tuple that's the pre-image of thepermissionId
.We decided to change it to
function setRolePermission(uint8 role, PermissionData memory permissionData, bool hasPermission)
to address this concern.Modifications:
setRolePermission
and_setRolePermission
to accept apermissionData
parameterRolePermissionAssigned
event to emit both thepermissionId
and thepermissionData
tuplebootstrapPermissionData
instead ofbootstrapPermissionID
to the policy initializationdeployLlamaInstance.json
input file to pass apermissionDataInput
struct instead of the permission hash.recordLogs
to ensure event data is emitted correctlyResult:
Offchain infrastructure will be able to easily maintain mappings between
(target, selector, strategy)
tuples andpermissionId
s