From b993bf32764aa926f248e6c0b1f66674e7c5b91d Mon Sep 17 00:00:00 2001
From: Trajan0x <trajan0x@users.noreply.github.com>
Date: Fri, 19 Jul 2024 14:24:25 -0400
Subject: [PATCH 1/5] [goreleaser] disable cache build

---
 .github/workflows/goreleaser-actions.yml | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/goreleaser-actions.yml b/.github/workflows/goreleaser-actions.yml
index 2698ea3435..be0978a27b 100644
--- a/.github/workflows/goreleaser-actions.yml
+++ b/.github/workflows/goreleaser-actions.yml
@@ -111,7 +111,7 @@ jobs:
 
   # TODO: we may want to dry run this on prs
   run-goreleaser:
-    runs-on: namespace-profile-default
+    runs-on: github-namespace-profile-fast-goreleaser-synapsecns-sanguine
     needs: [build-goreleaser,changes]
     if: ${{ needs.changes.outputs.package_count > 0 }}
     permissions:
@@ -128,7 +128,11 @@ jobs:
         package: ${{ fromJSON(needs.changes.outputs.packages) }}
     container:
       image: ${{ needs.build-goreleaser.outputs.goreleaser-image }}
-      volumes: [ /repo ]
+      volumes:
+        - /repo
+        - /cache:/cache
+      options: --cap-add=SYS_ADMIN # Required to by nscloud-cache-action to call `mount`.
+
     steps:
       - name: Git Checkout
         uses: actions/checkout@v4
@@ -137,6 +141,7 @@ jobs:
           submodules: 'recursive'
 
       - name: Set up cache
+        if:  ${{ !contains(runner.name, 'nsc') }}
         uses: actions/cache@v4
         with:
           path: |
@@ -146,6 +151,12 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-go-${{matrix.package}}
 
+      - name: Setup Go cache
+        uses: namespacelabs/nscloud-cache-action@v1
+        if:  ${{ contains(runner.name, 'nsc') }}
+        with:
+          cache: go
+
       - name: Get branch name
         id: branch-name
         uses: tj-actions/branch-names@v6

From 2dd78c33cfef926f70f132bf51a3b1e7401faadd Mon Sep 17 00:00:00 2001
From: Trajan0x <trajan0x@users.noreply.github.com>
Date: Fri, 19 Jul 2024 14:25:23 -0400
Subject: [PATCH 2/5] [goreleaser] use correct image

---
 .github/workflows/goreleaser-actions.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/goreleaser-actions.yml b/.github/workflows/goreleaser-actions.yml
index be0978a27b..7a2307b66d 100644
--- a/.github/workflows/goreleaser-actions.yml
+++ b/.github/workflows/goreleaser-actions.yml
@@ -111,7 +111,7 @@ jobs:
 
   # TODO: we may want to dry run this on prs
   run-goreleaser:
-    runs-on: github-namespace-profile-fast-goreleaser-synapsecns-sanguine
+    runs-on: namespace-profile-fast-goreleaser
     needs: [build-goreleaser,changes]
     if: ${{ needs.changes.outputs.package_count > 0 }}
     permissions:

From 22560ceeb173d6feefcda74ace37473b5dc6beba Mon Sep 17 00:00:00 2001
From: Trajan0x <trajan0x@users.noreply.github.com>
Date: Fri, 19 Jul 2024 14:37:48 -0400
Subject: [PATCH 3/5] fix hang goroutine [goreleaser]

---
 ethergo/backends/anvil/anvil.go | 2 +-
 services/rfq/e2e/setup_test.go  | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ethergo/backends/anvil/anvil.go b/ethergo/backends/anvil/anvil.go
index 2f631bedec..adbb0a6050 100644
--- a/ethergo/backends/anvil/anvil.go
+++ b/ethergo/backends/anvil/anvil.go
@@ -308,7 +308,7 @@ func (f *Backend) FundAccount(ctx context.Context, address common.Address, amoun
 	defer unlocker.Unlock()
 
 	prevBalance, err := f.Backend.BalanceAt(ctx, address, nil)
-	require.Nil(f.T(), err)
+	require.NoError(f.T(), err)
 
 	newBal := new(big.Int).Add(prevBalance, &amount)
 
diff --git a/services/rfq/e2e/setup_test.go b/services/rfq/e2e/setup_test.go
index 460047ffc8..0cfa0eceea 100644
--- a/services/rfq/e2e/setup_test.go
+++ b/services/rfq/e2e/setup_test.go
@@ -147,20 +147,25 @@ func (i *IntegrationSuite) setupBE(backend backends.SimulatedTestBackend) {
 	backend.FundAccount(i.GetTestContext(), i.guardWallet.Address(), ethAmount)
 	backend.FundAccount(i.GetTestContext(), i.userWallet.Address(), ethAmount)
 
+	var wg sync.WaitGroup
+	wg.Add(1)
 	go func() {
+		defer wg.Done()
 		i.manager.BulkDeploy(i.GetTestContext(), core.ToSlice(backend), predeploys...)
 	}()
 
 	// TODO: in the case of relayer this not finishing before the test starts can lead to race conditions since
 	// nonce may be shared between submitter and relayer. Think about how to deal w/ this.
 	for _, user := range []wallet.Wallet{i.relayerWallet, i.guardWallet, i.userWallet} {
+		wg.Add(1)
 		go func(userWallet wallet.Wallet) {
+			defer wg.Done()
 			for _, token := range predeployTokens {
 				i.Approve(backend, i.manager.Get(i.GetTestContext(), backend, token), userWallet)
 			}
 		}(user)
 	}
-
+	wg.Wait()
 }
 
 func (i *IntegrationSuite) setupCCTP() {

From 1528a2d5119691d866b3ca4c5c83d66b28ed8b43 Mon Sep 17 00:00:00 2001
From: Trajan0x <trajan0x@users.noreply.github.com>
Date: Fri, 19 Jul 2024 15:08:59 -0400
Subject: [PATCH 4/5] [goreleaser] add premature call

---
 services/rfq/e2e/setup_test.go | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/services/rfq/e2e/setup_test.go b/services/rfq/e2e/setup_test.go
index 0cfa0eceea..55792ccd00 100644
--- a/services/rfq/e2e/setup_test.go
+++ b/services/rfq/e2e/setup_test.go
@@ -148,11 +148,6 @@ func (i *IntegrationSuite) setupBE(backend backends.SimulatedTestBackend) {
 	backend.FundAccount(i.GetTestContext(), i.userWallet.Address(), ethAmount)
 
 	var wg sync.WaitGroup
-	wg.Add(1)
-	go func() {
-		defer wg.Done()
-		i.manager.BulkDeploy(i.GetTestContext(), core.ToSlice(backend), predeploys...)
-	}()
 
 	// TODO: in the case of relayer this not finishing before the test starts can lead to race conditions since
 	// nonce may be shared between submitter and relayer. Think about how to deal w/ this.
@@ -171,7 +166,6 @@ func (i *IntegrationSuite) setupBE(backend backends.SimulatedTestBackend) {
 func (i *IntegrationSuite) setupCCTP() {
 	// deploy the contract to all backends
 	testBackends := core.ToSlice(i.originBackend, i.destBackend)
-	i.cctpDeployManager.BulkDeploy(i.GetTestContext(), testBackends, cctpTest.SynapseCCTPType, cctpTest.MockMintBurnTokenType)
 
 	// register remote deployments and tokens
 	for _, backend := range testBackends {

From 0a06328fdb602a61762da8d99f27bc80262d2fd8 Mon Sep 17 00:00:00 2001
From: Trajan0x <trajan0x@users.noreply.github.com>
Date: Fri, 19 Jul 2024 15:15:37 -0400
Subject: [PATCH 5/5] install sudo [goreleaser]

---
 .github/workflows/goreleaser-actions.yml | 5 ++++-
 docker/goreleaser/Dockerfile             | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/goreleaser-actions.yml b/.github/workflows/goreleaser-actions.yml
index 7a2307b66d..481d45a2f0 100644
--- a/.github/workflows/goreleaser-actions.yml
+++ b/.github/workflows/goreleaser-actions.yml
@@ -111,7 +111,8 @@ jobs:
 
   # TODO: we may want to dry run this on prs
   run-goreleaser:
-    runs-on: namespace-profile-fast-goreleaser
+    runs-on:
+      - namespace-profile-fast-goreleaser
     needs: [build-goreleaser,changes]
     if: ${{ needs.changes.outputs.package_count > 0 }}
     permissions:
@@ -128,6 +129,8 @@ jobs:
         package: ${{ fromJSON(needs.changes.outputs.packages) }}
     container:
       image: ${{ needs.build-goreleaser.outputs.goreleaser-image }}
+      env:
+        NSC_CACHE_PATH: ${{ env.NSC_CACHE_PATH }} # env.NSC_CACHE_PATH contains the path to Cache Volume directory, that is `/cache`.
       volumes:
         - /repo
         - /cache:/cache
diff --git a/docker/goreleaser/Dockerfile b/docker/goreleaser/Dockerfile
index d325f2b92a..4f383341be 100644
--- a/docker/goreleaser/Dockerfile
+++ b/docker/goreleaser/Dockerfile
@@ -113,7 +113,7 @@ ENV NODE_MAJOR=20
 
 RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" |  tee /etc/apt/sources.list.d/nodesource.list
 
-RUN apt-get update && apt-get install -y nodejs
+RUN apt-get update && apt-get install -y nodejs sudo
 
 # Install syft