Skip to content

Commit

Permalink
MultiOffRamp - merge MultiCommitStore (#987)
Browse files Browse the repository at this point in the history
## Motivation
Directly merges the MultiOffRamp with the MultiCommitStore to benefit
from the locality of the commit & execution reporting in one contract

## Solution
* Copies over the functions and tests from the MultiCommitStore
* Simplifies shared configuration
* `_verify` is now an internal function only used locally in execution
* Fix: Implements a `_afterOCR3ConfigSet` to clear the
`s_latestPriceEpochAndRound` for the CommitStore - since this was
previously only done on the `_beforeConfigSet` hook, which is no longer
present

Current size margin is -2.604KB. Optimizations are out of scope for this
PR.
  • Loading branch information
elatoskinas authored Jun 13, 2024
1 parent b8ad704 commit 974da41
Show file tree
Hide file tree
Showing 23 changed files with 2,270 additions and 3,926 deletions.
5 changes: 5 additions & 0 deletions contracts/.changeset/stale-cows-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chainlink/contracts-ccip": minor
---

#updated Merge MultiCommitStore into MultiOffRamp
319 changes: 161 additions & 158 deletions contracts/gas-snapshots/ccip.gas-snapshot

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ compileContract ccip/applications/EtherSenderReceiver.sol
compileContract ccip/onRamp/EVM2EVMMultiOnRamp.sol
compileContract ccip/onRamp/EVM2EVMOnRamp.sol
compileContract ccip/CommitStore.sol
compileContract ccip/MultiCommitStore.sol
compileContract ccip/MultiAggregateRateLimiter.sol
compileContract ccip/Router.sol
compileContract ccip/PriceRegistry.sol
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/CommitStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ contract CommitStore is ICommitStore, ITypeAndVersion, OCR2Base {
uint64 private s_minSeqNr = 1;
/// @dev The epoch and round of the last report
uint40 private s_latestPriceEpochAndRound;
/// @dev Whether this OnRamp is paused or not
/// @dev Whether this CommitStore is paused or not
bool private s_paused = false;
// merkleRoot => timestamp when received
mapping(bytes32 merkleRoot => uint256 timestamp) private s_roots;
Expand Down
365 changes: 0 additions & 365 deletions contracts/src/v0.8/ccip/MultiCommitStore.sol

This file was deleted.

25 changes: 0 additions & 25 deletions contracts/src/v0.8/ccip/interfaces/IMultiCommitStore.sol

This file was deleted.

5 changes: 5 additions & 0 deletions contracts/src/v0.8/ccip/ocr/MultiOCR3Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,13 @@ abstract contract MultiOCR3Base is ITypeAndVersion, OwnerIsCreator {
emit ConfigSet(
ocrPluginType, ocrConfigArgs.configDigest, ocrConfig.signers, ocrConfigArgs.transmitters, ocrConfigArgs.F
);
_afterOCR3ConfigSet(ocrPluginType);
}

/// @notice Hook that is called after a plugin's OCR3 config changes
/// @param ocrPluginType Plugin type for which the config changed
function _afterOCR3ConfigSet(uint8 ocrPluginType) internal virtual {}

/// @notice Clears oracle roles for the provided oracle addresses
/// @param ocrPluginType OCR plugin type to clear roles for
/// @param oracleAddresses Oracle addresses to clear roles for
Expand Down
324 changes: 272 additions & 52 deletions contracts/src/v0.8/ccip/offRamp/EVM2EVMMultiOffRamp.sol

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions contracts/src/v0.8/ccip/test/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ contract BaseTest is Test {
uint32 internal constant DEFAULT_TOKEN_DEST_GAS_OVERHEAD = 34_000;
uint32 internal constant DEFAULT_TOKEN_BYTES_OVERHEAD = 50;

// OCR
// Signer private keys used for these test
uint256 internal constant PRIVATE0 = 0x7b2e97fe057e6de99d6872a2ef2abf52c9b4469bc848c2465ac3fcd8d336e81d;
uint64 internal constant s_offchainConfigVersion = 3;
bytes internal constant REPORT = abi.encode("testReport");

bool private s_baseTestInitialized;

// Use 16 gas per data availability byte in our tests.
Expand Down
Loading

0 comments on commit 974da41

Please sign in to comment.