From 4c607966739a3a2f50ee23b721acd1ace0090f4a Mon Sep 17 00:00:00 2001 From: Elliot Date: Mon, 10 Feb 2025 18:23:32 -0800 Subject: [PATCH 1/8] automatically find the template name in the config.toml file, remove owner safe from required env var unless running simulate Signed-off-by: Elliot --- src/improvements/nested.just | 172 +++++++++++++++++++++-------------- src/improvements/single.just | 40 +++++--- 2 files changed, 132 insertions(+), 80 deletions(-) diff --git a/src/improvements/nested.just b/src/improvements/nested.just index 2cf1b82d8..f8696c087 100644 --- a/src/improvements/nested.just +++ b/src/improvements/nested.just @@ -1,38 +1,49 @@ set dotenv-load +# Common variables used across multiple recipes +# Export variables in uppercase for shell script usage +export TASK_PATH := invocation_directory() +export SCRIPT_PATH := justfile_directory() + +# Fetch the template name from the config.toml file +cmd := "sed -n 's/^[[:space:]]*templateName[[:space:]]*=[[:space:]]*\\\"\\([^\\\"]*\\)\\\".*/\\1/p' " + TASK_PATH + "/config.toml" +export SCRIPT_NAME := shell(cmd) + export rpcUrl := env_var_or_default('ETH_RPC_URL', 'https://ethereum.publicnode.com') export signatures := env_var_or_default('SIGNATURES', '') -export taskPath := invocation_directory() -export scriptPath := justfile_directory() -export scriptName := env_var('SCRIPT_NAME') - -# Accounts -export councilSafe := env_var("COUNCIL_SAFE") -export foundationSafe := env_var("FOUNDATION_SAFE") -export chainGovernorSafe := env_var_or_default('CHAIN_GOVERNOR_SAFE', '') -export randomPersonEoa := "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" +randomPersonEoa := "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" simulate whichSafe hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol - - echo "Using script ${script}" - echo "getting signer address for {{whichSafe}}..." - + # Get the appropriate safe address based on whichSafe if [ "{{whichSafe}}" == "foundation" ]; then - safe="{{foundationSafe}}" - fi - if [ "{{whichSafe}}" == "council" ]; then - safe="{{councilSafe}}" - fi - if [ "{{whichSafe}}" == "chain-governor" ]; then - if [ -z "{{chainGovernorSafe}}" ]; then - echo "Error: CHAIN_GOVERNOR_SAFE is not set for chain-governor." >&2 + if [ -z "$FOUNDATION_SAFE" ]; then + echo "Error: FOUNDATION_SAFE is required for foundation simulation" >&2 + exit 1 + fi + safe="$FOUNDATION_SAFE" + elif [ "{{whichSafe}}" == "council" ]; then + if [ -z "$COUNCIL_SAFE" ]; then + echo "Error: COUNCIL_SAFE is required for council simulation" >&2 + exit 1 + fi + safe="$COUNCIL_SAFE" + elif [ "{{whichSafe}}" == "chain-governor" ]; then + if [ -z "$CHAIN_GOVERNOR_SAFE" ]; then + echo "Error: CHAIN_GOVERNOR_SAFE is required for chain-governor simulation" >&2 exit 1 fi - safe="{{chainGovernorSafe}}" + safe="$CHAIN_GOVERNOR_SAFE" + else + echo "Error: Invalid safe type {{whichSafe}}" >&2 + exit 1 fi + + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol + + echo "Using script ${script}" + echo "getting signer address for {{whichSafe}}..." signer=$(cast call ${safe} "getOwners()(address[])" -r ${rpcUrl} | grep -oE '0x[a-fA-F0-9]{40}' | head -n1) echo "safe: $safe" @@ -55,25 +66,34 @@ simulate whichSafe hdPath='0': sign whichSafe hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol - - echo "Using script ${script}" + # Get the appropriate safe address based on whichSafe if [ "{{whichSafe}}" == "foundation" ]; then - safe="{{foundationSafe}}" + if [ -z "$FOUNDATION_SAFE" ]; then + echo "Error: FOUNDATION_SAFE is required for foundation signing" >&2 + exit 1 + fi + safe="$FOUNDATION_SAFE" echo "Using foundation safe at ${safe}" - fi - if [ "{{whichSafe}}" == "council" ]; then - safe="{{councilSafe}}" + elif [ "{{whichSafe}}" == "council" ]; then + if [ -z "$COUNCIL_SAFE" ]; then + echo "Error: COUNCIL_SAFE is required for council signing" >&2 + exit 1 + fi + safe="$COUNCIL_SAFE" echo "Using council safe at ${safe}" - fi - if [ "{{whichSafe}}" == "chain-governor" ]; then - if [ -z "{{chainGovernorSafe}}" ]; then - echo "Error: CHAIN_GOVERNOR_SAFE is not set for chain-governor." >&2 + elif [ "{{whichSafe}}" == "chain-governor" ]; then + if [ -z "$CHAIN_GOVERNOR_SAFE" ]; then + echo "Error: CHAIN_GOVERNOR_SAFE is required for chain-governor signing" >&2 exit 1 fi - safe="{{chainGovernorSafe}}" + safe="$CHAIN_GOVERNOR_SAFE" + else + echo "Error: Invalid safe type {{whichSafe}}" >&2 + exit 1 fi + + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol echo "getting signer address..." signer=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") echo "Signing with: ${signer}" @@ -90,25 +110,34 @@ sign whichSafe hdPath='0': approve whichSafe hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol - - echo "Using script ${script}" + # Get the appropriate safe address based on whichSafe if [ "{{whichSafe}}" == "foundation" ]; then - safe="{{foundationSafe}}" + if [ -z "$FOUNDATION_SAFE" ]; then + echo "Error: FOUNDATION_SAFE is required for foundation approval" >&2 + exit 1 + fi + safe="$FOUNDATION_SAFE" echo "Using foundation safe at ${safe}" - fi - if [ "{{whichSafe}}" == "council" ]; then - safe="{{councilSafe}}" + elif [ "{{whichSafe}}" == "council" ]; then + if [ -z "$COUNCIL_SAFE" ]; then + echo "Error: COUNCIL_SAFE is required for council approval" >&2 + exit 1 + fi + safe="$COUNCIL_SAFE" echo "Using council safe at ${safe}" - fi - if [ "{{whichSafe}}" == "chain-governor" ]; then - if [ -z "{{chainGovernorSafe}}" ]; then - echo "Error: CHAIN_GOVERNOR_SAFE is not set for chain-governor." >&2 + elif [ "{{whichSafe}}" == "chain-governor" ]; then + if [ -z "$CHAIN_GOVERNOR_SAFE" ]; then + echo "Error: CHAIN_GOVERNOR_SAFE is required for chain-governor approval" >&2 exit 1 fi - safe="{{chainGovernorSafe}}" + safe="$CHAIN_GOVERNOR_SAFE" + else + echo "Error: Invalid safe type {{whichSafe}}" >&2 + exit 1 fi + + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") forge build @@ -124,26 +153,35 @@ approve whichSafe hdPath='0': simulate-approve whichSafe hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol - - echo "Using script ${script}" + # Get the appropriate safe address based on whichSafe if [ "{{whichSafe}}" == "foundation" ]; then - safe="{{foundationSafe}}" + if [ -z "$FOUNDATION_SAFE" ]; then + echo "Error: FOUNDATION_SAFE is required for foundation simulate-approve" >&2 + exit 1 + fi + safe="$FOUNDATION_SAFE" echo "Using foundation safe at ${safe}" - fi - if [ "{{whichSafe}}" == "council" ]; then - safe="{{councilSafe}}" + elif [ "{{whichSafe}}" == "council" ]; then + if [ -z "$COUNCIL_SAFE" ]; then + echo "Error: COUNCIL_SAFE is required for council simulate-approve" >&2 + exit 1 + fi + safe="$COUNCIL_SAFE" echo "Using council safe at ${safe}" - fi - if [ "{{whichSafe}}" == "chain-governor" ]; then - if [ -z "{{chainGovernorSafe}}" ]; then - echo "Error: CHAIN_GOVERNOR_SAFE is not set for chain-governor." >&2 + elif [ "{{whichSafe}}" == "chain-governor" ]; then + if [ -z "$CHAIN_GOVERNOR_SAFE" ]; then + echo "Error: CHAIN_GOVERNOR_SAFE is required for chain-governor simulate-approve" >&2 exit 1 fi - safe="{{chainGovernorSafe}}" + safe="$CHAIN_GOVERNOR_SAFE" + else + echo "Error: Invalid safe type {{whichSafe}}" >&2 + exit 1 fi + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol + if [ ! -z "$SIMULATE_WITHOUT_LEDGER" ]; then sender=$(cast call ${safe} "getOwners()(address[])" -r ${rpcUrl} | grep -oE '0x[a-fA-F0-9]{40}' | head -n1) else @@ -161,8 +199,8 @@ simulate-approve whichSafe hdPath='0': execute hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol echo "Using script ${script}" sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") @@ -179,8 +217,8 @@ execute hdPath='0': simulated-run hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol echo "Using script ${script}" diff --git a/src/improvements/single.just b/src/improvements/single.just index a78233b0b..1ed0c1f20 100644 --- a/src/improvements/single.just +++ b/src/improvements/single.just @@ -1,23 +1,34 @@ set dotenv-load +# Common variables used across multiple recipes +# Export variables in uppercase for shell script usage +export TASK_PATH := invocation_directory() +export SCRIPT_PATH := justfile_directory() + +# Fetch the template name from the config.toml file +cmd := "sed -n 's/^[[:space:]]*templateName[[:space:]]*=[[:space:]]*\\\"\\([^\\\"]*\\)\\\".*/\\1/p' " + TASK_PATH + "/config.toml" +export SCRIPT_NAME := shell(cmd) + export rpcUrl := env_var('ETH_RPC_URL') export signatures := env_var_or_default('SIGNATURES', '') -export taskPath := invocation_directory() -export scriptPath := justfile_directory() -export ownerSafe := env_var('OWNER_SAFE') -export scriptName := env_var('SCRIPT_NAME') simulate hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol + # Check required environment variables + if [ -z "$OWNER_SAFE" ]; then + echo "Error: OWNER_SAFE is required for simulate" >&2 + exit 1 + fi + + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol echo "Using script ${script}" - echo "Safe address: ${ownerSafe}" + echo "Safe address: ${OWNER_SAFE}" echo "Getting signer address..." if [ ! -z "$SIMULATE_WITHOUT_LEDGER" ]; then - signer=$(cast call ${ownerSafe} "getOwners()(address[])" -r ${rpcUrl} | grep -oE '0x[a-fA-F0-9]{40}' | head -n1) + signer=$(cast call ${OWNER_SAFE} "getOwners()(address[])" -r ${rpcUrl} | grep -oE '0x[a-fA-F0-9]{40}' | head -n1) else signer=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") fi @@ -32,8 +43,11 @@ simulate hdPath='0': sign hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol + echo "script name: ${SCRIPT_NAME}" + echo "task path: ${TASK_PATH}" + echo "script path: ${SCRIPT_PATH}" echo "Using script ${script}" echo "getting signer address..." @@ -50,8 +64,8 @@ sign hdPath='0': execute hdPath='0': #!/usr/bin/env bash - config=${taskPath}/config.toml - script=${scriptPath}/template/${scriptName}.sol + config=${TASK_PATH}/config.toml + script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol echo "Using script ${script}" sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") @@ -60,4 +74,4 @@ execute hdPath='0': forge script --fork-url ${rpcUrl} ${script} \ --sig "executeRun(string,bytes)" ${config} ${signatures} \ --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" --broadcast \ - --sender ${sender} \ No newline at end of file + --sender ${sender} From 105a506d2db8d37ca82d5fd75d4d9717cdccba54 Mon Sep 17 00:00:00 2001 From: Elliot Date: Mon, 10 Feb 2025 18:44:58 -0800 Subject: [PATCH 2/8] add env file with rpc url Signed-off-by: Elliot --- test/tasks/mock/example/task-05/.env | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/tasks/mock/example/task-05/.env diff --git a/test/tasks/mock/example/task-05/.env b/test/tasks/mock/example/task-05/.env new file mode 100644 index 000000000..99b6f2b2f --- /dev/null +++ b/test/tasks/mock/example/task-05/.env @@ -0,0 +1 @@ +export ETH_RPC_URL="https://ethereum-sepolia-rpc.publicnode.com" \ No newline at end of file From 9d50f17a42aeef39e0ba9321e87139f1320c47de Mon Sep 17 00:00:00 2001 From: Elliot Date: Mon, 10 Feb 2025 18:46:14 -0800 Subject: [PATCH 3/8] add .env file with rpc url Signed-off-by: Elliot --- test/tasks/mock/example/task-00/.env | 1 + test/tasks/mock/example/task-01/.env | 1 + test/tasks/mock/example/task-02/.env | 1 + test/tasks/mock/example/task-03/.env | 1 + test/tasks/mock/example/task-04/.env | 1 + 5 files changed, 5 insertions(+) create mode 100644 test/tasks/mock/example/task-00/.env create mode 100644 test/tasks/mock/example/task-01/.env create mode 100644 test/tasks/mock/example/task-02/.env create mode 100644 test/tasks/mock/example/task-03/.env create mode 100644 test/tasks/mock/example/task-04/.env diff --git a/test/tasks/mock/example/task-00/.env b/test/tasks/mock/example/task-00/.env new file mode 100644 index 000000000..163adde8d --- /dev/null +++ b/test/tasks/mock/example/task-00/.env @@ -0,0 +1 @@ +export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-01/.env b/test/tasks/mock/example/task-01/.env new file mode 100644 index 000000000..163adde8d --- /dev/null +++ b/test/tasks/mock/example/task-01/.env @@ -0,0 +1 @@ +export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-02/.env b/test/tasks/mock/example/task-02/.env new file mode 100644 index 000000000..163adde8d --- /dev/null +++ b/test/tasks/mock/example/task-02/.env @@ -0,0 +1 @@ +export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-03/.env b/test/tasks/mock/example/task-03/.env new file mode 100644 index 000000000..163adde8d --- /dev/null +++ b/test/tasks/mock/example/task-03/.env @@ -0,0 +1 @@ +export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-04/.env b/test/tasks/mock/example/task-04/.env new file mode 100644 index 000000000..99b6f2b2f --- /dev/null +++ b/test/tasks/mock/example/task-04/.env @@ -0,0 +1 @@ +export ETH_RPC_URL="https://ethereum-sepolia-rpc.publicnode.com" \ No newline at end of file From ce0f40e51216f3cd90bedf9aa17417b8ab3f79e0 Mon Sep 17 00:00:00 2001 From: Elliot Date: Wed, 12 Feb 2025 14:06:15 -0800 Subject: [PATCH 4/8] remove OWNER_SAFE environment variable Signed-off-by: Elliot --- src/improvements/single.just | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/improvements/single.just b/src/improvements/single.just index 1ed0c1f20..69ea1b744 100644 --- a/src/improvements/single.just +++ b/src/improvements/single.just @@ -14,32 +14,17 @@ export signatures := env_var_or_default('SIGNATURES', '') simulate hdPath='0': #!/usr/bin/env bash - # Check required environment variables - if [ -z "$OWNER_SAFE" ]; then - echo "Error: OWNER_SAFE is required for simulate" >&2 - exit 1 - fi config=${TASK_PATH}/config.toml script=${SCRIPT_PATH}/template/${SCRIPT_NAME}.sol echo "Using script ${script}" - echo "Safe address: ${OWNER_SAFE}" - echo "Getting signer address..." - - if [ ! -z "$SIMULATE_WITHOUT_LEDGER" ]; then - signer=$(cast call ${OWNER_SAFE} "getOwners()(address[])" -r ${rpcUrl} | grep -oE '0x[a-fA-F0-9]{40}' | head -n1) - else - signer=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") - fi - echo "Simulating with: ${signer}" echo "" forge build forge script ${script} \ --rpc-url ${rpcUrl} \ --sig "simulateRun(string)" ${config} \ - --sender ${signer} sign hdPath='0': #!/usr/bin/env bash From 9383274116292ec781544f1a702bc7cb9fd0f1aa Mon Sep 17 00:00:00 2001 From: Elliot Date: Wed, 12 Feb 2025 14:43:51 -0800 Subject: [PATCH 5/8] get rpc url based on folder Signed-off-by: Elliot --- src/improvements/get-rpc-url.sh | 14 ++++++++++++++ src/improvements/nested.just | 6 ++++-- src/improvements/single.just | 6 ++++-- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 src/improvements/get-rpc-url.sh diff --git a/src/improvements/get-rpc-url.sh b/src/improvements/get-rpc-url.sh new file mode 100755 index 000000000..3aa11ee60 --- /dev/null +++ b/src/improvements/get-rpc-url.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Get the task path from the first argument +TASK_PATH="$1" + +# Check if the path contains eth/ or sep/ +if [[ "$TASK_PATH" == *"/eth/"* ]]; then + echo "mainnet" +elif [[ "$TASK_PATH" == *"/sep/"* ]]; then + echo "sepolia" +else + echo "Error: Task path must contain either /eth/ or /sep/" >&2 + exit 1 +fi diff --git a/src/improvements/nested.just b/src/improvements/nested.just index f8696c087..2d06c1410 100644 --- a/src/improvements/nested.just +++ b/src/improvements/nested.just @@ -5,11 +5,13 @@ set dotenv-load export TASK_PATH := invocation_directory() export SCRIPT_PATH := justfile_directory() +# Get RPC URL based on task path +rpc_cmd := SCRIPT_PATH + "/get-rpc-url.sh \"" + TASK_PATH + "\"" +export rpcUrl := shell(rpc_cmd) + # Fetch the template name from the config.toml file cmd := "sed -n 's/^[[:space:]]*templateName[[:space:]]*=[[:space:]]*\\\"\\([^\\\"]*\\)\\\".*/\\1/p' " + TASK_PATH + "/config.toml" export SCRIPT_NAME := shell(cmd) - -export rpcUrl := env_var_or_default('ETH_RPC_URL', 'https://ethereum.publicnode.com') export signatures := env_var_or_default('SIGNATURES', '') randomPersonEoa := "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" diff --git a/src/improvements/single.just b/src/improvements/single.just index 69ea1b744..3813b298d 100644 --- a/src/improvements/single.just +++ b/src/improvements/single.just @@ -5,11 +5,13 @@ set dotenv-load export TASK_PATH := invocation_directory() export SCRIPT_PATH := justfile_directory() +# Get RPC URL based on task path +rpc_cmd := SCRIPT_PATH + "/get-rpc-url.sh \"" + TASK_PATH + "\"" +export rpcUrl := shell(rpc_cmd) + # Fetch the template name from the config.toml file cmd := "sed -n 's/^[[:space:]]*templateName[[:space:]]*=[[:space:]]*\\\"\\([^\\\"]*\\)\\\".*/\\1/p' " + TASK_PATH + "/config.toml" export SCRIPT_NAME := shell(cmd) - -export rpcUrl := env_var('ETH_RPC_URL') export signatures := env_var_or_default('SIGNATURES', '') simulate hdPath='0': From 50a9acbf3da830479eb84cfe35db1f5d498a0317 Mon Sep 17 00:00:00 2001 From: Elliot Date: Wed, 12 Feb 2025 14:51:26 -0800 Subject: [PATCH 6/8] fix tests Signed-off-by: Elliot --- test/tasks/MultisigTask.t.sol | 2 +- test/tasks/NestedMultisigTask.t.sol | 2 +- test/tasks/Regression.t.sol | 8 ++++---- test/tasks/SingleMultisigTask.t.sol | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/tasks/MultisigTask.t.sol b/test/tasks/MultisigTask.t.sol index be730bfcb..e6f8d5cf7 100644 --- a/test/tasks/MultisigTask.t.sol +++ b/test/tasks/MultisigTask.t.sol @@ -15,7 +15,7 @@ contract MultisigTaskUnitTest is Test { AddressRegistry public addresses; MultisigTask public task; - string constant MAINNET_CONFIG = "./test/tasks/mock/example/task-03/config.toml"; + string constant MAINNET_CONFIG = "./test/tasks/mock/example/eth/task-03/config.toml"; /// @notice variables that store the storage offset of different variables in the MultisigTask contract diff --git a/test/tasks/NestedMultisigTask.t.sol b/test/tasks/NestedMultisigTask.t.sol index eb6aa0f59..0d132d496 100644 --- a/test/tasks/NestedMultisigTask.t.sol +++ b/test/tasks/NestedMultisigTask.t.sol @@ -30,7 +30,7 @@ contract NestedMultisigTaskTest is Test { uint256 public constant THRESHOLD_STORAGE_OFFSET = 4; /// ProxyAdminOwner safe for task-01 is a nested multisig for Op mainnet L2 chain. - string taskConfigFilePath = "test/tasks/mock/example/task-01/config.toml"; + string taskConfigFilePath = "test/tasks/mock/example/eth/task-01/config.toml"; function setUp() public { vm.createSelectFork("mainnet"); diff --git a/test/tasks/Regression.t.sol b/test/tasks/Regression.t.sol index b1831320a..0475ebd78 100644 --- a/test/tasks/Regression.t.sol +++ b/test/tasks/Regression.t.sol @@ -11,7 +11,7 @@ import {DisputeGameUpgradeTemplate} from "src/improvements/template/DisputeGameU contract RegressionTest is Test { function testRegressionCallDataMatchesTask00() public { - string memory taskConfigFilePath = "test/tasks/mock/example/task-00/config.toml"; + string memory taskConfigFilePath = "test/tasks/mock/example/eth/task-00/config.toml"; string memory expectedCallData = "0x174dea7100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000005e6432f18bc5d497b1ab2288a025fbf9d69e22210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000024b40a817c0000000000000000000000000000000000000000000000000000000005f5e100000000000000000000000000000000000000000000000000000000000000000000000000000000007bd909970b0eedcf078de6aeff23ce571663b8aa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000024b40a817c0000000000000000000000000000000000000000000000000000000005f5e10000000000000000000000000000000000000000000000000000000000"; vm.createSelectFork("mainnet", 21724199); @@ -29,7 +29,7 @@ contract RegressionTest is Test { } function testRegressionCallDataMatchesTask01() public { - string memory taskConfigFilePath = "test/tasks/mock/example/task-01/config.toml"; + string memory taskConfigFilePath = "test/tasks/mock/example/eth/task-01/config.toml"; string memory expectedCallData = "0x174dea71000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e5965ab5962edc7477c8520243a95517cd252fa9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004414f6b1a30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f691f8a6d908b58c534b624cf16495b491e633ba00000000000000000000000000000000000000000000000000000000"; vm.createSelectFork("mainnet", 21724199); @@ -53,7 +53,7 @@ contract RegressionTest is Test { } function testRegressionCallDataMatchesTask02() public { - string memory taskConfigFilePath = "test/tasks/mock/example/task-02/config.toml"; + string memory taskConfigFilePath = "test/tasks/mock/example/eth/task-02/config.toml"; string memory expectedCallData = "0x174dea71000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c6901f65369fc59fc1b4d6d6be7a2318ff38db5b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000044a1155ed9000000000000000000000000beb5fc579115071764c7423a4f12edde41f106ed000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000"; vm.createSelectFork("mainnet", 21724199); @@ -71,7 +71,7 @@ contract RegressionTest is Test { } function testRegressionCallDataMatchesTask03() public { - string memory taskConfigFilePath = "test/tasks/mock/example/task-03/config.toml"; + string memory taskConfigFilePath = "test/tasks/mock/example/eth/task-03/config.toml"; string memory expectedCallData = "0x174dea71000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000229047fed2591dbec1ef1118d64f7af3db9eb2900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000024b40a817c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000000000000000000000000000000000000"; vm.createSelectFork("mainnet", 21724199); diff --git a/test/tasks/SingleMultisigTask.t.sol b/test/tasks/SingleMultisigTask.t.sol index 71651426c..9bb258ffa 100644 --- a/test/tasks/SingleMultisigTask.t.sol +++ b/test/tasks/SingleMultisigTask.t.sol @@ -31,7 +31,7 @@ contract SingleMultisigTaskTest is Test { uint256 public constant THRESHOLD_STORAGE_OFFSET = 4; /// @notice ProxyAdminOwner safe for task-00 is a single multisig. - string taskConfigFilePath = "test/tasks/mock/example/task-00/config.toml"; + string taskConfigFilePath = "test/tasks/mock/example/eth/task-00/config.toml"; function setUp() public { vm.createSelectFork("mainnet"); From 6602c915252476a212668d5474372f0db928862d Mon Sep 17 00:00:00 2001 From: Elliot Date: Wed, 12 Feb 2025 14:54:28 -0800 Subject: [PATCH 7/8] change test file structure, add network directory to mock config.toml files, delete .env files Signed-off-by: Elliot --- test/tasks/mock/example/{ => eth}/task-00/README.md | 0 test/tasks/mock/example/{ => eth}/task-00/config.toml | 0 test/tasks/mock/example/{ => eth}/task-01/README.md | 0 test/tasks/mock/example/{ => eth}/task-01/config.toml | 0 test/tasks/mock/example/{ => eth}/task-02/README.md | 0 test/tasks/mock/example/{ => eth}/task-02/config.toml | 0 test/tasks/mock/example/{ => eth}/task-03/README.md | 0 test/tasks/mock/example/{ => eth}/task-03/config.toml | 0 test/tasks/mock/example/{task-04 => sep/task-00}/README.md | 0 test/tasks/mock/example/{task-04 => sep/task-00}/config.toml | 0 test/tasks/mock/example/task-00/.env | 1 - test/tasks/mock/example/task-01/.env | 1 - test/tasks/mock/example/task-02/.env | 1 - test/tasks/mock/example/task-03/.env | 1 - test/tasks/mock/example/task-04/.env | 1 - 15 files changed, 5 deletions(-) rename test/tasks/mock/example/{ => eth}/task-00/README.md (100%) rename test/tasks/mock/example/{ => eth}/task-00/config.toml (100%) rename test/tasks/mock/example/{ => eth}/task-01/README.md (100%) rename test/tasks/mock/example/{ => eth}/task-01/config.toml (100%) rename test/tasks/mock/example/{ => eth}/task-02/README.md (100%) rename test/tasks/mock/example/{ => eth}/task-02/config.toml (100%) rename test/tasks/mock/example/{ => eth}/task-03/README.md (100%) rename test/tasks/mock/example/{ => eth}/task-03/config.toml (100%) rename test/tasks/mock/example/{task-04 => sep/task-00}/README.md (100%) rename test/tasks/mock/example/{task-04 => sep/task-00}/config.toml (100%) delete mode 100644 test/tasks/mock/example/task-00/.env delete mode 100644 test/tasks/mock/example/task-01/.env delete mode 100644 test/tasks/mock/example/task-02/.env delete mode 100644 test/tasks/mock/example/task-03/.env delete mode 100644 test/tasks/mock/example/task-04/.env diff --git a/test/tasks/mock/example/task-00/README.md b/test/tasks/mock/example/eth/task-00/README.md similarity index 100% rename from test/tasks/mock/example/task-00/README.md rename to test/tasks/mock/example/eth/task-00/README.md diff --git a/test/tasks/mock/example/task-00/config.toml b/test/tasks/mock/example/eth/task-00/config.toml similarity index 100% rename from test/tasks/mock/example/task-00/config.toml rename to test/tasks/mock/example/eth/task-00/config.toml diff --git a/test/tasks/mock/example/task-01/README.md b/test/tasks/mock/example/eth/task-01/README.md similarity index 100% rename from test/tasks/mock/example/task-01/README.md rename to test/tasks/mock/example/eth/task-01/README.md diff --git a/test/tasks/mock/example/task-01/config.toml b/test/tasks/mock/example/eth/task-01/config.toml similarity index 100% rename from test/tasks/mock/example/task-01/config.toml rename to test/tasks/mock/example/eth/task-01/config.toml diff --git a/test/tasks/mock/example/task-02/README.md b/test/tasks/mock/example/eth/task-02/README.md similarity index 100% rename from test/tasks/mock/example/task-02/README.md rename to test/tasks/mock/example/eth/task-02/README.md diff --git a/test/tasks/mock/example/task-02/config.toml b/test/tasks/mock/example/eth/task-02/config.toml similarity index 100% rename from test/tasks/mock/example/task-02/config.toml rename to test/tasks/mock/example/eth/task-02/config.toml diff --git a/test/tasks/mock/example/task-03/README.md b/test/tasks/mock/example/eth/task-03/README.md similarity index 100% rename from test/tasks/mock/example/task-03/README.md rename to test/tasks/mock/example/eth/task-03/README.md diff --git a/test/tasks/mock/example/task-03/config.toml b/test/tasks/mock/example/eth/task-03/config.toml similarity index 100% rename from test/tasks/mock/example/task-03/config.toml rename to test/tasks/mock/example/eth/task-03/config.toml diff --git a/test/tasks/mock/example/task-04/README.md b/test/tasks/mock/example/sep/task-00/README.md similarity index 100% rename from test/tasks/mock/example/task-04/README.md rename to test/tasks/mock/example/sep/task-00/README.md diff --git a/test/tasks/mock/example/task-04/config.toml b/test/tasks/mock/example/sep/task-00/config.toml similarity index 100% rename from test/tasks/mock/example/task-04/config.toml rename to test/tasks/mock/example/sep/task-00/config.toml diff --git a/test/tasks/mock/example/task-00/.env b/test/tasks/mock/example/task-00/.env deleted file mode 100644 index 163adde8d..000000000 --- a/test/tasks/mock/example/task-00/.env +++ /dev/null @@ -1 +0,0 @@ -export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-01/.env b/test/tasks/mock/example/task-01/.env deleted file mode 100644 index 163adde8d..000000000 --- a/test/tasks/mock/example/task-01/.env +++ /dev/null @@ -1 +0,0 @@ -export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-02/.env b/test/tasks/mock/example/task-02/.env deleted file mode 100644 index 163adde8d..000000000 --- a/test/tasks/mock/example/task-02/.env +++ /dev/null @@ -1 +0,0 @@ -export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-03/.env b/test/tasks/mock/example/task-03/.env deleted file mode 100644 index 163adde8d..000000000 --- a/test/tasks/mock/example/task-03/.env +++ /dev/null @@ -1 +0,0 @@ -export ETH_RPC_URL="https://ethereum.publicnode.com" \ No newline at end of file diff --git a/test/tasks/mock/example/task-04/.env b/test/tasks/mock/example/task-04/.env deleted file mode 100644 index 99b6f2b2f..000000000 --- a/test/tasks/mock/example/task-04/.env +++ /dev/null @@ -1 +0,0 @@ -export ETH_RPC_URL="https://ethereum-sepolia-rpc.publicnode.com" \ No newline at end of file From 8f2481e538683b6acf399cc1adf1211c774738d2 Mon Sep 17 00:00:00 2001 From: Elliot Date: Wed, 12 Feb 2025 14:58:55 -0800 Subject: [PATCH 8/8] change paths to config.toml files Signed-off-by: Elliot --- src/improvements/README.md | 8 ++++---- src/improvements/doc/CALLDATA_DIFFERENCE.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/improvements/README.md b/src/improvements/README.md index acc2a3c5a..2391000c3 100644 --- a/src/improvements/README.md +++ b/src/improvements/README.md @@ -37,23 +37,23 @@ This toml configuration file allows task developers to set gas limits for the ta #### Template 00 to set gas configs: ```bash -forge script src/improvements/template/GasConfigTemplate.sol --sig "run(string)" test/tasks/mock/example/task-00/config.toml --rpc-url mainnet -vvv +forge script src/improvements/template/GasConfigTemplate.sol --sig "run(string)" test/tasks/mock/example/eth/task-00/config.toml --rpc-url mainnet -vvv ``` #### Template 01 to set dispute game upgrade: ```bash -forge script src/improvements/template/DisputeGameUpgradeTemplate.sol --sig "run(string)" test/tasks/mock/example/task-01/config.toml --rpc-url mainnet -vvv +forge script src/improvements/template/DisputeGameUpgradeTemplate.sol --sig "run(string)" test/tasks/mock/example/eth/task-01/config.toml --rpc-url mainnet -vvv ``` #### Template 02 to set respected game type: ```bash -forge script src/improvements/template/SetGameTypeTemplate.sol --sig "run(string)" test/tasks/mock/example/task-02/config.toml --rpc-url mainnet -vvvvv +forge script src/improvements/template/SetGameTypeTemplate.sol --sig "run(string)" test/tasks/mock/example/eth/task-02/config.toml --rpc-url mainnet -vvvvv ``` #### Template 03 to set gas config: ```bash -forge script src/improvements/template/GasConfigTemplate.sol --sig "run(string)" test/tasks/mock/example/task-03/config.toml --rpc-url mainnet -vvvvv +forge script src/improvements/template/GasConfigTemplate.sol --sig "run(string)" test/tasks/mock/example/eth/task-03/config.toml --rpc-url mainnet -vvvvv ``` diff --git a/src/improvements/doc/CALLDATA_DIFFERENCE.md b/src/improvements/doc/CALLDATA_DIFFERENCE.md index 1c7abb1b6..d11cc054a 100644 --- a/src/improvements/doc/CALLDATA_DIFFERENCE.md +++ b/src/improvements/doc/CALLDATA_DIFFERENCE.md @@ -56,7 +56,7 @@ data: `0xb40a817c000000000000000000000000000000000000000000000000000000000393870 command: ```bash -forge script src/improvements/template/GasConfigTemplate.sol --sig "simulateRun(string)" test/tasks/mock/example/task-03/config.toml --rpc-url mainnet -vvv +forge script src/improvements/template/GasConfigTemplate.sol --sig "simulateRun(string)" test/tasks/mock/example/eth/task-03/config.toml --rpc-url mainnet -vvv ``` Calldata diff can be found here https://www.diffchecker.com/HA7YFSWi/, select character comparison to see the difference. \ No newline at end of file