-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
I see that you haven't updated any README files. Would it make sense to do so? |
Go solidity wrappers are out-of-date, regenerate them via the |
5a6c39d
to
ab3b3a3
Compare
// NOTE: Optionally, compute additional fee here | ||
return IFunctionsRouter(address(_getRouter())).getAdminFee(); | ||
(adminFee, , ) = IFunctionsRouter(address(_getRouter())).getConfig(); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this 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, |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
Go solidity wrappers are out-of-date, regenerate them via the |
* @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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplifying these
Go solidity wrappers are out-of-date, regenerate them via the |
No description provided.