-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[DEVSVCS-963] Ensure that workflow id is unique #15582
Conversation
I see you updated files related to |
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
4778956
to
f908103
Compare
@eutopian code looks good, I have two additional comments to add:
|
d93c1b2
to
02ab7af
Compare
/// @notice Frees up a previously used workflowID, allowing it to be reused. | ||
/// @param workflowID The workflowID to release. | ||
function _releaseWorkflowID( | ||
bytes32 workflowID | ||
) internal { | ||
s_workflowIDs[workflowID] = false; | ||
} |
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.
I don't think this needs a separate function and could just be done inline for readability purposes.
d66b0e6
to
c561b73
Compare
c561b73
to
d4224b3
Compare
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.
A few nits that can probably be addressed in a separate PR.
@@ -138,6 +138,35 @@ contract WorkflowRegistry_registerWorkflow is WorkflowRegistrySetup { | |||
); | |||
} | |||
|
|||
// whenTheCallerIsAnAuthorizedAddress whenTheRegistryIsNotLocked whenTheDonIDIsAllowed | |||
function test_RevertWhen_TheWorkflowIDIsAlreadyInUsedByAnotherWorkflow() external { |
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.
function test_RevertWhen_TheWorkflowIDIsAlreadyInUsedByAnotherWorkflow() external { | |
function test_RevertWhen_TheWorkflowIDIsAlreadyInUseByAnotherWorkflow() external { |
typo
// Ensure the new workflowID is unique | ||
_requireUniqueWorkflowID(newWorkflowID); |
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.
This is redundant because above you have:
// Condition to revert: WorkflowID must change, and at least one URL must change
if (currentWorkflowID == newWorkflowID) {
revert WorkflowIDNotUpdated();
}
Now you still need to do the newWorkflowID != address(0)
check, but you might be better off inlining it as it isn't quite "requireUnique".
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.
We should remove the current == old then as we still need to check globally it's unique in case it's a different but existing workflowID
Requires
Supports