Skip to content

feat: add pay-to-relay - #131

Merged
cameri merged 45 commits into
mainfrom
130-add-pay-to-relay
Feb 2, 2023
Merged

cameri merged 45 commits into
mainfrom
130-add-pay-to-relay

Conversation

@cameri

@cameri cameri commented Jan 11, 2023 •

Copy link
Copy Markdown
Owner

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

image

image

image

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • All new and existing tests passed.

@cameri cameri linked an issue Jan 11, 2023 that may be closed by this pull request
@cameri
cameri requested a review from kevinsmith January 11, 2023 01:54
@coveralls

coveralls commented Jan 11, 2023 •

Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 3888916706

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 214 of 356 (60.11%) changed or added relevant lines in 37 files are covered.
  • 119 unchanged lines in 11 files lost coverage.
  • Overall coverage decreased (-16.4%) to 70.277%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/app/worker.ts 2 3 66.67%
src/payments-processors/null-payments-processor.ts 1 2 50.0%
src/handlers/request-handlers/post-zebedee-callback-request-handler.ts 2 4 50.0%
src/handlers/request-handlers/root-request-handler.ts 1 3 33.33%
src/payments-processors/payments-procesor.ts 1 3 33.33%
src/schemas/http-request-schemas.ts 0 3 0.0%
src/adapters/web-server-adapter.ts 1 5 20.0%
src/factories/worker-factory.ts 12 16 75.0%
src/factories/zebedee-callback-controller-factory.ts 5 9 55.56%
src/index.ts 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
src/index.ts 1 0.0%
src/utils/event.ts 1 92.14%
src/repositories/event-repository.ts 2 97.3%
src/factories/rate-limiter-factory.ts 4 45.45%
src/adapters/web-socket-server-adapter.ts 5 59.52%
src/app/worker.ts 5 38.1%
src/cache/client.ts 5 46.15%
src/app/app.ts 9 24.49%
src/adapters/redis-adapter.ts 11 7.89%
src/adapters/web-server-adapter.ts 21 25.0%
Totals Coverage Status
Change from base Build 3825451498: -16.4%
Covered Lines: 866
Relevant Lines: 1228

💛 - Coveralls

Comment thread .nostr.local/settings.json Outdated

@kevinsmith kevinsmith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to send you the comments so far, but I'm gonna have to finish this up tomorrow.

Comment thread .nostr.local/settings.json Outdated
Comment thread .nostr.local/settings.json
Comment thread docker-compose.yml Outdated
Comment thread scripts/stop
Comment thread src/adapters/web-server-adapter.ts Outdated
Comment thread .nostr.local/settings.json
@bleetube

Copy link
Copy Markdown

Afaict, relays that require payments always appear to be offline on monitors like nostr.watch. Is it possible to instead reserve nodejs workers for registered client pubkeys? Suppose you have a dedicated server with 16+ cpu cores, and have 12 workers answer public requests while reserving 4 workers to be available anytime a registered client makes a request? That way anyone with a public relay can provide higher reliability to clients that have registered by making a lightning payment.

ie. in settings.json

  "workers": {
    "public": 12,
    "private": 4
  },

@cameri
cameri force-pushed the 130-add-pay-to-relay branch from 45529fd to c693c80 Compare January 27, 2023 15:21
Comment thread src/utils/event.ts

// deepcode ignore InsecureCipherNoIntegrity: NIP-04 Encrypted Direct Message uses aes-256-cbc
const cipher = createCipheriv(
'aes-256-cbc',

Check failure

Code scanning / SonarCloud

Encryption algorithms should be used with secure mode and padding scheme

<!--SONAR_ISSUE_KEY:AYX1K0Y4M1iW9U1CGQxQ-->Use a secure mode and padding scheme. <p>See more on <a href="https://sonarcloud.io/project/issues?id=Cameri_nostr-ts-relay&issues=AYX1K0Y4M1iW9U1CGQxQ&open=AYX1K0Y4M1iW9U1CGQxQ&pullRequest=131">SonarCloud</a></p>
cameri and others added 21 commits February 2, 2023 00:09
Co-authored-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Co-authored-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
cameri and others added 23 commits February 2, 2023 00:09
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
@cameri
cameri force-pushed the 130-add-pay-to-relay branch from 923499a to 777e5a8 Compare February 2, 2023 05:11
@cameri
cameri enabled auto-merge (rebase) February 2, 2023 05:16
@sonarqubecloud

sonarqubecloud Bot commented Feb 2, 2023 •

Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 16 Code Smells

32.9% 32.9% Coverage
1.5% 1.5% Duplication

@cameri
cameri merged commit 45b08d8 into main Feb 2, 2023
@cameri
cameri deleted the 130-add-pay-to-relay branch February 2, 2023 05:19
@github-actions

github-actions Bot commented Feb 2, 2023

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.19.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Pay To Relay

7 participants