From aa27f4ff186f7877dcc37828665ffe8edc249ff3 Mon Sep 17 00:00:00 2001 From: zramsay Date: Thu, 26 Jun 2025 10:58:21 -0400 Subject: [PATCH] fix --- Dockerfile | 8 ++--- package.json | 2 +- src/deployments.ts | 3 +- src/paymentProcessor.ts | 66 +++++------------------------------------ 4 files changed, 14 insertions(+), 65 deletions(-) diff --git a/Dockerfile b/Dockerfile index 583be00..700fb3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,12 +11,12 @@ RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg - apt update && apt install -y nodejs # laconic-so -#RUN curl -LO https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so && \ -# chmod +x ./laconic-so && \ -# mv ./laconic-so /usr/bin/laconic-so +RUN curl -LO https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so && \ + chmod +x ./laconic-so && \ + mv ./laconic-so /usr/bin/laconic-so # for testing, put so in the root of this repo prior to running `build-containers` -COPY laconic-so /usr/bin/laconic-so +#COPY laconic-so /usr/bin/laconic-so # laconic-registry-cli RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ && \ diff --git a/package.json b/package.json index 40feac5..0c48aae 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "author": "Jakub Synowiec ", "license": "Apache-2.0", "dependencies": { - "@cerc-io/laconic-sdk": "^0.1.15", + "@cerc-io/registry-sdk": "^0.2.11", "@openpgp/web-stream-tools": "^0.1.3", "axios": "^1.6.7", "body-parser": "^1.20.2", diff --git a/src/deployments.ts b/src/deployments.ts index f8e1cfe..f6921c6 100644 --- a/src/deployments.ts +++ b/src/deployments.ts @@ -1,9 +1,8 @@ -import {getRegistry, Config} from './config.js'; +import {getRegistry} from './config.js'; import {Registry} from '@cerc-io/registry-sdk'; import stringify from 'json-stable-stringify'; import {createHash} from 'crypto'; -import {verifyAtomPayment} from './atomPayments.js'; function generateHostnameForApp(app) { const lastPart = app.attributes.name.split('/').pop(); diff --git a/src/paymentProcessor.ts b/src/paymentProcessor.ts index 0a55625..d794733 100644 --- a/src/paymentProcessor.ts +++ b/src/paymentProcessor.ts @@ -122,68 +122,17 @@ class PaymentProcessor { } /** - * Verify LNT payment using existing laconic registry + * Verify LNT payment - delegated to stack-orchestrator + * Since stack-orchestrator already handles LNT verification efficiently, + * we only need to handle ATOM verification here */ private async verifyLNTPayment(txHash: string, request: any): Promise { try { - // Use the registry from regHelper to get transaction - const registry = getRegistry(); - const tx = await registry.getTx(txHash); - - if (!tx) { - return { - valid: false, - reason: 'Transaction not found in laconic registry' - }; - } - - if (tx.code !== 0) { - return { - valid: false, - reason: `Transaction failed with code ${tx.code}: ${tx.log}` - }; - } - - // Get the deployer record to check payment address - const deployer = await this.regHelper.getRecord(request.attributes.deployer); - if (!deployer) { - return { - valid: false, - reason: 'Deployer record not found' - }; - } - - const paymentAddress = deployer.attributes.paymentAddress; - const minPayment = parseInt(deployer.attributes.minimumPayment?.replace(/[^0-9]/g, '') || '0'); - - if (tx.recipient !== paymentAddress) { - return { - valid: false, - reason: `Payment recipient ${tx.recipient} does not match deployer payment address ${paymentAddress}` - }; - } - - const payDenom = tx.amount.replace(/[0-9]/g, ''); - if (payDenom !== 'alnt') { - return { - valid: false, - reason: `Payment denomination ${payDenom} is not 'alnt'` - }; - } - - const payAmount = parseInt(tx.amount.replace(/[^0-9]/g, '')); - if (payAmount < minPayment) { - return { - valid: false, - reason: `Payment amount ${payAmount} is less than minimum ${minPayment}` - }; - } - + // LNT verification is handled by stack-orchestrator + // We assume if it's not an ATOM payment, stack-orchestrator will handle it return { - valid: true, - amount: tx.amount, - sender: tx.sender, - chainUsed: 'LNT' + valid: false, + reason: 'LNT verification delegated to stack-orchestrator' }; } catch (error) { @@ -359,6 +308,7 @@ class PaymentProcessor { // }); // } + console.log(`Configured ${configs.length} payment chains`); return configs; } }