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-518] Workflow Registry Contract #14990

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

eutopian
Copy link
Contributor

@eutopian eutopian commented Oct 28, 2024

Initial dev portion of the workflow registry contract ported from dev-platform

@eutopian eutopian force-pushed the workflow-registry-contract-draft branch from 1e373da to ea6b7ff Compare October 28, 2024 21:29
Copy link
Contributor

github-actions bot commented Oct 28, 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 Oct 29, 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 workflow-registry-contract-draft branch from af3a3ae to 8cc5835 Compare October 31, 2024 02:13
@cl-sonarqube-production
Copy link

@eutopian eutopian marked this pull request as ready for review October 31, 2024 12:30
@eutopian eutopian requested review from a team as code owners October 31, 2024 12:30
@eutopian eutopian changed the title workflow registry contract draft workflow registry contract Oct 31, 2024
@eutopian eutopian force-pushed the workflow-registry-contract-draft branch from 653d06d to 8f37a80 Compare November 1, 2024 14:22
@eutopian eutopian force-pushed the workflow-registry-contract-draft branch from b321eed to 81df9a9 Compare November 8, 2024 18:22
@eutopian eutopian force-pushed the workflow-registry-contract-draft branch from 81df9a9 to 4e04532 Compare November 8, 2024 18:38
@eutopian eutopian force-pushed the workflow-registry-contract-draft branch from 3ea3eab to 40023d2 Compare November 8, 2024 20:02
@@ -22,6 +22,7 @@ LinkToken.json
typechain
**/vendor
src/v0.8/ccip/**
src/v0.8/workflow/**
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason we ignore prettier, i used to rely on prettier to format for me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:D we're using forge fmt right now in our repo as it's a bit faster :D

@eutopian eutopian changed the title workflow registry contract [DEVSVCS-518] Workflow Registry Contract Nov 8, 2024
@@ -132,6 +132,19 @@ let config = {
version: '0.8.19',
settings: COMPILER_SETTINGS,
},
'src/v0.8/workflow/dev/WorkflowRegistry.sol': {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this?


import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/structs/EnumerableSet.sol";

/// @title DONAccessControl
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if a title adds a lot


// Struct
struct DONPermission {
uint32 donID;
Copy link
Contributor

Choose a reason for hiding this comment

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

missing struct packing comments

error AddressNotAuthorized(uint32 donID, address caller);
error DONNotAllowed(uint32 donID);

/// @notice Updates the allowed status for a single DON
Copy link
Contributor

Choose a reason for hiding this comment

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

comments should end with a .

@@ -39,7 +39,8 @@ jobs:
{ "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*' --ir-minimum", "min-coverage": 32.6, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "transmission", "setup": { "run-coverage": true, "min-coverage": 61.5, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "vrf", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }}
{ "name": "vrf", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }},
{ "name": "workflow", "setup": { "run-coverage": true, "extra-coverage-params": "--ir-minimum", "min-coverage": 60.0, "run-gas-snapshot": false, "run-forge-fmt": false }}
Copy link
Contributor

Choose a reason for hiding this comment

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

why is forge fmt false?

Copy link
Contributor

Choose a reason for hiding this comment

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

"min-coverage": 60.0

That's very low. You want this to be well above 90%

uint32 private s_chainID = 1;

function setUp() public {
vm.prank(s_owner);
Copy link
Contributor

Choose a reason for hiding this comment

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

use vm.startPrank to use a prank for multiple calls

import {WorkflowRegistryManager} from "../dev/WorkflowRegistryManager.sol";
import {Test} from "forge-std/Test.sol";

contract WorkflowRegistryManagerTest is Test {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the following test name format

test_Description for standard tests.
testFuzz_Description for fuzz tests.
test_RevertWhen_Condition for tests expecting a revert.
testFork_Description for tests that fork from a network.

and create a test file per function to be called. For the folder structure, see #15165 as example.


// Activate first version
s_manager.activateVersion(1);
vm.stopPrank();
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no need to stop the prank

function testGetAllVersionsPagination() public {
// Add multiple versions
vm.startPrank(s_owner);
for (uint32 i = 0; i < 5; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

++i, even in tests :)

address private s_owner = address(1);
address private s_unauthorizedUser = address(2);
address private s_authorizedUser = address(3);
bytes32 private s_workflowID1 = keccak256(abi.encodePacked("workflow1"));
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think you have to encode it at all

@RensR
Copy link
Contributor

RensR commented Nov 11, 2024

The PR isn't forge formatted but also adds its code to prettierignore. This means there is no formatting which is not allowed

using EnumerableSet for EnumerableSet.UintSet;

// Constants
string public constant override typeAndVersion = "WorkflowRegistry 1.0.0";
Copy link
Contributor

Choose a reason for hiding this comment

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

When under development please use the -dev suffix for versions

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.

5 participants