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

[Functions] Various changes from review #2 #10014

Merged
merged 50 commits into from
Aug 2, 2023
Merged

Conversation

justinkaseman
Copy link
Contributor

No description provided.

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Go solidity wrappers are out-of-date, regenerate them via the make go-solidity-wrappers command

// NOTE: Optionally, compute additional fee here
return IFunctionsRouter(address(_getRouter())).getAdminFee();
(adminFee, , ) = IFunctionsRouter(address(_getRouter())).getConfig();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Morgan's PR will take over this change

@@ -67,29 +67,10 @@ abstract contract FunctionsClient is IFunctionsClient {
/**
* @inheritdoc IFunctionsClient
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Leaning out FunctionsClient

@@ -365,7 +365,7 @@ abstract contract FunctionsBilling is HasRouter, IFunctionsBilling {

// The Functions Router will perform the callback to the client contract
IFunctionsRouter router = IFunctionsRouter(address(_getRouter()));
(uint8 result, uint96 callbackCostJuels) = router.fulfill(
(FulfillResult resultCode, uint96 callbackCostJuels) = router.fulfill(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Return result code directly rather than uint8

@@ -226,52 +223,43 @@ contract FunctionsRouter is RouterBase, IFunctionsRouter, FunctionsSubscriptions
bytes memory response,
bytes memory err,
uint96 juelsPerGas,
uint96 costWithoutFulfillment,
uint96 costWithoutCallback,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

More accurate name

@@ -7,8 +7,6 @@ import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol";
import {IOwnableRouter} from "./interfaces/IOwnableRouter.sol";

abstract contract HasRouter is ITypeAndVersion, IConfigurable {
bytes32 internal s_configHash;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't care about the config hash anymore?

Copy link
Contributor Author

@justinkaseman justinkaseman Aug 2, 2023

Choose a reason for hiding this comment

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

It provided a safety check where you couldn't double apply the same config, but that's not really a problem. Querying the hash also isn't really use-able information.

So it got removed to reduce gas costs & reduce contract size

KuphJr
KuphJr previously approved these changes Aug 2, 2023
Copy link
Collaborator

@KuphJr KuphJr left a comment

Choose a reason for hiding this comment

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

Overall, I like the changes. It simplifies a lot.

I want someone else to look these contracts over since it is pretty late for me, however I know Steve and Rens are planning to review the refactored contracts tomorrow, so I'll approve such that we can get this merged.

@@ -218,20 +198,19 @@ abstract contract RouterBase is IRouterBase, Pausable, ITypeAndVersion, Confirme
address from = s_route[id];
address to = s_proposedContractSet.to[i];
s_route[id] = to;
emit ContractUpdated(id, from, to);
emit ContractUpdated({
proposedContractSetId: id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why arguments for this event are prefixed "proposed"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed!

@@ -49,14 +45,14 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, ERC677Recei

error TooManyConsumers();
error InsufficientBalance();
error InvalidConsumer(uint64 subscriptionId, address consumer);
error InvalidConsumer();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Losing error args to help with contract size. They aren't super useful anyway.

/**
* @inheritdoc IFunctionsSubscriptions
*/
function getFlags(uint64 subscriptionId) external view returns (bytes32) {
return _getFlags(subscriptionId);
function getFlags(uint64 subscriptionId) public view returns (bytes32) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Saves us a couple bytes

@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Go solidity wrappers are out-of-date, regenerate them via the make go-solidity-wrappers command

* @return Hash of the message data packed as "\x19Ethereum Signed Message\n" + len(msg) + msg
*/
function getEthSignedMessageHash(bytes32 messageHash) external pure returns (bytes32);
function getMessage(address acceptor, address recipient) external pure returns (bytes32);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplifying these

@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate failed

Failed condition 0.0% 0.0% Coverage on New Code (is less than 80%)

See analysis details on SonarQube

@justinkaseman justinkaseman added this pull request to the merge queue Aug 2, 2023
Merged via the queue into develop with commit 600365a Aug 2, 2023
95 checks passed
@justinkaseman justinkaseman deleted the jk/functions_various2 branch August 2, 2023 06:37
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

Go solidity wrappers are out-of-date, regenerate them via the make go-solidity-wrappers command

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