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

FUN-1009 - Remove redundant Functions Coordinator commitment & request id checks #10975

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

justinkaseman
Copy link
Contributor

@justinkaseman justinkaseman commented Oct 16, 2023

There are safety checks against incorrect request commitments and incorrect request ids in both the Functions Coordinator and the Functions Router. The issue with this is that the Functions Router contract is the one that emits an event. Since Functions Coordinator checks are hit before the Functions Router checks, the event is never given.

Favor the checks in Functions Router so that an event is emitted.

@github-actions
Copy link
Contributor

I see that you haven't updated any README files. Would it make sense to do so?

…t id checks, favoring handling in Functions Router
@@ -261,14 +261,6 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling {
) internal returns (FunctionsResponse.FulfillResult) {
FunctionsResponse.Commitment memory commitment = abi.decode(onchainMetadata, (FunctionsResponse.Commitment));

if (s_requestCommitments[requestId] == bytes32(0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain in the PR description that these are repeated inside fulfill() and triggering them over there is better because it also emits events with error messages?

Also, why are tests such as "FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedInvalidRequestId()" not affected gas-wise? They should be using slightly more now, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

The FunctionsRouter test doesn't go through the FunctionsCoordinator, it calls the Router directly, so it is unaffected by Coordinator changes

Copy link
Contributor

@bolekk bolekk Oct 17, 2023

Choose a reason for hiding this comment

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

I see. How hard would it be to add a simple test that goes through coordinator into router.fulfill()? I just want to be extra safe with coverage.

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'll get a PR up that will add ^ before we merge this one, then we can see it change in this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually you can see it changing on the Gas Minimum Request & Gas Maximum Request tests, those go through the end to end flow - we should probably just merge this, as I am adding more to the test PR that I mentioned

@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@justinkaseman justinkaseman added this pull request to the merge queue Oct 18, 2023
Merged via the queue into develop with commit e5ef778 Oct 18, 2023
107 checks passed
@justinkaseman justinkaseman deleted the FUN-1009 branch October 18, 2023 17:45
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.

2 participants