-
Notifications
You must be signed in to change notification settings - Fork 5
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: approved relays, jobs and selectors #7
Conversation
…ork-core into refactor/relays-selectors
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.
Looking good. Some extra comments:
- A lot is being managed through constants. This may be prone to error when deploying to multiple chains. I would guess, but not entirely sure, that in different chains the jobs will pay not in
ETH
for example but in the other chain's native token.Keep3r_V2
will be deployed in another address as well. So, perhaps having names such asETH
and events that areETHReceived
may not be 100% compatible with the idea of multi-chain deployment, as well as fixed addresses.
Consider using immutables to at least have the user think through what parameters he's inputting.
- The
GelatoRelay
is powerful. I mean this in the sense that anyAutomationVault
is banking on the protocol's reputation to avoid them from calling a bunch of vaults withFeeData
==vaultBalance
and drain them. Now, one thing we should be extremely careful about is howGelato
itself checks the parameters their own keepers/executors use.
A good question to answer is:
- What happens when a random user tells Gelato: "Hey I have put some money in
1Balance
please callGelatoRelay
with these malicious parameters." Do we know what checks they perform? Do we know if they just obey and do it?
} | ||
|
||
unchecked { | ||
++_i; | ||
} | ||
|
||
// If the relay has no enabled callers, remove it from the list of relays | ||
if (_relayCallers[_relay].length() == 0) { |
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.
This should be outside of the for loop, to avoid rechecking on each iteration.
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.
👍
// Create the new automation vault with the owner | ||
_automationVault = new AutomationVault(_owner); | ||
_automationVault = new AutomationVault{salt: keccak256(abi.encodePacked(msg.sender, _salt))}(_owner); |
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.
This add a bit of extra gas cost, so it's optional but when a CREATE2
deployment fails, it returns address(0)
. You may want to add a check for it to avoid adding address(0)
to the automation vaults mapping
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.
I didnt know nice one 👍
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.
@0xng are we sure that this happens?, im trying to test this situation and when the deployment fails reverts and not return address (0)
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.
@ashitakah interesting, you may be right, I got this idea from the evm.codes CREATE2 line that says:
Deployment can fail due to:
- A contract already exists at the destination address.
- Insufficient value to transfer.
- Sub context reverted.
- Insufficient gas to execute the initialisation code.
- Call depth limit reached.
- Note that these failures only affect the return value and do not cause the calling context to revert (unlike the error cases below).
But also tested one of these cases (contract already exists at the destination address), and it also reverts. So then we should be good without adding the check.
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.
👍 cool
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.
Awesome work @ashitakah!
// Get the list of selectors | ||
_selectors = _relayJobSelectors[_relay][_job].values(); |
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.
Should there be a method to get a relay's approved jobs?
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.
Should be in the front end part. Ardy can collect all jobs and check if the job is for that relay
// Create the exec data needed variables | ||
ExecData memory _execDatum; | ||
ExecData memory _dataToExecute; |
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.
In views of normalization, I suggest naming this variable _dataInfo
.
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.
Also, the naming was review'd
abstract contract Deploy is Script { | ||
abstract contract DeployNativeETH is Script { |
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.
Isn't ETH always native? 🤔
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.
If you deploy in L2 you can choose another native. I know that at the end of the day is the same, however I think that is better to specify that.
function relays() external view returns (address[] memory __relays); | ||
function relays() external view returns (address[] memory _listRelays); |
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.
_relaysList
and _jobsList
sounds better to me.
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.
I changed it because another comments told me that sounds better hahahha
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.
🔥
No description provided.