Skip to content

Commit

Permalink
chore: standardize solidity version to 0.8.20 across repo
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Jul 11, 2024
1 parent b0a20a3 commit ac4d36a
Show file tree
Hide file tree
Showing 48 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions bridge/standard/bridge-v1/deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ RELAYER_ADDR="$RELAYER_ADDR" $FORGE_BIN_PATH script \
--broadcast \
--chain-id "$SETTLEMENT_CHAIN_ID" \
-vvvv \
--use 0.8.23 | tee deploy_sg_output.txt
--use 0.8.20 | tee deploy_sg_output.txt

awk -F"JSON_DEPLOY_ARTIFACT: " '/JSON_DEPLOY_ARTIFACT:/ {print $2}' deploy_sg_output.txt | sed '/^$/d' > SettlementGatewayArtifact.json
mv SettlementGatewayArtifact.json "$ARTIFACT_OUT_PATH"
Expand All @@ -131,7 +131,7 @@ RELAYER_ADDR="$RELAYER_ADDR" $FORGE_BIN_PATH script \
--broadcast \
--chain-id "$L1_CHAIN_ID" \
-vvvv \
--use 0.8.23 | tee deploy_l1g_output.txt
--use 0.8.20 | tee deploy_l1g_output.txt

awk -F"JSON_DEPLOY_ARTIFACT: " '/JSON_DEPLOY_ARTIFACT:/ {print $2}' deploy_l1g_output.txt | sed '/^$/d' > L1GatewayArtifact.json
mv L1GatewayArtifact.json "$ARTIFACT_OUT_PATH"
Expand Down
4 changes: 2 additions & 2 deletions contracts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ WORKDIR /app
# Copy our source code into the container
COPY . .

# Compile contracts using solidity compiler version 0.8.23
RUN forge build --use 0.8.23 --via-ir
# Compile contracts using solidity compiler version 0.8.20
RUN forge build --use 0.8.20 --via-ir

# Set environment variables for RPC URL and private key
# These should be passed during the Docker build process
Expand Down
2 changes: 1 addition & 1 deletion contracts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ deploy-val-reg:
--broadcast \
--chain-id 31337 \
-vvvv \
--use 0.8.23 \
--use 0.8.20 \
--via-ir \

deploy-core:
Expand Down
8 changes: 4 additions & 4 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,26 +163,26 @@ export CHAIN_ID=17864
- Run the deploy script for core contracts

```
forge script scripts/DeployScripts.s.sol:DeployScript --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --chain-id $CHAIN_ID -vvvv --use 0.8.23
forge script scripts/DeployScripts.s.sol:DeployScript --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --chain-id $CHAIN_ID -vvvv --use 0.8.20
```

- Run deploy script for whitelist contract, HYP_ERC20_ADDR denotes the HypERC20.sol contract address to give native mint/burn privileges.

```
HYP_ERC20_ADDR=0xBe3dEF3973584FdcC1326634aF188f0d9772D57D forge script scripts/DeployScripts.s.sol:DeployWhitelist --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --chain-id $CHAIN_ID -vvvv --use 0.8.23
HYP_ERC20_ADDR=0xBe3dEF3973584FdcC1326634aF188f0d9772D57D forge script scripts/DeployScripts.s.sol:DeployWhitelist --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --chain-id $CHAIN_ID -vvvv --use 0.8.20
```

#### Note on CREATE2

Foundry scripts in this repo use the CREATE2 opcode to deploy for every contract. Meaning deployment on any chain will yield the same contract addresses, given a constant deployer account, contract bytecode, and salt.

This means the solidity version used for contract compilation affects the addresses those contracts will be deployed to. Solidity 0.8.23 is the canonical version to use.
This means the solidity version used for contract compilation affects the addresses those contracts will be deployed to. Solidity 0.8.20 is the canonical version to use.

It's recommended to use `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266` as the deployer account so that contract addresses will match external facing documentation. In production this address will have proper key management, for now here's the private key: `ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`.

The CREATE2 proxy needs to be deployed prior to these contracts. See [this repo](https://github.com/primev/deterministic-deployment-proxy), or this [make command](https://github.com/primev/mev-commit-geth/blob/d29cfe94205e852cc57a8184585ccc895d32a517/geth-poa/Makefile#L48) to deploy. Anvil automatically deploys this proxy to the expected address.

Using the above private key and compiling with solidity 0.8.23, expected contract addresses are:
Using the above private key and compiling with solidity 0.8.20, expected contract addresses are:

```bash
UserRegistry deployed to: 0xe38B5a8C41f307646F395030992Aa008978E2699
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/BidderRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/BlockTracker.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/Oracle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/PreConfCommitmentStore.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {ECDSA} from "@openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/ProviderRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/Whitelist.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IBidderRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

interface IBidderRegistry {
struct PreConfCommitment {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IBlockTracker.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

/// @title IBlockTracker interface for BlockTracker contract
interface IBlockTracker {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IMevCommitAVS.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol";
import {EventHeightLib} from "../utils/EventHeight.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IPreConfCommitmentStore.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

/**
* @title IPreConfCommitmentStore
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IProviderRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

interface IProviderRegistry {
function registerAndStake(bytes calldata blsPublicKey) external payable;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IValidatorOptInRouter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

interface IValidatorOptInRouter {
/// @notice Initializes the contract with the validator registry and mev-commit AVS contracts.
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IValidatorRegistryV1.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import { EventHeightLib } from "../utils/EventHeight.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IWhitelist.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

interface IWhitelist {
function mint(address _mintTo, uint256 _amount) external;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/standard-bridge/Gateway.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/standard-bridge/L1Gateway.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

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

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/standard-bridge/SettlementGateway.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {Gateway} from "./Gateway.sol";
import {IWhitelist} from "../interfaces/IWhitelist.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/utils/EnumerableMap.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

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

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/utils/EnumerableSet.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

/// @title Implements an enumerable set of bytes arrays.
/// @notice Adapted from OpenZeppelin's EnumerableSet.sol implementation.
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/utils/EventHeight.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

library EventHeightLib {
/// @title EventHeight
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/utils/WindowFromBlockNumber.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

/**
* @title WindowFromBlockNumber
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {ValidatorOptInRouterStorage} from "./ValidatorOptInRouterStorage.sol";
import {IValidatorOptInRouter} from "../interfaces/IValidatorOptInRouter.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {IValidatorRegistryV1} from "../interfaces/IValidatorRegistryV1.sol";
import {IMevCommitAVS} from "../interfaces/IMevCommitAVS.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {IValidatorRegistryV1} from "../interfaces/IValidatorRegistryV1.sol";
import {ValidatorRegistryV1Storage} from "./ValidatorRegistryV1Storage.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {IValidatorRegistryV1} from "../interfaces/IValidatorRegistryV1.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import {IMevCommitAVS} from "../../interfaces/IMevCommitAVS.sol";
import {MevCommitAVSStorage} from "./MevCommitAVSStorage.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;


import {IMevCommitAVS} from "../../interfaces/IMevCommitAVS.sol";
Expand Down
12 changes: 6 additions & 6 deletions contracts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ "${DEPLOY_TYPE}" = "core" ]; then
--password "${KEYSTORE_PASSWORD}" \
--sender "${SENDER}" \
--skip-simulation \
--use 0.8.23 \
--use 0.8.20 \
--broadcast \
--force \
--json \
Expand Down Expand Up @@ -61,7 +61,7 @@ elif [ "${DEPLOY_TYPE}" = "transfer-ownership" ]; then
--password "${KEYSTORE_PASSWORD}" \
--sender "${SENDER}" \
--skip-simulation \
--use 0.8.23 \
--use 0.8.20 \
--broadcast \
--force \
--json \
Expand All @@ -82,7 +82,7 @@ elif [ "${DEPLOY_TYPE}" = "whitelist" ]; then
--broadcast \
--chain-id "${CHAIN_ID}" \
-vvvv \
--use 0.8.23 \
--use 0.8.20 \
--root "${CONTRACT_REPO_ROOT_PATH}" \
--via-ir

Expand All @@ -101,7 +101,7 @@ elif [ "${DEPLOY_TYPE}" = "settlement-gateway" ]; then
--broadcast \
--chain-id "${CHAIN_ID}" \
-vvvv \
--use 0.8.23 \
--use 0.8.20 \
--root "${CONTRACT_REPO_ROOT_PATH}" \
--via-ir

Expand All @@ -120,7 +120,7 @@ elif [ "${DEPLOY_TYPE}" = "l1-gateway" ]; then
--broadcast \
--chain-id "${CHAIN_ID}" \
-vvvv \
--use 0.8.23 \
--use 0.8.20 \
--root "${CONTRACT_REPO_ROOT_PATH}" \
--via-ir

Expand All @@ -135,7 +135,7 @@ elif [ "${DEPLOY_TYPE}" = "validator-registry" ]; then
--broadcast \
--chain-id "${CHAIN_ID}" \
-vvvv \
--use 0.8.23 \
--use 0.8.20 \
--root "${CONTRACT_REPO_ROOT_PATH}" \
--via-ir \
--skip-simulation \
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/DeployScripts.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;
import "forge-std/Script.sol";
import "../contracts/BidderRegistry.sol";
import "../contracts/ProviderRegistry.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/DeployStandardBridge.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;
import "forge-std/Script.sol";
import {SettlementGateway} from "../contracts/standard-bridge/SettlementGateway.sol";
import {L1Gateway} from "../contracts/standard-bridge/L1Gateway.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Script.sol";
import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/BidderRegistryTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import {BidderRegistry} from "../contracts/BidderRegistry.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/OracleTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import "../contracts/Oracle.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/PreConfirmationConfTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/test/ProviderRegistryTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import {ProviderRegistry} from "../contracts/ProviderRegistry.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/WhitelistTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import "../contracts/Whitelist.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/standard-bridge/L1GatewayTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import "../../contracts/standard-bridge/L1Gateway.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/standard-bridge/SettlementGatewayTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import "../../contracts/standard-bridge/SettlementGateway.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/utils/EnumerableMapTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import "../../contracts/utils/EnumerableMap.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/utils/EnumerableSetTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.20;
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import "../../contracts/utils/EnumerableSet.sol";
Expand Down
Loading

0 comments on commit ac4d36a

Please sign in to comment.