diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bc5709a..b3f15d4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,5 +16,3 @@ updates: - 'patch' exclude-patterns: - '@solana/web3.js' - - 'chainfile-*' - - '@chainfile/*' diff --git a/.gitignore b/.gitignore index 18fa918..026b4cb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ build coverage .nyc_output .turbo -.chainfile \ No newline at end of file diff --git a/README.md b/README.md index 4a2015a..a5a2bcc 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -# Chainfile Solana +# Solana Test Validator Container -Part of the [Chainfile](https://chainfile.org) ecosystem, -this library provides a Docker image for running `solana-test-validator` in a container for toolchain isolation. +Provides a Docker image for running `solana-test-validator` in a container for toolchain isolation. This is particularly useful for language-agnostic development and parallelization of systems. +> Initially created for use in [fuxingloh/chainfile](https://github.com/fuxingloh/chainfile). + > The default [solanalabs/solana](https://hub.docker.com/r/solanalabs/solana) is an optimized image, > when used on a host system that does not support AVX, it will fail with the following error: > `Incompatible CPU detected: missing AVX support. Please build from source on the target.` @@ -11,7 +12,7 @@ This is particularly useful for language-agnostic development and parallelizatio ## `solana-testcontainers` This is a standalone testcontainers-node package for running `solana-test-validator` in a container for testing -purposes. You don't need to use the Chainfile ecosystem to use this package. +purposes. ```shell npm i -D solana-testcontainers @solana/web3.js diff --git a/packages/chainfile-solana/package.json b/packages/chainfile-solana/package.json deleted file mode 100644 index 1db4020..0000000 --- a/packages/chainfile-solana/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "chainfile-solana", - "version": "0.0.0", - "private": false, - "repository": { - "url": "git+https://github.com/vetumorg/chainfile-solana" - }, - "license": "MPL-2.0", - "files": [ - "*.json" - ], - "scripts": { - "lint": "eslint .", - "test": "jest" - }, - "jest": { - "preset": "@workspace/jest" - }, - "devDependencies": { - "@chainfile/testcontainers": "^0.8.0" - } -} diff --git a/packages/chainfile-solana/test-validator.json b/packages/chainfile-solana/test-validator.json deleted file mode 100644 index 4aa78e5..0000000 --- a/packages/chainfile-solana/test-validator.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "$schema": "https://chainfile.org/schema.json", - "caip2": "solana:00000000000000000000000000000000", - "name": "Solana Test Validator", - "params": { - "version": { - "description": "Solana test validator version to use, the container image is built in the chainfile-solana repository. Published in to ghcr.io/vetumorg/solana-test-validator, to see the available versions check github.com/vetumorg/chainfile-solana/pkgs/container/solana-test-validator", - "default": "1.18.15" - } - }, - "description": "Solana test validator is a convenient way to target a cluster with fewer restrictions and more configuration options than the public offerings provide. This is easily achieved with the solana-test-validator binary, which starts a full-featured, single-node cluster on the developer's workstation.", - "containers": { - "solana": { - "image": "ghcr.io/vetumorg/solana-test-validator", - "tag": { - "$param": "version" - }, - "source": "https://github.com/vetumorg/chainfile-solana", - "resources": { - "cpu": 0.25, - "memory": 256 - }, - "endpoints": { - "rpc": { - "port": 8899, - "protocol": "HTTP JSON-RPC 2.0", - "probes": { - "readiness": { - "params": [], - "method": "getBlockHeight", - "match": { - "result": { - "type": "number" - } - } - } - } - } - } - } - } -} diff --git a/packages/chainfile-solana/test-validator.test.ts b/packages/chainfile-solana/test-validator.test.ts deleted file mode 100644 index 8c9e875..0000000 --- a/packages/chainfile-solana/test-validator.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CFTestcontainers } from '@chainfile/testcontainers'; -import { afterAll, beforeAll, describe, expect, it } from '@workspace/jest/globals'; - -import test from './test-validator.json'; - -const testcontainers = new CFTestcontainers(test); - -beforeAll(async () => { - await testcontainers.start(); -}); - -afterAll(async () => { - await testcontainers.stop(); -}); - -describe('solana', () => { - it('should rpc(getBlockHeight)', async () => { - const response = await testcontainers.get('solana').rpc({ - method: 'getBlockHeight', - }); - - expect(response.status).toStrictEqual(200); - expect(await response.json()).toMatchObject({ - result: 0, - }); - }); -}); diff --git a/packages/solana-docker/.dockerignore b/packages/solana-test-validator/.dockerignore similarity index 100% rename from packages/solana-docker/.dockerignore rename to packages/solana-test-validator/.dockerignore diff --git a/packages/solana-docker/Dockerfile b/packages/solana-test-validator/Dockerfile similarity index 100% rename from packages/solana-docker/Dockerfile rename to packages/solana-test-validator/Dockerfile diff --git a/packages/solana-docker/docker.mjs b/packages/solana-test-validator/docker.mjs similarity index 78% rename from packages/solana-docker/docker.mjs rename to packages/solana-test-validator/docker.mjs index 2120220..312de09 100644 --- a/packages/solana-docker/docker.mjs +++ b/packages/solana-test-validator/docker.mjs @@ -20,23 +20,23 @@ async function run(version, type) { '.', '--progress=plain', '-t', - `ghcr.io/vetumorg/solana-test-validator:${version}`, + `ghcr.io/fuxingloh/solana-test-validator:${version}`, '--build-arg', `SOLANA_VERSION=${version}`, '--cache-from', - 'type=registry,ref=ghcr.io/vetumorg/solana-test-validator:build-cache', + 'type=registry,ref=ghcr.io/fuxingloh/solana-test-validator:build-cache', ]; if (type === 'push') { args.push( '-t', - 'ghcr.io/vetumorg/solana-test-validator:latest', + 'ghcr.io/fuxingloh/solana-test-validator:latest', '--output', 'type=registry', '--platform', 'linux/amd64,linux/arm64', '--cache-to', - 'type=registry,ref=ghcr.io/vetumorg/solana-test-validator:build-cache', + 'type=registry,ref=ghcr.io/fuxingloh/solana-test-validator:build-cache', ); } diff --git a/packages/solana-docker/package.json b/packages/solana-test-validator/package.json similarity index 88% rename from packages/solana-docker/package.json rename to packages/solana-test-validator/package.json index f0e47da..218df86 100644 --- a/packages/solana-docker/package.json +++ b/packages/solana-test-validator/package.json @@ -1,5 +1,5 @@ { - "name": "solana-docker", + "name": "solana-test-validator", "version": "0.0.0", "private": true, "license": "MPL-2.0", diff --git a/packages/solana-testcontainers/README.md b/packages/solana-testcontainers/README.md index 121e8a4..b13589c 100644 --- a/packages/solana-testcontainers/README.md +++ b/packages/solana-testcontainers/README.md @@ -1,5 +1,4 @@ -This project is part of the [Chainfile](https://chainfile.org) ecosystem; -it provides a Docker image for running `solana-test-validator` in a container for toolchain isolation. +Provides a Docker image for running `solana-test-validator` in a container for toolchain isolation. ```shell npm i -D solana-testcontainers @solana/web3.js diff --git a/packages/solana-testcontainers/package.json b/packages/solana-testcontainers/package.json index f6c261c..771579e 100644 --- a/packages/solana-testcontainers/package.json +++ b/packages/solana-testcontainers/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": false, "repository": { - "url": "git+https://github.com/vetumorg/chainfile-solana" + "url": "git+https://github.com/fuxingloh/solana-test-validator" }, "license": "MPL-2.0", "main": "dist/index.js", diff --git a/packages/solana-testcontainers/src/index.ts b/packages/solana-testcontainers/src/index.ts index cbe44ae..aa40da4 100644 --- a/packages/solana-testcontainers/src/index.ts +++ b/packages/solana-testcontainers/src/index.ts @@ -2,7 +2,7 @@ import { Connection, ConnectionConfig } from '@solana/web3.js'; import { AbstractStartedContainer, GenericContainer, StartedTestContainer, Wait } from 'testcontainers'; export class SolanaContainer extends GenericContainer { - constructor(image: string = `ghcr.io/vetumorg/solana-test-validator:1.18.15`) { + constructor(image: string = `ghcr.io/fuxingloh/solana-test-validator:1.18.15`) { super(image); this.withWaitStrategy(Wait.forLogMessage('Processed Slot:')); this.withExposedPorts(