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

KS-264: Capability registry internal review informational findings #13437

Conversation

cds95
Copy link
Contributor

@cds95 cds95 commented Jun 5, 2024

No description provided.

@cds95 cds95 requested review from archseer, bolekk, patrick-dowell and a team as code owners June 5, 2024 22:19
…lity-registry-internal-review-informational-findings
@@ -447,13 +463,10 @@ contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface {

Node storage node = s_nodes[p2pId];

bool nodeExists = bytes32(node.signer) != bytes32("");
if (!nodeExists) revert InvalidNodeP2PId(p2pId);
if (bytes32(node.signer) == bytes32("")) revert InvalidNodeP2PId(p2pId);
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
if (bytes32(node.signer) == bytes32("")) revert InvalidNodeP2PId(p2pId);
if (bytes32(node.signer) == bytes32("")) revert ???(p2pId);

The error message here is misleading.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this check p2pId?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking it could be either. We are basically just checking to see if the p2pId on line 464 queried a valid node. Wdyt about changing this error message to be NodeDoesNotExist to match the other error messages when an entity does not exist?

bool nodeExists = s_nodes[node.p2pId].signer != bytes32("");
if (!nodeExists) revert InvalidNodeP2PId(node.p2pId);
Node storage storedNode = s_nodes[node.p2pId];
if (storedNode.signer == bytes32("")) revert InvalidNodeP2PId(node.p2pId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

@cds95 cds95 merged commit 9adda79 into capability-registry-internal-review Jun 6, 2024
118 checks passed
@cds95 cds95 deleted the KS-264/capability-registry-internal-review-informational-findings branch June 6, 2024 14:38
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