diff --git a/.github/workflows/build-pre-baked-images.yml b/.github/workflows/build-pre-baked-images.yml index fb81d7aa..72e2776d 100644 --- a/.github/workflows/build-pre-baked-images.yml +++ b/.github/workflows/build-pre-baked-images.yml @@ -50,4 +50,4 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: "FOUNDRY_VERSION=nightly-2044faec64f99a21f0e5f0094458a973612d0712" \ No newline at end of file + build-args: "FOUNDRY_VERSION=nightly-ac81a53d1d5823919ffbadd3c65f081927aa11f2" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9074580b..7960193c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -38,8 +38,8 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: - version: 'nightly-2044faec64f99a21f0e5f0094458a973612d0712' + version: "nightly-ac81a53d1d5823919ffbadd3c65f081927aa11f2" - run: forge --version - name: Run Forge fmt # only format code, we do not want to format LIB - run: forge fmt contracts/src --check \ No newline at end of file + run: forge fmt contracts/src --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b685aaed..0a9168f1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: - version: 'nightly-2044faec64f99a21f0e5f0094458a973612d0712' + version: "nightly-ac81a53d1d5823919ffbadd3c65f081927aa11f2" - run: dev/contracts/deploy-local - name: Run Tests run: | @@ -51,7 +51,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: - version: 'nightly-2044faec64f99a21f0e5f0094458a973612d0712' + version: "nightly-ac81a53d1d5823919ffbadd3c65f081927aa11f2" - name: Run Forge build working-directory: contracts diff --git a/cmd/replication/main.go b/cmd/replication/main.go index fb40b661..40de3557 100644 --- a/cmd/replication/main.go +++ b/cmd/replication/main.go @@ -57,9 +57,10 @@ func main() { var wg sync.WaitGroup doneC := make(chan bool, 1) tracing.GoPanicWrap(ctx, &wg, "main", func(ctx context.Context) { - db, err := db.NewDB( + db, err := db.NewNamespacedDB( ctx, options.DB.WriterConnectionString, + utils.BuildNamespace(options), options.DB.WaitForDB, options.DB.ReadTimeout, ) diff --git a/dev/contracts/deploy-ephemeral b/dev/contracts/deploy-ephemeral index cfc6f0bc..3f6e2a3c 100755 --- a/dev/contracts/deploy-ephemeral +++ b/dev/contracts/deploy-ephemeral @@ -5,4 +5,4 @@ source dev/contracts/.env cd ./contracts -forge create --legacy --json --rpc-url $DOCKER_RPC_URL --private-key $PRIVATE_KEY "$1:$2" \ No newline at end of file +forge create --legacy --json --broadcast --rpc-url $DOCKER_RPC_URL --private-key $PRIVATE_KEY "$1:$2" \ No newline at end of file diff --git a/dev/contracts/deploy-local b/dev/contracts/deploy-local index 698a1a60..feae3942 100755 --- a/dev/contracts/deploy-local +++ b/dev/contracts/deploy-local @@ -1,6 +1,8 @@ #!/bin/bash # Deploy the smart contracts to the local anvil node +set -euo pipefail + source dev/contracts/.env # Make sure the build directory exists @@ -10,7 +12,7 @@ cd ./contracts # Deploy a contract and save the output (which includes the contract address) to a JSON file to be used in tests function deploy_contract() { - forge create --legacy --json --rpc-url $DOCKER_RPC_URL --private-key $PRIVATE_KEY "$1:$2" > ../build/$2.json + forge create --broadcast --legacy --json --rpc-url $DOCKER_RPC_URL --private-key $PRIVATE_KEY "$1:$2" > ../build/$2.json } deploy_contract src/GroupMessages.sol GroupMessages diff --git a/dev/contracts/deploy-testnet b/dev/contracts/deploy-testnet index 6aa410e3..d5a18abc 100755 --- a/dev/contracts/deploy-testnet +++ b/dev/contracts/deploy-testnet @@ -8,6 +8,7 @@ cd ./contracts function deploy_contract() { forge create \ --rpc-url $RPC_URL \ + --broadcast \ --chain=241320161 \ --compiler-version=0.8.28 \ --verify \ diff --git a/pkg/utils/namespace.go b/pkg/utils/namespace.go new file mode 100644 index 00000000..67276c16 --- /dev/null +++ b/pkg/utils/namespace.go @@ -0,0 +1,15 @@ +package utils + +import ( + ethcrypto "github.com/ethereum/go-ethereum/crypto" + "github.com/xmtp/xmtpd/pkg/config" +) + +func BuildNamespace(options config.ServerOptions) string { + hash := ethcrypto.Keccak256( + []byte(options.Signer.PrivateKey), + []byte(options.Contracts.NodesContractAddress), + ) + + return HexEncode(hash)[:12] +}