Skip to content

Commit

Permalink
FUN-1009 - Remove redundant Functions Coordinator commitment & reques…
Browse files Browse the repository at this point in the history
…t id checks, favoring handling in Functions Router (#10975)
  • Loading branch information
justinkaseman authored Oct 18, 2023
1 parent 560a789 commit e5ef778
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 25 deletions.
1 change: 1 addition & 0 deletions contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Moved `VRFCoordinatorMock.sol` to src/v0.8/vrf/mocks
- Release Functions v1.0.0 contracts. Start dev folder for v1.X (#10941)
- Add minimumEstimateGasPriceWei to Functions Coordinator config (#10916)
- Remove redundant Functions Coordinator commitment & request id checks (#10975)

### Removed

Expand Down
30 changes: 15 additions & 15 deletions contracts/gas-snapshots/functions.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FunctionsBilling_EstimateCost:test_EstimateCost_RevertsIfGasPriceAboveCeiling() (gas: 32391)
FunctionsBilling_EstimateCost:test_EstimateCost_Success() (gas: 53186)
FunctionsBilling_EstimateCost:test_EstimateCost_SuccessLowGasPrice() (gas: 53289)
FunctionsBilling_EstimateCost:test_EstimateCost_Success() (gas: 53182)
FunctionsBilling_EstimateCost:test_EstimateCost_SuccessLowGasPrice() (gas: 53285)
FunctionsBilling_GetConfig:test_GetConfig_Success() (gas: 23671)
FunctionsBilling_OracleWithdrawAll:test_OracleWithdrawAll_RevertIfNotOwner() (gas: 13296)
FunctionsBilling_OracleWithdrawAll:test_OracleWithdrawAll_SuccessPaysTransmittersWithBalance() (gas: 146657)
FunctionsClient_FulfillRequest:test_FulfillRequest_MaximumGas() (gas: 499173)
FunctionsClient_FulfillRequest:test_FulfillRequest_MinimumGas() (gas: 200320)
FunctionsClient_FulfillRequest:test_FulfillRequest_MaximumGas() (gas: 498113)
FunctionsClient_FulfillRequest:test_FulfillRequest_MinimumGas() (gas: 199261)
FunctionsClient__SendRequest:test__SendRequest_RevertIfInvalidCallbackGasLimit() (gas: 54991)
FunctionsCoordinator_Constructor:test_Constructor_Success() (gas: 11933)
FunctionsOracle_sendRequest:testEmptyRequestDataReverts() (gas: 13452)
Expand All @@ -22,17 +22,17 @@ FunctionsRequest_DEFAULT_BUFFER_SIZE:test_DEFAULT_BUFFER_SIZE() (gas: 246)
FunctionsRequest_EncodeCBOR:test_EncodeCBOR_Success() (gas: 223)
FunctionsRequest_REQUEST_DATA_VERSION:test_REQUEST_DATA_VERSION() (gas: 225)
FunctionsRouter_Constructor:test_Constructor_Success() (gas: 12073)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedCostExceedsCommitment() (gas: 173058)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedInsufficientGas() (gas: 163385)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedCostExceedsCommitment() (gas: 169899)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedInsufficientGas() (gas: 160226)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedInvalidCommitment() (gas: 38092)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedInvalidRequestId() (gas: 35224)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedSubscriptionBalanceInvariant() (gas: 181553)
FunctionsRouter_Fulfill:test_Fulfill_RequestNotProcessedSubscriptionBalanceInvariant() (gas: 178394)
FunctionsRouter_Fulfill:test_Fulfill_RevertIfNotCommittedCoordinator() (gas: 28063)
FunctionsRouter_Fulfill:test_Fulfill_RevertIfPaused() (gas: 157059)
FunctionsRouter_Fulfill:test_Fulfill_SuccessClientNoLongerExists() (gas: 297770)
FunctionsRouter_Fulfill:test_Fulfill_SuccessFulfilled() (gas: 311362)
FunctionsRouter_Fulfill:test_Fulfill_SuccessUserCallbackReverts() (gas: 2485784)
FunctionsRouter_Fulfill:test_Fulfill_SuccessUserCallbackRunsOutOfGas() (gas: 516269)
FunctionsRouter_Fulfill:test_Fulfill_RevertIfPaused() (gas: 153900)
FunctionsRouter_Fulfill:test_Fulfill_SuccessClientNoLongerExists() (gas: 296711)
FunctionsRouter_Fulfill:test_Fulfill_SuccessFulfilled() (gas: 310303)
FunctionsRouter_Fulfill:test_Fulfill_SuccessUserCallbackReverts() (gas: 2484625)
FunctionsRouter_Fulfill:test_Fulfill_SuccessUserCallbackRunsOutOfGas() (gas: 515110)
FunctionsRouter_GetAdminFee:test_GetAdminFee_Success() (gas: 18005)
FunctionsRouter_GetAllowListId:test_GetAllowListId_Success() (gas: 12926)
FunctionsRouter_GetConfig:test_GetConfig_Success() (gas: 37136)
Expand Down Expand Up @@ -61,15 +61,15 @@ FunctionsRouter_SendRequest:test_SendRequest_RevertIfInvalidCallbackGasLimit() (
FunctionsRouter_SendRequest:test_SendRequest_RevertIfInvalidDonId() (gas: 25061)
FunctionsRouter_SendRequest:test_SendRequest_RevertIfNoSubscription() (gas: 29111)
FunctionsRouter_SendRequest:test_SendRequest_RevertIfPaused() (gas: 34247)
FunctionsRouter_SendRequest:test_SendRequest_Success() (gas: 198076)
FunctionsRouter_SendRequest:test_SendRequest_Success() (gas: 198072)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_RevertIfConsumerNotAllowed() (gas: 65800)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_RevertIfEmptyData() (gas: 35991)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_RevertIfIncorrectDonId() (gas: 29897)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_RevertIfInvalidCallbackGasLimit() (gas: 57488)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_RevertIfInvalidDonId() (gas: 27482)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_RevertIfNoSubscription() (gas: 35696)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_RevertIfPaused() (gas: 40766)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_Success() (gas: 204634)
FunctionsRouter_SendRequestToProposed:test_SendRequestToProposed_Success() (gas: 204630)
FunctionsRouter_SendRequestToProposed:test_SendRequest_RevertIfInsufficientSubscriptionBalance() (gas: 192728)
FunctionsRouter_SetAllowListId:test_SetAllowListId_Success() (gas: 30687)
FunctionsRouter_SetAllowListId:test_UpdateConfig_RevertIfNotOwner() (gas: 13380)
Expand Down Expand Up @@ -98,7 +98,7 @@ FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_RevertIfPaused
FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_RevertIfPendingRequests() (gas: 193445)
FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessForfeitAllBalanceAsDeposit() (gas: 114636)
FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessForfeitSomeBalanceAsDeposit() (gas: 125891)
FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessRecieveDeposit() (gas: 312326)
FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessRecieveDeposit() (gas: 311168)
FunctionsSubscriptions_Constructor:test_Constructor_Success() (gas: 7654)
FunctionsSubscriptions_CreateSubscriptionWithConsumer:test_CreateSubscriptionWithConsumer_RevertIfNotAllowedSender() (gas: 28637)
FunctionsSubscriptions_CreateSubscriptionWithConsumer:test_CreateSubscriptionWithConsumer_RevertIfPaused() (gas: 17948)
Expand Down
8 changes: 0 additions & 8 deletions contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
return FunctionsResponse.FulfillResult.INVALID_REQUEST_ID;
}

if (s_requestCommitments[requestId] != keccak256(abi.encode(commitment))) {
return FunctionsResponse.FulfillResult.INVALID_COMMITMENT;
}

uint96 juelsPerGas = _getJuelsPerGas(tx.gasprice);
// Gas overhead without callback
uint96 gasOverheadJuels = juelsPerGas *
Expand Down
Loading

0 comments on commit e5ef778

Please sign in to comment.