This commit is contained in:
zramsay 2025-06-26 10:58:21 -04:00
parent 15187227e9
commit aa27f4ff18
4 changed files with 14 additions and 65 deletions

View File

@ -11,12 +11,12 @@ RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg -
apt update && apt install -y nodejs apt update && apt install -y nodejs
# laconic-so # laconic-so
#RUN curl -LO https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so && \ RUN curl -LO https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so && \
# chmod +x ./laconic-so && \ chmod +x ./laconic-so && \
# mv ./laconic-so /usr/bin/laconic-so mv ./laconic-so /usr/bin/laconic-so
# for testing, put so in the root of this repo prior to running `build-containers` # 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 # laconic-registry-cli
RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ && \ RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ && \

View File

@ -36,7 +36,7 @@
"author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>", "author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@cerc-io/laconic-sdk": "^0.1.15", "@cerc-io/registry-sdk": "^0.2.11",
"@openpgp/web-stream-tools": "^0.1.3", "@openpgp/web-stream-tools": "^0.1.3",
"axios": "^1.6.7", "axios": "^1.6.7",
"body-parser": "^1.20.2", "body-parser": "^1.20.2",

View File

@ -1,9 +1,8 @@
import {getRegistry, Config} from './config.js'; import {getRegistry} from './config.js';
import {Registry} from '@cerc-io/registry-sdk'; import {Registry} from '@cerc-io/registry-sdk';
import stringify from 'json-stable-stringify'; import stringify from 'json-stable-stringify';
import {createHash} from 'crypto'; import {createHash} from 'crypto';
import {verifyAtomPayment} from './atomPayments.js';
function generateHostnameForApp(app) { function generateHostnameForApp(app) {
const lastPart = app.attributes.name.split('/').pop(); const lastPart = app.attributes.name.split('/').pop();

View File

@ -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<VerificationResult> { private async verifyLNTPayment(txHash: string, request: any): Promise<VerificationResult> {
try { try {
// Use the registry from regHelper to get transaction // LNT verification is handled by stack-orchestrator
const registry = getRegistry(); // We assume if it's not an ATOM payment, stack-orchestrator will handle it
const tx = await registry.getTx(txHash);
if (!tx) {
return { return {
valid: false, valid: false,
reason: 'Transaction not found in laconic registry' reason: 'LNT verification delegated to stack-orchestrator'
};
}
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}`
};
}
return {
valid: true,
amount: tx.amount,
sender: tx.sender,
chainUsed: 'LNT'
}; };
} catch (error) { } catch (error) {
@ -359,6 +308,7 @@ class PaymentProcessor {
// }); // });
// } // }
console.log(`Configured ${configs.length} payment chains`);
return configs; return configs;
} }
} }