-
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
add readonly address #11906
add readonly address #11906
Conversation
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 |
e825087
to
e2ed701
Compare
Go solidity wrappers are out-of-date, regenerate them via the |
e2ed701
to
5eab36a
Compare
@@ -13,6 +13,7 @@ contract AutomationRegistry2_2_SetUp is BaseTest { | |||
address internal constant LINK_ETH_FEED = 0x1111111111111111111111111111111111111110; | |||
address internal constant FAST_GAS_FEED = 0x1111111111111111111111111111111111111112; | |||
address internal constant LINK_TOKEN = 0x1111111111111111111111111111111111111113; | |||
address internal constant ZERO_ADDRESS = 0x0000000000000000000000000000000000000000; |
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.
try 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.
let's add a test here to expect a revert if someone sends a eth_call with different tx.origin
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.
Sure, will do. @FelixFan1992 can you elaborate a bit more on someone sends a eth_call
? Trying to see what is the best way to cover this scenario. Thanks.
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.
the reason we add this new address is to restrict which address can call checkUpkeep
, simulatePerformUpkeep
etc. only eth_call
from this address is allowed. so we can add a simple testcase for this. maybe just for checkUpkeep
5eab36a
to
2bbb646
Compare
2bbb646
to
eb6f030
Compare
); | ||
|
||
// Expect the call to revert with "OnlySimulatedBackend" error | ||
require(!success, "Expected eth_call to revert for not allowed address"); |
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.
Added this test. Not sure if I am doing it the right way. Looking for comments.
eb6f030
to
e731482
Compare
Go solidity wrappers are out-of-date, regenerate them via the |
e731482
to
12930d4
Compare
12930d4
to
c9c970c
Compare
Go solidity wrappers are out-of-date, regenerate them via the |
c9c970c
to
60da2bd
Compare
60da2bd
to
3f83878
Compare
3f83878
to
8226d04
Compare
Go solidity wrappers are out-of-date, regenerate them via the |
8226d04
to
8e38687
Compare
returns (bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed) | ||
{ | ||
_preventExecution(); |
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 one is unnecessary because checkCallback()
calls executeCallback()
, which already has the modifier :)
function testPreventExecutionOnCheckUpkeep() public { | ||
IAutomationRegistryMaster registry = IAutomationRegistryMaster( | ||
address(deployRegistry2_2(AutomationRegistryBase2_2.Mode(0))) | ||
); | ||
|
||
uint256 id = 1; | ||
bytes memory triggerData = abi.encodePacked("trigger_data"); | ||
|
||
// The tx.origin is the default DEFAULT_SENDER (0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38) of foundry | ||
// Expecting a revert since the tx.origin is not address(0) | ||
vm.expectRevert(abi.encodeWithSelector(IAutomationRegistryMaster.OnlySimulatedBackend.selector)); | ||
registry.checkUpkeep(id, triggerData); | ||
} |
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 test is currently inside of the AutomationRegistry2_2_SetConfig
contract (aka a "test block" in foundry world). I think our plan to organize tests is that each test goes inside a test block for that particular function. So the layout should look like...
contract AutomationRegistry2_2_SetConfig is AutomationRegistry2_2_SetUp {
// all of the setConfig() tests
}
contract AutomationRegistry2_2_CheckUpkeep is AutomationRegistry2_2_SetUp {
// all of the checkUpkeep() tests
}
8e38687
to
0042b62
Compare
SonarQube Quality Gate 0 Bugs No Coverage information |
AUTO-8803
forge test --match-path "*/AutomationRegistry2_2.t.sol"
all foundry tests pass.