From 683b9ffb2fa9a99f2b3c5208e6f8aa87f104c616 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Thu, 2 May 2024 23:17:16 -0700 Subject: [PATCH 01/10] changed base and batch invokers to have relative dep paths + updated makefile foundry command + downgraded forge-std to 1.7.6 --- .gitmodules | 1 + Makefile | 18 +++++++++++------- lib/forge-std | 2 +- src/BaseInvoker.sol | 2 +- src/BatchInvoker.sol | 4 ++-- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6f41488..efd656a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,7 @@ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std + branch = chore/bump-to-1.7.6 [submodule "lib/solady"] path = lib/solady url = https://github.com/vectorized/solady \ No newline at end of file diff --git a/Makefile b/Makefile index f390ac0..25b3577 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,14 @@ install: .PHONY: foundry foundry: - docker run --rm \ - -v $$(pwd):/app/foundry \ - -u $$(id -u):$$(id -g) \ - -p 8545:8545 \ - ghcr.io/paradigmxyz/foundry-alphanet:latest \ - --foundry-directory /app/foundry \ - --foundry-command "$(cmd)" \ No newline at end of file + @extra_flags="" + @if [ "$$(echo $(cmd) | cut -c 1-5)" = "anvil" ]; then \ + extra_flags="-p 8545:8545"; \ + fi; + @docker run --rm \ + -v $$(pwd):/app/foundry \ + -u $$(id -u):$$(id -g) \ + $$extra_flags \ + ghcr.io/paradigmxyz/foundry-alphanet:latest \ + --foundry-directory /app/foundry \ + --foundry-command "$(cmd)" \ No newline at end of file diff --git a/lib/forge-std b/lib/forge-std index 2f11269..5f6b5bc 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 2f112697506eab12d433a65fdc31a639548fe365 +Subproject commit 5f6b5bc6197b3dd248b38a4db60886eebf2a5be1 diff --git a/src/BaseInvoker.sol b/src/BaseInvoker.sol index 0da981e..fb3f14d 100644 --- a/src/BaseInvoker.sol +++ b/src/BaseInvoker.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity ^0.8.20; -import { Auth } from "src/Auth.sol"; +import { Auth } from "./Auth.sol"; /// @title BaseInvoker /// @author Anna Carroll diff --git a/src/BatchInvoker.sol b/src/BatchInvoker.sol index 9b4c183..a8120ba 100644 --- a/src/BatchInvoker.sol +++ b/src/BatchInvoker.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity ^0.8.20; -import { BaseInvoker } from "src/BaseInvoker.sol"; -import { MultiSendAuthCallOnly } from "src/MultiSendAuthCallOnly.sol"; +import { BaseInvoker } from "./BaseInvoker.sol"; +import { MultiSendAuthCallOnly } from "./MultiSendAuthCallOnly.sol"; /// @title BatchInvoker /// @author Anna Carroll From d7e75b035c52999dd3c4cac48afb20d71bebafa6 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Fri, 3 May 2024 00:20:18 -0700 Subject: [PATCH 02/10] forge install: solady v0.0.198 --- .gitmodules | 2 +- lib/solady | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index efd656a..70f9103 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,4 +4,4 @@ branch = chore/bump-to-1.7.6 [submodule "lib/solady"] path = lib/solady - url = https://github.com/vectorized/solady \ No newline at end of file + url = https://github.com/vectorized/solady diff --git a/lib/solady b/lib/solady index fad3f67..adfad66 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit fad3f6703c2cd4cfd185f9921790d117503f54c6 +Subproject commit adfad66656a6ef8c65b2a412d849bbf7f7a59842 From 205f35c37279d1960c56c53c6ceb1eb929ce8154 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Fri, 3 May 2024 18:33:56 -0700 Subject: [PATCH 03/10] updated makefile --- Makefile | 14 ++++++++------ README.md | 4 ++-- script/Deploy.s.sol | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 25b3577..a9fdebf 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,15 @@ install: .PHONY: foundry foundry: - @extra_flags="" - @if [ "$$(echo $(cmd) | cut -c 1-5)" = "anvil" ]; then \ + @if [[ "$(cmd)" == anvil* ]]; then \ extra_flags="-p 8545:8545"; \ - fi; - @docker run --rm \ - -v $$(pwd):/app/foundry \ - -u $$(id -u):$$(id -g) \ + else \ + extra_flags=""; \ + fi; \ + docker run --rm \ + --env-file .env \ + -v "$$(pwd):/app/foundry" \ + -u "$$(id -u):$$(id -g)" \ $$extra_flags \ ghcr.io/paradigmxyz/foundry-alphanet:latest \ --foundry-directory /app/foundry \ diff --git a/README.md b/README.md index 3a6ed95..eeef1b6 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ make cmd="anvil" Deploy the `BatchInvoker` contract to the network. ```shell -make cmd="forge script Deploy --sig 'deploy()' --rpc-url $RPC_URL --private-key $EXECUTOR_PRIVATE_KEY --broadcast" +make cmd="forge script Deploy --sig deploy() --rpc-url $RPC_URL --private-key $EXECUTOR_PRIVATE_KEY --broadcast" ``` **Note:** if the `$RPC_URL` you're pointing to is on host, you should use http://host.docker.internal:8545 instead of http://localhost:8545. See Docker's networking docs [here](https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host). @@ -73,7 +73,7 @@ make cmd="forge script Deploy --sig 'deploy()' --rpc-url $RPC_URL --private-key We can test the `BatchInvoker` by sending a transaction via the contract. ```shell -make cmd="forge script Executor --sig 'sendEth(address,address,uint256)' $INVOKER_ADDRESS 0x3074ca113074ca113074ca113074ca113074ca11 0.01ether --rpc-url $RPC_URL --broadcast" +make cmd="forge script Executor --sig sendEth(address,address,uint256) $INVOKER_ADDRESS 0x3074ca113074ca113074ca113074ca113074ca11 0.01ether --rpc-url $RPC_URL --broadcast" ``` ## 3074-Compatible Networks diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index 3c61799..f9489c5 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -6,7 +6,7 @@ import { BatchInvoker } from "../src/BatchInvoker.sol"; contract Deploy is Script { // deploy: - // make cmd="forge script Deploy --sig 'deploy()' --rpc-url $RPC_URL --private-key $EXECUTOR_PRIVATE_KEY --broadcast" + // make cmd="forge script Deploy --sig deploy() --rpc-url $RPC_URL --private-key $EXECUTOR_PRIVATE_KEY --broadcast" function deploy() public { vm.broadcast(); new BatchInvoker(); From 4fff1c69c09d72378f305f5797add2557427aedd Mon Sep 17 00:00:00 2001 From: Jrachman Date: Fri, 3 May 2024 18:57:22 -0700 Subject: [PATCH 04/10] updated forge-std back to 1.7.3 --- .gitmodules | 1 - lib/forge-std | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 70f9103..0f07815 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,6 @@ [submodule "lib/forge-std"] path = lib/forge-std url = https://github.com/foundry-rs/forge-std - branch = chore/bump-to-1.7.6 [submodule "lib/solady"] path = lib/solady url = https://github.com/vectorized/solady diff --git a/lib/forge-std b/lib/forge-std index 5f6b5bc..1955082 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 5f6b5bc6197b3dd248b38a4db60886eebf2a5be1 +Subproject commit 195508236e4e79d4cd6b3a1fa144929848db9d57 From 672491326c509dcccd30068823024b14a2e6a951 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Sat, 4 May 2024 18:59:16 -0700 Subject: [PATCH 05/10] reverted lib back to main --- lib/forge-std | 2 +- lib/solady | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/forge-std b/lib/forge-std index 1955082..2f11269 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 195508236e4e79d4cd6b3a1fa144929848db9d57 +Subproject commit 2f112697506eab12d433a65fdc31a639548fe365 diff --git a/lib/solady b/lib/solady index adfad66..fad3f67 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit adfad66656a6ef8c65b2a412d849bbf7f7a59842 +Subproject commit fad3f6703c2cd4cfd185f9921790d117503f54c6 From ff94440b977b04c5a3989dfe5df7505a8a0c9042 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Sat, 4 May 2024 19:00:18 -0700 Subject: [PATCH 06/10] removed extra line --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 0f07815..6f41488 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/foundry-rs/forge-std [submodule "lib/solady"] path = lib/solady - url = https://github.com/vectorized/solady + url = https://github.com/vectorized/solady \ No newline at end of file From 424fd76984d996ced7830a88c3de5c18da6ed82d Mon Sep 17 00:00:00 2001 From: Jrachman Date: Sun, 5 May 2024 17:31:41 -0700 Subject: [PATCH 07/10] added remappings for gitmodule'ing this repo --- remappings.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 remappings.txt diff --git a/remappings.txt b/remappings.txt new file mode 100644 index 0000000..f0a1ed5 --- /dev/null +++ b/remappings.txt @@ -0,0 +1 @@ +@3074-invokers/contracts/=src/ \ No newline at end of file From 6c41f315cc788784aff097fdf757052ede8dc8c6 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Wed, 8 May 2024 20:44:13 -0700 Subject: [PATCH 08/10] updated script to match integration test setup --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f045f5f..c095a6e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ out/ # Ignores development broadcast logs !/broadcast +/broadcast/*/1337/ /broadcast/*/31337/ /broadcast/*/41144114/ /broadcast/**/dry-run/ From 6b406d38eb882c7df9881d415cc7dd6ebb9ef190 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Mon, 20 May 2024 13:47:37 -0700 Subject: [PATCH 09/10] added fork test to execute --- script/Execute.s.sol | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/script/Execute.s.sol b/script/Execute.s.sol index a4e3972..4de0db1 100644 --- a/script/Execute.s.sol +++ b/script/Execute.s.sol @@ -7,6 +7,7 @@ import { BatchInvoker } from "../src/BatchInvoker.sol"; import { vToYParity, packCalls } from "../test/utils.sol"; import { Script } from "forge-std/Script.sol"; import { Test } from "forge-std/Test.sol"; +import { LibString } from "solady/utils/LibString.sol"; contract Executor is Script, Test { uint256 apk = vm.envUint("AUTHORITY_PRIVATE_KEY"); @@ -43,4 +44,28 @@ contract Executor is Script, Test { call(invoker, recipient, value, ""); assertEq(recipient.balance, balanceBefore + value); } + + function test_fork_sendEth() public { + // set up fork, skip if localhost or docker.internal + string memory rpcUrl = vm.envString("RPC_URL"); + + if (bytes(rpcUrl).length > 0 && (LibString.contains(rpcUrl, "localhost") || LibString.contains(rpcUrl, "docker.internal"))) { + return; + } + uint256 forkId = vm.createFork(rpcUrl); + vm.selectFork(forkId); + + // deploy batchinvoker + BatchInvoker invoker = new BatchInvoker(); + // send 10 eth to authority + vm.broadcast(epk); + address authority = vm.addr(apk); + authority.call{value: 10 ether}(""); + assertEq(authority.balance, 10 ether); + + // send 1 eth to 0x3074 via invoker + sendEth(address(invoker), address(0x3074), 1 ether); + assertEq(address(0x3074).balance, 1 ether); + assertEq(authority.balance, 9 ether); + } } From 4a840a47f22cedb31528a447dd2d3edd1318c5f7 Mon Sep 17 00:00:00 2001 From: Jrachman Date: Mon, 20 May 2024 14:28:51 -0700 Subject: [PATCH 10/10] removed newline --- script/Execute.s.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/script/Execute.s.sol b/script/Execute.s.sol index 4de0db1..8c0e2b1 100644 --- a/script/Execute.s.sol +++ b/script/Execute.s.sol @@ -48,7 +48,6 @@ contract Executor is Script, Test { function test_fork_sendEth() public { // set up fork, skip if localhost or docker.internal string memory rpcUrl = vm.envString("RPC_URL"); - if (bytes(rpcUrl).length > 0 && (LibString.contains(rpcUrl, "localhost") || LibString.contains(rpcUrl, "docker.internal"))) { return; }