Skip to content

Commit

Permalink
merge core develop -> ccip-develop
Browse files Browse the repository at this point in the history
merge core develop -> ccip-develop

fix conflicts, build

use openzeppelin-solidity v4.8.3

add ERC165Checker.sol to the vendor, wasn't there before

add missing file

update shared snapshot

update gethwrappers

add ERC165.sol to fix metatx compile

update generated files

update modgraph

fix one config test

fix some config tests

fix config again

more config test fixes

bump mockery version in contracts makefile

go.mod updates

more updates

remove integration-tests dependencies

USDC filter fix (#383)

fix integration-tests go mod

more fixes

fix lint errors

fix TestSecrets_Validate

fix TestResolver_ConfigV2

fix TestIntegration_CCIP

try using crypto/rand

remove build-publish-pr.yml

skip metatx test
  • Loading branch information
AnieeG authored and makramkd committed Dec 18, 2023
1 parent ed2333f commit 147721d
Show file tree
Hide file tree
Showing 172 changed files with 3,504 additions and 2,658 deletions.
64 changes: 0 additions & 64 deletions .github/workflows/build-publish-pr.yml

This file was deleted.

6 changes: 3 additions & 3 deletions contracts/GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ALL_FOUNDRY_PRODUCTS contains a list of all products that have a foundry
# profile defined and use the Foundry snapshots.
# profile defined and use the Foundry snapshots.
ALL_FOUNDRY_PRODUCTS = llo-feeds functions shared ccip

# To make a snapshot for a specific product, either set the `FOUNDRY_PROFILE` env var
Expand Down Expand Up @@ -39,7 +39,7 @@ abigen: ## Build & install abigen.

.PHONY: mockery
mockery: $(mockery) ## Install mockery.
go install github.com/vektra/mockery/v2@v2.35.4
go install github.com/vektra/mockery/v2@v2.38.0

.PHONY: foundry
foundry: ## Install foundry.
Expand Down Expand Up @@ -109,4 +109,4 @@ help:
@echo " \/ \/ \/ \/ \/ \/"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
24 changes: 12 additions & 12 deletions contracts/STYLE_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Structure

This guide is split into two sections: [Guidelines](#guidelines) and [Rules](#rules).
Guidelines are recommendations that should be followed but are hard to enforce in an automated way.
This guide is split into two sections: [Guidelines](#guidelines) and [Rules](#rules).
Guidelines are recommendations that should be followed but are hard to enforce in an automated way.
Rules are all enforced through CI, this can be through Solhint rules or other tools.

## Background
Expand All @@ -27,7 +27,7 @@ We will be looking into `forge fmt`, but for now we still use `prettier`.
- This `dev` folder also has implications for when code is valid for bug bounties, so be extra careful to move functionality out of a `dev` folder.


## comments
## comments
- Besides comment above functions/structs, comments should live everywhere a reader might be confused.
Don’t overestimate the reader of your contract, expect confusion in many places and document accordingly.
This will help massively during audits and onboarding new team members.
Expand Down Expand Up @@ -78,11 +78,11 @@ uint256 networkFeeUSDCents; // good
struct FeeTokenConfigArgs {
address token; // ────────────╮ Token address
uint32 networkFeeUSD; // │ Flat network fee to charge for messages, multiples of 0.01 USD
// │ multiline comments should work like this. More fee info
// │ multiline comments should work like this. More fee info
uint64 gasMultiplier; // ─────╯ Price multiplier for gas costs, 1e18 based so 11e17 = 10% extra cost
uint64 premiumMultiplier; // ─╮ Multiplier for fee-token-specific premiums
bool enabled; // ─────────────╯ Whether this fee token is enabled
uint256 fee; // The flat fee the user pays in juels
uint256 fee; // The flat fee the user pays in juels
}
```
## Functions
Expand Down Expand Up @@ -134,7 +134,7 @@ assembly {
// call and return whether we succeeded. ignore return data
// call(gas,addr,value,argsOffset,argsLength,retOffset,retLength)
success := call(gasLimit, target, 0, add(payload, 0x20), mload(payload), 0, 0)
// limit our copy to maxReturnBytes bytes
let toCopy := returndatasize()
if gt(toCopy, maxReturnBytes) {
Expand Down Expand Up @@ -246,7 +246,7 @@ contract AccessControlledFoo is Foo {
contract OffchainAggregator is ITypeAndVersion {
// solhint-disable-next-line chainlink-solidity/all-caps-constant-storage-variables
string public constant override typeAndVersion = "OffchainAggregator 1.0.0";
function getData() public returns(uint256) {
return 4;
}
Expand All @@ -256,7 +256,7 @@ contract OffchainAggregator is ITypeAndVersion {
contract SuperDuperAggregator is ITypeAndVersion {
/// This is a new contract that has not been released yet, so we
/// add a `-dev` suffix to the typeAndVersion.
// solhint-disable-next-line chainlink-solidity/all-caps-constant-storage-variables
string public constant override typeAndVersion = "SuperDuperAggregator 1.1.0-dev";
Expand Down Expand Up @@ -316,8 +316,8 @@ import {IPool} from "../interfaces/pools/IPool.sol";
import {AggregateRateLimiter} from "../AggregateRateLimiter.sol";
import {Client} from "../libraries/Client.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
```

## Variables
Expand Down Expand Up @@ -386,6 +386,6 @@ rule: `custom-errors`

## Interfaces

Interfaces should be named `IFoo` instead of `FooInterface`. This follows the patterns of popular [libraries like OpenZeppelin’s](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol#L9).
Interfaces should be named `IFoo` instead of `FooInterface`. This follows the patterns of popular [libraries like OpenZeppelin’s](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol#L9).

rule: `tbd`
rule: `tbd`
8 changes: 8 additions & 0 deletions contracts/gas-snapshots/shared.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ CallWithExactGas__callWithExactGasSafeReturnData:test_CallWithExactGasSafeReturn
CallWithExactGas__callWithExactGasSafeReturnData:test_NoContractReverts() (gas: 13949)
CallWithExactGas__callWithExactGasSafeReturnData:test_NoGasForCallExactCheckReverts() (gas: 13239)
CallWithExactGas__callWithExactGasSafeReturnData:test_NotEnoughGasForCallReverts() (gas: 13670)
EnumerableMapAddresses_at:testAtSuccess() (gas: 98813)
EnumerableMapAddresses_contains:testContainsSuccess() (gas: 97480)
EnumerableMapAddresses_get:testGetSuccess() (gas: 98781)
EnumerableMapAddresses_get_errorMessage:testGetErrorMessageSuccess() (gas: 99220)
EnumerableMapAddresses_length:testLengthSuccess() (gas: 76136)
EnumerableMapAddresses_remove:testRemoveSuccess() (gas: 78050)
EnumerableMapAddresses_set:testSetSuccess() (gas: 99129)
EnumerableMapAddresses_tryGet:testTryGetSuccess() (gas: 99170)
OpStackBurnMintERC677_constructor:testConstructorSuccess() (gas: 1739317)
OpStackBurnMintERC677_interfaceCompatibility:testBurnCompatibility() (gas: 263373)
OpStackBurnMintERC677_interfaceCompatibility:testMintCompatibility() (gas: 137957)
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/PriceRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {OwnerIsCreator} from "./../shared/access/OwnerIsCreator.sol";
import {Internal} from "./libraries/Internal.sol";
import {USDPriceWith18Decimals} from "./libraries/USDPriceWith18Decimals.sol";

import {EnumerableSet} from "../vendor/openzeppelin-solidity/v4.8.0/contracts/utils/structs/EnumerableSet.sol";
import {EnumerableSet} from "../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/structs/EnumerableSet.sol";

/// @notice The PriceRegistry contract responsibility is to store the current gas price in USD for a given destination chain,
/// and the price of a token in USD allowing the owner or priceUpdater to update this value.
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/v0.8/ccip/Router.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {Internal} from "./libraries/Internal.sol";
import {CallWithExactGas} from "../shared/call/CallWithExactGas.sol";
import {OwnerIsCreator} from "../shared/access/OwnerIsCreator.sol";

import {EnumerableSet} from "../vendor/openzeppelin-solidity/v4.8.0/contracts/utils/structs/EnumerableSet.sol";
import {SafeERC20} from "../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {EnumerableSet} from "../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/structs/EnumerableSet.sol";
import {SafeERC20} from "../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

/// @title Router
/// @notice This is the entry point for the end user wishing to send data across chains.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/applications/CCIPClientExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {Client} from "../libraries/Client.sol";
import {CCIPReceiver} from "./CCIPReceiver.sol";
import {OwnerIsCreator} from "../../shared/access/OwnerIsCreator.sol";

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

// @notice Example of a client which supports EVM/non-EVM chains
// @dev If chain specific logic is required for different chain families (e.g. particular
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/applications/CCIPReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {IAny2EVMMessageReceiver} from "../interfaces/IAny2EVMMessageReceiver.sol

import {Client} from "../libraries/Client.sol";

import {IERC165} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/utils/introspection/IERC165.sol";
import {IERC165} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/introspection/IERC165.sol";

/// @title CCIPReceiver - Base contract for CCIP applications that can receive messages.
abstract contract CCIPReceiver is IAny2EVMMessageReceiver, IERC165 {
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/v0.8/ccip/applications/DefensiveExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {IRouterClient} from "../interfaces/IRouterClient.sol";
import {Client} from "../libraries/Client.sol";
import {CCIPClientExample} from "./CCIPClientExample.sol";

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {EnumerableMap} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/utils/structs/EnumerableMap.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";
import {EnumerableMap} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/structs/EnumerableMap.sol";

contract DefensiveExample is CCIPClientExample {
using EnumerableMap for EnumerableMap.Bytes32ToUintMap;
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/applications/PingPongDemo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {OwnerIsCreator} from "../../shared/access/OwnerIsCreator.sol";
import {Client} from "../libraries/Client.sol";
import {CCIPReceiver} from "./CCIPReceiver.sol";

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

/// @title PingPongDemo - A simple ping-pong contract for demonstrating cross-chain communication
contract PingPongDemo is CCIPReceiver, OwnerIsCreator, ITypeAndVersion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Client} from "../libraries/Client.sol";
import {Router} from "../Router.sol";
import {EVM2EVMOnRamp} from "../onRamp/EVM2EVMOnRamp.sol";

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

contract SelfFundedPingPong is PingPongDemo {
// solhint-disable-next-line chainlink-solidity/all-caps-constant-storage-variables
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/v0.8/ccip/applications/TokenProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {IRouterClient} from "../interfaces/IRouterClient.sol";
import {Client} from "../libraries/Client.sol";
import {OwnerIsCreator} from "../../shared/access/OwnerIsCreator.sol";

import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

contract TokenProxy is OwnerIsCreator {
using SafeERC20 for IERC20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {IPool} from "./pools/IPool.sol";

import {Client} from "../libraries/Client.sol";

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

interface IEVM2AnyOnRampClient {
/// @notice Get the fee for a given ccip message
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/interfaces/IWrappedNative.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

interface IWrappedNative is IERC20 {
function deposit() external payable;
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/interfaces/pools/IPool.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";

// Shared public interface for multiple pool types.
// Each pool type handles a different child token model (lock/unlock, mint/burn.)
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/v0.8/ccip/offRamp/EVM2EVMOffRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {OCR2BaseNoChecks} from "../ocr/OCR2BaseNoChecks.sol";
import {AggregateRateLimiter} from "../AggregateRateLimiter.sol";
import {EnumerableMapAddresses} from "../../shared/enumerable/EnumerableMapAddresses.sol";

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {Address} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/utils/Address.sol";
import {ERC165Checker} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/utils/introspection/ERC165Checker.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {Address} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Address.sol";
import {ERC165Checker} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/introspection/ERC165Checker.sol";

/// @notice EVM2EVMOffRamp enables OCR networks to execute multiple messages
/// in an OffRamp in a single transaction.
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {RateLimiter} from "../libraries/RateLimiter.sol";
import {USDPriceWith18Decimals} from "../libraries/USDPriceWith18Decimals.sol";
import {EnumerableMapAddresses} from "../../shared/enumerable/EnumerableMapAddresses.sol";

import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {EnumerableMap} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/utils/structs/EnumerableMap.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {EnumerableMap} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/structs/EnumerableMap.sol";

/// @notice The onRamp is a contract that handles lane-specific fee logic, NOP payments and
/// bridgeable token support.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IBurnMintERC20} from "../../shared/token/ERC20/IBurnMintERC20.sol";
import {TokenPool} from "./TokenPool.sol";
import {BurnMintTokenPoolAbstract} from "./BurnMintTokenPoolAbstract.sol";

import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";

/// @notice This pool mints and burns a 3rd-party token.
/// @dev Pool whitelisting mode is set in the constructor and cannot be modified later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IBurnMintERC20} from "../../shared/token/ERC20/IBurnMintERC20.sol";
import {TokenPool} from "./TokenPool.sol";
import {BurnMintTokenPoolAbstract} from "./BurnMintTokenPoolAbstract.sol";

import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";

/// @notice This pool mints and burns a 3rd-party token.
/// @dev Pool whitelisting mode is set in the constructor and cannot be modified later.
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";

import {TokenPool} from "./TokenPool.sol";

import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";

/// @notice Token pool used for tokens on their native chain. This uses a lock and release mechanism.
/// Because of lock/unlock requiring liquidity, this pool contract also has function to add and remove
Expand Down
Loading

0 comments on commit 147721d

Please sign in to comment.