From 31c6f587e804bf6be29c965347ab45d5f12bc512 Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Thu, 26 Sep 2024 17:02:23 -0300 Subject: [PATCH 1/2] Change the way exec.Command is called to sanitize parameters --- testutils/anvil.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/testutils/anvil.go b/testutils/anvil.go index 3cec5400..84a82126 100644 --- a/testutils/anvil.go +++ b/testutils/anvil.go @@ -131,12 +131,7 @@ func GetContractAddressesFromContractRegistry(ethHttpUrl string) (mockAvsContrac } func AdvanceChainByNBlocks(n int, anvilEndpoint string) { - cmd := exec.Command("bash", "-c", - fmt.Sprintf( - // see https://book.getfoundry.sh/reference/anvil/#custom-methods - `cast rpc anvil_mine %d --rpc-url %s`, - n, anvilEndpoint), - ) + cmd := exec.Command("cast", "rpc", "anvil_mine", fmt.Sprintf("%d", n), "--rpc-url", anvilEndpoint) err := cmd.Run() if err != nil { panic(err) From d9e25172e7c4032889970964b5b542c07d9ad8a4 Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Thu, 26 Sep 2024 17:39:27 -0300 Subject: [PATCH 2/2] comment restored --- testutils/anvil.go | 1 + 1 file changed, 1 insertion(+) diff --git a/testutils/anvil.go b/testutils/anvil.go index 84a82126..42a13239 100644 --- a/testutils/anvil.go +++ b/testutils/anvil.go @@ -131,6 +131,7 @@ func GetContractAddressesFromContractRegistry(ethHttpUrl string) (mockAvsContrac } func AdvanceChainByNBlocks(n int, anvilEndpoint string) { + // see https://book.getfoundry.sh/reference/anvil/#custom-methods cmd := exec.Command("cast", "rpc", "anvil_mine", fmt.Sprintf("%d", n), "--rpc-url", anvilEndpoint) err := cmd.Run() if err != nil {