Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate nilDB <> nilComm to support writes / executes from chain #133

Merged
merged 16 commits into from
Mar 24, 2025

Conversation

tim-hm
Copy link
Collaborator

@tim-hm tim-hm commented Feb 25, 2025

Closes #126

@tim-hm tim-hm self-assigned this Feb 25, 2025
Copy link

github-actions bot commented Feb 25, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 68.9% 3504 / 5085
🔵 Statements 68.9% 3504 / 5085
🔵 Functions 68.85% 241 / 350
🔵 Branches 87.77% 517 / 589
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
bin/credentials.ts 0% 0% 0% 0% 1-67
src/app.ts 92.72% 50% 100% 92.72% 50-51, 72-73
src/env.ts 69.31% 50% 100% 69.31% 111-125, 129-140
src/main.ts 0% 0% 0% 0% 1-97
src/accounts/accounts.repository.ts 75% 87.09% 66.66% 75% 82, 87-92, 119, 124-129, 136-171, 204, 209-214, 272-277
src/accounts/accounts.services.ts 79.71% 81.81% 83.33% 79.71% 47-49, 52-57, 72-79
src/accounts/accounts.types.ts 100% 100% 100% 100%
src/admin/admin.controllers.accounts.ts 93.18% 100% 100% 93.18% 53-58
src/admin/admin.types.ts 100% 100% 100% 100%
src/common/amqp.ts 27.94% 100% 0% 27.94% 49-84, 87-119, 129-168
src/common/identity.ts 78.87% 90% 81.81% 78.87% 53-54, 77-85, 88-95
src/common/logger.ts 100% 100% 100% 100%
src/common/nil-did.ts 87.03% 100% 100% 87.03% 45-51
src/common/shares.ts 48.27% 100% 0% 48.27% 8-11, 14-15, 22-23, 26-28, 32-33, 36-37
src/common/zod-utils.ts 66.03% 81.81% 75% 66.03% 41-45, 50-64
src/docs/docs.router.ts 26.08% 100% 0% 26.08% 10-27
src/middleware/auth.middleware.ts 78.75% 82.35% 100% 78.75% 57-61, 66-71, 78-83
src/nilcomm/nilcomm.controllers.ts 5.4% 100% 0% 5.4% 20-98
src/nilcomm/nilcomm.mq.ts 6.06% 100% 0% 6.06% 25-57, 60-99, 102-141, 144-183, 186-190, 193-197
src/nilcomm/nilcomm.repository.ts 8.88% 100% 0% 8.88% 24-70
src/nilcomm/nilcomm.router.ts 16.66% 100% 0% 16.66% 7-25
src/nilcomm/nilcomm.service.ts 15.67% 100% 0% 15.67% 35-68, 71-76, 79-121, 124-175
src/nilcomm/nilcomm.types.ts 64.28% 100% 100% 64.28% 28-37, 48, 59-60, 75-86, 98-102, 114-115
Generated in workflow #240 for commit 88c7719 by the Vitest Coverage Report Action

@tim-hm tim-hm force-pushed the feat/blockchain-integrations branch 2 times, most recently from 29af379 to 58fe4e4 Compare February 25, 2025 14:25
@tim-hm tim-hm changed the title feat(chain): wip add ampqlib Integrate nilDB <> nilComm to support writes / executes from chain Feb 25, 2025
@tim-hm tim-hm marked this pull request as ready for review March 10, 2025 09:55
@tim-hm tim-hm force-pushed the feat/blockchain-integrations branch 2 times, most recently from 83c5e44 to 3123854 Compare March 12, 2025 08:30
tim-hm added 14 commits March 20, 2025 11:15
# Conflicts:
#	src/env.ts
#	src/main.ts
…...`

� Conflicts:
�	src/accounts/accounts.openapi.yaml
�	src/accounts/accounts.repository.ts
�	src/admin/admin.types.ts
�	src/system/system.openapi.yaml
This unifies log formatting between prod, local and test envs and fixes an issue where log messages in Intellij were not shown in the vitest runner.
- correct start query result event shape
- flatten error logging
- correctly decrypt secret share using node sk
Although this test omits the nilcomm service, it simulates an end to end blind action tests where:

1. User provide bids
2. Bids are encrypted using the node's public key and ECIES
3. "Bids shares" are stored in plain text
4. The commit reveal query is called
5. The commit reveal query returns all bid shares in plain text
6. The highest bidder is correctly selected
…test env feature

If nilcomm is required in a test it should be enabled via a test fixture parameter because enabling it via .env.test causes conflicting consumers and producers in multiple suites. This isn't an ideal solution and will need to be matured in time.

This also now correctly closes the fixtures mq channel and connection.
This cannot be fixed in the short term since it's being replaced by NUCs and nilAuth. So this reverts to the original behaviour which set subscriptions to active on testnet by default.

Also, tidied up logging in main.
@tim-hm tim-hm force-pushed the feat/blockchain-integrations branch from 28d37cc to af78f45 Compare March 20, 2025 12:50
tim-hm added 2 commits March 24, 2025 11:21
Id is generic and so for nilcomm related events we'll use the more verbose `mapping_id` to better label its purpose.
@tim-hm
Copy link
Collaborator Author

tim-hm commented Mar 24, 2025

This feature is not done as it's waiting on integration testing feedback but I'm going to merge this to avoid divergence.

To reduce risk, the nilcomm feature and tests are disabled by default.

@tim-hm tim-hm merged commit e97cae6 into main Mar 24, 2025
2 checks passed
@tim-hm tim-hm deleted the feat/blockchain-integrations branch March 24, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add openapi feature flag
1 participant