Skip to content

Commit 179d9f6

Browse files
authored
feat: add Cardano VDR implementation to the prism-node (#884)
* feat: add VDR_SIGNING_KEY to the DIDOperations Signed-off-by: Yurii Shynbuiev <[email protected]> * style: format the code Signed-off-by: Yurii Shynbuiev <[email protected]> * feat: extend the gRPC API for the VDR Signed-off-by: Yurii Shynbuiev <[email protected]> * feat: add VDR storage operations with gRPC endpoints and tests Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: switch to the Docker Hub and eclipse-temurin docker base image Signed-off-by: Yurii Shynbuiev <[email protected]> * feat: add VDR entry DAO tests, document VDR storage Signed-off-by: Yurii Shynbuiev <[email protected]> * feat: add VDR storage integration tests and gRPC coverage Signed-off-by: Yurii Shynbuiev <[email protected]> * test: add prism-test docker stack for cardano testnet Signed-off-by: Yurii Shynbuiev <[email protected]> * test: add PRISM_NODE_VERSION env variable for the compose.yml file Signed-off-by: Yurii Shynbuiev <[email protected]> * test: add e2e subproject and script to run it Signed-off-by: Yurii Shynbuiev <[email protected]> * test: add e2e crud tests Signed-off-by: Yurii Shynbuiev <[email protected]> * test: add VDR gRPC e2e test suite and scripts Signed-off-by: Yurii Shynbuiev <[email protected]> * chore: rename VDR signing key to VDR_KEY across prism-node Signed-off-by: Yurii Shynbuiev <[email protected]> * chore: make the GITHUB_TOKEN optional Signed-off-by: Yurii Shynbuiev <[email protected]> * chore: make the GITHUB_TOKEN optional (second try) Signed-off-by: Yurii Shynbuiev <[email protected]> * test: add full-check script and expand VDR e2e edge-case coverage Signed-off-by: Yurii Shynbuiev <[email protected]> * test: stabilize full-check.sh and expand VDR e2e coverage Signed-off-by: Yurii Shynbuiev <[email protected]> * test: stabilize VDR e2e coverage Signed-off-by: Yurii Shynbuiev <[email protected]> * refactor: VDR e2e tests Signed-off-by: Yurii Shynbuiev <[email protected]> * test: refine VDR e2e coverage and stabilize test harness Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: add docker-publish.yml and e2e tests to the CI actions Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: fix GitHub actions Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: upgrade docker/login-action to v3 Signed-off-by: Yurii Shynbuiev <[email protected]> * style: apply megalinter formatting Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: fix e2e tests and prism-node docker image Signed-off-by: Yurii Shynbuiev <[email protected]> * test: build the local image of the prism-node for e2e tests Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: fix TLS error in GitHub actions Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: fix the image version resolution Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: add metadata to the docker image Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: upgrade megalinter GitHub action to 7.13.0 Signed-off-by: Yurii Shynbuiev <[email protected]> * ci: disable megalinter REPOSITORY_GRYPE linter Signed-off-by: Yurii Shynbuiev <[email protected]> --------- Signed-off-by: Yurii Shynbuiev <[email protected]>
1 parent 301093e commit 179d9f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3848
-27
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Publish prism-node to Docker Hub"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
env:
10+
JAVA_VERSION: [email protected]
11+
COURSIER_JAVA_ARGS: "-Djdk.tls.client.protocols=TLSv1.2"
12+
JAVA_TOOL_OPTIONS: "-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2"
13+
SBT_OPTS: "-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2"
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Docker meta
25+
id: meta
26+
uses: docker/metadata-action@v5
27+
with:
28+
images: docker.io/inputoutput/prism-node
29+
tags: |
30+
type=semver,pattern={{version}}
31+
type=sha,format=long
32+
type=edge,branch=main
33+
type=edge,branch=${{ github.ref_name }}
34+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
35+
36+
- name: Login to Docker Hub
37+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
38+
uses: docker/login-action@v3
39+
with:
40+
registry: docker.io
41+
username: ${{ secrets.DOCKERHUB_USERNAME }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
- name: Build and push image
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: .
48+
push: true
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
fetch-depth: 0
2626
- name: Mega-Linter
2727
id: ml
28-
uses: megalinter/megalinter@v7.1.0
28+
uses: megalinter/megalinter@v7.13.0
2929
- name: Archive production artifacts
3030
if: success() || failure()
3131
uses: actions/upload-artifact@v4

.github/workflows/unit-tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ env:
1212
SCALA_VERSION: "2.13"
1313
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
1414
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
15+
COURSIER_JAVA_ARGS: "-Djdk.tls.client.protocols=TLSv1.2"
16+
JAVA_TOOL_OPTIONS: "-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2"
17+
SBT_OPTS: "-Djdk.tls.client.protocols=TLSv1.2 -Dhttps.protocols=TLSv1.2"
1518

1619
jobs:
1720
build-and-test:
@@ -42,3 +45,21 @@ jobs:
4245
with:
4346
files: "target/test-reports/**/TEST-*.xml"
4447
check_run_annotations_branch: "*"
48+
49+
e2e-tests:
50+
name: "E2E tests"
51+
runs-on: ubuntu-latest
52+
needs: build-and-test
53+
env:
54+
JAVA_VERSION: [email protected]
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
59+
- name: Setup Scala
60+
uses: olafurpg/setup-scala@v14
61+
with:
62+
java-version: ${{ env.JAVA_VERSION }}
63+
64+
- name: Run E2E suite (docker compose)
65+
run: ./docker/prism-test/run-e2e.sh

.mega-linter.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ DISABLE_LINTERS: [
77
REPOSITORY_DEVSKIM,
88
REPOSITORY_GITLEAKS,
99
DOCKERFILE_HADOLINT,
10+
REPOSITORY_GRYPE,
1011
REPOSITORY_TRIVY,
1112
REPOSITORY_CHECKOV,
1213
REPOSITORY_SECRETLINT,
@@ -44,8 +45,9 @@ PRE_COMMANDS:
4445

4546
# Linter customisation
4647
MARKDOWN_MARKDOWN_LINK_CHECK_FILTER_REGEX_EXCLUDE: "CHANGELOG.md"
47-
MARKDOWN_MARKDOWNLINT_FILTER_REGEX_EXCLUDE: "CHANGELOG.md"
48+
MARKDOWN_MARKDOWNLINT_FILTER_REGEX_EXCLUDE: "CHANGELOG.md|docker/prism-test/README.md"
4849
SQL_SQL_LINT_ARGUMENTS: -d postgres --ignore-errors=postgres-invalid-alter-option,postgres-invalid-create-option
4950
YAML_YAMLLINT_FILTER_REGEX_EXCLUDE: "infrastructure/charts/node/*"
5051
YAML_PRETTIER_FILTER_REGEX_EXCLUDE: "infrastructure/charts/node/*"
5152
YAML_V8R_FILTER_REGEX_EXCLUDE: "infrastructure/charts/node/*"
53+
FILTER_REGEX_EXCLUDE: "(^neoprism/|^cloud-agent/|^scala-did/|^mediator/)"

build.sbt

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import sbt.Keys.*
33
import sbtassembly.AssemblyPlugin.autoImport.*
44
import sbtbuildinfo.BuildInfoPlugin
55
import sbtbuildinfo.BuildInfoPlugin.autoImport.*
6-
import sbtghpackages.GitHubPackagesPlugin.autoImport.*
76
import sbtprotoc.ProtocPlugin.autoImport.PB
87

98
inThisBuild(
@@ -12,9 +11,7 @@ inThisBuild(
1211
scalaVersion := "2.13.15",
1312
fork := true,
1413
run / connectInput := true,
15-
versionScheme := Some("semver-spec"),
16-
githubOwner := "input-output-hk",
17-
githubRepository := "atala-prism"
14+
versionScheme := Some("semver-spec")
1815
)
1916
)
2017

@@ -163,7 +160,6 @@ lazy val root =
163160
),
164161
scalacOptions += "-Ymacro-annotations",
165162
javacOptions ++= Seq("-source", "1.11", "-target", "1.11"),
166-
githubTokenSource := TokenSource.Environment("GITHUB_TOKEN"),
167163
addCompilerPlugin(
168164
"org.typelevel" % "kind-projector" % "0.13.3" cross CrossVersion.full
169165
),
@@ -219,11 +215,12 @@ lazy val root =
219215
resolvers += Resolver.jcenterRepo,
220216
resolvers += Resolver.mavenCentral,
221217
Docker / maintainer := "[email protected]",
222-
Docker / dockerUsername := Some("input-output-hk"),
223-
Docker / dockerRepository := Some("ghcr.io"),
218+
Docker / dockerUsername := Some("inputoutput"),
219+
Docker / dockerRepository := Some("docker.io"),
224220
Docker / packageName := "prism-node",
225221
dockerExposedPorts := Seq(5432),
226-
dockerBaseImage := "openjdk:11",
222+
// openjdk:11 no longer published; switch to maintained Eclipse Temurin Java 11 image
223+
dockerBaseImage := "eclipse-temurin:11-jre",
227224
libraryDependencies
228225
++= Dependencies.circeDependencies
229226
++ Dependencies.tofuDependencies
@@ -253,6 +250,25 @@ lazy val root =
253250
)
254251
.enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin)
255252

253+
lazy val e2e =
254+
project
255+
.in(file("e2e"))
256+
.configs(IntegrationTest)
257+
.dependsOn(root)
258+
.settings(
259+
name := "node-e2e",
260+
publish / skip := true,
261+
Defaults.itSettings,
262+
IntegrationTest / scalaSource := baseDirectory.value / "src" / "it" / "scala",
263+
IntegrationTest / resourceDirectory := baseDirectory.value / "src" / "it" / "resources",
264+
IntegrationTest / parallelExecution := false,
265+
IntegrationTest / fork := true,
266+
libraryDependencies ++= Seq(
267+
"org.scalatest" %% "scalatest" % versions.scalatest % IntegrationTest
268+
)
269+
)
270+
.settings(addCommandAlias("e2eTest", "e2e/it:test"))
271+
256272
Global / onChangedBuildSource := ReloadOnSourceChanges
257273

258274
// ############################
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:3000 {
2+
handle /tx/submit {
3+
rewrite * /api/submit/tx
4+
reverse_proxy cardano-submit-api:8090
5+
}
6+
7+
handle {
8+
reverse_proxy bf-ryo:3000
9+
}
10+
}

docker/prism-test/README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# PRISM Test Docker Setup
2+
3+
Local PRISM testing environment with a local Cardano testnet, wallet services, and PRISM node implementations.
4+
5+
## Quick Start
6+
7+
Start the environment:
8+
9+
```sh
10+
cd docker/prism-test
11+
docker compose up
12+
```
13+
14+
The following services will be available:
15+
16+
> **Note:** Service availability varies by configuration. See [Compose Configurations](#compose-configurations) for details.
17+
18+
| Service | URL | Remark |
19+
|------------------------|--------------------------|--------|
20+
| **Cardano Wallet API** | `http://localhost:18081` | |
21+
| **Blockfrost API** | `http://localhost:18082` | |
22+
| **PRISM Node gRPC** | localhost:50053 | |
23+
24+
Override the PRISM node image tag if needed (default: `2.6.1-SNAPSHOT`):
25+
26+
```sh
27+
PRISM_NODE_VERSION=2.6.1-SNAPSHOT docker compose up -d
28+
```
29+
30+
Stop the environment:
31+
32+
```sh
33+
docker compose down # Stop services
34+
docker compose down -v # Stop and remove volumes (clean restart)
35+
```
36+
37+
Run the e2e (gRPC VDR) tests end-to-end:
38+
39+
```sh
40+
export GITHUB_TOKEN=... # required for sbt credentials
41+
PRISM_NODE_VERSION=2.6.1-SNAPSHOT \
42+
docker/prism-test/run-e2e.sh
43+
# or via sbt alias once stack is up: sbt e2eTest
44+
```
45+
46+
## Compose Configurations
47+
48+
### compose.yml - Full Testing Environment
49+
50+
Complete PRISM testing stack with local Cardano testnet, Blockfrost API compatibility layer, and PRISM Node gRPC. Use this for comprehensive integration testing against the legacy PRISM node while exercising Cardano infrastructure.
51+
52+
| Service | Port | Description |
53+
|--------------------|-------|-------------------------|
54+
| **prism-node** | 50053 | PRISM Node gRPC API |
55+
| **cardano-wallet** | 18081 | Cardano Wallet HTTP API |
56+
| **bf-proxy** | 18082 | Blockfrost API proxy |
57+
58+
### compose-ci.yml - CI Testing Environment
59+
60+
CI-focused stack mirroring `compose.yml` but built for automation. Use when testing the PRISM node against the full Cardano stack without Blockfrost extras.
61+
62+
| Service | Port | Description |
63+
|--------------------|-------|-------------------------|
64+
| **prism-node** | 50053 | PRISM Node gRPC API |
65+
| **cardano-wallet** | 18081 | Cardano Wallet HTTP API |
66+
67+
## Running Tests
68+
69+
Run normal conformance tests:
70+
71+
```sh
72+
cd tests/prism-test
73+
sbt test
74+
```
75+
76+
## Pre-configured Entities
77+
78+
### Cardano Testnet
79+
80+
The local Cardano testnet is configured with custom parameters for testing.
81+
82+
| Property | Value |
83+
|-------------------|----------------|
84+
| **Network Magic** | `42` |
85+
| **Network** | Custom testnet |
86+
87+
### Wallet
88+
89+
A pre-configured wallet is available on the **cardano-wallet** service for testing purposes.
90+
91+
| Property | Value |
92+
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
93+
| **Wallet ID** | `9263a1248b046fe9e1aabc4134b03dc5c3a7ee3d` |
94+
| **Payment Address** | `addr_test1qp83v2wq3z9mkcjj5ejlupgwt6tcly5mtmz36rpm8w4atvqd5jzpz23y8l4dwfd9l46fl2p86nmkkx5keewdevqxhlyslv99j3` |
95+
| **Passphrase** | `super_secret` |
96+
| **Mnemonic** | `mimic candy diamond virus hospital dragon culture price emotion tell update give faint resist faculty soup demand window dignity capital bullet purity practice fossil` |
97+
98+
### DID
99+
100+
A pre-configured DID is published to the **local testnet** and available for testing.
101+
102+
| Property | Value |
103+
|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
104+
| **DID** | `did:prism:e3b675023ef13a2bd1b015a6b1c88d2bfbfbb09bed5b675598397aec361f0d6e` |
105+
| **VDR Key Name** | `vdr-0` |
106+
| **VDR Private Key (hex)** | `d3ed47189d10509305494d89e8f08d139beed1e8ed18c3cf6b38bc897078c052` |
107+
| **PrismObject (hex)** | `22d50112d2010a086d61737465722d3012473045022100c921083f391f179c947a4e95f8ed226870c32557565f8adba52daebcf47ce5b3022019f8632237331c5183d5ee6d192b617637848e32ce5d26c12dd2a86890b8bd041a7d0a7b0a79123c0a086d61737465722d3010014a2e0a09736563703235366b31122103b20404f350d87eec98982131c176acfea520f26f8901fe08b619a56a0dd9e41712390a057664722d3010084a2e0a09736563703235366b31122102647aff70cfd5d510ec369c512da85faef95803db30bb47499a28c08a590186ac` |
108+
109+
<!-- markdownlint-disable MD013 -->
110+
111+
## Generating Test Fixtures
112+
113+
Remove `TestAspect.ignore` from the `generateDidFixtureSpec` in `tests/prism-test/src/test/scala/org/hyperledger/identus/prismtest/MainSpec.scala`, then run:
114+
115+
```sh
116+
cd tests/prism-test
117+
sbt "testOnly -- -tags fixture"
118+
```

0 commit comments

Comments
 (0)