Skip to content

Initial work for workflow registry v2: limits #40

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

Merged
merged 3 commits into from
May 27, 2025

Conversation

eutopian
Copy link
Contributor

No description provided.

@eutopian eutopian requested a review from a team as a code owner April 24, 2025 19:44
Copy link
Contributor

github-actions bot commented Apr 24, 2025

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.

@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch 7 times, most recently from a37a2df to 7a16d99 Compare April 24, 2025 21:32
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch 3 times, most recently from 0530b5e to 28b1d42 Compare April 28, 2025 14:16
if (isSet) {
s_cfg.userOverride[user] = Config.Value(limit, true);
} else {
delete s_cfg.userOverride[user];
Copy link
Contributor

Choose a reason for hiding this comment

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

Not 100% sure on this, but generally, deleting elements in mappings/arrays is avoided due to gas costs, so resetting values is more desirable. Since you're already using this isSet field value, maybe you can just set it false? In that case, this code is as simple as:

s_cfg.userOverride[user] = Config.Value(limit, isSet);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

delete is only costly for large structures, but this is one slot size, so delete versus setting this to false cost the same storage write but has the slight benefit of the cleared slot refund. the only benefit potentially in allowing it is record I think.

// Struct to distinguish between unset and explicitly set zero values
struct Value {
uint32 value;
bool isSet;
Copy link
Contributor

Choose a reason for hiding this comment

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

You could also use the uint32 max value or any other arbitrarily large value to have a special meaning, but this is certainly easier to understand!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks like it's more complicated but actually not much more as both are small and fits into one storage slot, but much more explicit and readable than using an arbitrary value to get around the falsey zeros

@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch from 28b1d42 to 5561750 Compare April 29, 2025 13:59
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch from 5561750 to af24803 Compare May 15, 2025 14:30
@eutopian eutopian requested a review from a team as a code owner May 15, 2025 14:35
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch 5 times, most recently from b7cd0d0 to 453fbeb Compare May 19, 2025 18:51
@eutopian eutopian requested review from a team as code owners May 19, 2025 18:51
@eutopian eutopian requested a review from patrickhuie19 May 19, 2025 18:51
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch from 453fbeb to 67f2f0b Compare May 19, 2025 20:58
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch 5 times, most recently from 3ff3c89 to 0db8d50 Compare May 20, 2025 00:28
@eutopian eutopian requested review from a team as code owners May 20, 2025 00:28
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch 3 times, most recently from d41e70c to dc36809 Compare May 21, 2025 14:46
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch 3 times, most recently from 3fececd to a6df1f0 Compare May 27, 2025 12:51
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch from a6df1f0 to ebf89cb Compare May 27, 2025 13:02
@eutopian eutopian force-pushed the DEVSVCS-1014/workflow-registry-limits branch from 746180c to af37a41 Compare May 27, 2025 13:11
@eutopian eutopian merged commit 93d37ed into develop May 27, 2025
45 of 47 checks passed
@eutopian eutopian deleted the DEVSVCS-1014/workflow-registry-limits branch May 27, 2025 17:21
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.

3 participants