-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add legacy fallback to RMNRemote (#15422)
* add legacy fallback to RMNRemote * changeset * [Bot] Update changeset file with jira issues * allow address 0 * fix solhint --------- Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
- Loading branch information
1 parent
cb194d7
commit 3cecd5f
Showing
9 changed files
with
132 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'@chainlink/contracts': patch | ||
--- | ||
|
||
add legacy fallback to RMN | ||
|
||
|
||
PR issue: CCIP-4261 | ||
|
||
Solidity Review issue: CCIP-3966 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
contracts/src/v0.8/ccip/test/rmn/RMNRemote/RMNRemote.constructor.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.24; | ||
|
||
import {RMNRemote} from "../../../rmn/RMNRemote.sol"; | ||
import {RMNRemoteSetup} from "./RMNRemoteSetup.t.sol"; | ||
|
||
contract RMNRemote_constructor is RMNRemoteSetup { | ||
function test_constructor_success() public view { | ||
function test_constructor() public view { | ||
assertEq(s_rmnRemote.getLocalChainSelector(), 1); | ||
} | ||
|
||
function test_constructor_zeroChainSelector_reverts() public { | ||
vm.expectRevert(RMNRemote.ZeroValueNotAllowed.selector); | ||
new RMNRemote(0); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
contracts/src/v0.8/ccip/test/rmn/RMNRemote/RMNRemote.isBlessed.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.24; | ||
|
||
import {IRMN} from "../../../interfaces/IRMN.sol"; | ||
|
||
import {RMNRemote} from "../../../rmn/RMNRemote.sol"; | ||
import {RMNRemoteSetup} from "./RMNRemoteSetup.t.sol"; | ||
|
||
contract RMNRemote_isBlessed is RMNRemoteSetup { | ||
function test_isBlessed() public { | ||
IRMN.TaggedRoot memory taggedRoot = IRMN.TaggedRoot({root: keccak256("root"), commitStore: makeAddr("commitStore")}); | ||
|
||
vm.mockCall( | ||
address(s_legacyRMN), abi.encodeWithSelector(s_legacyRMN.isBlessed.selector, taggedRoot), abi.encode(true) | ||
); | ||
|
||
assertTrue(s_rmnRemote.isBlessed(taggedRoot)); | ||
|
||
vm.mockCall( | ||
address(s_legacyRMN), abi.encodeWithSelector(s_legacyRMN.isBlessed.selector, taggedRoot), abi.encode(false) | ||
); | ||
|
||
assertFalse(s_rmnRemote.isBlessed(taggedRoot)); | ||
} | ||
|
||
function test_isBlessed_RevertWhen_IsBlessedNotAvailable() public { | ||
IRMN.TaggedRoot memory taggedRoot = IRMN.TaggedRoot({root: keccak256("root"), commitStore: makeAddr("commitStore")}); | ||
|
||
s_rmnRemote = new RMNRemote(100, IRMN(address(0))); | ||
|
||
vm.expectRevert(RMNRemote.IsBlessedNotAvailable.selector); | ||
s_rmnRemote.isBlessed(taggedRoot); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters