From 2a7de28e0a8549ff7e25bd771b971618fa85792d Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:02:51 +0400 Subject: [PATCH 01/19] lock update --- flake.lock | 59 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index 894a168..b88de52 100644 --- a/flake.lock +++ b/flake.lock @@ -75,11 +75,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1758705030, - "narHash": "sha256-zYM8PiEXANNrtjfyGUc7w37/D/kCynp0cQS+wCQ77GI=", + "lastModified": 1769324704, + "narHash": "sha256-aef15vEgiMEls1hTMt46rJuKNSO2cIOfiP99patq9yc=", "owner": "shazow", "repo": "foundry.nix", - "rev": "b59a55014050110170023e3e1c277c1d4a2f055b", + "rev": "e830409ba1bdecdc5ef9a1ec92660fc2da9bc68d", "type": "github" }, "original": { @@ -102,13 +102,29 @@ "type": "indirect" } }, + "nixpkgs-old": { + "locked": { + "lastModified": 1749104371, + "narHash": "sha256-m2NmOPd6XgBiskmUq/BS9Xxuf3z0ebnGVfSKNAO5NEM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "48975d7f9b9960ed33c4e8561bcce20cc0c2de5b", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "48975d7f9b9960ed33c4e8561bcce20cc0c2de5b", + "type": "github" + } + }, "nixpkgs_2": { "locked": { - "lastModified": 1758711836, - "narHash": "sha256-uBqPg7wNX2v6YUdTswH7wWU8wqb60cFZx0tHaWTGF30=", + "lastModified": 1769364508, + "narHash": "sha256-Wy8EVYSLq5Fb/rYH3LRxAMCnW75f9hOg2562AXVFmPk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "46f97b78e825ae762c0224e3983c47687436a498", + "rev": "6077bc4fb29be43d525984f63b69d37b9b1e62fe", "type": "github" }, "original": { @@ -135,11 +151,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1748662220, - "narHash": "sha256-7gGa49iB9nCnFk4h/g9zwjlQAyjtpgcFkODjcOQS0Es=", + "lastModified": 1766653575, + "narHash": "sha256-TPgxCS7+hWc4kPhzkU5dD2M5UuPhLuuaMNZ/IpwKQvI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "59138c7667b7970d205d6a05a8bfa2d78caa3643", + "rev": "3c1016e6acd16ad96053116d0d3043029c9e2649", "type": "github" }, "original": { @@ -154,15 +170,16 @@ "flake-utils": "flake-utils_2", "foundry": "foundry", "nixpkgs": "nixpkgs_2", + "nixpkgs-old": "nixpkgs-old", "rust-overlay": "rust-overlay", "solc": "solc" }, "locked": { - "lastModified": 1760460761, - "narHash": "sha256-IHvwnmphDaOyZnzvObwOoDQlA9nzym2ZUxe9K/5vs0U=", + "lastModified": 1770274701, + "narHash": "sha256-00kymonJVHUtCBBaXMqmVF3b78dtDdXJg8K7P2U9lbA=", "owner": "rainprotocol", "repo": "rainix", - "rev": "add0d8a1fd76ce0e65b962c952e9252257876465", + "rev": "51c1c74a0e6bc5c49336b02ef97684d01e1e8ad4", "type": "github" }, "original": { @@ -182,11 +199,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1758681214, - "narHash": "sha256-8cW731vev6kfr58cILO2ZsjHwaPhm88dQ8Q6nTSjP9I=", + "lastModified": 1769309768, + "narHash": "sha256-AbOIlNO+JoqRJkK1VrnDXhxuX6CrdtIu2hSuy4pxi3g=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "b12ed88d8d33d4f3cbc842bf29fad93bb1437299", + "rev": "140c9dc582cb73ada2d63a2180524fcaa744fad5", "type": "github" }, "original": { @@ -202,11 +219,11 @@ "solc-macos-amd64-list-json": "solc-macos-amd64-list-json" }, "locked": { - "lastModified": 1756368702, - "narHash": "sha256-cqEHv7uCV0LibmQphyiXZ1+jYtGjMNb9Pae4tfcAcF8=", + "lastModified": 1768831671, + "narHash": "sha256-0mmlYRtZK+eomevkQCCH7PL8QlSuALZQsjLroCWGE08=", "owner": "hellwolf", "repo": "solc.nix", - "rev": "d83e90df2fa8359a690f6baabf76099432193c3f", + "rev": "80ad871b93d15c7bccf71617f78f73c2d291a9c7", "type": "github" }, "original": { @@ -218,13 +235,13 @@ "solc-macos-amd64-list-json": { "flake": false, "locked": { - "narHash": "sha256-AvITkfpNYgCypXuLJyqco0li+unVw39BAfdOZvd/SPE=", + "narHash": "sha256-P+ZslplK4cQ/wnV/wykVKb+yTCviI0eylA3sk9uHmRo=", "type": "file", - "url": "https://github.com/argotorg/solc-bin/raw/26fc3fd/macosx-amd64/list.json" + "url": "https://github.com/argotorg/solc-bin/raw/a11f1ad/macosx-amd64/list.json" }, "original": { "type": "file", - "url": "https://github.com/argotorg/solc-bin/raw/26fc3fd/macosx-amd64/list.json" + "url": "https://github.com/argotorg/solc-bin/raw/a11f1ad/macosx-amd64/list.json" } }, "systems": { From 8af748bda8cf01211829da814f4158099e85aef0 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:04:13 +0400 Subject: [PATCH 02/19] extrospection bump --- foundry.lock | 2 +- lib/rain.extrospection | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foundry.lock b/foundry.lock index 0b13571..a9a6aeb 100644 --- a/foundry.lock +++ b/foundry.lock @@ -6,6 +6,6 @@ "rev": "fcbae5394ae8ad52d8e580a3477db99814b9d565" }, "lib/rain.extrospection": { - "rev": "57b600f44084b6c678d680b813463f2197087921" + "rev": "ab33ddb8b64d7566edfb15a775d86c536c977181" } } \ No newline at end of file diff --git a/lib/rain.extrospection b/lib/rain.extrospection index 57b600f..ab33ddb 160000 --- a/lib/rain.extrospection +++ b/lib/rain.extrospection @@ -1 +1 @@ -Subproject commit 57b600f44084b6c678d680b813463f2197087921 +Subproject commit ab33ddb8b64d7566edfb15a775d86c536c977181 From e7c19bfe552878a2d8b8dc541e6804ae894e4b7b Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:04:40 +0400 Subject: [PATCH 03/19] update forge-std --- foundry.lock | 2 +- lib/forge-std | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foundry.lock b/foundry.lock index a9a6aeb..c445044 100644 --- a/foundry.lock +++ b/foundry.lock @@ -1,6 +1,6 @@ { "lib/forge-std": { - "rev": "b8f065fda83b8cd94a6b2fec8fcd911dc3b444fd" + "rev": "1801b0541f4fda118a10798fd3486bb7051c5dd6" }, "lib/openzeppelin-contracts": { "rev": "fcbae5394ae8ad52d8e580a3477db99814b9d565" diff --git a/lib/forge-std b/lib/forge-std index b8f065f..1801b05 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit b8f065fda83b8cd94a6b2fec8fcd911dc3b444fd +Subproject commit 1801b0541f4fda118a10798fd3486bb7051c5dd6 From b20c981f679500fe41abf47c7e397930aef95e44 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:07:27 +0400 Subject: [PATCH 04/19] update rain.deploy --- .gitmodules | 3 +++ lib/rain.deploy | 1 + 2 files changed, 4 insertions(+) create mode 160000 lib/rain.deploy diff --git a/.gitmodules b/.gitmodules index 082aec8..3ea327c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std +[submodule "lib/rain.deploy"] + path = lib/rain.deploy + url = https://github.com/rainlanguage/rain.deploy diff --git a/lib/rain.deploy b/lib/rain.deploy new file mode 160000 index 0000000..1af8ca2 --- /dev/null +++ b/lib/rain.deploy @@ -0,0 +1 @@ +Subproject commit 1af8ca2a981c2f67844f343e224f4c7b1969de1c From d9b4ec44a1596e9773f594d0dff391415a0f9911 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:11:07 +0400 Subject: [PATCH 05/19] wip on zoltu deploy --- script/Deploy.sol | 19 +++++++++++++++---- src/lib/LibCloneFactoryDeploy.sol | 11 +++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/lib/LibCloneFactoryDeploy.sol diff --git a/script/Deploy.sol b/script/Deploy.sol index 711c815..0c4fc1f 100644 --- a/script/Deploy.sol +++ b/script/Deploy.sol @@ -11,9 +11,20 @@ contract Deploy is Script { function run() external { uint256 deployerPrivateKey = vm.envUint("DEPLOYMENT_KEY"); - vm.startBroadcast(deployerPrivateKey); - CloneFactory cloneFactory = new CloneFactory(); - (cloneFactory); - vm.stopBroadcast(); + LibRainDeploy.deployAndBroadcastToSupportedNetworks( + vm, + LibRainDeploy.supportedNetworks(), + deployerPrivateKey, + type(CloneFactory).creationCode, + "", + LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_ADDRESS, + LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_CODEHASH, + new address[](0) + ); + + // vm.startBroadcast(deployerPrivateKey); + // CloneFactory cloneFactory = new CloneFactory(); + // (cloneFactory); + // vm.stopBroadcast(); } } diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol new file mode 100644 index 0000000..f5670a0 --- /dev/null +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: LicenseRef-DCL-1.0 +// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd +pragma solidity ^0.8.25; + +library LibCloneFactoryDeploy { + address constant CLONE_FACTORY_DEPLOYED_ADDRESS = + address(0); + + bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = + bytes32(0); +} \ No newline at end of file From b8b20225558cd807900edcde5152bfff0df57fd7 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:14:58 +0400 Subject: [PATCH 06/19] manual artifacts env --- .github/workflows/manual-sol-artifacts.yaml | 52 +++++---------------- 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/.github/workflows/manual-sol-artifacts.yaml b/.github/workflows/manual-sol-artifacts.yaml index e92ad60..57940f2 100644 --- a/.github/workflows/manual-sol-artifacts.yaml +++ b/.github/workflows/manual-sol-artifacts.yaml @@ -2,42 +2,11 @@ name: Manual sol artifacts on: workflow_dispatch: inputs: - network: - description: 'Network to deploy to' - required: true - type: choice - options: - - arbitrum - - arbitrum_sepolia - - avalanche - - base - - base_sepolia - - bsc - - ethereum - - flare - - mumbai - - oasis_sapphire - - polygon - - sepolia - - songbird - - amoy - - epn jobs: deploy: runs-on: ubuntu-latest - env: - DEPLOYMENT_KEY: ${{ github.ref == 'refs/heads/main' && secrets.PRIVATE_KEY || secrets.PRIVATE_KEY_DEV }} steps: - - run: | - network=${{ inputs.network }} - echo "etherscan_api_key_secret_name=CI_DEPLOY_${network^^}_ETHERSCAN_API_KEY" >> $GITHUB_ENV - echo "rpc_secret_name=CI_DEPLOY_${network^^}_RPC_URL" >> $GITHUB_ENV - echo "verify_secret_name=CI_DEPLOY_${network^^}_VERIFY" >> $GITHUB_ENV - echo "verifier_secret_name=CI_DEPLOY_${network^^}_VERIFIER" >> $GITHUB_ENV - echo "verifier_url_secret_name=CI_DEPLOY_${network^^}_VERIFIER_URL" >> $GITHUB_ENV - echo "metaboard_address_secret_name=CI_DEPLOY_${network^^}_METABOARD_ADDRESS" >> $GITHUB_ENV - - uses: actions/checkout@v4 with: submodules: recursive @@ -47,14 +16,17 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@v2 - run: nix develop -c rainix-sol-prelude - - name: deploy to ${{ inputs.network }} - run: nix develop -c rainix-sol-artifacts + - run: nix develop -c forge selectors up --all + - run: nix develop -c forge script script/Deploy.sol:Deploy -vvvvv --slow --broadcast --verify env: - DEPLOY_BROADCAST: '1' DEPLOYMENT_KEY: ${{ github.ref == 'refs/heads/main' && secrets.PRIVATE_KEY || secrets.PRIVATE_KEY_DEV }} - ETH_RPC_URL: ${{ secrets[env.rpc_secret_name] || vars[env.rpc_secret_name] || '' }} - ETHERSCAN_API_KEY: ${{ secrets[env.etherscan_api_key_secret_name] || vars[env.etherscan_api_key_secret_name] || ''}} - DEPLOY_VERIFY: ${{ secrets[env.verify_secret_name] || vars[env.verify_secret_name] || '' }} - DEPLOY_VERIFIER: ${{ secrets[env.verifier_secret_name] || vars[env.verifier_secret_name] || '' }} - DEPLOY_VERIFIER_URL: ${{ secrets[env.verifier_url_secret_name] || vars[env.verifier_url_secret_name] || '' }} - DEPLOY_METABOARD_ADDRESS: ${{ secrets[env.metaboard_address_secret_name] || vars[env.metaboard_address_secret_name] || '' }} \ No newline at end of file + + CI_DEPLOY_ARBITRUM_RPC_URL: ${{ secrets.CI_DEPLOY_ARBITRUM_RPC_URL || vars.CI_DEPLOY_ARBITRUM_RPC_URL || '' }} + CI_DEPLOY_BASE_RPC_URL: ${{ secrets.CI_DEPLOY_BASE_RPC_URL || vars.CI_DEPLOY_BASE_RPC_URL || '' }} + CI_DEPLOY_FLARE_RPC_URL: ${{ secrets.CI_DEPLOY_FLARE_RPC_URL || vars.CI_DEPLOY_FLARE_RPC_URL || '' }} + CI_DEPLOY_POLYGON_RPC_URL: ${{ secrets.CI_DEPLOY_POLYGON_RPC_URL || vars.CI_DEPLOY_POLYGON_RPC_URL || '' }} + + CI_DEPLOY_ARBITRUM_ETHERSCAN_API_KEY: ${{ secrets.CI_DEPLOY_ARBITRUM_ETHERSCAN_API_KEY || vars.CI_DEPLOY_ARBITRUM_ETHERSCAN_API_KEY || '' }} + CI_DEPLOY_BASE_ETHERSCAN_API_KEY: ${{ secrets.CI_DEPLOY_BASE_ETHERSCAN_API_KEY || vars.CI_DEPLOY_BASE_ETHERSCAN_API_KEY || '' }} + CI_DEPLOY_FLARE_ETHERSCAN_API_KEY: ${{ secrets.CI_DEPLOY_FLARE_ETHERSCAN_API_KEY || vars.CI_DEPLOY_FLARE_ETHERSCAN_API_KEY || '' }} + CI_DEPLOY_POLYGON_ETHERSCAN_API_KEY: ${{ secrets.CI_DEPLOY_POLYGON_ETHERSCAN_API_KEY || vars.CI_DEPLOY_POLYGON_ETHERSCAN_API_KEY || '' }} \ No newline at end of file From cf2670ef1326ddd47e18eae9ab7c751128fe6d63 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:23:06 +0400 Subject: [PATCH 07/19] fix build --- .gas-snapshot | 12 ++++++------ foundry.toml | 4 ++++ script/Deploy.sol | 2 ++ src/lib/LibCloneFactoryDeploy.sol | 8 +++----- test/concrete/CloneFactory.t.sol | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 5b18839..4c7aa8d 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,6 +1,6 @@ -CloneFactoryCloneTest:testCloneBytecode(bytes) (runs: 2048, μ: 371392, ~: 361967) -CloneFactoryCloneTest:testCloneInitializeData(bytes) (runs: 2048, μ: 376530, ~: 366844) -CloneFactoryCloneTest:testCloneInitializeEvent(bytes) (runs: 2048, μ: 377279, ~: 367854) -CloneFactoryCloneTest:testCloneInitializeFailureFails(bytes32) (runs: 2048, μ: 173411, ~: 173411) -CloneFactoryCloneTest:testCloneUninitializableFails(address,bytes) (runs: 2048, μ: 10029, ~: 9967) -CloneFactoryCloneTest:testZeroImplementationCodeSizeError(address,bytes) (runs: 2046, μ: 10812, ~: 10790) \ No newline at end of file +CloneFactoryCloneTest:testCloneBytecode(bytes) (runs: 2048, μ: 362118, ~: 352769) +CloneFactoryCloneTest:testCloneInitializeData(bytes) (runs: 2048, μ: 366673, ~: 357227) +CloneFactoryCloneTest:testCloneInitializeEvent(bytes) (runs: 2048, μ: 367289, ~: 357940) +CloneFactoryCloneTest:testCloneInitializeFailureFails(bytes32) (runs: 2048, μ: 170471, ~: 170471) +CloneFactoryCloneTest:testCloneUninitializableFails(address,bytes) (runs: 2048, μ: 9870, ~: 9844) +CloneFactoryCloneTest:testZeroImplementationCodeSizeError(address,bytes) (runs: 2048, μ: 10526, ~: 10557) \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index 2b03b81..f348a82 100644 --- a/foundry.toml +++ b/foundry.toml @@ -15,6 +15,10 @@ evm_version = "cancun" # than expose ffi to forge. fs_permissions = [{ access = "read", path = "./meta"}] +remappings = [ + "rain.deploy/=lib/rain.deploy/src/" +] + [fuzz] runs = 2048 diff --git a/script/Deploy.sol b/script/Deploy.sol index 0c4fc1f..c5f5973 100644 --- a/script/Deploy.sol +++ b/script/Deploy.sol @@ -4,6 +4,8 @@ pragma solidity =0.8.25; import {Script} from "forge-std/Script.sol"; import {CloneFactory} from "src/concrete/CloneFactory.sol"; +import {LibRainDeploy} from "rain.deploy/lib/LibRainDeploy.sol"; +import {LibCloneFactoryDeploy} from "src/lib/LibCloneFactoryDeploy.sol"; /// @title Deploy /// @notice A script that deploys a CloneFactory. diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol index f5670a0..34336f5 100644 --- a/src/lib/LibCloneFactoryDeploy.sol +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -3,9 +3,7 @@ pragma solidity ^0.8.25; library LibCloneFactoryDeploy { - address constant CLONE_FACTORY_DEPLOYED_ADDRESS = - address(0); + address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0); - bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = - bytes32(0); -} \ No newline at end of file + bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = bytes32(0); +} diff --git a/test/concrete/CloneFactory.t.sol b/test/concrete/CloneFactory.t.sol index ece658a..f744373 100644 --- a/test/concrete/CloneFactory.t.sol +++ b/test/concrete/CloneFactory.t.sol @@ -4,7 +4,7 @@ pragma solidity =0.8.25; import {Test, Vm} from "forge-std/Test.sol"; -import {LibExtrospectERC1167Proxy} from "rain.extrospection/src/lib/LibExtrospectERC1167Proxy.sol"; +import {LibExtrospectERC1167Proxy} from "rain.extrospection/lib/LibExtrospectERC1167Proxy.sol"; import {ICloneableV2, ICLONEABLE_V2_SUCCESS} from "src/interface/ICloneableV2.sol"; import {CloneFactory, ZeroImplementationCodeSize, InitializationFailed} from "src/concrete/CloneFactory.sol"; From 5bb98069fcfe2bd4358fc90f613366f191fb8801 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:50:02 +0400 Subject: [PATCH 08/19] rain.deploy lock --- foundry.lock | 3 +++ 1 file changed, 3 insertions(+) diff --git a/foundry.lock b/foundry.lock index c445044..60654c8 100644 --- a/foundry.lock +++ b/foundry.lock @@ -5,6 +5,9 @@ "lib/openzeppelin-contracts": { "rev": "fcbae5394ae8ad52d8e580a3477db99814b9d565" }, + "lib/rain.deploy": { + "rev": "1af8ca2a981c2f67844f343e224f4c7b1969de1c" + }, "lib/rain.extrospection": { "rev": "ab33ddb8b64d7566edfb15a775d86c536c977181" } From 99eefebef1e2285990612b4960fadcb22ab6c0c2 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:50:21 +0400 Subject: [PATCH 09/19] rain.deploy update --- foundry.lock | 2 +- lib/rain.deploy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foundry.lock b/foundry.lock index 60654c8..595835b 100644 --- a/foundry.lock +++ b/foundry.lock @@ -6,7 +6,7 @@ "rev": "fcbae5394ae8ad52d8e580a3477db99814b9d565" }, "lib/rain.deploy": { - "rev": "1af8ca2a981c2f67844f343e224f4c7b1969de1c" + "rev": "e419a46e2a1317a63639ac13fc5a22d7e967fbef" }, "lib/rain.extrospection": { "rev": "ab33ddb8b64d7566edfb15a775d86c536c977181" diff --git a/lib/rain.deploy b/lib/rain.deploy index 1af8ca2..e419a46 160000 --- a/lib/rain.deploy +++ b/lib/rain.deploy @@ -1 +1 @@ -Subproject commit 1af8ca2a981c2f67844f343e224f4c7b1969de1c +Subproject commit e419a46e2a1317a63639ac13fc5a22d7e967fbef From 17cb97aa859685f272563e5c75a25c1db6e813a6 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 17:59:24 +0400 Subject: [PATCH 10/19] foundry.toml config --- foundry.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/foundry.toml b/foundry.toml index f348a82..a9dc71a 100644 --- a/foundry.toml +++ b/foundry.toml @@ -22,3 +22,14 @@ remappings = [ [fuzz] runs = 2048 +[rpc_endpoints] +arbitrum = "${CI_DEPLOY_ARBITRUM_RPC_URL}" +base = "${CI_DEPLOY_BASE_RPC_URL}" +flare = "${CI_DEPLOY_FLARE_RPC_URL}" +polygon = "${CI_DEPLOY_POLYGON_RPC_URL}" + +[etherscan] +arbitrum = { key = "${CI_DEPLOY_ARBITRUM_ETHERSCAN_API_KEY}" } +base = { key = "${CI_DEPLOY_BASE_ETHERSCAN_API_KEY}" } +flare = { key = "${CI_DEPLOY_FLARE_ETHERSCAN_API_KEY}" } +polygon = { key = "${CI_DEPLOY_POLYGON_ETHERSCAN_API_KEY}" } \ No newline at end of file From ac5908fb756d5701a3a6879e1caa97c0833c8e2c Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:00:38 +0400 Subject: [PATCH 11/19] deployed address --- src/lib/LibCloneFactoryDeploy.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol index 34336f5..b33d27c 100644 --- a/src/lib/LibCloneFactoryDeploy.sol +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.25; library LibCloneFactoryDeploy { - address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0); + address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0xFF33804957D415F0BDCC5A5314D88125F1d3beee); bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = bytes32(0); } From 95b27d2856d415e5cf1829f1091a73a9310126d6 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:08:14 +0400 Subject: [PATCH 12/19] deployed code hash --- src/lib/LibCloneFactoryDeploy.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol index b33d27c..15d4153 100644 --- a/src/lib/LibCloneFactoryDeploy.sol +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -5,5 +5,5 @@ pragma solidity ^0.8.25; library LibCloneFactoryDeploy { address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0xFF33804957D415F0BDCC5A5314D88125F1d3beee); - bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = bytes32(0); + bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = bytes32(0xe492c748e3f4247a6a99f0703c29bc14f662f4716c3faa6b8ef33f8ac5a691eb); } From 2024c078a583a7018bb8446488338647dc5e5a01 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:14:44 +0400 Subject: [PATCH 13/19] fmt --- src/lib/LibCloneFactoryDeploy.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol index 15d4153..515fd4a 100644 --- a/src/lib/LibCloneFactoryDeploy.sol +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -5,5 +5,6 @@ pragma solidity ^0.8.25; library LibCloneFactoryDeploy { address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0xFF33804957D415F0BDCC5A5314D88125F1d3beee); - bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = bytes32(0xe492c748e3f4247a6a99f0703c29bc14f662f4716c3faa6b8ef33f8ac5a691eb); + bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = + bytes32(0xe492c748e3f4247a6a99f0703c29bc14f662f4716c3faa6b8ef33f8ac5a691eb); } From d9fd158e2e8d043c3b65660a09ec1dd6910ad16f Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:20:39 +0400 Subject: [PATCH 14/19] tests --- .gitignore | 3 ++- src/lib/LibCloneFactoryDeploy.sol | 4 ++-- test/{ => src}/concrete/CloneFactory.t.sol | 0 test/src/lib/LibCloneFactoryDeploy.t.sol | 27 ++++++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) rename test/{ => src}/concrete/CloneFactory.t.sol (100%) create mode 100644 test/src/lib/LibCloneFactoryDeploy.t.sol diff --git a/.gitignore b/.gitignore index a4d5834..edc4cb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ out cache -result \ No newline at end of file +result +.env \ No newline at end of file diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol index 515fd4a..3f19313 100644 --- a/src/lib/LibCloneFactoryDeploy.sol +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.25; library LibCloneFactoryDeploy { - address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0xFF33804957D415F0BDCC5A5314D88125F1d3beee); + address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0x0118968b787271206878fcc635d5961f15cb2344); bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = - bytes32(0xe492c748e3f4247a6a99f0703c29bc14f662f4716c3faa6b8ef33f8ac5a691eb); + bytes32(0xc3551c73c20f69ddbb73f5cf312b40405b757815ed200b99ea076a64454c4517); } diff --git a/test/concrete/CloneFactory.t.sol b/test/src/concrete/CloneFactory.t.sol similarity index 100% rename from test/concrete/CloneFactory.t.sol rename to test/src/concrete/CloneFactory.t.sol diff --git a/test/src/lib/LibCloneFactoryDeploy.t.sol b/test/src/lib/LibCloneFactoryDeploy.t.sol new file mode 100644 index 0000000..258b731 --- /dev/null +++ b/test/src/lib/LibCloneFactoryDeploy.t.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: LicenseRef-DCL-1.0 +// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd +pragma solidity =0.8.25; + +import {Test} from "forge-std/Test.sol"; +import {LibRainDeploy} from "rain.deploy/lib/LibRainDeploy.sol"; +import {LibCloneFactoryDeploy} from "src/lib/LibCloneFactoryDeploy.sol"; +import {CloneFactory} from "src/concrete/CloneFactory.sol"; + +contract LibCloneFactoryDeployTest is Test { + function testDeployAddress() external { + vm.createSelectFork(vm.envString("CI_FORK_ETH_RPC_URL")); + + address deployedAddress = LibRainDeploy.deployZoltu(type(CloneFactory).creationCode); + + assertEq(deployedAddress, LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_ADDRESS); + assertTrue(address(deployedAddress).code.length > 0, "Deployed address has no code"); + + assertEq(address(deployedAddress).codehash, LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_CODEHASH); + } + + function testExpectedCodeHashDecimalFloat() external { + CloneFactory cloneFactory = new CloneFactory(); + + assertEq(address(cloneFactory).codehash, LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_CODEHASH); + } +} From 63a766a5a4a8690ec6b0920381a4e0297c240676 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:22:05 +0400 Subject: [PATCH 15/19] lint --- script/Deploy.sol | 5 ----- 1 file changed, 5 deletions(-) diff --git a/script/Deploy.sol b/script/Deploy.sol index c5f5973..8d52889 100644 --- a/script/Deploy.sol +++ b/script/Deploy.sol @@ -23,10 +23,5 @@ contract Deploy is Script { LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_CODEHASH, new address[](0) ); - - // vm.startBroadcast(deployerPrivateKey); - // CloneFactory cloneFactory = new CloneFactory(); - // (cloneFactory); - // vm.stopBroadcast(); } } From de7730e45f24c5ea514a4da3ac7db301bb82f7a7 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:28:52 +0400 Subject: [PATCH 16/19] rm metadata --- foundry.toml | 3 +++ src/lib/LibCloneFactoryDeploy.sol | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/foundry.toml b/foundry.toml index a9dc71a..a3ed5e8 100644 --- a/foundry.toml +++ b/foundry.toml @@ -11,6 +11,9 @@ optimizer_runs = 100000 evm_version = "cancun" +bytecode_hash = "none" +cbor_metadata = false + # Build metadata used for testing rain meta aware contracts in this folder rather # than expose ffi to forge. fs_permissions = [{ access = "read", path = "./meta"}] diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol index 3f19313..a2e8026 100644 --- a/src/lib/LibCloneFactoryDeploy.sol +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.25; library LibCloneFactoryDeploy { - address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0x0118968b787271206878fcc635d5961f15cb2344); + address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0x444acC29d63fa643E8adCC35FD9aa6DE111dCb39); bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = - bytes32(0xc3551c73c20f69ddbb73f5cf312b40405b757815ed200b99ea076a64454c4517); + bytes32(0xf21b813c7075a1621285df3a8369d0652c31ea80cb807be1aaadafeecd134475); } From 83e0f4c8b600e39c9ff4e29ff389856239ef5517 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:34:31 +0400 Subject: [PATCH 17/19] fix ci --- .github/workflows/rainix.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index 4eb7ef8..e7dbef6 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -26,6 +26,7 @@ jobs: - name: Run ${{ matrix.task }} env: ETH_RPC_URL: ${{ secrets.CI_DEPLOY_RPC_URL }} + CI_FORK_ETH_RPC_URL: ${{ secrets.RPC_URL_ETHEREUM_FORK || vars.RPC_URL_ETHEREUM_FORK || '' }} ETHERSCAN_API_KEY: ${{ secrets.EXPLORER_VERIFICATION_KEY }} DEPLOY_VERIFIER: 'etherscan' run: nix develop -c ${{ matrix.task }} \ No newline at end of file From 2653298bd2c9f3cbf476cbc74e1b8320c78d1162 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:41:15 +0400 Subject: [PATCH 18/19] lint --- test/src/lib/LibCloneFactoryDeploy.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/lib/LibCloneFactoryDeploy.t.sol b/test/src/lib/LibCloneFactoryDeploy.t.sol index 258b731..4f84b91 100644 --- a/test/src/lib/LibCloneFactoryDeploy.t.sol +++ b/test/src/lib/LibCloneFactoryDeploy.t.sol @@ -19,7 +19,7 @@ contract LibCloneFactoryDeployTest is Test { assertEq(address(deployedAddress).codehash, LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_CODEHASH); } - function testExpectedCodeHashDecimalFloat() external { + function testExpectedCodeHash() external { CloneFactory cloneFactory = new CloneFactory(); assertEq(address(cloneFactory).codehash, LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_CODEHASH); From ce34cec05d6ee986e58dbb23b3009aaa82f4c849 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Tue, 10 Feb 2026 19:52:35 +0400 Subject: [PATCH 19/19] lint --- .gas-snapshot | 14 ++++++++------ src/lib/LibCloneFactoryDeploy.sol | 12 ++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 4c7aa8d..e19acb7 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,6 +1,8 @@ -CloneFactoryCloneTest:testCloneBytecode(bytes) (runs: 2048, μ: 362118, ~: 352769) -CloneFactoryCloneTest:testCloneInitializeData(bytes) (runs: 2048, μ: 366673, ~: 357227) -CloneFactoryCloneTest:testCloneInitializeEvent(bytes) (runs: 2048, μ: 367289, ~: 357940) -CloneFactoryCloneTest:testCloneInitializeFailureFails(bytes32) (runs: 2048, μ: 170471, ~: 170471) -CloneFactoryCloneTest:testCloneUninitializableFails(address,bytes) (runs: 2048, μ: 9870, ~: 9844) -CloneFactoryCloneTest:testZeroImplementationCodeSizeError(address,bytes) (runs: 2048, μ: 10526, ~: 10557) \ No newline at end of file +CloneFactoryCloneTest:testCloneBytecode(bytes) (runs: 2048, μ: 350833, ~: 341941) +CloneFactoryCloneTest:testCloneInitializeData(bytes) (runs: 2048, μ: 355388, ~: 346399) +CloneFactoryCloneTest:testCloneInitializeEvent(bytes) (runs: 2048, μ: 356010, ~: 347118) +CloneFactoryCloneTest:testCloneInitializeFailureFails(bytes32) (runs: 2048, μ: 159643, ~: 159643) +CloneFactoryCloneTest:testCloneUninitializableFails(address,bytes) (runs: 2048, μ: 9882, ~: 9844) +CloneFactoryCloneTest:testZeroImplementationCodeSizeError(address,bytes) (runs: 2048, μ: 10539, ~: 10557) +LibCloneFactoryDeployTest:testDeployAddress() (gas: 242794) +LibCloneFactoryDeployTest:testExpectedCodeHash() (gas: 235395) \ No newline at end of file diff --git a/src/lib/LibCloneFactoryDeploy.sol b/src/lib/LibCloneFactoryDeploy.sol index a2e8026..39ebbbe 100644 --- a/src/lib/LibCloneFactoryDeploy.sol +++ b/src/lib/LibCloneFactoryDeploy.sol @@ -2,9 +2,21 @@ // SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd pragma solidity ^0.8.25; +/// @title LibCloneFactoryDeploy +/// A library containing the deployed address and code hash of the CloneFactory +/// contract when deployed with the rain standard zoltu deployer. This allows +/// idempotent deployments against precommitted addresses and hashes that can be +/// easily verified automatically in tests and scripts rather than relying on +/// registries or manual verification. library LibCloneFactoryDeploy { + /// The address of the `CloneFactory` contract when deployed with the rain + /// standard zoltu deployer. address constant CLONE_FACTORY_DEPLOYED_ADDRESS = address(0x444acC29d63fa643E8adCC35FD9aa6DE111dCb39); + /// The code hash of the `CloneFactory` contract when deployed with the rain + /// standard zoltu deployer. This can be used to verify that the deployed + /// contract has the expected bytecode, which provides stronger guarantees + /// than just checking the address. bytes32 constant CLONE_FACTORY_DEPLOYED_CODEHASH = bytes32(0xf21b813c7075a1621285df3a8369d0652c31ea80cb807be1aaadafeecd134475); }