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

[WIP] RMNHome #1443

Closed
wants to merge 40 commits into from
Closed

[WIP] RMNHome #1443

wants to merge 40 commits into from

Conversation

RensR
Copy link
Collaborator

@RensR RensR commented Sep 16, 2024

Make RMNHome production ready

Copy link
Contributor

github-actions bot commented Sep 16, 2024

LCOV of commit 2894740 during Solidity Foundry #8203

Summary coverage rate:
  lines......: 97.8% (2262 of 2314 lines)
  functions..: 95.0% (420 of 442 functions)
  branches...: 93.6% (537 of 574 branches)

Files changed coverage rate: n/a

@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@RyanRHall RyanRHall force-pushed the CCIP-3379-productionize-rmn-remote-and-rmn-home-contracts branch from 2804858 to f3454c4 Compare September 16, 2024 16:47
uint64 minObservers; // required to agree on an observation for this source chain
uint64 chainSelector; // ─────╮ The Source chain selector.
uint64 minObservers; // ──────╯ Required number of observers to agree on an observation for this source chain.
uint256 observerNodesBitmap; // ObserverNodesBitmap & (1<<i) == (1<<i) iff nodes[i] is an observer for this source chain.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit to aid in understanding

Suggested change
uint256 observerNodesBitmap; // ObserverNodesBitmap & (1<<i) == (1<<i) iff nodes[i] is an observer for this source chain.
uint256 observerNodesBitmap; // ObserverNodesBitmap & (1<<i) == (1<<i) iff Config.nodes[i] is an observer for this source chain.

bytes32 s_latestConfigDigest;
string public constant override typeAndVersion = "RMNHome 1.6.0-dev";

/// @notice The max number of configs that can be active at the same time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can place the reasoning for 3 under a @dev comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be helpful for the auditors too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 is not final, still figuring out the number

Comment on lines +149 to +151
/// @notice Revokes past configs, so that only the latest config remains. Call to promote staging to production. If
/// the latest config that was set through setConfig, was subsequently revoked through revokeConfig, this function
/// will revoke _all_ configs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to understand what is staging and what is production when the ring buffer size is 3 - is staging s_latestConfigIndex and production s_latestConfigIndex - 1 if s_latestConfigIndex > 0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// s_latestConfigIndex == 0
setConfig(...); // v1. s_latestConfigIndex == 0, this is the production config because its the only one
setConfig(...); // v2. s_latestConfigIndex == 1, this is the staging config because there's already a config from before thats not revoked
setConfig(...); // v3. s_latestConfigIndex == 2, this is the staging staging config? only used if staging sucks?
revokeAllConfigsButLatest(); // v1 and v2 revoked, only v3 is valid. 

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no set index for each, it can be whatever you make it. Which is maybe a good and maybe a bad thing. Let's discuss

Comment on lines +10 to 11
/// @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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add a getter for this? That way we don't have to duplicate this constant offchain and nodes can fetch it as part of reading from the remote.

@RyanRHall RyanRHall force-pushed the CCIP-3379-productionize-rmn-remote-and-rmn-home-contracts branch 3 times, most recently from 3e57295 to f39440a Compare September 16, 2024 20:47
Comment on lines +216 to +219
/// @param offset setting to 0 will put the newest config in the last position of the returned array, setting to 1
/// will put the second newest config in the last position, and so on
/// @param limit len(versionedConfigsWithDigests) <= limit, set to 1 to get just the latest config,
/// set to CONFIG_RING_BUFFER_SIZE to ensure that all configs are returned
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it just me or does this seem unnecessarily complicated? Why not just return it in a specific order and offchain can re-order if needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might even simplify the code below.

@RyanRHall RyanRHall force-pushed the CCIP-3379-productionize-rmn-remote-and-rmn-home-contracts branch from 4d52586 to 57da48d Compare September 17, 2024 17:44
Base automatically changed from CCIP-3379-productionize-rmn-remote-and-rmn-home-contracts to ccip-develop September 18, 2024 07:36
@RensR RensR closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants