From 8c74a1238631fb7beecae6b8822d85c49f4ac74d Mon Sep 17 00:00:00 2001 From: agusduha Date: Fri, 28 Nov 2025 10:57:50 -0300 Subject: [PATCH] fix: sys feature CI --- .circleci/config.yml | 148 ++++++------------ .../test/L1/L1StandardBridge.t.sol | 1 - .../test/invariants/FeeSplit.t.sol | 2 - .../test/setup/CommonTest.sol | 1 - 4 files changed, 51 insertions(+), 101 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 88dfb27a9ee..86e7db320ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -244,66 +244,46 @@ commands: echo "Resolved TARGET_BRANCH=$TARGET_BRANCH" echo "export TARGET_BRANCH=$TARGET_BRANCH" >> "$BASH_ENV" - setup-dev-features: - description: "Set up dev feature environment variables from comma-separated list" + setup-features: + description: "Set up dev and system feature environment variables. Features are auto-classified based on system_features registry." parameters: - dev_features: - description: "Comma-separated list of dev features to enable" + features: + description: "Comma-separated list of features (can mix dev and system features, e.g., 'OPTIMISM_PORTAL_INTEROP,CUSTOM_GAS_TOKEN')" type: string default: "" - steps: - - run: - name: Set dev feature environment variables - command: | - # Set dev feature environment variables if provided - if [ -n "<>" ]; then - DEV_FEATURES_STRING="<>" - - # Check if this is just "main" (baseline with no dev features) - if [ "$(echo "$DEV_FEATURES_STRING" | tr '[:upper:]' '[:lower:]')" = "main" ]; then - echo "Running with baseline configuration (no dev features enabled)" - else - echo "Enabling dev features: <>" - IFS=',' - for feature in $DEV_FEATURES_STRING; do - feature=$(echo "$feature" | xargs) # trim whitespace - if [ -n "$feature" ] && [ "$(echo "$feature" | tr '[:upper:]' '[:lower:]')" != "main" ]; then - env_var="DEV_FEATURE__${feature}" - echo "Setting ${env_var}=true" - echo "export ${env_var}=true" >> $BASH_ENV - fi - done - unset IFS - fi - fi - - setup-system-features: - description: "Set up system feature environment variables from comma-separated list" - parameters: system_features: - description: "Comma-separated list of system features to enable" + description: "Registry of system features (others treated as dev features)" type: string - default: "" + default: "CUSTOM_GAS_TOKEN" steps: - run: - name: Set system feature environment variables + name: Set feature environment variables command: | - # Set system feature environment variables if provided - if [ -n "<>" ]; then - SYSTEM_FEATURES_STRING="<>" + # Define which features are system features (registry) + SYSTEM_FEATURES="<>" + + if [ -n "<>" ]; then + FEATURES_STRING="<>" - # Check if this is just "main" (baseline with no system features) - if [ "$(echo "$SYSTEM_FEATURES_STRING" | tr '[:upper:]' '[:lower:]')" = "main" ]; then - echo "Running with baseline configuration (no system features enabled)" + # Check if this is just "main" (baseline with no features) + if [ "$(echo "$FEATURES_STRING" | tr '[:upper:]' '[:lower:]')" = "main" ]; then + echo "Running with baseline configuration (no features enabled)" else - echo "Enabling system features: <>" + echo "Processing features: <>" IFS=',' - for feature in $SYSTEM_FEATURES_STRING; do + for feature in $FEATURES_STRING; do feature=$(echo "$feature" | xargs) # trim whitespace if [ -n "$feature" ] && [ "$(echo "$feature" | tr '[:upper:]' '[:lower:]')" != "main" ]; then - env_var="SYS_FEATURE__${feature}" - echo "Setting ${env_var}=true" - echo "export ${env_var}=true" >> $BASH_ENV + # Check if this feature is in the system features registry + if echo "$SYSTEM_FEATURES" | grep -qw "$feature"; then + env_var="SYS_FEATURE__${feature}" + echo "Setting ${env_var}=true (system feature)" + echo "export ${env_var}=true" >> $BASH_ENV + else + env_var="DEV_FEATURE__${feature}" + echo "Setting ${env_var}=true (dev feature)" + echo "export ${env_var}=true" >> $BASH_ENV + fi fi done unset IFS @@ -945,12 +925,8 @@ jobs: description: List of changed files to run tests on type: string default: contracts-bedrock - dev_features: - description: Comma-separated list of dev features to enable (e.g., "OPTIMISM_PORTAL_INTEROP,ANOTHER_FEATURE") - type: string - default: "" - system_features: - description: Comma-separated list of system features to enable (e.g., "CUSTOM_GAS_TOKEN") + features: + description: Comma-separated list of features to enable (e.g., "OPTIMISM_PORTAL_INTEROP", "CUSTOM_GAS_TOKEN") type: string default: "" steps: @@ -985,10 +961,8 @@ jobs: working_directory: packages/contracts-bedrock - go-save-cache: namespace: packages/contracts-bedrock/scripts/go-ffi - - setup-dev-features: - dev_features: <> - - setup-system-features: - system_features: <> + - setup-features: + features: <> - run: name: Run tests command: | @@ -1124,12 +1098,8 @@ jobs: description: Profile to use for testing type: string default: ci - dev_features: - description: Comma-separated list of dev features to enable (e.g., "OPTIMISM_PORTAL_INTEROP,ANOTHER_FEATURE") - type: string - default: "" - system_features: - description: Comma-separated list of system features to enable (e.g., "CUSTOM_GAS_TOKEN") + features: + description: Comma-separated list of features to enable (e.g., "OPTIMISM_PORTAL_INTEROP", "CUSTOM_GAS_TOKEN") type: string default: "" steps: @@ -1165,10 +1135,8 @@ jobs: - restore_cache: name: Restore forked state key: forked-state-contracts-bedrock-tests-upgrade-{{ checksum "packages/contracts-bedrock/pinnedBlockNumber.txt" }} - - setup-dev-features: - dev_features: <> - - setup-system-features: - system_features: <> + - setup-features: + features: <> - run: name: Build go-ffi command: just build-go-ffi @@ -1222,12 +1190,8 @@ jobs: fork_base_rpc: description: Fork Base RPC type: string - dev_features: - description: Comma-separated list of dev features to enable (e.g., "OPTIMISM_PORTAL_INTEROP,ANOTHER_FEATURE") - type: string - default: "" - system_features: - description: Comma-separated list of system features to enable (e.g., "CUSTOM_GAS_TOKEN") + features: + description: Comma-separated list of features to enable (e.g., "OPTIMISM_PORTAL_INTEROP", "CUSTOM_GAS_TOKEN") type: string default: "" docker: @@ -1262,10 +1226,8 @@ jobs: - restore_cache: name: Restore forked state key: forked-state-contracts-bedrock-tests-upgrade-<>-<>-{{ checksum "packages/contracts-bedrock/pinnedBlockNumber.txt" }} - - setup-dev-features: - dev_features: <> - - setup-system-features: - system_features: <> + - setup-features: + features: <> - run: name: Run tests command: just test-upgrade @@ -2585,59 +2547,51 @@ workflows: - circleci-repo-readonly-authenticated-github-token - contracts-bedrock-tests: # Heavily fuzz any fuzz tests within added or modified test files. - name: contracts-bedrock-tests-heavy-fuzz-modified <> <> + name: contracts-bedrock-tests-heavy-fuzz-modified <> test_list: git diff origin/develop...HEAD --name-only --diff-filter=AM -- './test/**/*.t.sol' | sed 's|packages/contracts-bedrock/||' test_timeout: 1h test_profile: ciheavy - dev_features: <> - system_features: <> + features: <> matrix: parameters: - dev_features: &dev_features_matrix + features: &features_matrix - main - OPTIMISM_PORTAL_INTEROP - CANNON_KONA,DEPLOY_V2_DISPUTE_GAMES - OPCM_V2 - system_features: &system_features_matrix - CUSTOM_GAS_TOKEN context: - circleci-repo-readonly-authenticated-github-token - contracts-bedrock-tests: - name: contracts-bedrock-tests <> <> + name: contracts-bedrock-tests <> test_list: find test -name "*.t.sol" - dev_features: <> - system_features: <> + features: <> matrix: parameters: - dev_features: *dev_features_matrix - system_features: *system_features_matrix + features: *features_matrix context: - circleci-repo-readonly-authenticated-github-token check_changed_patterns: contracts-bedrock,op-node - contracts-bedrock-coverage: # Generate coverage reports. - name: contracts-bedrock-coverage <> <> + name: contracts-bedrock-coverage <> test_timeout: 1h test_profile: cicoverage - dev_features: <> - system_features: <> + features: <> matrix: parameters: - dev_features: *dev_features_matrix - system_features: *system_features_matrix + features: *features_matrix context: - circleci-repo-readonly-authenticated-github-token - contracts-bedrock-tests-upgrade: - name: contracts-bedrock-tests-upgrade op-mainnet <> <> + name: contracts-bedrock-tests-upgrade op-mainnet <> fork_op_chain: op fork_base_chain: mainnet fork_base_rpc: https://ci-mainnet-l1-archive.optimism.io - dev_features: <> - system_features: <> + features: <> matrix: parameters: - dev_features: *dev_features_matrix - system_features: *system_features_matrix + features: *features_matrix context: - circleci-repo-readonly-authenticated-github-token - contracts-bedrock-tests-upgrade: diff --git a/packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol b/packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol index b233286da58..a876ef795f7 100644 --- a/packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol +++ b/packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol @@ -15,7 +15,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; import { Features } from "src/libraries/Features.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; // Interfaces import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenger.sol"; diff --git a/packages/contracts-bedrock/test/invariants/FeeSplit.t.sol b/packages/contracts-bedrock/test/invariants/FeeSplit.t.sol index d17d1fbc23a..f8d36eb6b19 100644 --- a/packages/contracts-bedrock/test/invariants/FeeSplit.t.sol +++ b/packages/contracts-bedrock/test/invariants/FeeSplit.t.sol @@ -10,8 +10,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; import { IFeeSplitter } from "interfaces/L2/IFeeSplitter.sol"; import { IL1Withdrawer } from "interfaces/L2/IL1Withdrawer.sol"; import { ISuperchainRevSharesCalculator } from "interfaces/L2/ISuperchainRevSharesCalculator.sol"; -import { DevFeatures } from "src/libraries/DevFeatures.sol"; -import { Features } from "src/libraries/Features.sol"; /// @notice A struct to keep track of the state when a disburse call fails struct DisburseFailureState { diff --git a/packages/contracts-bedrock/test/setup/CommonTest.sol b/packages/contracts-bedrock/test/setup/CommonTest.sol index c0635c34275..529534b7ceb 100644 --- a/packages/contracts-bedrock/test/setup/CommonTest.sol +++ b/packages/contracts-bedrock/test/setup/CommonTest.sol @@ -16,7 +16,6 @@ import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; // Libraries -import { Features } from "src/libraries/Features.sol"; import { Config } from "scripts/libraries/Config.sol"; import { console } from "forge-std/console.sol";