Skip to content

Commit e97cae6

Browse files
authored
Merge pull request NillionNetwork#133 from NillionNetwork/feat/blockchain-integrations
2 parents 162f1bb + 88c7719 commit e97cae6

Some content is hidden

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

42 files changed

+1662
-227
lines changed

.env.example

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
APP_DB_NAME_DATA=datablocks_data
22
APP_DB_NAME_PRIMARY=datablocks
33
APP_DB_URI=mongodb://localhost:27017
4-
APP_ENV=testnet
4+
APP_ENABLED_FEATURES=openapi-docs,prometheus-metrics,migrations
55
APP_LOG_LEVEL=debug
6+
APP_NILCOMM_PUBLIC_KEY=037a87f9b010687e23eccb2fc70a474cbb612418cb513a62289eaed6cf1f11ac6b
67
APP_METRICS_PORT=9091
8+
APP_MQ_URI=amqp://guest:guest@localhost:5672
9+
# Required iff running nilcomm integration
10+
#APP_NILCOMM_PUBLIC_KEY=037a87f9b010687e23eccb2fc70a474cbb612418cb513a62289eaed6cf1f11ac6b
711
APP_NODE_SECRET_KEY=d5cf0b58964c516465d228be9330a047cb09bcdc7aaabea6485e1152182967fa
812
APP_NODE_PUBLIC_ENDPOINT=http://localhost:8080
913
APP_PORT=8080

.env.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
APP_DB_NAME_DATA=test_datablocks_data
22
APP_DB_NAME_PRIMARY=test_datablocks
33
APP_DB_URI=mongodb://localhost:27017
4-
APP_ENV=testnet
4+
# If nilcomm is required in a test it should be enabled as a test fixture parameter, enabling here causes all tests to spin up conflicting consumers and producers
5+
APP_ENABLED_FEATURES=migrations
56
APP_LOG_LEVEL=debug
7+
APP_NILCOMM_PUBLIC_KEY=037a87f9b010687e23eccb2fc70a474cbb612418cb513a62289eaed6cf1f11ac6b
68
APP_METRICS_PORT=9091
9+
APP_MQ_URI=amqp://guest:guest@localhost:5672
710
APP_NODE_SECRET_KEY=ac8d429739597744f5c638a069aa641d66dce6478580aa6369dab47ea47abbeb
811
APP_NODE_PUBLIC_ENDPOINT=http://localhost:8081
912
APP_PORT=8081

.github/workflows/ci.yaml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,33 @@ jobs:
2626
test:
2727
needs: check
2828
runs-on: ubuntu-latest
29+
30+
services:
31+
rabbitmq:
32+
image: rabbitmq:4
33+
ports:
34+
- 5672:5672
35+
options: >-
36+
--health-cmd "rabbitmq-diagnostics -q ping"
37+
--health-interval 10s
38+
--health-timeout 5s
39+
--health-retries 5
40+
mongodb:
41+
image: mongo:8.0
42+
ports:
43+
- 27017:27017
44+
options: >-
45+
--health-cmd "mongosh --eval 'db.runCommand(\"ping\").ok'"
46+
--health-interval 10s
47+
--health-timeout 5s
48+
--health-retries 5
49+
2950
steps:
3051
- uses: actions/checkout@v4
3152
- uses: actions/setup-node@v4
3253
with:
3354
node-version: "23"
3455
- uses: pnpm/action-setup@v4
35-
- uses: supercharge/mongodb-github-action@1.11.0
36-
with:
37-
mongodb-version: "8.0"
3856
- run: pnpm install
3957
- run: pnpm vitest --coverage
4058
- uses: davelosert/vitest-coverage-report-action@v2

bin/credentials.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { PRIVATE_KEY_LENGTH, PUBLIC_KEY_LENGTH } from "#/env";
66
const Args = z.object({
77
secretKey: z.string().length(PRIVATE_KEY_LENGTH).optional(),
88
nodePublicKey: z.string().length(PUBLIC_KEY_LENGTH).optional(),
9-
mainnet: z.boolean(),
109
});
1110
type Args = z.infer<typeof Args>;
1211

@@ -34,16 +33,10 @@ async function main(): Promise<void> {
3433
"-n, --node-public-key <key>",
3534
"The node's hex-encoded public key. Required for JWT generation.",
3635
)
37-
.option(
38-
"-m --mainnet",
39-
"Generate mainnet DIDs (defaults to testnet if not specified)",
40-
false,
41-
)
4236
.version("0.0.1");
4337

4438
program.parse(process.argv);
4539
const options = Args.parse(program.opts<Args>());
46-
process.env.APP_ENV = options.mainnet ? "mainnet" : "testnet";
4740

4841
const result: Partial<Output> = {};
4942

@@ -58,7 +51,7 @@ async function main(): Promise<void> {
5851

5952
if (options.nodePublicKey) {
6053
const nodePk = options.nodePublicKey;
61-
const nodeDid = Identity.didFromPk(nodePk);
54+
const nodeDid = Identity.didFromPkHex(nodePk);
6255
const jwt = await identity.createJwt({ aud: nodeDid });
6356

6457
result.client.jwt = jwt;

docker-compose.local.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ services:
99
- APP_DB_NAME_DATA=datablocks_data
1010
- APP_DB_NAME_PRIMARY=datablocks
1111
- APP_DB_URI=mongodb://node-ucct-db:27017
12-
- APP_ENV=testnet
1312
- APP_LOG_LEVEL=debug
1413
- APP_METRICS_PORT=9091
1514
- APP_NODE_SECRET_KEY=6cab2d10ac21886404eca7cbd40f1777071a243177eae464042885b391412b4e
@@ -31,7 +30,6 @@ services:
3130
- APP_DB_NAME_DATA=datablocks_data
3231
- APP_DB_NAME_PRIMARY=datablocks
3332
- APP_DB_URI=mongodb://node-cr35-db:27017
34-
- APP_ENV=testnet
3533
- APP_LOG_LEVEL=debug
3634
- APP_METRICS_PORT=9091
3735
- APP_NODE_SECRET_KEY=05cee0065bdd080a26310bd201e90075b7739aa97253cb35c351e1df1e3ebeec
@@ -53,7 +51,6 @@ services:
5351
- APP_DB_NAME_DATA=datablocks_data
5452
- APP_DB_NAME_PRIMARY=datablocks
5553
- APP_DB_URI=mongodb://node-dglk-db:27017
56-
- APP_ENV=testnet
5754
- APP_LOG_LEVEL=debug
5855
- APP_METRICS_PORT=9091
5956
- APP_NODE_SECRET_KEY=1fa6a7620d08b5249f59f13219bd045b2440f512fb80c306d81d78a106a2eb8d

docs/admin-guide.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ services:
4747
- APP_DB_NAME_DATA=datablocks_data
4848
- APP_DB_NAME_PRIMARY=datablocks
4949
- APP_DB_URI=mongodb://node-xxxx-db:27017
50-
- APP_ENV=testnet
5150
- APP_LOG_LEVEL=debug
5251
- APP_METRICS_PORT=9091
5352
- APP_NODE_SECRET_KEY=6cab2d10ac21886404eca7cbd40f1777071a243177eae464042885b391412b4e

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
"@noble/secp256k1": "^2.2.3",
2525
"ajv": "^8.17.1",
2626
"ajv-formats": "^3.0.1",
27+
"amqplib": "^0.10.5",
2728
"bech32": "^2.0.0",
2829
"commander": "^13.1.0",
2930
"compression": "^1.7.5",
3031
"cors": "^2.8.5",
3132
"did-jwt": "^8.0.8",
3233
"did-resolver": "^4.1.0",
3334
"dotenv": "^16.4.7",
35+
"eciesjs": "^0.4.14",
3436
"effect": "^3.12.9",
3537
"hono": "^4.6.20",
3638
"http-status-codes": "^2.3.0",
@@ -40,7 +42,6 @@
4042
"mongodb": "^6.13.0",
4143
"pino": "^9.6.0",
4244
"pino-http": "^10.4.0",
43-
"pino-pretty": "^13.0.0",
4445
"prom-client": "^15.1.3",
4546
"swagger-ui-express": "^5.0.1",
4647
"temporal-polyfill": "^0.2.5",
@@ -54,6 +55,7 @@
5455
"@commitlint/types": "^19.5.0",
5556
"@faker-js/faker": "^9.4.0",
5657
"@stoplight/spectral-cli": "^6.14.2",
58+
"@types/amqplib": "^0.10.6",
5759
"@types/elliptic": "^6.4.18",
5860
"@types/js-yaml": "^4.0.9",
5961
"@types/jsonwebtoken": "^9.0.8",

0 commit comments

Comments
 (0)