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

refactor: no need to check requester service Id #86

Merged
merged 10 commits into from
Jan 20, 2025

Conversation

kupermind
Copy link
Collaborator

@kupermind kupermind commented Jan 20, 2025

  • No need to check requester service Id;
  • Delivery rate is added as a hashing parameter as part of requestId();
  • Renaming for more generic usage;
  • NO CODE CHANGE IN OVERALL LOGIC, JUST ABI UPDATES WHERE NEEDED.

Comment on lines -62 to -63
// Buy back burner address
address public immutable buyBackBurner;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Drainer is a better name - it's generic.

@@ -204,14 +204,12 @@ contract MechMarketplace is IErrorsMarketplace {
/// @notice The request is going to be registered for a specified priority mech.
/// @param requestDatas Set of self-descriptive opaque request data-blobs.
/// @param priorityMechServiceId Priority mech service Id.
/// @param requesterServiceId Requester service Id, or zero if EOA.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This came out as a parameter that can always be equal to zero, and it passes all the checks. So checks on requesters become obsolete.

@@ -237,9 +235,6 @@ contract MechMarketplace is IErrorsMarketplace {
revert ZeroAddress();
}

// Check requester
checkRequester(msg.sender, requesterServiceId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

checkRequester() ultimately becomes obsolete as well.

@@ -260,7 +255,7 @@ contract MechMarketplace is IErrorsMarketplace {
}

// Calculate request Id
requestIds[i] = getRequestId(msg.sender, requestDatas[i], nonce);
requestIds[i] = getRequestId(msg.sender, requestDatas[i], deliveryRate, nonce);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding deliveryRate into the requestId is required as this is the part of the request the requester signs on, and it becomes the only verifiable part of hash when requesting off-chain

@kupermind kupermind merged commit 1d7cb5e into deployment_tests Jan 20, 2025
2 checks passed
@kupermind kupermind deleted the requester_service_id branch January 20, 2025 18:53
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