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

add opcm regression test #34

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ commands:
- utils/checkout-with-mise
- run:
name: "simulate << parameters.task >>"
environment:
FOUNDRY_PROFILE: ci
command: |
just install
cd tasks/<< parameters.task >>
Expand All @@ -51,6 +53,8 @@ commands:
- utils/checkout-with-mise
- run:
name: "simulate nested << parameters.task >>"
environment:
FOUNDRY_PROFILE: ci
command: |
just install
cd tasks/<< parameters.task >>
Expand Down Expand Up @@ -199,6 +203,7 @@ jobs:
# Use L1_RPC_URL and L2_RPC_URL here.

just_simulate_sc_rehearsal_1:
circleci_ip_ranges: true
docker:
- image: <<pipeline.parameters.default_docker_image>>
steps:
Expand All @@ -216,6 +221,7 @@ jobs:
just simulate # simulate again to make sure the json is still valid

just_simulate_sc_rehearsal_2:
circleci_ip_ranges: true
docker:
- image: <<pipeline.parameters.default_docker_image>>
steps:
Expand All @@ -234,12 +240,15 @@ jobs:
just simulate # simulate again to make sure the json is still valid

just_simulate_sc_rehearsal_4:
circleci_ip_ranges: true
docker:
- image: <<pipeline.parameters.default_docker_image>>
steps:
- utils/checkout-with-mise
- run:
name: just simulate r4-jointly-upgrade
environment:
FOUNDRY_PROFILE: ci
command: |
just install
cd security-council-rehearsals
Expand All @@ -251,13 +260,15 @@ jobs:
just simulate-council # simulate again to make sure the json is still valid

just_simulate_ink_respected_game_type:
circleci_ip_ranges: true
docker:
- image: <<pipeline.parameters.default_docker_image>>
steps:
- simulate:
task: "/eth/ink-002-set-respected-game-type"

just_simulate_zora_002_fp_upgrade:
circleci_ip_ranges: true
docker:
- image: <<pipeline.parameters.default_docker_image>>
steps:
Expand Down Expand Up @@ -289,12 +300,15 @@ jobs:
forge fmt --check

forge_test:
circleci_ip_ranges: true
docker:
- image: <<pipeline.parameters.default_docker_image>>
steps:
- utils/checkout-with-mise
- run:
name: forge test
environment:
FOUNDRY_PROFILE: ci
command: |
forge --version
forge test -vvv
Expand All @@ -303,20 +317,18 @@ jobs:
circleci_ip_ranges: true
docker:
- image: <<pipeline.parameters.default_docker_image>>
environment:
FOUNDRY_PROFILE: ci
steps:
- utils/checkout-with-mise
- run:
name: monorepo integration tests
environment:
ETH_RPC_URL: << pipeline.parameters.l1_mainnet_rpc_url >>
command: |
(cd src/improvements && just monorepo-integration-test)
- notify-failures-on-develop:
mentions: "@security-team"
- run:
name: Print failed test traces
environment:
ETH_RPC_URL: << pipeline.parameters.l1_mainnet_rpc_url >>
command: (cd src/improvements && just monorepo-integration-test rerun)
when: on_fail

Expand Down
6 changes: 5 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ remappings = [
[profile.ci]
deny_warnings = true

[rpc_endpoints]
[profile.ci.rpc_endpoints]
mainnet = "https://ci-mainnet-l1-archive.optimism.io" # Must have 'circleci_ip_ranges = true' in .circleci/config.yml
sepolia = "https://ci-sepolia-l1-archive.optimism.io" # Must have 'circleci_ip_ranges = true' in .circleci/config.yml

[profile.default.rpc_endpoints]
localhost = "http://127.0.0.1:8545"
mainnet = "https://ethereum.publicnode.com"
sepolia = "https://ethereum-sepolia-rpc.publicnode.com"
15 changes: 13 additions & 2 deletions src/improvements/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,21 @@ task COMMAND="" NETWORK="":
monorepo-integration-test COMMAND="":
#!/usr/bin/env bash
set -euo pipefail

# Set FOUNDRY_PROFILE, defaulting to 'default' if not already set.
export FOUNDRY_PROFILE="${FOUNDRY_PROFILE:-default}"
echo "Currently running with FOUNDRY_PROFILE: ${FOUNDRY_PROFILE}"

root_dir=$(git rev-parse --show-toplevel)
allocs_path=${root_dir}/lib/optimism/packages/contracts-bedrock/allocs.json
allocs_path="${root_dir}/lib/optimism/packages/contracts-bedrock/allocs.json"

# Running this command with mainnet RPC URL.
ETH_RPC_URL=$(yq eval ".profile.\"${FOUNDRY_PROFILE}\".rpc_endpoints.mainnet" "${root_dir}/foundry.toml")
export ETH_RPC_URL
echo "Using mainnet RPC: ${ETH_RPC_URL}"

forge build
forge script ${root_dir}/src/improvements/tasks/Runner.sol:Runner --sig "run(string)" ${allocs_path} --rpc-url $ETH_RPC_URL --ffi
forge script ${root_dir}/src/improvements/tasks/Runner.sol:Runner --sig "run(string)" ${allocs_path} --ffi --rpc-url $ETH_RPC_URL
export SUPERCHAIN_OPS_ALLOCS_PATH=./allocs.json
cd ${root_dir}/lib/optimism/packages/contracts-bedrock/
# shellcheck disable=SC2194
Expand Down
15 changes: 7 additions & 8 deletions src/improvements/script/create-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ create_template() {
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import {MultisigTask} from "src/improvements/tasks/MultisigTask.sol";
import {AddressRegistry} from "src/improvements/AddressRegistry.sol";

/// @title ${contract_name}
/// @notice A template contract for configuring protocol parameters.
Expand All @@ -26,7 +25,7 @@ contract ${contract_name} is MultisigTask {
/// @notice TODO: Define the struct fields for your task configuration.
struct TaskConfig {
// TODO: Add members this template needs
// (e.g., chainId, gas, implementation, gameType, etc.)
// (e.g., chainId, gas, implementation, gameType, etc.)
}

/// @notice TODO: Update the mapping key/value types as needed.
Expand All @@ -35,35 +34,35 @@ contract ${contract_name} is MultisigTask {
/// @notice Returns the safe address string identifier.
/// @return A string identifier.
function safeAddressString() public pure override returns (string memory) {
// TODO: Return the actual safe address string identifier as defined in
/// Superchain-Registry's addresses.json.
require(false, "TODO: Return the actual safe address string identifier as defined in Superchain-Registry's addresses.json.");
// Superchain-Registry's addresses.json.
// return "ProxyAdminOwner";
}

/// @notice Specifies the storage write permissions required for this task.
/// @return An array of strings representing the storage permissions.
function _taskStorageWrites() internal pure override returns (string[] memory) {
// TODO: Populate this array with actual storage permission identifiers.
require(false, "TODO: Populate this array with actual storage permission identifiers.");
// string[] memory storageWrites = new string[](1);
// return storageWrites;
}

/// @notice Sets up the template using configuration data from a file.
/// @param taskConfigFilePath The path to the configuration file.
function _templateSetup(string memory taskConfigFilePath) internal override {
// TODO: Parse the configuration file and populate the \`taskConfig\` mapping.
require(false, "TODO: Implement the logic to parse the configuration file and populate the \`taskConfig\` mapping.");
}

/// @notice Builds the action(s) for applying the configuration for a given chain ID.
/// @param chainId The chain ID for which to build the configuration actions.
function _build(uint256 chainId) internal override {
// TODO: Implement the logic to build the configuration action(s).
require(false, "TODO: Implement the logic to build the configuration action(s).");
}

/// @notice Validates that the configuration has been applied correctly.
/// @param chainId The chain ID to validate.
function _validate(uint256 chainId) internal view override {
// TODO: Implement the logic to validate that the configuration was set as expected.
require(false, "TODO: Implement the logic to validate that the configuration was set as expected.");
}
}
EOL
Expand Down
2 changes: 1 addition & 1 deletion src/improvements/single.just
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ simulate hdPath='0':
forge build
forge script ${script} \
--rpc-url ${rpcUrl} \
--sig "simulateRun(string)" ${config} \
--sig "simulateRun(string)" ${config}

sign hdPath='0':
#!/usr/bin/env bash
Expand Down
Loading