Skip to content

Commit

Permalink
Add RMN_V1_6_ANY2EVM_REPORT to RMNRemote and make public (#1447)
Browse files Browse the repository at this point in the history
## Motivation

#1431 (comment)

## Solution
Expose the constant as public
  • Loading branch information
RyanRHall authored Sep 18, 2024
1 parent f95dce6 commit 0a2d960
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 14 deletions.
12 changes: 6 additions & 6 deletions contracts/gas-snapshots/ccip.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -810,25 +810,25 @@ PingPong_plumbing:test_Pausing_Success() (gas: 17810)
PingPong_startPingPong:test_StartPingPong_With_OOO_Success() (gas: 162091)
PingPong_startPingPong:test_StartPingPong_With_Sequenced_Ordered_Success() (gas: 181509)
RMNRemote_constructor:test_constructor_success() (gas: 8334)
RMNRemote_constructor:test_constructor_zeroChainSelector_reverts() (gas: 59151)
RMNRemote_constructor:test_constructor_zeroChainSelector_reverts() (gas: 59165)
RMNRemote_curse:test_curse_AlreadyCursed_duplicateSubject_reverts() (gas: 154457)
RMNRemote_curse:test_curse_calledByNonOwner_reverts() (gas: 18780)
RMNRemote_curse:test_curse_success() (gas: 149164)
RMNRemote_global_and_legacy_curses:test_global_and_legacy_curses_success() (gas: 133319)
RMNRemote_curse:test_curse_success() (gas: 149365)
RMNRemote_global_and_legacy_curses:test_global_and_legacy_curses_success() (gas: 133464)
RMNRemote_setConfig:test_setConfig_addSigner_removeSigner_success() (gas: 976479)
RMNRemote_setConfig:test_setConfig_duplicateOnChainPublicKey_reverts() (gas: 323272)
RMNRemote_setConfig:test_setConfig_invalidSignerOrder_reverts() (gas: 80138)
RMNRemote_setConfig:test_setConfig_minSignersIs0_success() (gas: 700548)
RMNRemote_setConfig:test_setConfig_minSignersTooHigh_reverts() (gas: 54024)
RMNRemote_uncurse:test_uncurse_NotCursed_duplicatedUncurseSubject_reverts() (gas: 51912)
RMNRemote_uncurse:test_uncurse_calledByNonOwner_reverts() (gas: 18748)
RMNRemote_uncurse:test_uncurse_success() (gas: 40044)
RMNRemote_uncurse:test_uncurse_success() (gas: 40151)
RMNRemote_verify_withConfigNotSet:test_verify_reverts() (gas: 13650)
RMNRemote_verify_withConfigSet:test_verify_InvalidSignature_reverts() (gas: 78519)
RMNRemote_verify_withConfigSet:test_verify_OutOfOrderSignatures_duplicateSignature_reverts() (gas: 76336)
RMNRemote_verify_withConfigSet:test_verify_OutOfOrderSignatures_not_sorted_reverts() (gas: 83399)
RMNRemote_verify_withConfigSet:test_verify_ThresholdNotMet_reverts() (gas: 152265)
RMNRemote_verify_withConfigSet:test_verify_UnexpectedSigner_reverts() (gas: 386487)
RMNRemote_verify_withConfigSet:test_verify_ThresholdNotMet_reverts() (gas: 153002)
RMNRemote_verify_withConfigSet:test_verify_UnexpectedSigner_reverts() (gas: 387667)
RMNRemote_verify_withConfigSet:test_verify_minSignersIsZero_success() (gas: 184524)
RMNRemote_verify_withConfigSet:test_verify_success() (gas: 68207)
RMN_constructor:test_Constructor_Success() (gas: 48994)
Expand Down
12 changes: 9 additions & 3 deletions contracts/src/v0.8/ccip/rmn/RMNRemote.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import {OwnerIsCreator} from "../../shared/access/OwnerIsCreator.sol";
import {EnumerableSet} from "../../shared/enumerable/EnumerableSetWithBytes16.sol";
import {Internal} from "../libraries/Internal.sol";

/// @dev this is included in the preimage of the digest that RMN nodes sign
bytes32 constant RMN_V1_6_ANY2EVM_REPORT = keccak256("RMN_V1_6_ANY2EVM_REPORT");

/// @dev An active curse on this subject will cause isCursed() to return true. Use this subject if there is an issue with a
/// remote chain, for which there exists a legacy lane contract deployed on the same chain as this RMN contract is
/// deployed, relying on isCursed().
Expand Down Expand Up @@ -66,6 +63,9 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 {
Internal.MerkleRoot[] merkleRoots; // The dest lane updates
}

/// @dev this is included in the preimage of the digest that RMN nodes sign
bytes32 private constant RMN_V1_6_ANY2EVM_REPORT = keccak256("RMN_V1_6_ANY2EVM_REPORT");

string public constant override typeAndVersion = "RMNRemote 1.6.0-dev";
uint64 internal immutable i_localChainSelector;

Expand Down Expand Up @@ -174,6 +174,12 @@ contract RMNRemote is OwnerIsCreator, ITypeAndVersion, IRMNV2 {
return i_localChainSelector;
}

/// @notice Returns the 32 byte header used in computing the report digest
/// @return digestHeader the digest header
function getReportDigestHeader() external pure returns (bytes32 digestHeader) {
return RMN_V1_6_ANY2EVM_REPORT;
}

// ================================================================
// │ Cursing │
// ================================================================
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/v0.8/ccip/test/rmn/RMNRemoteSetup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.24;

import {IRMNV2} from "../../interfaces/IRMNV2.sol";
import {Internal} from "../../libraries/Internal.sol";
import {RMNRemote, RMN_V1_6_ANY2EVM_REPORT} from "../../rmn/RMNRemote.sol";
import {RMNRemote} from "../../rmn/RMNRemote.sol";
import {BaseTest} from "../BaseTest.t.sol";
import {Vm} from "forge-std/Vm.sol";

Expand Down Expand Up @@ -107,7 +107,7 @@ contract RMNRemoteSetup is BaseTest {
(, RMNRemote.Config memory config) = s_rmnRemote.getVersionedConfig();
bytes32 digest = keccak256(
abi.encode(
RMN_V1_6_ANY2EVM_REPORT,
s_rmnRemote.getReportDigestHeader(),
RMNRemote.Report({
destChainId: block.chainid,
destChainSelector: s_rmnRemote.getLocalChainSelector(),
Expand Down
28 changes: 26 additions & 2 deletions core/gethwrappers/ccip/generated/rmn_remote/rmn_remote.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ registry_module_owner_custom: ../../../contracts/solc/v0.8.24/RegistryModuleOwne
report_codec: ../../../contracts/solc/v0.8.24/ReportCodec/ReportCodec.abi ../../../contracts/solc/v0.8.24/ReportCodec/ReportCodec.bin 7413576693f76bac7c01fbaec4a161d37a1de51b13dcab78455d2c484ed938b1
rmn_contract: ../../../contracts/solc/v0.8.24/RMN/RMN.abi ../../../contracts/solc/v0.8.24/RMN/RMN.bin 8b45b0fb08631c6b582fd3c0b4052a79cc2b4e091e6286af1ab131bef63661f9
rmn_proxy_contract: ../../../contracts/solc/v0.8.24/ARMProxy/ARMProxy.abi ../../../contracts/solc/v0.8.24/ARMProxy/ARMProxy.bin b048d8e752e3c41113ebb305c1efa06737ad36b4907b93e627fb0a3113023454
rmn_remote: ../../../contracts/solc/v0.8.24/RMNRemote/RMNRemote.abi ../../../contracts/solc/v0.8.24/RMNRemote/RMNRemote.bin ed08711d211cbe7e2ed389838864a33044fa5a95c4a2fcdeb4ac049d1c225475
rmn_remote: ../../../contracts/solc/v0.8.24/RMNRemote/RMNRemote.abi ../../../contracts/solc/v0.8.24/RMNRemote/RMNRemote.bin 515b0b7038284f8970edddf58d23cd1492237206dbe047dcbe045248db07e8a5
router: ../../../contracts/solc/v0.8.24/Router/Router.abi ../../../contracts/solc/v0.8.24/Router/Router.bin 2e4f0a7826c8abb49d882bb49fc5ff20a186dbd3137624b9097ffed903ae4888
self_funded_ping_pong: ../../../contracts/solc/v0.8.24/SelfFundedPingPong/SelfFundedPingPong.abi ../../../contracts/solc/v0.8.24/SelfFundedPingPong/SelfFundedPingPong.bin 8ea5d75dbc3f8afd90d22c4a665a94e02892259cd16520c1c6b4cf0dc80c9148
token_admin_registry: ../../../contracts/solc/v0.8.24/TokenAdminRegistry/TokenAdminRegistry.abi ../../../contracts/solc/v0.8.24/TokenAdminRegistry/TokenAdminRegistry.bin 942be7d1681ac102e0615bee13f76838ebb0b261697cf1270d2bf82c12e57aeb
Expand Down

0 comments on commit 0a2d960

Please sign in to comment.