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

RMNHome #1469

Merged
merged 7 commits into from
Sep 27, 2024
Merged

RMNHome #1469

merged 7 commits into from
Sep 27, 2024

Conversation

RensR
Copy link
Collaborator

@RensR RensR commented Sep 26, 2024

New PR to have this be standalone

Copy link
Contributor

github-actions bot commented Sep 26, 2024

LCOV of commit 2cd7d2c during Solidity Foundry #8415

Summary coverage rate:
  lines......: 97.7% (2284 of 2338 lines)
  functions..: 94.6% (421 of 445 functions)
  branches...: 93.6% (543 of 580 branches)

Files changed coverage rate: n/a

Copy link
Collaborator

@connorwstein connorwstein left a comment

Choose a reason for hiding this comment

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

Think we should allow only state transitions we want:

  • init->candidate
  • candidate->active
  • active->init
  • active->active/candidate
  • active/candidate->active
  • active/candidate->active/candidate

then revert on everything else

contracts/src/v0.8/ccip/rmn/RMNHome.sol Outdated Show resolved Hide resolved
contracts/src/v0.8/ccip/rmn/RMNHome.sol Outdated Show resolved Hide resolved
/// in case one of the configs is too large to be returnable by one of the other getters.
/// @param configDigest The digest of the config to fetch.
/// @return versionedConfig The config and its version.
/// @return ok True if the config was found, false otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering if this is needed, won't configDigest on the VersionedConfig be ZERO_DIGEST which is always an invalid digest and hence config does not exist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is true, but using the bool is more explicit. It's not strictly needed but I kinda like it.

contracts/src/v0.8/ccip/rmn/RMNHome.sol Outdated Show resolved Hide resolved
contracts/src/v0.8/ccip/rmn/RMNHome.sol Outdated Show resolved Hide resolved
(PREFIX & PREFIX_MASK)
| (
uint256(
keccak256(bytes.concat(abi.encode(bytes32("EVM"), block.chainid, address(this), version), staticConfig))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is staticConfig bytes.concat'd and not abi.encode'd?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Both components are already abi.encoded. Afaik this should not compromise anything as the first section is all static length anyway

contracts/src/v0.8/ccip/rmn/RMNHome.sol Outdated Show resolved Hide resolved
/// - Init: promoteCandidateAndRevokeActive(), as there is no config to promote.
/// - Init: revokeCandidate(), as there is no config to revoke
/// - Active: revokeCandidate(), as there is no candidate to revoke
/// Note that we explicitly do allow promoteCandidateAndRevokeActive() to be called when there is an active config but
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd maybe add one more note (for completeness), that the other state transitions ActiveAndCandidate->Init, Candidate -> Init are not possible in one step given the transition functions available. Alternatively would be more clear to have a little ascii diagram

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to cute ascii diagram with state transitions.

@RensR RensR merged commit bf72809 into ccip-develop Sep 27, 2024
126 checks passed
@RensR RensR deleted the rmn-home-final branch September 27, 2024 16:31
@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

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

See analysis details on SonarQube

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.

4 participants