Skip to content
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

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

eutopian
Copy link
Contributor

@eutopian eutopian commented Dec 9, 2024

Requires

Supports

@eutopian eutopian requested a review from a team as a code owner December 9, 2024 23:01
Copy link
Contributor

github-actions bot commented Dec 9, 2024

I see you updated files related to contracts. Please run pnpm changeset in the contracts directory to add a changeset.

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Static analysis results are available

Hey @eutopian, you can view Slither reports in the job summary here or download them as artifact here.
Please check them before merging and make sure you have addressed all issues.

Copy link
Contributor

github-actions bot commented Dec 9, 2024

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@eutopian eutopian force-pushed the DEVSVCS-963/unique-workflowid branch 3 times, most recently from 4778956 to f908103 Compare December 10, 2024 02:31
@ibrajer
Copy link
Contributor

ibrajer commented Dec 10, 2024

@eutopian code looks good, I have two additional comments to add:

  • I think that deleteWorkflow() should release the current workflow ID as well
  • with this, workflow ID is now globally unique, which means if we have more than one DON, the workflow can only run on one of them - we should check with the Keystone team if this is the expected behavior or not? @cedric-cordenier

@eutopian eutopian force-pushed the DEVSVCS-963/unique-workflowid branch 2 times, most recently from d93c1b2 to 02ab7af Compare December 10, 2024 14:17
Comment on lines 538 to 544
/// @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;
}
Copy link
Collaborator

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.

@eutopian eutopian force-pushed the DEVSVCS-963/unique-workflowid branch from d66b0e6 to c561b73 Compare December 10, 2024 14:33
@eutopian eutopian force-pushed the DEVSVCS-963/unique-workflowid branch from c561b73 to d4224b3 Compare December 10, 2024 14:39
Copy link
Collaborator

@DeividasK DeividasK left a 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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
function test_RevertWhen_TheWorkflowIDIsAlreadyInUsedByAnotherWorkflow() external {
function test_RevertWhen_TheWorkflowIDIsAlreadyInUseByAnotherWorkflow() external {

typo

Comment on lines +302 to +303
// Ensure the new workflowID is unique
_requireUniqueWorkflowID(newWorkflowID);
Copy link
Collaborator

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

Copy link
Contributor Author

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

@eutopian eutopian added this pull request to the merge queue Dec 11, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 11, 2024
@eutopian eutopian added this pull request to the merge queue Dec 11, 2024
@eutopian eutopian removed this pull request from the merge queue due to a manual request Dec 11, 2024
@eutopian eutopian added this pull request to the merge queue Dec 11, 2024
Merged via the queue into develop with commit 7357207 Dec 11, 2024
190 of 192 checks passed
@eutopian eutopian deleted the DEVSVCS-963/unique-workflowid branch December 11, 2024 20:32
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.

4 participants