Skip to content
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

CCIP-4058 replace f with fObserve and fSign in RMHome and RMNRemote #15605

Merged
merged 47 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
dd7920b
replace f with fObserve in RMHome and RMNRemote
jhweintraub Dec 10, 2024
ead9934
Merge dd7920b789d87c67c82e54feb01ca5cc24c3a010 into 4eca0ec7a7fcf23fb…
jhweintraub Dec 10, 2024
61788f7
Update gethwrappers
app-token-issuer-infra-releng[bot] Dec 10, 2024
9766420
rename fObserve to fSign
jhweintraub Dec 10, 2024
a6062f9
fix off-chain components of renaming RMN parameters
jhweintraub Dec 11, 2024
3d4470b
core changeset
jhweintraub Dec 11, 2024
6317ac7
Merge branch 'develop' into fix/renamefObserve_rmn
carte7000 Dec 12, 2024
596ce8d
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Dec 12, 2024
ffc8ce9
update missing file for new parameter name
jhweintraub Dec 12, 2024
e9cf869
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Dec 13, 2024
9170dbd
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Dec 13, 2024
9153f63
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Dec 16, 2024
87eb8d8
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Dec 17, 2024
69d47ae
fix wrappers
jhweintraub Dec 17, 2024
0d9f48f
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Dec 19, 2024
f485c5e
fix merge conflict broken text
jhweintraub Dec 19, 2024
50ba4f9
Merge f485c5e1f167f333aed0c7d4691d58bdfec13e6b into 72fd6a44c03e125d9…
jhweintraub Dec 19, 2024
fe5d947
Update gethwrappers
app-token-issuer-infra-releng[bot] Dec 19, 2024
a0bfff7
attempt fix json export tag
jhweintraub Dec 19, 2024
4cf5273
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Jan 6, 2025
97ee19a
Merge 4cf527337e7a4d00e9971add553f2eaf02f07262 into eb8bb6cd5a158ce78…
jhweintraub Jan 6, 2025
05a4e90
Update gethwrappers
app-token-issuer-infra-releng[bot] Jan 6, 2025
bf3f4cb
upgrade cl-ccip and fix test
dimkouv Jan 8, 2025
b7758c9
upgrade cl-ccip@main
dimkouv Jan 8, 2025
ec3e140
upgrade cl-ccip@main
dimkouv Jan 8, 2025
f308f59
fix test
dimkouv Jan 8, 2025
d99e573
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Jan 8, 2025
e60de77
upgrade cl-ccip@main
dimkouv Jan 8, 2025
48b46e9
Merge d99e5739d3afa17296af27e7f2f8b38d8264023d into fcefd62068d6be4fe…
jhweintraub Jan 8, 2025
f9ca50e
Update gethwrappers
app-token-issuer-infra-releng[bot] Jan 8, 2025
f3f4592
upgrade chainlink ccip
asoliman92 Jan 9, 2025
3bae747
Merge pull request #15860 from smartcontractkit/dk/audit-fixes
dimkouv Jan 9, 2025
9a206f6
DEVSVCS-1087: remove unused automation hardhat tests (#15847)
FelixFan1992 Jan 8, 2025
51c5d56
CCIP Config backported from CCIP repo (#15856)
mateusz-sekara Jan 8, 2025
cdc2025
Remove panic recovery for wsrpc (#15865)
samsondav Jan 8, 2025
4dd2fcc
Added is_backfiled filed to solana's filter table (#15796)
dhaidashenko Jan 8, 2025
f09e402
Extract MultiNode to chainlink-framework (#15791)
DylanTinianov Jan 8, 2025
8adb27e
improve peer group dialer sync function logs (#15867)
dimkouv Jan 9, 2025
6c0f172
Solana devnet spin up in memory env (A) (#15831)
yashnevatia Jan 9, 2025
45d34c3
upgrade chainlink ccip fixing router binding issues in migration
asoliman92 Jan 9, 2025
fb3787f
Merge branch 'develop' into fix/renamefObserve_rmn
asoliman92 Jan 9, 2025
ccbaad0
upgrade chainlink ccip fixing router binding issues in migration
asoliman92 Jan 9, 2025
0cc0219
fix comment
jhweintraub Jan 9, 2025
f27865f
Merge branch 'develop' into fix/renamefObserve_rmn
jhweintraub Jan 9, 2025
f27b667
gomodtidy and formatting fix
jhweintraub Jan 9, 2025
3180337
update go mod file for newest cl-ccip
jhweintraub Jan 9, 2025
2c4db2b
update comment
jhweintraub Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-lizards-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Changed RMNRemote and RMNHome parameter f to fObserve and fSign #updated
5 changes: 5 additions & 0 deletions contracts/.changeset/stale-dots-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/contracts': patch
---

replace f with fObserve in RMNHome and RMNRemote and update all tests CCIP-4058
4 changes: 2 additions & 2 deletions contracts/src/v0.8/ccip/rmn/RMNHome.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ contract RMNHome is Ownable2StepMsgSender, ITypeAndVersion {

struct SourceChain {
uint64 chainSelector; // ─╮ The Source chain selector.
uint64 f; // ─────────────╯ Maximum number of faulty observers; f+1 observers required to agree on an observation for this source chain.
uint64 fObserve; // ──────╯ Maximum number of faulty observers; f+1 observers required to agree on an observation for this source chain.
uint256 observerNodesBitmap; // ObserverNodesBitmap & (1<<i) == (1<<i) iff StaticConfig.nodes[i] is an observer for this source chain.
}

Expand Down Expand Up @@ -387,7 +387,7 @@ contract RMNHome is Ownable2StepMsgSender, ITypeAndVersion {
}

// min observers are tenable.
if (observersCount < 2 * currentSourceChain.f + 1) {
if (observersCount < 2 * currentSourceChain.fObserve + 1) {
revert NotEnoughObservers();
}
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/v0.8/ccip/rmn/RMNRemote.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract RMNRemote is Ownable2StepMsgSender, ITypeAndVersion, IRMNRemote, IRMN {
struct Config {
bytes32 rmnHomeContractConfigDigest; // Digest of the RMNHome contract config.
Signer[] signers; // List of signers.
uint64 f; // Max number of faulty RMN nodes; f+1 signers are required to verify a report, must configure 2f+1 signers in total.
uint64 fSign; // Max number of faulty RMN nodes; f+1 signers are required to verify a report, must configure 2f+1 signers in total.
}

/// @dev part of the payload that RMN nodes sign: keccak256(abi.encode(RMN_V1_6_ANY2EVM_REPORT, report)).
Expand Down Expand Up @@ -101,7 +101,7 @@ contract RMNRemote is Ownable2StepMsgSender, ITypeAndVersion, IRMNRemote, IRMN {
if (s_configCount == 0) {
revert ConfigNotSet();
}
if (signatures.length < s_config.f + 1) revert ThresholdNotMet();
if (signatures.length < s_config.fSign + 1) revert ThresholdNotMet();

bytes32 digest = keccak256(
abi.encode(
Expand Down Expand Up @@ -150,7 +150,7 @@ contract RMNRemote is Ownable2StepMsgSender, ITypeAndVersion, IRMNRemote, IRMN {
}

// min signers requirement is tenable.
if (newConfig.signers.length < 2 * newConfig.f + 1) {
if (newConfig.signers.length < 2 * newConfig.fSign + 1) {
revert NotEnoughSigners();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract RMNHome_revokeCandidate is RMNHomeTestSetup {
bytes32 digest = s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST);
s_rmnHome.promoteCandidateAndRevokeActive(digest, ZERO_DIGEST);

config.dynamicConfig.sourceChains[1].f--;
config.dynamicConfig.sourceChains[1].fObserve--;
s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract RMNHome_setCandidate is RMNHomeTestSetup {
for (uint256 i = 0; i < storedDynamicConfig.sourceChains.length; i++) {
RMNHome.SourceChain memory storedSourceChain = storedDynamicConfig.sourceChains[i];
assertEq(storedSourceChain.chainSelector, versionedConfig.dynamicConfig.sourceChains[i].chainSelector);
assertEq(storedSourceChain.f, versionedConfig.dynamicConfig.sourceChains[i].f);
assertEq(storedSourceChain.fObserve, versionedConfig.dynamicConfig.sourceChains[i].fObserve);
assertEq(storedSourceChain.observerNodesBitmap, versionedConfig.dynamicConfig.sourceChains[i].observerNodesBitmap);
}
assertEq(storedDynamicConfig.offchainConfig, versionedConfig.dynamicConfig.offchainConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract RMNHome_setDynamicConfig is RMNHomeTestSetup {
(bytes32 priorActiveDigest,) = s_rmnHome.getConfigDigests();

Config memory config = _getBaseConfig();
config.dynamicConfig.sourceChains[1].f--;
config.dynamicConfig.sourceChains[1].fObserve--;

(, bytes32 candidateConfigDigest) = s_rmnHome.getConfigDigests();

Expand All @@ -27,7 +27,9 @@ contract RMNHome_setDynamicConfig is RMNHomeTestSetup {

(RMNHome.VersionedConfig memory storedVersionedConfig, bool ok) = s_rmnHome.getConfig(candidateConfigDigest);
assertTrue(ok);
assertEq(storedVersionedConfig.dynamicConfig.sourceChains[0].f, config.dynamicConfig.sourceChains[0].f);
assertEq(
storedVersionedConfig.dynamicConfig.sourceChains[0].fObserve, config.dynamicConfig.sourceChains[0].fObserve
);

// Asser the digests don't change when updating the dynamic config
(bytes32 activeDigest, bytes32 candidateDigest) = s_rmnHome.getConfigDigests();
Expand All @@ -38,7 +40,7 @@ contract RMNHome_setDynamicConfig is RMNHomeTestSetup {
// Asserts the validation function is being called
function test_RevertWhen_setDynamicConfig_MinObserversTooHigh() public {
Config memory config = _getBaseConfig();
config.dynamicConfig.sourceChains[0].f++;
config.dynamicConfig.sourceChains[0].fObserve++;

vm.expectRevert(abi.encodeWithSelector(RMNHome.DigestNotFound.selector, ZERO_DIGEST));
s_rmnHome.setDynamicConfig(config.dynamicConfig, ZERO_DIGEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract RMNHome_validateStaticAndDynamicConfig is RMNHomeTestSetup {

function test_RevertWhen_validateStaticAndDynamicConfig_NotEnoughObservers() public {
Config memory config = _getBaseConfig();
config.dynamicConfig.sourceChains[0].f++;
config.dynamicConfig.sourceChains[0].fObserve++;

vm.expectRevert(RMNHome.NotEnoughObservers.selector);
s_rmnHome.setCandidate(config.staticConfig, config.dynamicConfig, ZERO_DIGEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ contract RMNHomeTestSetup is Test {

RMNHome.SourceChain[] memory sourceChains = new RMNHome.SourceChain[](2);
// Observer 0 for source chain 9000
sourceChains[0] = RMNHome.SourceChain({chainSelector: 9000, f: 1, observerNodesBitmap: 1 << 0 | 1 << 1 | 1 << 2});
sourceChains[0] =
RMNHome.SourceChain({chainSelector: 9000, fObserve: 1, observerNodesBitmap: 1 << 0 | 1 << 1 | 1 << 2});
// Observers 0, 1 and 2 for source chain 9001
sourceChains[1] = RMNHome.SourceChain({chainSelector: 9001, f: 1, observerNodesBitmap: 1 << 0 | 1 << 1 | 1 << 2});
sourceChains[1] =
RMNHome.SourceChain({chainSelector: 9001, fObserve: 1, observerNodesBitmap: 1 << 0 | 1 << 1 | 1 << 2});

return Config({
staticConfig: RMNHome.StaticConfig({nodes: nodes, offchainConfig: abi.encode("static_config")}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {RMNRemoteSetup} from "./RMNRemoteSetup.t.sol";
contract RMNRemote_setConfig is RMNRemoteSetup {
function test_RevertWhen_setConfig_ZeroValueNotAllowed() public {
RMNRemote.Config memory config =
RMNRemote.Config({rmnHomeContractConfigDigest: bytes32(0), signers: s_signers, f: 1});
RMNRemote.Config({rmnHomeContractConfigDigest: bytes32(0), signers: s_signers, fSign: 1});

vm.expectRevert(RMNRemote.ZeroValueNotAllowed.selector);

Expand All @@ -18,7 +18,7 @@ contract RMNRemote_setConfig is RMNRemoteSetup {
uint32 currentConfigVersion = 0;
uint256 numSigners = s_signers.length;
RMNRemote.Config memory config =
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, f: 1});
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, fSign: 1});

vm.expectEmit();
emit RMNRemote.ConfigSet(++currentConfigVersion, config);
Expand All @@ -28,7 +28,7 @@ contract RMNRemote_setConfig is RMNRemoteSetup {
// add a signer
address newSigner = makeAddr("new signer");
s_signers.push(RMNRemote.Signer({onchainPublicKey: newSigner, nodeIndex: uint64(numSigners)}));
config = RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, f: 1});
config = RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, fSign: 1});

vm.expectEmit();
emit RMNRemote.ConfigSet(++currentConfigVersion, config);
Expand All @@ -44,7 +44,7 @@ contract RMNRemote_setConfig is RMNRemoteSetup {
// remove two signers
s_signers.pop();
s_signers.pop();
config = RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, f: 1});
config = RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, fSign: 1});

vm.expectEmit();
emit RMNRemote.ConfigSet(++currentConfigVersion, config);
Expand All @@ -59,7 +59,7 @@ contract RMNRemote_setConfig is RMNRemoteSetup {
function test_RevertWhen_setConfig_invalidSignerOrder() public {
s_signers.push(RMNRemote.Signer({onchainPublicKey: address(4), nodeIndex: 0}));
RMNRemote.Config memory config =
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, f: 1});
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, fSign: 1});

vm.expectRevert(RMNRemote.InvalidSignerOrder.selector);
s_rmnRemote.setConfig(config);
Expand All @@ -69,7 +69,7 @@ contract RMNRemote_setConfig is RMNRemoteSetup {
RMNRemote.Config memory config = RMNRemote.Config({
rmnHomeContractConfigDigest: _randomBytes32(),
signers: s_signers,
f: uint64(s_signers.length / 2) // at least 2f+1 is required
fSign: uint64(s_signers.length / 2) // at least 2f+1 is required
});

vm.expectRevert(RMNRemote.NotEnoughSigners.selector);
Expand All @@ -79,7 +79,7 @@ contract RMNRemote_setConfig is RMNRemoteSetup {
function test_RevertWhen_setConfig_duplicateOnChainPublicKey() public {
s_signers.push(RMNRemote.Signer({onchainPublicKey: s_signerWallets[0].addr, nodeIndex: uint64(s_signers.length)}));
RMNRemote.Config memory config =
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, f: 1});
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, fSign: 1});

vm.expectRevert(RMNRemote.DuplicateOnchainPublicKey.selector);
s_rmnRemote.setConfig(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract RMNRemote_verify_withConfigSet is RMNRemoteSetup {
super.setUp();

RMNRemote.Config memory config =
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, f: 3});
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, fSign: 3});
s_rmnRemote.setConfig(config);
_generatePayloadAndSigs(2, 4);
}
Expand Down Expand Up @@ -55,7 +55,7 @@ contract RMNRemote_verify_withConfigSet is RMNRemoteSetup {

function test_verify_RevertWhen_ThresholdNotMet() public {
RMNRemote.Config memory config =
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, f: 2}); // 3 = f+1 sigs required
RMNRemote.Config({rmnHomeContractConfigDigest: _randomBytes32(), signers: s_signers, fSign: 2}); // 3 = f+1 sigs required
s_rmnRemote.setConfig(config);

_generatePayloadAndSigs(2, 2); // 2 sigs generated, but 3 required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func GenerateRMNHomeConfigs(
SourceChains: []rmn_home.RMNHomeSourceChain{
{
ChainSelector: chainSelector,
F: f,
FObserve: f,
ObserverNodesBitmap: observerBitmap,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import (
ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big"
"github.com/smartcontractkit/chainlink/v2/core/utils/testutils/heavyweight"

"github.com/smartcontractkit/chainlink-common/pkg/types"

"github.com/smartcontractkit/chainlink-ccip/pkg/contractreader"
"github.com/smartcontractkit/chainlink-ccip/pkg/reader"
cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"
"github.com/smartcontractkit/chainlink-common/pkg/types"

evmconfig "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/configs/evm"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
Expand Down Expand Up @@ -195,7 +196,7 @@ func Test_USDCReader_MessageHashes(t *testing.T) {

for _, tc := range tt {
t.Run(tc.name, func(t *testing.T) {
hashes, err1 := usdcReader.MessageHashes(ctx, tc.sourceChain, tc.destChain, tc.tokens)
hashes, err1 := usdcReader.MessagesByTokenID(ctx, tc.sourceChain, tc.destChain, tc.tokens)
require.NoError(t, err1)

require.Equal(t, len(tc.expectedMsgIDs), len(hashes))
Expand Down Expand Up @@ -270,7 +271,7 @@ func Benchmark_MessageHashes(b *testing.B) {
b.ResetTimer()

for i := 0; i < b.N; i++ {
hashes, err := usdcReader.MessageHashes(ctx, sourceChain, destChain, tokens)
hashes, err := usdcReader.MessagesByTokenID(ctx, sourceChain, destChain, tokens)
require.NoError(b, err)
require.Len(b, hashes, tc.tokenCount) // Ensure the number of matches is as expected
}
Expand Down
Loading
Loading